Completed
Push — master ( b902fc...12ea9a )
by Steve
02:16 queued 18s
created
src/Renderer/Json.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
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()
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
@@ -8,11 +8,11 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/RequestHandler/DiceRequestHandler.php 1 patch
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.
src/Renderer/Html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/DiceApp.php 1 patch
Spacing   +7 added lines, -7 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);
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,
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
@@ -70,7 +70,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Dice/Factories/SpecialDiceFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function __construct()
19 19
     {
20 20
         $this->diceTypeCallbacks = [
21
-            'steve' => function ($_type, $diceCount) {
21
+            'steve' => function($_type, $diceCount) {
22 22
                 $newDice = [];
23 23
                 for ($i = 0; $i < $diceCount; $i++) {
24 24
                     $newDice[] = new SteveDice();
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -2,11 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace MeadSteve\DiceApi\Dice\Factories;
4 4
 
5
-use MeadSteve\DiceApi\Dice\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
 {
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.