File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 11install :
22 composer install
3- brain-games :
4- ./bin/brain-games
53validate :
64 composer validate
75lint :
8- composer exec --verbose phpcs -- --standard=PSR12 src bin
6+ composer exec --verbose phpcs -- --standard=PSR12 src bin
7+ brain-games :
8+ ./bin/brain-games
9+ brain-even :
10+ ./bin/brain-even
11+
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env php
2+
3+ <?php
4+
5+ require __DIR__ ."/../vendor/autoload.php " ;
6+
7+ \BrainGames \EvenGame \startEvenGame ();
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace BrainGames \EvenGame ;
4+
5+ use function BrainGames \Cli \playGame ;
6+
7+ function startEvenGame (): void
8+ {
9+ $ questions = [];
10+ $ answers = [];
11+ for ($ i = 0 ; $ i < 3 ; $ i ++) {
12+ $ questions [$ i ] = rand (1 , 100 );
13+ $ answers [$ i ] = isEven ($ questions [$ i ]) ? 'yes ' : 'no ' ;
14+ }
15+ playGame ($ questions , $ answers );
16+ }
17+
18+ function isEven (int $ number ): bool
19+ {
20+ return $ number % 2 === 0 ;
21+ }
You can’t perform that action at this time.
0 commit comments