| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * This file is part of the G.L.S.R. Apps package. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * (c) Dev-Int Création <[email protected]>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | namespace User\Infrastructure\Storage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use User\Domain\Model\User as UserModel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use User\Domain\Model\VO\Password; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use User\Infrastructure\Doctrine\Repository\UserRepository; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | class UpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     private UserRepository $userRepository; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     private ReadUser $readUser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     private UserPasswordEncoderInterface $passwordEncoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         UserRepository $userRepository, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         ReadUser $readUser, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         UserPasswordEncoderInterface $passwordEncoder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $this->userRepository = $userRepository; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         $this->readUser = $readUser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $this->passwordEncoder = $passwordEncoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |     public function update(UserModel $userModel): void | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |         $userEntity = $this->readUser->findOneByUuid($userModel->uuid()->__toString()); | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |         if (null === $userEntity) { | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |             throw new \DomainException('User provided does not exist !'); | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |         if ($this->passwordEncoder->isPasswordValid($userEntity, $userModel->password()->value())) { | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |             $encodedPassword = $this->passwordEncoder->encodePassword($userEntity, $userModel->password()->value()); | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |             $userModel->changePassword(Password::fromString($encodedPassword)); | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |         $userEntity->update($userModel); | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |         $this->userRepository->flush(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 54 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |  | 
            
                        
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