| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace App\Auth\Form; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use App\User\User; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use App\User\UserRepository; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Yiisoft\FormModel\FormModel; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Yiisoft\Translator\TranslatorInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Yiisoft\Validator\PropertyTranslator\ArrayPropertyTranslator; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Yiisoft\Validator\PropertyTranslatorInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Yiisoft\Validator\PropertyTranslatorProviderInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Yiisoft\Validator\Result; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Yiisoft\Validator\Rule\Equal; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Yiisoft\Validator\Rule\Length; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Yiisoft\Validator\Rule\Required; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Yiisoft\Validator\RulesProviderInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | final class SignupForm extends FormModel implements RulesProviderInterface, PropertyTranslatorProviderInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     private string $login = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     private string $password = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     private string $passwordVerify = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         private readonly TranslatorInterface $translator, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         private readonly UserRepository $userRepository, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     public function getPropertyLabels(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |             'login' => $this->translator->translate('layout.login'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             'password' => $this->translator->translate('layout.password'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             'passwordVerify' => $this->translator->translate('layout.password-verify'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |     public function getFormName(): string | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |         return 'Signup'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     public function getLogin(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         return $this->login; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     public function getPassword(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         return $this->password; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     public function signup(): User | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $user = new User($this->getLogin(), $this->getPassword()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $this->userRepository->save($user); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         return $user; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     public function getRules(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             'login' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                 new Required(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                 new Length(min: 1, max: 48, skipOnError: true), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |                 function ($value): Result { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |                     $result = new Result(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |                     if ($this->userRepository->findByLogin($value) !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |                         $result->addError('User with this login already exists.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |                     return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |                 }, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             'password' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |                 new Required(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |                 new Length(min: 8), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             'passwordVerify' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |                 new Required(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |                 new Equal( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |                     targetValue: $this->password, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |                     message: $this->translator->translate('validator.password.not.match') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     public function getPropertyTranslator(): ?PropertyTranslatorInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         return new ArrayPropertyTranslator($this->getPropertyLabels()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 96 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 97 |  |  |  | 
            
                        
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