@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function roll(): int |
| 26 | 26 | { |
| 27 | - if (! function_exists('random_int')) { |
|
| 27 | + if (!function_exists('random_int')) { |
|
| 28 | 28 | return mt_rand(1, $this->size); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -14,10 +14,10 @@ |
||
| 14 | 14 | public function __construct() |
| 15 | 15 | { |
| 16 | 16 | $this->diceTypeMappings = [ |
| 17 | - 'steve' => function (): Dice\SteveDice { |
|
| 17 | + 'steve' => function(): Dice\SteveDice { |
|
| 18 | 18 | return new Dice\SteveDice(); |
| 19 | 19 | }, |
| 20 | - 'fate' => function (): Dice\FateDice { |
|
| 20 | + 'fate' => function(): Dice\FateDice { |
|
| 21 | 21 | return new Dice\FateDice(); |
| 22 | 22 | }, |
| 23 | 23 | ]; |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | return $this->writeAppropriateFormatResponse($request, $diceResponse, $diceCollection); |
| 57 | 57 | } catch (UncreatableDiceException $creationError) { |
| 58 | 58 | return $diceResponse->withStatus(400) |
| 59 | - ->write("Unable to roll diceCollection: " . $creationError->getMessage()); |
|
| 59 | + ->write("Unable to roll diceCollection: ".$creationError->getMessage()); |
|
| 60 | 60 | } catch (UnrenderableDiceException $renderError) { |
| 61 | 61 | return $diceResponse->withStatus(400) |
| 62 | - ->write("Unable to render request: " . $renderError->getMessage()); |
|
| 62 | + ->write("Unable to render request: ".$renderError->getMessage()); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | ->withHeader("Content-Type", $renderer->contentType()); |
| 90 | 90 | } catch (UnknownRendererException $error) { |
| 91 | 91 | return $response->withStatus(406) |
| 92 | - ->write("Not sure how to respond with: " . $requestedContentType); |
|
| 92 | + ->write("Not sure how to respond with: ".$requestedContentType); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $rolledValue = $request->getHeader('totally-legit')[0]; |
| 104 | 104 | return array_map( |
| 105 | - function (Dice $dice) use ($rolledValue): Dice { |
|
| 105 | + function(Dice $dice) use ($rolledValue): Dice { |
|
| 106 | 106 | return new TotallyLegit($dice, (int) $rolledValue); |
| 107 | 107 | }, |
| 108 | 108 | $diceCollection |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | class DiceApp extends App |
| 16 | 16 | { |
| 17 | 17 | const DICE_PATH_REGEX = "{dice:(?:/[0-9]*[dD][^\/]+)+/?}"; |
| 18 | - private const INDEX_FILE_PATH = __DIR__ . "/generated-index.html"; |
|
| 18 | + private const INDEX_FILE_PATH = __DIR__."/generated-index.html"; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var DiceCounter |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->diceCounter = $diceCounter; |
| 36 | 36 | |
| 37 | 37 | $this->setupRoutes(); |
| 38 | - $this->tip = function () { |
|
| 38 | + $this->tip = function() { |
|
| 39 | 39 | }; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | public static function buildIndex(): string |
| 47 | 47 | { |
| 48 | 48 | $converter = new CommonMarkConverter(); |
| 49 | - $indexBody = $converter->convertToHtml(file_contents(__DIR__ . "/../README.md")); |
|
| 50 | - $indexContent = file_contents(__DIR__ . "/../www/templates/index.html"); |
|
| 49 | + $indexBody = $converter->convertToHtml(file_contents(__DIR__."/../README.md")); |
|
| 50 | + $indexContent = file_contents(__DIR__."/../www/templates/index.html"); |
|
| 51 | 51 | $indexContent = str_replace("{{body}}", $indexBody, $indexContent); |
| 52 | 52 | file_put_contents(self::INDEX_FILE_PATH, $indexContent); |
| 53 | 53 | return $indexContent; |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $diceRequestHandler = $this->diceRequestHandler; |
| 96 | 96 | $this->get( |
| 97 | - "/{$path}" . self::DICE_PATH_REGEX, |
|
| 98 | - function (Request $request, Response $response, $args) use ($diceRequestHandler, $contentType): Response { |
|
| 97 | + "/{$path}".self::DICE_PATH_REGEX, |
|
| 98 | + function(Request $request, Response $response, $args) use ($diceRequestHandler, $contentType): Response { |
|
| 99 | 99 | return $diceRequestHandler->getDice( |
| 100 | 100 | $request->withHeader('accept', $contentType), |
| 101 | 101 | $response, |