@@ -26,7 +26,7 @@  | 
                                                    ||
| 26 | 26 | |
| 27 | 27 | private function diceAsAssocArrays(array $diceCollection)  | 
                                                        
| 28 | 28 |      { | 
                                                        
| 29 | -        return array_map(function (Dice $dice) { | 
                                                        |
| 29 | +        return array_map(function(Dice $dice) { | 
                                                        |
| 30 | 30 | return [  | 
                                                        
| 31 | 31 | "value" => $dice->roll(),  | 
                                                        
| 32 | 32 | "size" => "d" . $dice->size()  | 
                                                        
@@ -8,11 +8,11 @@  | 
                                                    ||
| 8 | 8 | use MeadSteve\DiceApi\RequestHandler\DiceRequestHandler;  | 
                                                        
| 9 | 9 | use Predis\Client;  | 
                                                        
| 10 | 10 | |
| 11 | -require __DIR__ . "/../vendor/autoload.php";  | 
                                                        |
| 11 | +require __DIR__."/../vendor/autoload.php";  | 
                                                        |
| 12 | 12 | |
| 13 | 13 | $diceGenerator = new DiceGenerator();  | 
                                                        
| 14 | 14 | |
| 15 | -$rendererFactory = new RendererFactory('http://' . $_SERVER['HTTP_HOST']); | 
                                                        |
| 15 | +$rendererFactory = new RendererFactory('http://'.$_SERVER['HTTP_HOST']); | 
                                                        |
| 16 | 16 | |
| 17 | 17 |  if (isset($_ENV['REDIS_URL'])) { | 
                                                        
| 18 | 18 | $redis = new Client(  | 
                                                        
@@ -42,10 +42,10 @@ discard block  | 
                                                    ||
| 42 | 42 | $this->diceCounter->count($dice);  | 
                                                        
| 43 | 43 |          } catch (UncreatableDiceException $creationError) { | 
                                                        
| 44 | 44 | $diceResponse = $diceResponse->withStatus(400)  | 
                                                        
| 45 | -                ->write("Unable to roll dice: " . $creationError->getMessage()); | 
                                                        |
| 45 | +                ->write("Unable to roll dice: ".$creationError->getMessage()); | 
                                                        |
| 46 | 46 |          } catch (UnrenderableDiceException $renderError) { | 
                                                        
| 47 | 47 | $diceResponse = $diceResponse->withStatus(400)  | 
                                                        
| 48 | -                ->write("Unable to render request: " . $renderError->getMessage()); | 
                                                        |
| 48 | +                ->write("Unable to render request: ".$renderError->getMessage()); | 
                                                        |
| 49 | 49 | }  | 
                                                        
| 50 | 50 | return $diceResponse;  | 
                                                        
| 51 | 51 | }  | 
                                                        
@@ -60,7 +60,7 @@ discard block  | 
                                                    ||
| 60 | 60 |                  ->withHeader("Content-Type", $renderer->contentType()); | 
                                                        
| 61 | 61 |          } catch (UnknownRendererException $error) { | 
                                                        
| 62 | 62 | $responseWithOutput = $response->withStatus(406);  | 
                                                        
| 63 | -            $responseWithOutput->write("Not sure how to respond with: " . $requestedContentType); | 
                                                        |
| 63 | +            $responseWithOutput->write("Not sure how to respond with: ".$requestedContentType); | 
                                                        |
| 64 | 64 | }  | 
                                                        
| 65 | 65 | return $responseWithOutput;  | 
                                                        
| 66 | 66 | }  | 
                                                        
@@ -69,7 +69,7 @@ discard block  | 
                                                    ||
| 69 | 69 |      { | 
                                                        
| 70 | 70 |          $rolledValue = $request->getHeader('totally-legit')[0]; | 
                                                        
| 71 | 71 | return array_map(  | 
                                                        
| 72 | -            function (Dice $dice) use ($rolledValue) { | 
                                                        |
| 72 | +            function(Dice $dice) use ($rolledValue) { | 
                                                        |
| 73 | 73 | return new TotallyLegit($dice, (int) $rolledValue);  | 
                                                        
| 74 | 74 | },  | 
                                                        
| 75 | 75 | $dice  | 
                                                        
@@ -20,7 +20,7 @@  | 
                                                    ||
| 20 | 20 | |
| 21 | 21 | public function roll()  | 
                                                        
| 22 | 22 |      { | 
                                                        
| 23 | -        if (! function_exists('random_int')) { | 
                                                        |
| 23 | +        if (!function_exists('random_int')) { | 
                                                        |
| 24 | 24 | return mt_rand(1, $this->size);  | 
                                                        
| 25 | 25 | }  | 
                                                        
| 26 | 26 | |
@@ -35,6 +35,6 @@  | 
                                                    ||
| 35 | 35 | }  | 
                                                        
| 36 | 36 | $roll = $dice->roll();  | 
                                                        
| 37 | 37 |          $url = "{$this->urlRoot}/images/poorly-drawn/d{$size}/{$roll}.png"; | 
                                                        
| 38 | - return '<img src="' . $url . '" />';  | 
                                                        |
| 38 | + return '<img src="'.$url.'" />';  | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | }  | 
                                                        
@@ -27,11 +27,11 @@ discard block  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 | public function index(Request $request, Response $response)  | 
                                                        
| 29 | 29 |      { | 
                                                        
| 30 | - $indexFilePath = __DIR__ . "/generated-index.html";  | 
                                                        |
| 30 | + $indexFilePath = __DIR__."/generated-index.html";  | 
                                                        |
| 31 | 31 |          if (!file_exists($indexFilePath)) { | 
                                                        
| 32 | 32 | $converter = new CommonMarkConverter();  | 
                                                        
| 33 | - $indexBody = $converter->convertToHtml(file_get_contents(__DIR__ . "/../README.md"));  | 
                                                        |
| 34 | - $indexContent = file_get_contents(__DIR__ . "/../www/templates/index.html");  | 
                                                        |
| 33 | + $indexBody = $converter->convertToHtml(file_get_contents(__DIR__."/../README.md"));  | 
                                                        |
| 34 | + $indexContent = file_get_contents(__DIR__."/../www/templates/index.html");  | 
                                                        |
| 35 | 35 |              $indexContent = str_replace("{{body}}", $indexBody, $indexContent); | 
                                                        
| 36 | 36 | file_put_contents($indexFilePath, $indexContent);  | 
                                                        
| 37 | 37 | $response->write($indexContent);  | 
                                                        
@@ -58,8 +58,8 @@ discard block  | 
                                                    ||
| 58 | 58 | $this->get(self::DICE_PATH_REGEX, [$diceRequestHandler, 'getDice']);  | 
                                                        
| 59 | 59 | |
| 60 | 60 | $this->get(  | 
                                                        
| 61 | - "/html" . self::DICE_PATH_REGEX,  | 
                                                        |
| 62 | -            function (Request $request, $response, $args) use ($diceRequestHandler) { | 
                                                        |
| 61 | + "/html".self::DICE_PATH_REGEX,  | 
                                                        |
| 62 | +            function(Request $request, $response, $args) use ($diceRequestHandler) { | 
                                                        |
| 63 | 63 | return $diceRequestHandler->getDice(  | 
                                                        
| 64 | 64 |                      $request->withHeader('accept', 'text/html'), | 
                                                        
| 65 | 65 | $response,  | 
                                                        
@@ -68,8 +68,8 @@ discard block  | 
                                                    ||
| 68 | 68 | }  | 
                                                        
| 69 | 69 | );  | 
                                                        
| 70 | 70 | $this->get(  | 
                                                        
| 71 | - "/json" . self::DICE_PATH_REGEX,  | 
                                                        |
| 72 | -            function (Request $request, $response, $args) use ($diceRequestHandler) { | 
                                                        |
| 71 | + "/json".self::DICE_PATH_REGEX,  | 
                                                        |
| 72 | +            function(Request $request, $response, $args) use ($diceRequestHandler) { | 
                                                        |
| 73 | 73 | return $diceRequestHandler->getDice(  | 
                                                        
| 74 | 74 |                      $request->withHeader('accept', 'application/json'), | 
                                                        
| 75 | 75 | $response,  | 
                                                        
@@ -2,11 +2,8 @@  | 
                                                    ||
| 2 | 2 | |
| 3 | 3 | namespace MeadSteve\DiceApi\Dice\Factories;  | 
                                                        
| 4 | 4 | |
| 5 | -use MeadSteve\DiceApi\BasicDice;  | 
                                                        |
| 6 | 5 | use MeadSteve\DiceApi\Dice;  | 
                                                        
| 7 | 6 | use MeadSteve\DiceApi\Dice\SteveDice;  | 
                                                        
| 8 | -use MeadSteve\DiceApi\Dice\UncreatableDiceException;  | 
                                                        |
| 9 | -use MeadSteve\DiceApi\Dice\ZeropointDice;  | 
                                                        |
| 10 | 7 | |
| 11 | 8 | class SpecialDiceFactory implements DiceFactory  | 
                                                        
| 12 | 9 |  { | 
                                                        
@@ -70,7 +70,7 @@  | 
                                                    ||
| 70 | 70 | $data = [];  | 
                                                        
| 71 | 71 |          $valid = preg_match("/(?P<count>[0-9]+)?d(?P<type>[^\/]+)/i", $part, $data); | 
                                                        
| 72 | 72 |          if (!$valid) { | 
                                                        
| 73 | -            throw new UncreatableDiceException("Problem creating dice from incorrectly formated data: " . $part); | 
                                                        |
| 73 | +            throw new UncreatableDiceException("Problem creating dice from incorrectly formated data: ".$part); | 
                                                        |
| 74 | 74 | }  | 
                                                        
| 75 | 75 |          if (!$data["count"]) { | 
                                                        
| 76 | 76 | $data["count"] = 1;  |