Test Setup Failed
Branch master (56db7f)
by Alexey
01:44
created
src/components/Shop.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function addCurrency(Currency $currency)
59 59
     {
60
-        if($is_valid = $currency->validate()) {
60
+        if ($is_valid = $currency->validate()) {
61 61
             $this->currencies[] = $currency;
62 62
         } else {
63 63
             $this->errors['currency'][] = $currency->errors;
Please login to merge, or discard this patch.
src/components/Offer.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $this->writer->startElement('offer');
43 43
         $this->writer->writeAttribute('id', $this->id);
44
-        if(null !== $this->type) $this->writer->writeAttribute('type', $this->type);
44
+        if (null !== $this->type) $this->writer->writeAttribute('type', $this->type);
45 45
         $this->writer->writeAttribute('available', $this->available ? 'true' : 'false');
46 46
 
47
-        if(null !== $this->url) $this->writer->writeElement('url', $this->url);
48
-        if(null !== $this->price) $this->writer->writeElement('price', $this->price);
49
-        if(null !== $this->currencyId) $this->writer->writeElement('currencyId', $this->currencyId);
50
-        if(null !== $this->categoryId) $this->writer->writeElement('categoryId', $this->categoryId);
47
+        if (null !== $this->url) $this->writer->writeElement('url', $this->url);
48
+        if (null !== $this->price) $this->writer->writeElement('price', $this->price);
49
+        if (null !== $this->currencyId) $this->writer->writeElement('currencyId', $this->currencyId);
50
+        if (null !== $this->categoryId) $this->writer->writeElement('categoryId', $this->categoryId);
51 51
 
52 52
         if (count($this->pictures) > 0) {
53 53
             foreach ($this->pictures as $picture) {
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
             }
56 56
         }
57 57
 
58
-        if($this->store) $this->writer->writeElement('store', $this->store ? 'true' : 'false');
59
-        if($this->delivery) $this->writer->writeElement('delivery', $this->delivery ? 'true' : 'false');
60
-        if(null !== $this->name) $this->writer->writeElement('name', $this->name);
61
-        if(null !== $this->vendor) $this->writer->writeElement('vendor', $this->vendor);
62
-        if(null !== $this->vendorCode) $this->writer->writeElement('vendorCode', $this->vendorCode);
63
-        if(null !== $this->model) $this->writer->writeElement('model', $this->model);
64
-        if(null !== $this->description) $this->writer->writeElement('description', $this->description);
65
-        if(null !== $this->salesNotes) $this->writer->writeElement('sales_notes', $this->salesNotes);
66
-        if(null !== $this->barcode) $this->writer->writeElement('barcode', $this->barcode);
67
-        if(null !== $this->age) $this->writer->writeElement('age', $this->age);
68
-        if($this->manufacturerWarranty) $this->writer->writeElement('manufacturer_warranty', $this->manufacturerWarranty ? 'true' : 'false');
58
+        if ($this->store) $this->writer->writeElement('store', $this->store ? 'true' : 'false');
59
+        if ($this->delivery) $this->writer->writeElement('delivery', $this->delivery ? 'true' : 'false');
60
+        if (null !== $this->name) $this->writer->writeElement('name', $this->name);
61
+        if (null !== $this->vendor) $this->writer->writeElement('vendor', $this->vendor);
62
+        if (null !== $this->vendorCode) $this->writer->writeElement('vendorCode', $this->vendorCode);
63
+        if (null !== $this->model) $this->writer->writeElement('model', $this->model);
64
+        if (null !== $this->description) $this->writer->writeElement('description', $this->description);
65
+        if (null !== $this->salesNotes) $this->writer->writeElement('sales_notes', $this->salesNotes);
66
+        if (null !== $this->barcode) $this->writer->writeElement('barcode', $this->barcode);
67
+        if (null !== $this->age) $this->writer->writeElement('age', $this->age);
68
+        if ($this->manufacturerWarranty) $this->writer->writeElement('manufacturer_warranty', $this->manufacturerWarranty ? 'true' : 'false');
69 69
 
70 70
         if (count($this->params) > 0) {
71 71
             foreach ($this->params as $param) {
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function addParam(OfferParam $param)
141 141
     {
142
-        if($param->validate()) {
142
+        if ($param->validate()) {
143 143
             $this->params[] = $param;
144 144
             return true;
145 145
         } else {
146
-            $this->errors['params'][]=$param->errors;
146
+            $this->errors['params'][] = $param->errors;
147 147
             return false;
148 148
         }
149 149
     }
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function addPicture(OfferPicture $picrure)
156 156
     {
157
-        if($picrure->validate()) {
157
+        if ($picrure->validate()) {
158 158
             $this->pictures[] = $picrure;
159 159
             return true;
160 160
         } else {
161
-            $this->errors['pictures'][]=$picrure->errors;
161
+            $this->errors['pictures'][] = $picrure->errors;
162 162
             return false;
163 163
         }
164 164
     }
Please login to merge, or discard this patch.
src/validators/one_of.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     public function validate(Object &$object, array $attributes, array $options = []):void
11 11
     {
12
-        foreach ($attributes as $attribute){
13
-            if( !in_array($object->$attribute, $options)) {
12
+        foreach ($attributes as $attribute) {
13
+            if (!in_array($object->$attribute, $options)) {
14 14
                 $object->addError($attribute, $attribute.' must be element of ['.implode(', ', $options).']');
15 15
             }
16 16
         }
Please login to merge, or discard this patch.
src/validators/url.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     public function validate(Object &$object, array $attributes, array $options = []):void
11 11
     {
12
-        foreach ($attributes as $attribute){
13
-            if(!filter_var($object->$attribute, FILTER_VALIDATE_URL)) {
12
+        foreach ($attributes as $attribute) {
13
+            if (!filter_var($object->$attribute, FILTER_VALIDATE_URL)) {
14 14
                 $object->addError($attribute, $attribute.' must be valid url');
15 15
             }
16 16
         }
Please login to merge, or discard this patch.
src/validators/required.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     public function validate(Object &$object, array $attributes, array $options = []):void
11 11
     {
12
-        foreach ($attributes as $attribute){
13
-            if( strlen(trim( (string) $object->$attribute )) === 0) {
12
+        foreach ($attributes as $attribute) {
13
+            if (strlen(trim((string) $object->$attribute)) === 0) {
14 14
                 $object->addError($attribute, $attribute.' cannot be empty');
15 15
             }
16 16
         }
Please login to merge, or discard this patch.
src/Object.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,14 +72,14 @@
 block discarded – undo
72 72
                 throw new IncorrectRuleExceptin('Rule name must be a string');
73 73
             }
74 74
 
75
-            $class = '\\iamsaint\yml\\validators\\' . $rule[1];
75
+            $class = '\\iamsaint\yml\\validators\\'.$rule[1];
76 76
 
77 77
             if (!class_exists($class)) {
78 78
                 throw new IncorrectRuleExceptin('Validator not found');
79 79
             }
80 80
 
81 81
             $attributes = is_array($rule[0]) ? $rule[0] : [$rule[0]];
82
-            (new $class())->validate($this, $attributes, $rule[2] ? : []);
82
+            (new $class())->validate($this, $attributes, $rule[2] ?: []);
83 83
         }
84 84
 
85 85
         return count($this->errors) === 0;
Please login to merge, or discard this patch.