Test Setup Failed
Branch master (2bb5c9)
by David
08:31
created
Category
src/EaselDrawing/Drawers/GDDrawer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             $srcWidth,
185 185
             $srcHeight
186 186
         );
187
-        if (! $copy) {
187
+        if (!$copy) {
188 188
             throw new \RuntimeException("Cannot import the image $filename");
189 189
         }
190 190
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     protected function imageCreateFromFile(string $filename)
199 199
     {
200
-        if (! file_exists($filename) || ! is_readable($filename)) {
200
+        if (!file_exists($filename) || !is_readable($filename)) {
201 201
             throw new \InvalidArgumentException("The file $filename does not exists or is not readable");
202 202
         }
203 203
         $filetype = (new \finfo())->file($filename, FILEINFO_MIME_TYPE);
Please login to merge, or discard this patch.
src/EaselDrawing/Orientation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function setValue(string $value)
18 18
     {
19
-        if (! in_array($value, [static::LANDSCAPE, static::PORTRAIT])) {
19
+        if (!in_array($value, [static::LANDSCAPE, static::PORTRAIT])) {
20 20
             throw new \InvalidArgumentException('Orientation value is not valid');
21 21
         }
22 22
         $this->value = $value;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public static function newFromString(string $value)
31 31
     {
32 32
         $value = strtoupper($value);
33
-        if (! in_array($value, [static::LANDSCAPE, static::PORTRAIT])) {
33
+        if (!in_array($value, [static::LANDSCAPE, static::PORTRAIT])) {
34 34
             $value = static::LANDSCAPE;
35 35
         }
36 36
         return new Orientation($value);
Please login to merge, or discard this patch.
src/EaselDrawing/Elements/Label.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@
 block discarded – undo
40 40
         $this->setFont($font);
41 41
         $this->setSize($size);
42 42
         $this->setColor($color);
43
-        $this->setAlign($align ? : new Align(Align::LEFT));
44
-        $this->setTextBackground($textBackground ? : new TextBackground(TextBackground::BOX, new Color(255, 255, 255)));
43
+        $this->setAlign($align ?: new Align(Align::LEFT));
44
+        $this->setTextBackground($textBackground ?: new TextBackground(TextBackground::BOX, new Color(255, 255, 255)));
45 45
     }
46 46
 
47 47
     public function getContent(): string
Please login to merge, or discard this patch.
src/EaselDrawing/Elements/Image.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
     public function getBackground(): Color
34 34
     {
35
-        if (! $this->hasBackground()) {
35
+        if (!$this->hasBackground()) {
36 36
             throw new \RuntimeException('The Image does not have a background color set');
37 37
         }
38 38
         return $this->background;
Please login to merge, or discard this patch.
src/EaselDrawing/Color.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
                 . substr($value, 1, 1) . substr($value, 1, 1)
42 42
                 . substr($value, 2, 1) . substr($value, 2, 1);
43 43
         }
44
-        if (! preg_match('/^[[:xdigit:]]{6}$/', $value)) {
44
+        if (!preg_match('/^[[:xdigit:]]{6}$/', $value)) {
45 45
             throw new \InvalidArgumentException('A color must contain 3 or 6 hexadecimal characters');
46 46
         }
47 47
         $rgb = [];
Please login to merge, or discard this patch.
src/EaselDrawing/Align.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function setValue(string $value)
19 19
     {
20
-        if (! in_array($value, [static::LEFT, static::CENTER, static::RIGHT])) {
20
+        if (!in_array($value, [static::LEFT, static::CENTER, static::RIGHT])) {
21 21
             throw new \InvalidArgumentException('Align value is not valid');
22 22
         }
23 23
         $this->value = $value;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public static function newFromString(string $value)
32 32
     {
33 33
         $value = strtoupper($value);
34
-        if (! in_array($value, [static::LEFT, static::CENTER, static::RIGHT])) {
34
+        if (!in_array($value, [static::LEFT, static::CENTER, static::RIGHT])) {
35 35
             $value = static::LEFT;
36 36
         }
37 37
         return new Align($value);
Please login to merge, or discard this patch.
src/EaselDrawing/Templates/TemplateFactory.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     public function __construct(string $relativePath, ElementFactory $elementFactory = null)
18 18
     {
19 19
         $this->relativePath = $relativePath;
20
-        $this->elementFactory = $elementFactory ? : $this->getDefaultElementFactory();
20
+        $this->elementFactory = $elementFactory ?: $this->getDefaultElementFactory();
21 21
     }
22 22
 
23 23
     public function getDefaultElementFactory()
@@ -54,43 +54,43 @@  discard block
 block discarded – undo
54 54
         $pathResolver = new PathResolver($this->relativePath);
55 55
 
56 56
         // width
57
-        if (! isset($data['width']) || ! is_integer($data['width']) || $data['width'] < 1) {
57
+        if (!isset($data['width']) || !is_integer($data['width']) || $data['width'] < 1) {
58 58
             $data['width'] = 800;
59 59
         }
60 60
         $width = $data['width'];
61 61
 
62 62
         // grayscale
63
-        if (! isset($data['grayscale']) || ! is_bool($data['grayscale'])) {
63
+        if (!isset($data['grayscale']) || !is_bool($data['grayscale'])) {
64 64
             $data['grayscale'] = false;
65 65
         }
66 66
         $grayscale = $data['grayscale'];
67 67
 
68 68
         // orientation
69
-        if (! isset($data['orientation']) || ! is_string($data['orientation'])) {
69
+        if (!isset($data['orientation']) || !is_string($data['orientation'])) {
70 70
             $data['orientation'] = Orientation::LANDSCAPE;
71 71
         }
72 72
         $orientation = Utilities::interpretOrientation($data['orientation']);
73 73
 
74 74
         // height
75
-        if (! isset($data['height']) || ! is_integer($data['height']) || $data['height'] < 1) {
75
+        if (!isset($data['height']) || !is_integer($data['height']) || $data['height'] < 1) {
76 76
             $data['height'] = 600;
77 77
         }
78 78
         $height = $data['height'];
79 79
 
80 80
         // foreground
81
-        if (! isset($data['foreground'])) {
81
+        if (!isset($data['foreground'])) {
82 82
             $data['foreground'] = false;
83 83
         }
84 84
         $foreground = Utilities::interpretColor($data['foreground'], Color::newFromString('000000'));
85 85
 
86 86
         // background
87
-        if (! isset($data['background'])) {
87
+        if (!isset($data['background'])) {
88 88
             $data['background'] = false;
89 89
         }
90 90
         $background = Utilities::interpretColor($data['background'], Color::newFromString('ffffff'));
91 91
 
92 92
         // fonts
93
-        if (! isset($data['fonts']) || ! is_array($data['fonts'])) {
93
+        if (!isset($data['fonts']) || !is_array($data['fonts'])) {
94 94
             $data['fonts'] = [];
95 95
         }
96 96
         $fonts = [];
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 
115 115
         // elements
116 116
         $elementFactory = $this->getElementFactory();
117
-        if (! isset($data['elements']) || ! is_array($data['elements'])) {
117
+        if (!isset($data['elements']) || !is_array($data['elements'])) {
118 118
             $data['elements'] = [];
119 119
         }
120 120
         foreach ($data['elements'] as $index => $sourceElement) {
121
-            if (! is_array($sourceElement) || count($sourceElement) !== 1) {
121
+            if (!is_array($sourceElement) || count($sourceElement) !== 1) {
122 122
                 throw new \InvalidArgumentException("The element index $index is not valid");
123 123
             }
124 124
             foreach ($sourceElement as $type => $dataElement) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     public function obtainFromFile(string $filename, string $format): Template
133 133
     {
134
-        if (! file_exists($filename) || ! is_readable($filename)) {
134
+        if (!file_exists($filename) || !is_readable($filename)) {
135 135
             throw new \InvalidArgumentException("File $filename does not exists or is not readable");
136 136
         }
137 137
         return $this->obtain(file_get_contents($filename), $format);
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $format = strtoupper($format);
143 143
         if ('YAML' === $format) {
144
-            return Yaml::parse($contents) ? : [];
144
+            return Yaml::parse($contents) ?: [];
145 145
         }
146 146
         if ('JSON' === $format) {
147
-            return json_decode($contents, true) ? : [];
147
+            return json_decode($contents, true) ?: [];
148 148
         }
149 149
         throw new \InvalidArgumentException("Format $format is not recognized");
150 150
     }
Please login to merge, or discard this patch.
src/EaselDrawing/Templates/Template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             throw new \InvalidArgumentException("Height must be an integer greater than zero");
68 68
         }
69 69
         foreach ($fonts as $index => $font) {
70
-            if (! ($font instanceof Font)) {
70
+            if (!($font instanceof Font)) {
71 71
                 throw new \InvalidArgumentException("The font index $index is not valid");
72 72
             }
73 73
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function getFont(string $name): Font
134 134
     {
135
-        if (! count($this->fonts)) {
135
+        if (!count($this->fonts)) {
136 136
             throw new \RuntimeException('There are no fonts in the template');
137 137
         }
138 138
         foreach ($this->fonts as $font) {
Please login to merge, or discard this patch.
src/EaselDrawing/Templates/Builders/Label.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         parent::configure($data, $template);
79 79
 
80 80
         // content
81
-        if (! isset($data['content']) || ! is_string($data['content'])) {
81
+        if (!isset($data['content']) || !is_string($data['content'])) {
82 82
             $data['content'] = '';
83 83
         }
84 84
         $this->content = $data['content'];
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         }
92 92
 
93 93
         // font
94
-        if (! isset($data['font']) || ! is_string($data['font'])) {
94
+        if (!isset($data['font']) || !is_string($data['font'])) {
95 95
             $data['font'] = '';
96 96
         }
97 97
         $this->font = $template->getFont($data['font']);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         }
103 103
 
104 104
         // align
105
-        if (! isset($data['align']) || ! is_string($data['align'])) {
105
+        if (!isset($data['align']) || !is_string($data['align'])) {
106 106
             $data['align'] = '';
107 107
         }
108 108
         $this->align = Align::newFromString($data['align']);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $background = $template->getBackground();
116 116
         }
117 117
         // textbackground: backgroundtype
118
-        if (! isset($data['backgroundtype']) || ! is_string($data['backgroundtype'])) {
118
+        if (!isset($data['backgroundtype']) || !is_string($data['backgroundtype'])) {
119 119
             $data['backgroundtype'] = '';
120 120
         }
121 121
         $this->textBackground = TextBackground::newFromString($data['backgroundtype'], $background);
Please login to merge, or discard this patch.