@@ -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 |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | class DiceApp extends App |
| 15 | 15 | { |
| 16 | 16 | const DICE_PATH_REGEX = "{dice:(?:/[0-9]*[dD][^\/]+)+/?}"; |
| 17 | - private const INDEX_FILE_PATH = __DIR__ . "/generated-index.html"; |
|
| 17 | + private const INDEX_FILE_PATH = __DIR__."/generated-index.html"; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var DiceCounter |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | public static function buildIndex(): string |
| 44 | 44 | { |
| 45 | 45 | $converter = new CommonMarkConverter(); |
| 46 | - $indexBody = $converter->convertToHtml(file_contents(__DIR__ . "/../README.md")); |
|
| 47 | - $indexContent = file_contents(__DIR__ . "/../www/templates/index.html"); |
|
| 46 | + $indexBody = $converter->convertToHtml(file_contents(__DIR__."/../README.md")); |
|
| 47 | + $indexContent = file_contents(__DIR__."/../www/templates/index.html"); |
|
| 48 | 48 | $indexContent = str_replace("{{body}}", $indexBody, $indexContent); |
| 49 | 49 | file_put_contents(self::INDEX_FILE_PATH, $indexContent); |
| 50 | 50 | return $indexContent; |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $diceRequestHandler = $this->diceRequestHandler; |
| 93 | 93 | $this->get( |
| 94 | - "/{$path}" . self::DICE_PATH_REGEX, |
|
| 95 | - function (Request $request, Response $response, $args) use ($diceRequestHandler, $contentType): Response { |
|
| 94 | + "/{$path}".self::DICE_PATH_REGEX, |
|
| 95 | + function(Request $request, Response $response, $args) use ($diceRequestHandler, $contentType): Response { |
|
| 96 | 96 | return $diceRequestHandler->getDice( |
| 97 | 97 | $request->withHeader('accept', $contentType), |
| 98 | 98 | $response, |