Proyectos de Subversion LeadersLinked - Services

Rev

Rev 140 | Rev 240 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
declare(strict_types=1);
3
 
4
namespace LeadersLinked\Controller;
5
 
6
use Laminas\Db\Adapter\AdapterInterface;
7
 
8
use Laminas\Mvc\Controller\AbstractActionController;
9
use Laminas\Log\LoggerInterface;
10
use Laminas\View\Model\JsonModel;
11
use Laminas\View\Model\ViewModel;
12
 
13
use LeadersLinked\Library\Functions;
14
use LeadersLinked\Model\Post;
15
use LeadersLinked\Mapper\PostMapper;
16
use LeadersLinked\Mapper\UserMapper;
17
use LeadersLinked\Mapper\CommentMapper;
18
use LeadersLinked\Model\ContentReaction;
19
use LeadersLinked\Model\Comment;
20
use LeadersLinked\Form\Post\CommentForm;
21
use LeadersLinked\Mapper\ContentReactionMapper;
22
 
23
 
24
 
25
class PostController extends AbstractActionController
26
{
27
    /**
28
     *
29
     * @var \Laminas\Db\Adapter\AdapterInterface
30
     */
31
    private $adapter;
32
 
33
    /**
34
     *
35
     * @var \LeadersLinked\Cache\CacheInterface
36
     */
37
    private $cache;
38
 
39
 
40
    /**
41
     *
42
     * @var \Laminas\Log\LoggerInterface
43
     */
44
    private $logger;
45
 
46
    /**
47
     *
48
     * @var array
49
     */
50
    private $config;
51
 
52
 
53
    /**
54
     *
55
     * @var \Laminas\Mvc\I18n\Translator
56
     */
57
    private $translator;
58
 
59
 
60
    /**
61
     *
62
     * @param \Laminas\Db\Adapter\AdapterInterface $adapter
63
     * @param \LeadersLinked\Cache\CacheInterface $cache
64
     * @param \Laminas\Log\LoggerInterface LoggerInterface $logger
65
     * @param array $config
66
     * @param \Laminas\Mvc\I18n\Translator $translator
67
     */
68
    public function __construct($adapter, $cache, $logger, $config, $translator)
69
    {
70
        $this->adapter      = $adapter;
71
        $this->cache        = $cache;
72
        $this->logger       = $logger;
73
        $this->config       = $config;
74
        $this->translator   = $translator;
75
    }
76
 
77
    /**
78
     *
79
     * Generación del listado de perfiles
80
     * {@inheritDoc}
81
     * @see \Laminas\Mvc\Controller\AbstractActionController::indexAction()
82
     */
83
    public function indexAction()
84
    {
85
 
86
        return new JsonModel([
87
            'success' => false,
88
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
89
        ]);
90
    }
91
 
92
    public function viewAction()
93
    {
94
        $request = $this->getRequest();
95
        if ($request->isGet()) {
96
            $currentUserPlugin = $this->plugin('currentUserPlugin');
97
            $currentUser = $currentUserPlugin->getUser();
98
 
99
 
100
            $id = $this->params()->fromRoute('id');
101
 
102
            $postMapper = PostMapper::getInstance($this->adapter);
103
            $post = $postMapper->fetchOneByUuid($id);
104
 
105
 
106
                if (!$post || $post->status != Post::STATUS_ACTIVE) {
107
                    return new JsonModel([
108
                        'success' => false,
109
                        'data' => 'ERROR_POST_NOT_AVAILABLE'
110
                    ]);
111
                }
112
 
113
 
114
            $timestamp = time();
115
 
116
            list($usec, $sec) = explode(' ', microtime());
117
            $seed = intval($sec + ((float) $usec * 100000));
118
            mt_srand($seed, MT_RAND_MT19937);
119
            $rand =  mt_rand();
120
 
121
 
122
 
123
            $password  = md5('user-' . $currentUser->uuid . '-post-' . $post->uuid . '-timestamp-' . $timestamp . '-rand-' . $rand . '-share-key-' . $currentUser->share_key);
124
 
125
 
126
            $share_params = [
127
                'type' => 'post',
128
                'code' => $post->uuid,
129
                'user' => $currentUser->uuid,
130
                'timestamp' => $timestamp,
131
                'rand' => $rand,
132
                'password' => $password,
133
            ];
134
            $share_increment_external_counter_url = $this->url()->fromRoute('share/increment-external-counter', $share_params, ['force_canonical' => true]);
135
 
136
 
137
            $share_external_url = $this->url()->fromRoute('shorter/generate', ['code' => $post->uuid, 'type' => 'post'], ['force_canonical' => true]);
138
 
139
            //$contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
140
            //$contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
141
 
142
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
143
            $reactions = $contentReactionMapper->fetchCountByPostId($post->id);
144
            $reaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
234 efrain 145
 
146
            $type = '';
147
            if($post->file) {
148
                $filename = basename($post->file);
149
                $parts = explode(',', $filename);
150
                if(count($parts > 1)) {
151
                    $extension = $parts[ count($parts) -1 ];
152
                    if(in_array($extension, ['mov', 'webm','mp4','mpeg'] )) {
153
                        $type = 'video';
154
                    } else if(in_array($extension, ['jpg','jpeg','png'] )) {
155
                        $type = 'image';
156
                    } else if(in_array($extension, ['wav', 'mp3', 'pdf'] )) {
157
                        $type = 'audio';
158
                    }
159
                }
1 efrain 160
 
234 efrain 161
            }
162
 
1 efrain 163
 
234 efrain 164
 
165
 
166
 
1 efrain 167
                return new JsonModel([
168
                    'success' => true,
169
                    'data' => [
170
                        'post' => $post,
171
                        'id' => $post->id,
172
                        'uuid' => $post->uuid,
173
                        'title' => $post->title,
174
                        'description' => $post->description,
175
                        'url' => $post->url,
176
                        'date' => $post->date,
234 efrain 177
                        'type' => $post->type,
1 efrain 178
                        'status' => $post->status,
140 efrain 179
                        'image' =>   $this->url()->fromRoute('storage',['type' => 'post', 'code' => $post->uuid, 'filename' => $post->image], ['force_canonical' => true]),
180
                        'file' => $post->file ? $this->url()->fromRoute('storage',['type' => 'post', 'code' => $post->uuid, 'filename' => $post->file], ['force_canonical' => true]) : '',
234 efrain 181
                        'type' => $type,
1 efrain 182
                        'added_on' => $post->added_on,
183
                        'share_external_url' =>  $share_external_url,
184
                        'total_share_external' => $post->total_external_shared,
185
                        'share_increment_external_counter_url' => $share_increment_external_counter_url,
186
                        'comments_url' => $this->url()->fromRoute('post/comments', ['id' => $post->uuid]),
187
                        'comments_add_url' => $this->url()->fromRoute('post/comments/add', ['id' => $post->uuid]),
188
                        'save_reaction_url' => $this->url()->fromRoute('post/save-reaction', ['id' => $post->uuid]),
189
                        'delete_reaction_url' =>  $this->url()->fromRoute('post/delete-reaction', ['id' => $post->uuid]),
190
                        'my_reaction' => $reaction ? $reaction->reaction : '',
191
                        'reactions' =>  $reactions,
192
                        //'is_liked' => $contentReaction ? 1 : 0,
193
                        //'like_url' => $this->url()->fromRoute('post/like', ['id' => $post->uuid]),
194
                        //'unlike_url' => $this->url()->fromRoute('post/unlike', ['id' => $post->uuid]),
195
 
196
                    ]
197
                ]);
198
        } else {
199
            $response = [
200
                'success' => false,
201
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
202
            ];
203
            return new JsonModel($response);
204
        }
205
    }
206
 
207
    public function commentsAddAction()
208
    {
209
        $id = $this->params()->fromRoute('id');
210
 
211
        $request = $this->getRequest();
212
        if ($request->isPost()) {
213
 
214
 
215
 
216
            $postMapper = PostMapper::getInstance($this->adapter);
217
            $now = $postMapper->getDatebaseNow();
218
 
219
            $post = $postMapper->fetchOneByUuid($id);
220
            if (!$post) {
221
                $response = [
222
                    'success' => false,
223
                    'data' => 'ERROR_POST_NOT_FOUND'
224
                ];
225
                return new JsonModel($response);
226
            }
227
 
228
            $dataPost = $request->getPost()->toArray();
229
            $form = new CommentForm();
230
            $form->setData($dataPost);
231
 
232
            if ($form->isValid()) {
233
 
234
 
235
                $currentUserPlugin = $this->plugin('currentUserPlugin');
236
                $currentUser = $currentUserPlugin->getUser();
237
 
238
                $dataPost = (array) $form->getData();
239
 
240
 
241
 
242
                $comment = new Comment();
243
                $comment->network_id = $currentUser->network_id;
244
                $comment->comment = $dataPost['comment'];
245
                $comment->user_id = $currentUser->id;
246
                $comment->post_id = $post->id;
247
                $comment->relational = Comment::RELATIONAL_POST;
248
 
249
                $commentMapper = CommentMapper::getInstance($this->adapter);
250
                if ($commentMapper->insert($comment)) {
251
 
252
                    $total_comments = $commentMapper->fetchCountCommentByPostId($comment->post_id);
253
 
254
                    $post->total_comments = $total_comments;
255
                    $postMapper->update($post);
256
 
257
                    $response = [
258
                        'success'   => true,
259
                        'data'   => $this->renderComment($comment->id, $now),
260
                        'total_comments' => $total_comments
261
                    ];
262
 
263
                    return new JsonModel($response);
264
                } else {
265
 
266
                    $response = [
267
                        'success'   => false,
268
                        'data'   => $commentMapper->getError()
269
                    ];
270
 
271
                    return new JsonModel($response);
272
                }
273
            } else {
274
                $message = '';;
275
                $form_messages = (array) $form->getMessages();
276
                foreach ($form_messages  as $fieldname => $field_messages) {
277
                    foreach ($field_messages as $key => $value) {
278
                        $message = $value;
279
                    }
280
                }
281
 
282
                $response = [
283
                    'success'   => false,
284
                    'data'   => $message
285
                ];
286
 
287
                return new JsonModel($response);
288
            }
289
        } else {
290
            $response = [
291
                'success' => false,
292
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
293
            ];
294
 
295
            return new JsonModel($response);
296
        }
297
    }
298
 
299
 
300
 
301
    public function commentsDeleteAction()
302
    {
303
        $request = $this->getRequest();
304
        if ($request->isPost()) {
305
            $currentUserPlugin = $this->plugin('currentUserPlugin');
306
            $currentUser = $currentUserPlugin->getUser();
307
 
308
            $post_id = $this->params()->fromRoute('id');
309
            $comment = $this->params()->fromRoute('comment');
310
 
311
            $postMapper = PostMapper::getInstance($this->adapter);
312
            $post = $postMapper->fetchOneByUuidAndNetworkId($post_id, $currentUser->network_id);
313
 
314
            if ($post) {
315
 
316
                $commentMapper = CommentMapper::getInstance($this->adapter);
317
                $comment = $commentMapper->fetchOneByUuid($comment);
318
 
319
                if ($comment && $comment->post_id == $post->id && $comment->user_id == $currentUser->id) {
320
 
321
                    $comment->status = Comment::STATUS_DELETED;
322
 
323
                    if ($commentMapper->update($comment)) {
324
 
325
                        $total_comments = $commentMapper->fetchCountCommentByPostId($comment->post_id);
326
 
327
 
328
                        $postMapper = PostMapper::getInstance($this->adapter);
329
                        $post = $postMapper->fetchOne($comment->post_id);
330
                        $post->total_comments = $total_comments;
331
                        $postMapper->update($post);
332
 
333
 
334
 
335
 
336
 
337
                        $response = [
338
                            'success' => true,
339
                            'data' => 'LABEL_COMMENT_WAS_DELETED',
340
                            'total_comments' => $total_comments
341
                        ];
342
                    } else {
343
                        $response = [
344
                            'success' => false,
345
                            'data' => $commentMapper->getError()
346
                        ];
347
                    }
348
                } else {
349
                    $response = [
350
                        'success' => false,
351
                        'data' => 'ERROR_COMMENT_NOT_FOUND'
352
                    ];
353
                }
354
            } else {
355
                $response = [
356
                    'success' => false,
357
                    'data' => 'ERROR_COMMENT_NOT_FOUND'
358
                ];
359
            }
360
        } else {
361
            $response = [
362
                'success' => false,
363
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
364
            ];
365
        }
366
 
367
        return new JsonModel($response);
368
    }
369
 
370
    /*
371
    public function likeAction()
372
    {
373
        $id = $this->params()->fromRoute('id');
374
 
375
        $request = $this->getRequest();
376
        if ($request->isPost()) {
377
            $currentUserPlugin = $this->plugin('currentUserPlugin');
378
            $currentUser = $currentUserPlugin->getUser();
379
 
380
 
381
            $postMapper = PostMapper::getInstance($this->adapter);
382
            $post = $postMapper->fetchOneByUuidAndNetworkId($id, $currentUser->network_id);
383
            if (!$post) {
384
                $response = [
385
                    'success' => false,
386
                    'data' => 'ERROR_POST_NOT_FOUND'
387
                ];
388
                return new JsonModel($response);
389
            }
390
 
391
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
392
            $contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
393
 
394
            if ($contentReaction) {
395
                $response = [
396
                    'success' => false,
397
                    'data' => 'ERROR_DUPLICATE_ACTION'
398
                ];
399
                return new JsonModel($response);
400
            }
401
 
402
            $contentReaction = new Like();
403
            $contentReaction->user_id = $currentUser->id;
404
            $contentReaction->post_id = $post->id;
405
            $contentReaction->relational = Like::RELATIONAL_POST;
406
 
407
            if ($contentReactionMapper->insert($contentReaction)) {
408
 
409
                $contentReactions = $contentReactionMapper->fetchCountLikeByPostId($post->id);
410
                $response = [
411
                    'success' => true,
412
                    'data' => [
413
                        'likes' => $contentReactions
414
                    ]
415
                ];
416
            } else {
417
                $response = [
418
                    'success' => false,
419
                    'data' => $contentReactionMapper->getError()
420
                ];
421
            }
422
            return new JsonModel($response);
423
        }
424
 
425
        $response = [
426
            'success' => false,
427
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
428
        ];
429
        return new JsonModel($response);
430
    }
431
 
432
    public function unlikeAction()
433
    {
434
        $id = $this->params()->fromRoute('id');
435
 
436
        $request = $this->getRequest();
437
        if ($request->isPost()) {
438
            $currentUserPlugin = $this->plugin('currentUserPlugin');
439
            $currentUser = $currentUserPlugin->getUser();
440
 
441
            $postMapper = PostMapper::getInstance($this->adapter);
442
            $post = $postMapper->fetchOneByUuidAndNetworkId($id, $currentUser->network_id);
443
            if (!$post) {
444
                $response = [
445
                    'success' => false,
446
                    'data' => 'ERROR_POST_NOT_FOUND'
447
                ];
448
                return new JsonModel($response);
449
            }
450
 
451
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
452
            $contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
453
 
454
            if (!$contentReaction) {
455
                $response = [
456
                    'success' => false,
457
                    'data' => 'ERROR_DUPLICATE_ACTION'
458
                ];
459
                return new JsonModel($response);
460
            }
461
 
462
            if ($contentReactionMapper->deleteByPostIdAndUserId($post->id, $currentUser->id)) {
463
                $contentReactions = $contentReactionMapper->fetchCountLikeByPostId($post->id);
464
 
465
 
466
                $response = [
467
                    'success' => true,
468
                    'data' => [
469
                        'likes' => $contentReactions
470
                    ]
471
                ];
472
            } else {
473
                $response = [
474
                    'success' => false,
475
                    'data' => $contentReactionMapper->getError()
476
                ];
477
            }
478
            return new JsonModel($response);
479
        }
480
 
481
        $response = [
482
            'success' => false,
483
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
484
        ];
485
        return new JsonModel($response);
486
    }*/
487
 
488
    public function saveReactionAction()
489
    {
490
        $id = $this->params()->fromRoute('id');
491
        $reaction  = $this->params()->fromPost('reaction');
492
 
493
        $request = $this->getRequest();
494
        if ($request->isPost()) {
495
            $currentUserPlugin = $this->plugin('currentUserPlugin');
496
            $currentUser = $currentUserPlugin->getUser();
497
 
498
 
499
            $postMapper = PostMapper::getInstance($this->adapter);
500
            $post = $postMapper->fetchOneByUuidAndNetworkId($id, $currentUser->network_id);
501
            if (!$post) {
502
                $response = [
503
                    'success' => false,
504
                    'data' => 'ERROR_POST_NOT_FOUND'
505
                ];
506
                return new JsonModel($response);
507
            }
508
 
509
            $reactions = [
510
                ContentReaction::REACTION_RECOMMENDED,
511
                ContentReaction::REACTION_SUPPORT,
512
                ContentReaction::REACTION_LOVE,
513
                ContentReaction::REACTION_INTEREST,
514
                ContentReaction::REACTION_FUN
515
 
516
            ];
517
            if(!in_array($reaction, $reactions)) {
518
                $response = [
519
                    'success' => false,
520
                    'data' => 'ERROR_REACTION_NOT_FOUND'
521
                ];
522
                return new JsonModel($response);
523
            }
524
 
525
 
526
 
527
 
528
 
529
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
530
            $contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
531
 
532
            if ($contentReaction) {
533
                $contentReaction->reaction = $reaction;
534
 
535
                $result = $contentReactionMapper->update($contentReaction);
536
            } else {
537
                $contentReaction = new ContentReaction();
538
                $contentReaction->user_id = $currentUser->id;
539
                $contentReaction->post_id = $post->id;
540
                $contentReaction->relational = ContentReaction::RELATIONAL_POST;
541
                $contentReaction->reaction = $reaction;
542
 
543
                $result = $contentReactionMapper->insert($contentReaction);
544
            }
545
 
546
 
547
 
548
            if ($result) {
549
 
550
                $reactions = $contentReactionMapper->fetchCountByPostId($post->id);
551
                $response = [
552
                    'success' => true,
553
                    'data' => [
554
                        'reactions' => $reactions
555
                    ]
556
                ];
557
            } else {
558
                $response = [
559
                    'success' => false,
560
                    'data' => $contentReactionMapper->getError()
561
                ];
562
            }
563
            return new JsonModel($response);
564
        }
565
 
566
        $response = [
567
            'success' => false,
568
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
569
        ];
570
        return new JsonModel($response);
571
    }
572
 
573
    public function deleteReactionAction()
574
    {
575
        $id = $this->params()->fromRoute('id');
576
 
577
        $request = $this->getRequest();
578
        if ($request->isPost()) {
579
            $currentUserPlugin = $this->plugin('currentUserPlugin');
580
            $currentUser = $currentUserPlugin->getUser();
581
 
582
            $postMapper = PostMapper::getInstance($this->adapter);
583
            $post = $postMapper->fetchOneByUuidAndNetworkId($id, $currentUser->network_id);
584
            if (!$post) {
585
                $response = [
586
                    'success' => false,
587
                    'data' => 'ERROR_POST_NOT_FOUND'
588
                ];
589
                return new JsonModel($response);
590
            }
591
 
592
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
593
            $contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
594
 
595
            if (!$contentReaction) {
596
                $response = [
597
                    'success' => false,
598
                    'data' => 'ERROR_DUPLICATE_ACTION'
599
                ];
600
                return new JsonModel($response);
601
            }
602
 
603
            if ($contentReactionMapper->deleteByPostIdAndUserId($post->id, $currentUser->id)) {
604
                $reactions = $contentReactionMapper->fetchCountByPostId($post->id);
605
 
606
 
607
                $response = [
608
                    'success' => true,
609
                    'data' => [
610
                        'reactions' => $reactions
611
                    ]
612
                ];
613
            } else {
614
                $response = [
615
                    'success' => false,
616
                    'data' => $contentReactionMapper->getError()
617
                ];
618
            }
619
            return new JsonModel($response);
620
        }
621
 
622
        $response = [
623
            'success' => false,
624
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
625
        ];
626
        return new JsonModel($response);
627
    }
628
 
629
    public function commentsAction()
630
    {
631
        $id = $this->params()->fromRoute('id');
632
 
633
        $request = $this->getRequest();
634
        if ($request->isGet()) {
635
 
636
 
637
 
638
            $currentUserPlugin = $this->plugin('currentUserPlugin');
639
            $currentUser = $currentUserPlugin->getUser();
640
 
641
            $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
642
            $currentNetwork = $currentNetworkPlugin->getNetwork();
643
 
644
 
645
            $id = $this->params()->fromRoute('id');
646
            $postMapper = PostMapper::getInstance($this->adapter);
647
            $now = $postMapper->getDatebaseNow();
648
 
649
            $post = $postMapper->fetchOneByUuidAndNetworkId($id,  $currentNetwork->id);
650
            if (!$post) {
651
                $data = [
652
                    'success' => false,
653
                    'data' => 'ERROR_UNAUTHORIZED',
654
                ];
655
 
656
                return new JsonModel($data);
657
            }
658
 
659
            $commentMapper = CommentMapper::getInstance($this->adapter);
660
            $records = $commentMapper->fetchAllPublishedByPostId($post->id);
661
 
662
            $comments = [];
663
            foreach ($records as $record) {
664
                $comment = $this->renderComment($record->id, $now);
665
                array_push($comments, $comment);
666
            }
667
 
668
            $response = [
669
                'success' => true,
670
                'data' => $comments
671
            ];
672
 
673
            return new JsonModel($response);
674
        } else {
675
 
676
 
677
 
678
            $response = [
679
                'success' => false,
680
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
681
            ];
682
 
683
 
684
            return new JsonModel($response);
685
        }
686
    }
687
 
688
 
689
 
690
    /**
691
     *
692
     * @param int $comment_id
693
     * @return array
694
     */
695
    private function renderComment($comment_id, $now)
696
    {
697
        $item = [];
698
 
699
        $commentMapper = CommentMapper::getInstance($this->adapter);
700
        $record = $commentMapper->fetchOne($comment_id);
701
 
702
        $postMapper = PostMapper::getInstance($this->adapter);
703
        $post = $postMapper->fetchOne($record->post_id);
704
 
705
        if ($record) {
706
            $userMapper = UserMapper::getInstance($this->adapter);
707
 
708
            $user = $userMapper->fetchOne($record->user_id);
709
 
710
            $item['unique'] = uniqid();
60 efrain 711
            $item['user_image'] = $this->url()->fromRoute('storage', ['type' => 'user',  'code' => $user->uuid, 'filename' =>  $user->image],['force_canonical' => true]);
1 efrain 712
            $item['user_url'] = $this->url()->fromRoute('profile/view', ['id' => $user->uuid]);
713
            $item['user_name'] = $user->first_name . ' ' . $user->last_name;
714
            $item['time_elapsed'] = Functions::timeAgo($record->added_on, $now);
715
            $item['comment'] = $record->comment;
716
            $item['link_delete'] = $this->url()->fromRoute('post/comments/delete', ['id' => $post->uuid, 'comment' => $record->uuid]);
717
        }
718
        return $item;
719
    }
720
}