@@ -10,16 +10,16 @@ |
||
10 | 10 | ****************/ |
11 | 11 | interface RulePlayerInterface |
12 | 12 | { |
13 | - public function setPlayerDefaultValues(PlayerVersion $version):?PlayerVersion; |
|
13 | + public function setPlayerDefaultValues(PlayerVersion $version): ?PlayerVersion; |
|
14 | 14 | public function playerIsDisposable(PlayerVersion $playerVersion):bool; |
15 | - public function getInjury(string $key):?object; |
|
15 | + public function getInjury(string $key): ?object; |
|
16 | 16 | public function getAvailablePlayerKeyTypes(string $roster):array; |
17 | 17 | public function getAvailablePlayerTypes(string $roster):array; |
18 | 18 | |
19 | 19 | /************************** |
20 | 20 | * PLAYER EVOLUTION METHOD |
21 | 21 | *************************/ |
22 | - public function getSppLevel(PlayerVersion $version):?string; |
|
23 | - public function getContextForRoll(array $roll):?array; |
|
24 | - public function getAvailableSkills(?PlayerVersion $version, array $context = null):?ArrayCollection; |
|
22 | + public function getSppLevel(PlayerVersion $version): ?string; |
|
23 | + public function getContextForRoll(array $roll): ?array; |
|
24 | + public function getAvailableSkills(?PlayerVersion $version, array $context = null): ?ArrayCollection; |
|
25 | 25 | } |
@@ -52,14 +52,12 @@ |
||
52 | 52 | { |
53 | 53 | // Upload |
54 | 54 | $uploadDirectory = (!isset($config['obblm.upload_directory'])) ? |
55 | - $uploadDirectory = $container->getParameter('kernel.project_dir') . '/public/obblm/uploads' : |
|
56 | - $config['obblm.upload_directory']; |
|
55 | + $uploadDirectory = $container->getParameter('kernel.project_dir') . '/public/obblm/uploads' : $config['obblm.upload_directory']; |
|
57 | 56 | $container->setParameter('obblm.config.directory.upload', $uploadDirectory); |
58 | 57 | |
59 | 58 | // Image resize cache |
60 | 59 | $uploadDirectory = (!isset($config['obblm.public_cache_directory'])) ? |
61 | - $uploadDirectory = $container->getParameter('kernel.project_dir') . '/public/obblm/cache' : |
|
62 | - $config['obblm.public_cache_directory']; |
|
60 | + $uploadDirectory = $container->getParameter('kernel.project_dir') . '/public/obblm/cache' : $config['obblm.public_cache_directory']; |
|
63 | 61 | $container->setParameter('obblm.config.directory.public.cache', $uploadDirectory); |
64 | 62 | } |
65 | 63 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return object|null |
88 | 88 | * @throws \Exception |
89 | 89 | */ |
90 | - public function getInjury($key):?object |
|
90 | + public function getInjury($key): ?object |
|
91 | 91 | { |
92 | 92 | if (!$this->getInjuries()->containsKey($key)) { |
93 | 93 | throw new NotFoundKeyException($key, 'getInjuries', self::class); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param PlayerVersion $version |
104 | 104 | * @return string|null |
105 | 105 | */ |
106 | - public function getSppLevel(PlayerVersion $version):?string |
|
106 | + public function getSppLevel(PlayerVersion $version): ?string |
|
107 | 107 | { |
108 | 108 | if ($version->getSpp() && $version->getSpp() > 0) { |
109 | 109 | if ($this->getSppLevels()->containsKey($version->getSpp())) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return $this->getSppLevels()->first(); |
116 | 116 | } |
117 | 117 | |
118 | - public function getContextForRoll(array $roll):?array |
|
118 | + public function getContextForRoll(array $roll): ?array |
|
119 | 119 | { |
120 | 120 | $context = null; |
121 | 121 | if (isset($roll['d6_1']) && isset($roll['d6_2'])) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return $context; |
140 | 140 | } |
141 | 141 | |
142 | - public function getAvailableSkills(?PlayerVersion $version, $context = ['single', 'double']):?ArrayCollection |
|
142 | + public function getAvailableSkills(?PlayerVersion $version, $context = ['single', 'double']): ?ArrayCollection |
|
143 | 143 | { |
144 | 144 | $criteria = Criteria::create(); |
145 | 145 | if ($version) { |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | interface CanHaveRuleInterface |
8 | 8 | { |
9 | - public function getRule():?Rule; |
|
9 | + public function getRule(): ?Rule; |
|
10 | 10 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | public function getInjuriesTable():array; |
15 | 15 | public function calculateTeamValue(TeamVersion $version, bool $excludeDisposable = false):int; |
16 | - public function calculateTeamRate(TeamVersion $version):?int; |
|
16 | + public function calculateTeamRate(TeamVersion $version): ?int; |
|
17 | 17 | public function getMaxTeamCost():int; |
18 | 18 | public function getRerollCost(Team $team):int; |
19 | 19 | public function getApothecaryCost(Team $team):int; |
@@ -23,7 +23,7 @@ |
||
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | - public function __toString():?string |
|
26 | + public function __toString(): ?string |
|
27 | 27 | { |
28 | 28 | return $this->getName(); |
29 | 29 | } |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | $this->io->title('Promote a new OBBLM Administrator'); |
42 | 42 | $this->io->caution('Be carefull, this new user will have the highest right on the application'); |
43 | 43 | $continue = $this->io->confirm('Are you sure you want to continue ?', true); |
44 | - if($continue) { |
|
44 | + if ($continue) { |
|
45 | 45 | $coachRepository = $this->em->getRepository(Coach::class); |
46 | 46 | |
47 | 47 | $choice = $this->io->choice('Search him by login or email ', ['login', 'email']); |
48 | 48 | |
49 | - if($choice !== 'login' && $choice !== 'email') { |
|
49 | + if ($choice !== 'login' && $choice !== 'email') { |
|
50 | 50 | throw new \RuntimeException("Something went wrong."); |
51 | 51 | return 0; |
52 | 52 | } |
53 | - elseif($choice === 'login') { |
|
54 | - $coach = $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
|
53 | + elseif ($choice === 'login') { |
|
54 | + $coach = $this->io->ask('User login', null, function($username) use ($coachRepository) { |
|
55 | 55 | if (empty($username)) { |
56 | 56 | throw new \RuntimeException('The login cannot be empty.'); |
57 | 57 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | }); |
64 | 64 | } |
65 | 65 | elseif ($choice === 'email') { |
66 | - $coach = $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
|
66 | + $coach = $this->io->ask('User email', null, function($email) use ($coachRepository) { |
|
67 | 67 | if (empty($email)) { |
68 | 68 | throw new \RuntimeException('The email cannot be empty.'); |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | /** @var Coach $coach */ |
78 | 78 | $continue = $this->io->confirm("Are you sure you want to promote {$coach->getUsername()} ?", true); |
79 | - if($continue) { |
|
79 | + if ($continue) { |
|
80 | 80 | $coach |
81 | 81 | ->setRoles([Roles::ADMIN]); |
82 | 82 | $this->em->persist($coach); |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | if($choice !== 'login' && $choice !== 'email') { |
50 | 50 | throw new \RuntimeException("Something went wrong."); |
51 | 51 | return 0; |
52 | - } |
|
53 | - elseif($choice === 'login') { |
|
52 | + } elseif($choice === 'login') { |
|
54 | 53 | $coach = $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
55 | 54 | if (empty($username)) { |
56 | 55 | throw new \RuntimeException('The login cannot be empty.'); |
@@ -61,8 +60,7 @@ discard block |
||
61 | 60 | } |
62 | 61 | return $coach; |
63 | 62 | }); |
64 | - } |
|
65 | - elseif ($choice === 'email') { |
|
63 | + } elseif ($choice === 'email') { |
|
66 | 64 | $coach = $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
67 | 65 | if (empty($email)) { |
68 | 66 | throw new \RuntimeException('The email cannot be empty.'); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $this->io->title('Create a new OBBLM Administrator'); |
46 | 46 | $this->io->caution('Be carefull, this new user will have the highest right on the application'); |
47 | 47 | $continue = $this->io->confirm('Are you sure you want to continue ?', true); |
48 | - if($continue) { |
|
48 | + if ($continue) { |
|
49 | 49 | $coachRepository = $this->em->getRepository(Coach::class); |
50 | 50 | $this->io->section('User informations'); |
51 | - $username = $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
|
51 | + $username = $this->io->ask('User login', null, function($username) use ($coachRepository) { |
|
52 | 52 | if (empty($username)) { |
53 | 53 | throw new \RuntimeException('The login cannot be empty.'); |
54 | 54 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | return (string) $username; |
59 | 59 | }); |
60 | - $email = $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
|
60 | + $email = $this->io->ask('User email', null, function($email) use ($coachRepository) { |
|
61 | 61 | if (empty($email)) { |
62 | 62 | throw new \RuntimeException('The email cannot be empty.'); |
63 | 63 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | return (string) $email; |
68 | 68 | }); |
69 | - $password = $this->io->askHidden('User password', function ($password) { |
|
69 | + $password = $this->io->askHidden('User password', function($password) { |
|
70 | 70 | if (empty($password)) { |
71 | 71 | throw new \RuntimeException('Password cannot be empty.'); |
72 | 72 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->setLocale('en') |
85 | 85 | ->setRoles([Roles::ADMIN]) |
86 | 86 | ; |
87 | - if(!$active) { |
|
87 | + if (!$active) { |
|
88 | 88 | $coach |
89 | 89 | ->setHash(hash('sha256', $coach->getEmail())); |
90 | 90 | $registration = new RegisterCoachEvent($coach); |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | $this->io->title('Revoke an OBBLM Administrator'); |
42 | 42 | $this->io->caution('Be carefull, this new user will not have anymore the highest right on the application'); |
43 | 43 | $continue = $this->io->confirm('Are you sure you want to continue ?', true); |
44 | - if($continue) { |
|
44 | + if ($continue) { |
|
45 | 45 | $coachRepository = $this->em->getRepository(Coach::class); |
46 | 46 | |
47 | 47 | $choice = $this->io->choice('Search him by login or email ', ['login', 'email']); |
48 | 48 | |
49 | - if($choice !== 'login' && $choice !== 'email') { |
|
49 | + if ($choice !== 'login' && $choice !== 'email') { |
|
50 | 50 | throw new \RuntimeException("Something went wrong."); |
51 | 51 | return 0; |
52 | 52 | } |
53 | - elseif($choice === 'login') { |
|
54 | - $coach = $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
|
53 | + elseif ($choice === 'login') { |
|
54 | + $coach = $this->io->ask('User login', null, function($username) use ($coachRepository) { |
|
55 | 55 | if (empty($username)) { |
56 | 56 | throw new \RuntimeException('The login cannot be empty.'); |
57 | 57 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | }); |
64 | 64 | } |
65 | 65 | elseif ($choice === 'email') { |
66 | - $coach = $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
|
66 | + $coach = $this->io->ask('User email', null, function($email) use ($coachRepository) { |
|
67 | 67 | if (empty($email)) { |
68 | 68 | throw new \RuntimeException('The email cannot be empty.'); |
69 | 69 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | } |
77 | 77 | /** @var Coach $coach */ |
78 | 78 | $continue = $this->io->confirm("Are you sure you want to revoke {$coach->getUsername()} ?", true); |
79 | - if($continue) { |
|
80 | - if(in_array(Roles::ADMIN, $coach->getRoles())) { |
|
79 | + if ($continue) { |
|
80 | + if (in_array(Roles::ADMIN, $coach->getRoles())) { |
|
81 | 81 | $coach |
82 | 82 | ->setRoles([Roles::COACH]); |
83 | 83 | $this->em->persist($coach); |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | if($choice !== 'login' && $choice !== 'email') { |
50 | 50 | throw new \RuntimeException("Something went wrong."); |
51 | 51 | return 0; |
52 | - } |
|
53 | - elseif($choice === 'login') { |
|
52 | + } elseif($choice === 'login') { |
|
54 | 53 | $coach = $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
55 | 54 | if (empty($username)) { |
56 | 55 | throw new \RuntimeException('The login cannot be empty.'); |
@@ -61,8 +60,7 @@ discard block |
||
61 | 60 | } |
62 | 61 | return $coach; |
63 | 62 | }); |
64 | - } |
|
65 | - elseif ($choice === 'email') { |
|
63 | + } elseif ($choice === 'email') { |
|
66 | 64 | $coach = $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
67 | 65 | if (empty($email)) { |
68 | 66 | throw new \RuntimeException('The email cannot be empty.'); |