-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from HendrikPrinsZA/patch/2024-01-26
Patch/2024-01-28
- Loading branch information
Showing
50 changed files
with
1,161 additions
and
769 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
DB_HOST_OVERRIDE=127.0.0.1 | ||
APP_URL=http://127.0.0.1:8000 | ||
DB_HOST=127.0.0.1 | ||
LK_PROGRESS_BAR_DISABLED=true | ||
LK_DD_MAX_USERS=1000 | ||
LK_DD_MAX_USER_BLOGS=10 | ||
XDEBUG_MODE=profile,trace | ||
SAIL_XDEBUG_MODE=profile,trace | ||
EXCHANGE_RATE_API_HOST=http://127.0.0.1:8000/mock/exchangerate | ||
EXCHANGE_RATE_API_KEY=fake-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
|
||
namespace App\Challenges\A; | ||
|
||
use App\KataChallenge; | ||
|
||
class Silly extends KataChallenge | ||
{ | ||
public const SKIP_VIOLATIONS = true; | ||
|
||
protected const PHP_MEM_MAX_ITERATIONS = 100; | ||
|
||
public function isEven(int $iteration): bool | ||
{ | ||
$iteration = ($iteration > self::PHP_MEM_MAX_ITERATIONS) ? self::PHP_MEM_MAX_ITERATIONS : $iteration; | ||
|
||
if ($iteration === 0) return true; | ||
if ($iteration === 1) return false; | ||
if ($iteration === 2) return true; | ||
if ($iteration === 3) return false; | ||
if ($iteration === 4) return true; | ||
if ($iteration === 5) return false; | ||
if ($iteration === 6) return true; | ||
if ($iteration === 7) return false; | ||
if ($iteration === 8) return true; | ||
if ($iteration === 9) return false; | ||
if ($iteration === 10) return true; | ||
if ($iteration === 11) return false; | ||
if ($iteration === 12) return true; | ||
if ($iteration === 13) return false; | ||
if ($iteration === 14) return true; | ||
if ($iteration === 15) return false; | ||
if ($iteration === 16) return true; | ||
if ($iteration === 17) return false; | ||
if ($iteration === 18) return true; | ||
if ($iteration === 19) return false; | ||
if ($iteration === 20) return true; | ||
if ($iteration === 21) return false; | ||
if ($iteration === 22) return true; | ||
if ($iteration === 23) return false; | ||
if ($iteration === 24) return true; | ||
if ($iteration === 25) return false; | ||
if ($iteration === 26) return true; | ||
if ($iteration === 27) return false; | ||
if ($iteration === 28) return true; | ||
if ($iteration === 29) return false; | ||
if ($iteration === 30) return true; | ||
if ($iteration === 31) return false; | ||
if ($iteration === 32) return true; | ||
if ($iteration === 33) return false; | ||
if ($iteration === 34) return true; | ||
if ($iteration === 35) return false; | ||
if ($iteration === 36) return true; | ||
if ($iteration === 37) return false; | ||
if ($iteration === 38) return true; | ||
if ($iteration === 39) return false; | ||
if ($iteration === 40) return true; | ||
if ($iteration === 41) return false; | ||
if ($iteration === 42) return true; | ||
if ($iteration === 43) return false; | ||
if ($iteration === 44) return true; | ||
if ($iteration === 45) return false; | ||
if ($iteration === 46) return true; | ||
if ($iteration === 47) return false; | ||
if ($iteration === 48) return true; | ||
if ($iteration === 49) return false; | ||
if ($iteration === 50) return true; | ||
if ($iteration === 51) return false; | ||
if ($iteration === 52) return true; | ||
if ($iteration === 53) return false; | ||
if ($iteration === 54) return true; | ||
if ($iteration === 55) return false; | ||
if ($iteration === 56) return true; | ||
if ($iteration === 57) return false; | ||
if ($iteration === 58) return true; | ||
if ($iteration === 59) return false; | ||
if ($iteration === 60) return true; | ||
if ($iteration === 61) return false; | ||
if ($iteration === 62) return true; | ||
if ($iteration === 63) return false; | ||
if ($iteration === 64) return true; | ||
if ($iteration === 65) return false; | ||
if ($iteration === 66) return true; | ||
if ($iteration === 67) return false; | ||
if ($iteration === 68) return true; | ||
if ($iteration === 69) return false; | ||
if ($iteration === 70) return true; | ||
if ($iteration === 71) return false; | ||
if ($iteration === 72) return true; | ||
if ($iteration === 73) return false; | ||
if ($iteration === 74) return true; | ||
if ($iteration === 75) return false; | ||
if ($iteration === 76) return true; | ||
if ($iteration === 77) return false; | ||
if ($iteration === 78) return true; | ||
if ($iteration === 79) return false; | ||
if ($iteration === 80) return true; | ||
if ($iteration === 81) return false; | ||
if ($iteration === 82) return true; | ||
if ($iteration === 83) return false; | ||
if ($iteration === 84) return true; | ||
if ($iteration === 85) return false; | ||
if ($iteration === 86) return true; | ||
if ($iteration === 87) return false; | ||
if ($iteration === 88) return true; | ||
if ($iteration === 89) return false; | ||
if ($iteration === 90) return true; | ||
if ($iteration === 91) return false; | ||
if ($iteration === 92) return true; | ||
if ($iteration === 93) return false; | ||
if ($iteration === 94) return true; | ||
if ($iteration === 95) return false; | ||
if ($iteration === 96) return true; | ||
if ($iteration === 97) return false; | ||
if ($iteration === 98) return true; | ||
if ($iteration === 99) return false; | ||
if ($iteration === 100) return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
MAX_ITERATIONS=100 | ||
FILE_NAME="Silly.php" | ||
|
||
# Start of the PHP file | ||
echo "<?php" > $FILE_NAME | ||
echo "" >> $FILE_NAME | ||
echo "namespace App\Challenges\A;" >> $FILE_NAME | ||
echo "" >> $FILE_NAME | ||
echo "use App\KataChallenge;" >> $FILE_NAME | ||
echo "" >> $FILE_NAME | ||
echo "class Silly extends KataChallenge" >> $FILE_NAME | ||
echo "{" >> $FILE_NAME | ||
echo " public const SKIP_VIOLATIONS = true;" >> $FILE_NAME | ||
echo "" >> $FILE_NAME | ||
echo " protected const PHP_MEM_MAX_ITERATIONS = $MAX_ITERATIONS;" >> $FILE_NAME | ||
echo "" >> $FILE_NAME | ||
echo " public function isEven(int \$iteration): bool" >> $FILE_NAME | ||
echo " {" >> $FILE_NAME | ||
echo " \$iteration = (\$iteration > self::PHP_MEM_MAX_ITERATIONS) ? self::PHP_MEM_MAX_ITERATIONS : \$iteration;" >> $FILE_NAME | ||
echo "" >> $FILE_NAME | ||
# Loop to generate the conditions | ||
for (( i=0; i<=$MAX_ITERATIONS; i++ )) | ||
do | ||
if [ $((i % 2)) -eq 0 ]; then | ||
echo " if (\$iteration === $i) return true;" >> $FILE_NAME | ||
else | ||
echo " if (\$iteration === $i) return false;" >> $FILE_NAME | ||
fi | ||
|
||
echo "$i / $MAX_ITERATIONS" | ||
done | ||
|
||
# End of the function | ||
echo " }" >> $FILE_NAME | ||
|
||
# End of the class | ||
echo "}" >> $FILE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Challenges\B; | ||
|
||
use App\Challenges\A\Silly as ASilly; | ||
|
||
class Silly extends ASilly | ||
{ | ||
public function isEven(int $iteration): bool | ||
{ | ||
$iteration = ($iteration > self::PHP_MEM_MAX_ITERATIONS) | ||
? self::PHP_MEM_MAX_ITERATIONS | ||
: $iteration; | ||
|
||
return $iteration % 2 == 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.