| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace App\Game\Infrastructure\Repository\Doctrine; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use App\Game\Features\Player\Level\PlayerLevelRepositoryInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use App\Game\Features\Player\Player\Player; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use App\Game\Features\Player\Player\PlayerId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use App\Game\Features\Player\Player\PlayerNotFoundException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use App\Game\Features\Registration\PlayerRepositoryInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use App\Game\Features\Registration\Player\PlayerDto; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use App\Game\Infrastructure\Encoder\PasswordEncoderInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Doctrine\Persistence\ManagerRegistry; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | final class PersistPlayerRepository extends ServiceEntityRepository implements | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     PlayerRepositoryInterface, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     PlayerLevelRepositoryInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     private PasswordEncoderInterface $encoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     public function __construct(ManagerRegistry $registry, PasswordEncoderInterface $encoder) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         parent::__construct($registry, Player::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $this->encoder = $encoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     public function createPlayer(PlayerDto $playerDto): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         $player = new Player(new PlayerId($playerDto->playerId()->id())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $player->changeNickname($playerDto->nickname()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         $player->changeRole($playerDto->role()->getValue()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $player->changePassword($this->encoder->encodePassword($playerDto->password(), null)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $this->store($player); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     public function changeLevel(PlayerId $playerId): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $player = $this->createQueryBuilder('u') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             ->andWhere('u.playerId = :id') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             ->setParameter('id', (string) $playerId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             ->getQuery() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             ->getOneOrNullResult(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         if (!$player instanceof Player) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             throw new PlayerNotFoundException(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $player->changeLevel($player->level() + 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $this->store($player); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |     private function store(Player $player): void | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         $entityManager = $this->getEntityManager(); | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |         $entityManager->persist($player); | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |         $entityManager->flush($player); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 62 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 63 |  |  |  | 
            
                        
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