| @@ 17-77 (lines=61) @@ | ||
| 14 | * Class DivideIt |
|
| 15 | * @package PhpSchool\Php7Way\Exercise |
|
| 16 | */ |
|
| 17 | class DivideIt extends AbstractExercise implements |
|
| 18 | ExerciseInterface, |
|
| 19 | CliExercise, |
|
| 20 | FunctionRequirementsExerciseCheck |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @return string |
|
| 24 | */ |
|
| 25 | public function getName() |
|
| 26 | { |
|
| 27 | return 'Divide it'; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getDescription() |
|
| 34 | { |
|
| 35 | return 'Divide a number by another'; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @return array |
|
| 40 | */ |
|
| 41 | public function getArgs() |
|
| 42 | { |
|
| 43 | return [4, 3]; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return ExerciseType |
|
| 48 | */ |
|
| 49 | public function getType() |
|
| 50 | { |
|
| 51 | return ExerciseType::CLI(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return string[] |
|
| 56 | */ |
|
| 57 | public function getRequiredFunctions() |
|
| 58 | { |
|
| 59 | return ["intdiv"]; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return string[] |
|
| 64 | */ |
|
| 65 | public function getBannedFunctions() |
|
| 66 | { |
|
| 67 | return []; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param ExerciseDispatcher $dispatcher |
|
| 72 | */ |
|
| 73 | public function configure(ExerciseDispatcher $dispatcher) |
|
| 74 | { |
|
| 75 | $dispatcher->requireCheck(FunctionRequirementsCheck::class); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| @@ 17-77 (lines=61) @@ | ||
| 14 | * Class NewGeneration |
|
| 15 | * @package PhpSchool\Php7Way\Exercise |
|
| 16 | */ |
|
| 17 | class NewGeneration extends AbstractExercise implements |
|
| 18 | ExerciseInterface, |
|
| 19 | CliExercise, |
|
| 20 | FunctionRequirementsExerciseCheck |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @return string |
|
| 24 | */ |
|
| 25 | public function getName() |
|
| 26 | { |
|
| 27 | return 'A new generation is coming'; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getDescription() |
|
| 34 | { |
|
| 35 | return 'Develop a generator and use it'; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @return array |
|
| 40 | */ |
|
| 41 | public function getArgs() |
|
| 42 | { |
|
| 43 | return ["firstArgument", "secondArgument", "thirdArgument"]; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return ExerciseType |
|
| 48 | */ |
|
| 49 | public function getType() |
|
| 50 | { |
|
| 51 | return ExerciseType::CLI(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return string[] |
|
| 56 | */ |
|
| 57 | public function getRequiredFunctions() |
|
| 58 | { |
|
| 59 | return ["strtoupper"]; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return string[] |
|
| 64 | */ |
|
| 65 | public function getBannedFunctions() |
|
| 66 | { |
|
| 67 | return []; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param ExerciseDispatcher $dispatcher |
|
| 72 | */ |
|
| 73 | public function configure(ExerciseDispatcher $dispatcher) |
|
| 74 | { |
|
| 75 | $dispatcher->requireCheck(FunctionRequirementsCheck::class); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| @@ 17-77 (lines=61) @@ | ||
| 14 | * Class NewGenerationTransfer |
|
| 15 | * @package PhpSchool\Php7Way\Exercise |
|
| 16 | */ |
|
| 17 | class NewGenerationTransfer extends AbstractExercise implements |
|
| 18 | ExerciseInterface, |
|
| 19 | CliExercise, |
|
| 20 | FunctionRequirementsExerciseCheck |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @return string |
|
| 24 | */ |
|
| 25 | public function getName() |
|
| 26 | { |
|
| 27 | return 'The new generation transfers its power'; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getDescription() |
|
| 34 | { |
|
| 35 | return 'Use generators delegating some parts of the algorithm'; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @return array |
|
| 40 | */ |
|
| 41 | public function getArgs() |
|
| 42 | { |
|
| 43 | return ["firstArgument", "secondArgument", "thirdArgument"]; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return ExerciseType |
|
| 48 | */ |
|
| 49 | public function getType() |
|
| 50 | { |
|
| 51 | return ExerciseType::CLI(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return string[] |
|
| 56 | */ |
|
| 57 | public function getRequiredFunctions() |
|
| 58 | { |
|
| 59 | return ["strtoupper"]; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return string[] |
|
| 64 | */ |
|
| 65 | public function getBannedFunctions() |
|
| 66 | { |
|
| 67 | return []; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param ExerciseDispatcher $dispatcher |
|
| 72 | */ |
|
| 73 | public function configure(ExerciseDispatcher $dispatcher) |
|
| 74 | { |
|
| 75 | $dispatcher->requireCheck(FunctionRequirementsCheck::class); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| @@ 17-77 (lines=61) @@ | ||
| 14 | * Class TypeYourOutput |
|
| 15 | * @package PhpSchool\Php7Way\Exercise |
|
| 16 | */ |
|
| 17 | class TypeYourOutput extends AbstractExercise implements |
|
| 18 | ExerciseInterface, |
|
| 19 | CliExercise, |
|
| 20 | FunctionRequirementsExerciseCheck |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @return string |
|
| 24 | */ |
|
| 25 | public function getName() |
|
| 26 | { |
|
| 27 | return 'Type your output!'; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getDescription() |
|
| 34 | { |
|
| 35 | return 'Use types to validate the output of a function'; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @return array |
|
| 40 | */ |
|
| 41 | public function getArgs() |
|
| 42 | { |
|
| 43 | return [1, 2]; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return ExerciseType |
|
| 48 | */ |
|
| 49 | public function getType() |
|
| 50 | { |
|
| 51 | return ExerciseType::CLI(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return string[] |
|
| 56 | */ |
|
| 57 | public function getRequiredFunctions() |
|
| 58 | { |
|
| 59 | return ["noStrictFunction", "strictFunction"]; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return string[] |
|
| 64 | */ |
|
| 65 | public function getBannedFunctions() |
|
| 66 | { |
|
| 67 | return []; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param ExerciseDispatcher $dispatcher |
|
| 72 | */ |
|
| 73 | public function configure(ExerciseDispatcher $dispatcher) |
|
| 74 | { |
|
| 75 | $dispatcher->requireCheck(FunctionRequirementsCheck::class); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||