| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace ProjetNormandie\ForumBundle\Service; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Doctrine\ORM\EntityManagerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use ProjetNormandie\ForumBundle\Entity\Message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use ProjetNormandie\MessageBundle\Service\Messager; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Symfony\Contracts\Translation\TranslatorInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class NotifyManager | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     private EntityManagerInterface $em; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     private TranslatorInterface $translator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     private Messager $messager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * MessageService constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      * @param EntityManagerInterface $em | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |      * @param TranslatorInterface    $translator | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      * @param Messager               $messager | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 21 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     public function __construct(EntityManagerInterface $em, TranslatorInterface $translator, Messager $messager) | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |         $this->em = $em; | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |         $this->translator = $translator; | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |         $this->messager = $messager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * @param Message $message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @param string  $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     public function notify(Message $message, string $type = 'new') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         // Notify users | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $topicUsers = $this->em->getRepository('ProjetNormandie\ForumBundle\Entity\TopicUser')->findBy( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                 'topic' => $message->getTopic(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |                 'boolNotif' => 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         foreach ($topicUsers as $topicUser) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             $recipient = $topicUser->getUser(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             $url = '/' . $recipient->getLocale() . '/' . $message->getUrl(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             if ($topicUser->getUser()->getid() != $message->getUser()->getId()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                 $this->messager->send( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |                     sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |                         $this->translator->trans( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |                             'topic.notif.object.' . $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |                             array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |                             null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |                             $topicUser->getUser()->getLocale() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |                         ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |                         $message->getTopic()->getLibTopic() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |                     ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |                     sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |                         $this->translator->trans( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |                             'topic.notif.message', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |                             array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |                             null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |                             $topicUser->getUser()->getLocale() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |                         ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |                         $message->getMessage(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |                         $url, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                         $message->getTopic()->getLibTopic() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                     ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |                     $message->getUser(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |                     $topicUser->getUser(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |                     'FORUM_NOTIF' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 76 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 77 |  |  |  | 
            
                        
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths