File tree Expand file tree Collapse file tree 9 files changed +26
-21
lines changed Expand file tree Collapse file tree 9 files changed +26
-21
lines changed Original file line number Diff line number Diff line change 33
44$ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
55$ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+ use function BrainGames \Games \Calc \runGame ;
67
78if (file_exists ($ autoloadPath1 )) {
89 require_once $ autoloadPath1 ;
910} else {
1011 require_once $ autoloadPath2 ;
1112}
1213
13- BrainGames \ Games \ Calc \ runGame ();
14+ runGame ();
Original file line number Diff line number Diff line change 33
44$ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
55$ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+ use function BrainGames \Games \Even \runGame ;
67
78if (file_exists ($ autoloadPath1 )) {
89 require_once $ autoloadPath1 ;
910} else {
1011 require_once $ autoloadPath2 ;
1112}
1213
13- BrainGames \ Games \ Even \ runGame ();
14+ runGame ();
1415
1516
1617
Original file line number Diff line number Diff line change 33
44$ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
55$ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+ use function BrainGames \Cli \welcome ;
67
78if (file_exists ($ autoloadPath1 )) {
89 require_once $ autoloadPath1 ;
910} else {
1011 require_once $ autoloadPath2 ;
1112}
1213
13- BrainGames \ Cli \ welcome ();
14+ welcome ();
Original file line number Diff line number Diff line change 33
44$ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
55$ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+ use function BrainGames \Games \Gcd \runGame ;
67
78if (file_exists ($ autoloadPath1 )) {
89 require_once $ autoloadPath1 ;
910} else {
1011 require_once $ autoloadPath2 ;
1112}
1213
13- BrainGames \ Games \ Gcd \ runGame ();
14+ runGame ();
Original file line number Diff line number Diff line change 33
44$ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
55$ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+ use function BrainGames \Games \Prime \runGame ;
67
78if (file_exists ($ autoloadPath1 )) {
89 require_once $ autoloadPath1 ;
910} else {
1011 require_once $ autoloadPath2 ;
1112}
1213
13- BrainGames \ Games \ Prime \ runGame ();
14+ runGame ();
Original file line number Diff line number Diff line change 33
44$ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
55$ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+ use function BrainGames \Games \Progression \runGame ;
67
78if (file_exists ($ autoloadPath1 )) {
89 require_once $ autoloadPath1 ;
910} else {
1011 require_once $ autoloadPath2 ;
1112}
1213
13- BrainGames \ Games \ Progression \ runGame ();
14+ runGame ();
Original file line number Diff line number Diff line change 2020 " bin/brain-progression" ,
2121 " bin/brain-prime"
2222 ],
23-
24- "require-dev" : {
25- "squizlabs/php_codesniffer" : " ^4.0"
26- },
27- "scripts" : {
28- "phpcs" : " phpcs --standard=PSR12 src bin" ,
29- "phpcbf" : " phpcbf --standard=PSR12 src bin"
30- },
3123 "autoload" : {
3224 "files" : [
3325 " src/Engine.php" ,
3830 " src/Games/Prime.php" ,
3931 " src/Games/Progression.php"
4032 ]
33+ },
34+ "require-dev" : {
35+ "squizlabs/php_codesniffer" : " ^4.0"
36+ },
37+ "scripts" : {
38+ "phpcs" : " phpcs --standard=PSR12 src bin" ,
39+ "phpcbf" : " phpcbf --standard=PSR12 src bin"
4140 }
4241}
Original file line number Diff line number Diff line change 66
77const RULES = 'Answer "yes" if the number is even, otherwise answer "no". ' ;
88
9- function isEven (int $ number ): bool
10- {
11- return $ number % 2 === 0 ;
12- }
13-
149function runGame (): void
1510{
1611 $ generateData = function () {
@@ -26,3 +21,8 @@ function runGame(): void
2621
2722 runEngine ($ generateData , RULES );
2823}
24+
25+ function isEven (int $ number ): bool
26+ {
27+ return $ number % 2 === 0 ;
28+ }
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function runGame(): void
1919 }
2020
2121 $ question = "$ a $ b " ;
22- $ answer = gcd ($ a , $ b );
22+ $ answer = getGcd ($ a , $ b );
2323
2424 return [
2525 'question ' => $ question ,
@@ -30,7 +30,7 @@ function runGame(): void
3030 runEngine ($ generateData , RULES );
3131}
3232
33- function gcd (int $ a , int $ b ): int
33+ function getGcd (int $ a , int $ b ): int
3434{
3535 while ($ b !== 0 ) {
3636 [$ a , $ b ] = [$ b , $ a % $ b ];
You can’t perform that action at this time.
0 commit comments