Completed
Push — master ( 4614c0...dbb6e6 )
by Steve
03:09
created
src/RequestHandler/DiceRequestHandler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -77,10 +77,17 @@
 block discarded – undo
77 77
         return $responseWithOutput;
78 78
     }
79 79
 
80
+    /**
81
+     * @param Dice[] $dice
82
+     */
80 83
     private function makeDiceTotallyLegit($dice, Request $request)
81 84
     {
82 85
         $rolledValue = $request->getHeader('totally-legit')[0];
83 86
         return array_map(
87
+
88
+            /**
89
+             * @param Dice[] $dice
90
+             */
84 91
             function (Dice $dice) use ($rolledValue) {
85 92
                 return new TotallyLegit($dice, (int) $rolledValue);
86 93
             },
Please login to merge, or discard this patch.
src/Dice/BasicDice.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use MeadSteve\DiceApi\RequestHandler\DiceRequestHandler;
15 15
 use Predis\Client;
16 16
 
17
-require __DIR__ . "/../vendor/autoload.php";
17
+require __DIR__."/../vendor/autoload.php";
18 18
 
19 19
 $diceGenerator = new UrlDiceGenerator(
20 20
     new DiceFactoryCollection([
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 $rendererCollection = new RendererCollection([
27 27
     new Json(),
28
-    new Html('http://' . $_SERVER['HTTP_HOST']),
28
+    new Html('http://'.$_SERVER['HTTP_HOST']),
29 29
     new Plain()
30 30
 ]);
31 31
 
Please login to merge, or discard this patch.
src/DiceApp.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
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);
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $diceRequestHandler = $this->diceRequestHandler;
68 68
         $this->get(
69
-            "/{$path}" . self::DICE_PATH_REGEX,
70
-            function (Request $request, $response, $args) use ($diceRequestHandler, $contentType) {
69
+            "/{$path}".self::DICE_PATH_REGEX,
70
+            function(Request $request, $response, $args) use ($diceRequestHandler, $contentType) {
71 71
                 return $diceRequestHandler->getDice(
72 72
                     $request->withHeader('accept', $contentType),
73 73
                     $response,
Please login to merge, or discard this patch.
src/Renderer/Html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
         }
41 41
         $roll = $dice->roll();
42 42
         $url = "{$this->urlRoot}/images/poorly-drawn/{$name}/{$roll}.png";
43
-        return '<img src="' . $url . '" />';
43
+        return '<img src="'.$url.'" />';
44 44
     }
45 45
 }
Please login to merge, or discard this patch.
src/Renderer/Json.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
     private function diceAsAssocArrays(array $diceCollection)
33 33
     {
34
-        return array_map(function (Dice $dice) {
34
+        return array_map(function(Dice $dice) {
35 35
             return [
36 36
                 "value" => $dice->roll(),
37 37
                 "type"  => $dice->name()
Please login to merge, or discard this patch.
src/Dice/Factories/SpecialDiceFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
     public function __construct()
15 15
     {
16 16
         $this->diceTypeMappings = [
17
-            'steve' => function () {
17
+            'steve' => function() {
18 18
                 return new Dice\SteveDice();
19 19
             },
20
-            'fate'  => function () {
20
+            'fate'  => function() {
21 21
                 return new Dice\FateDice();
22 22
             },
23 23
         ];
Please login to merge, or discard this patch.
src/UrlDiceGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         $data = [];
64 64
         $valid = preg_match("/(?P<count>[0-9]+)?d(?P<type>[^\/]+)/i", $part, $data);
65 65
         if (!$valid) {
66
-            throw new UncreatableDiceException("Problem creating dice from incorrectly formatted data: " . $part);
66
+            throw new UncreatableDiceException("Problem creating dice from incorrectly formatted data: ".$part);
67 67
         }
68 68
         if (!$data["count"]) {
69 69
             $data["count"] = 1;
Please login to merge, or discard this patch.