Completed
Push — master ( 8ace16...5d30f6 )
by Alexey
03:23
created
src/Validations/IntValidation.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@
 block discarded – undo
14 14
 
15 15
     public function isValid(ValueObject $data)
16 16
     {
17
-        if (is_bool($data->value())) return false;
17
+        if (is_bool($data->value())) {
18
+            return false;
19
+        }
18 20
         return is_int($data->value()) || preg_match('/^\d+$/', $data->value());
19 21
     }
20 22
 
Please login to merge, or discard this patch.
src/Validations/MinLenValidation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function getErrorMessage()
19 19
     {
20
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
20
+        if (!is_null($this->errorMessage)) return parent::getErrorMessage();
21 21
 
22 22
         return "{$this->data->name()} is too short (minimum {$this->options[0]} characters";
23 23
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
     public function getErrorMessage()
19 19
     {
20
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
20
+        if(!is_null($this->errorMessage)) {
21
+            return parent::getErrorMessage();
22
+        }
21 23
 
22 24
         return "{$this->data->name()} is too short (minimum {$this->options[0]} characters";
23 25
     }
Please login to merge, or discard this patch.
src/Validations/FloatValidation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
     public function isValid(ValueObject $data)
16 16
     {
17
-        if ( is_bool($data->value()) ) return false;
17
+        if (is_bool($data->value())) return false;
18 18
         return is_float($data->value()) || preg_match('/^[\d\.]+$/', $data->value());
19 19
     }
20 20
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@
 block discarded – undo
14 14
 
15 15
     public function isValid(ValueObject $data)
16 16
     {
17
-        if ( is_bool($data->value()) ) return false;
17
+        if ( is_bool($data->value()) ) {
18
+            return false;
19
+        }
18 20
         return is_float($data->value()) || preg_match('/^[\d\.]+$/', $data->value());
19 21
     }
20 22
 
Please login to merge, or discard this patch.
src/Validations/MaxValidation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function getErrorMessage()
19 19
     {
20
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
20
+        if (!is_null($this->errorMessage)) return parent::getErrorMessage();
21 21
 
22 22
         return "{$this->data->name()} is too big (maximum {$this->options[0]})";
23 23
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
     public function getErrorMessage()
19 19
     {
20
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
20
+        if(!is_null($this->errorMessage)) {
21
+            return parent::getErrorMessage();
22
+        }
21 23
 
22 24
         return "{$this->data->name()} is too big (maximum {$this->options[0]})";
23 25
     }
Please login to merge, or discard this patch.
src/Validations/AbstractValidation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $this->options = $options;
23 23
     }
24 24
 
25
-    public function setErrorMessage($message){
25
+    public function setErrorMessage($message) {
26 26
         $this->errorMessage = $message;
27 27
     }
28 28
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
         return $this->error;
32 32
     }
33 33
 
34
-    public function validate(ValueObject $data){
34
+    public function validate(ValueObject $data) {
35 35
         $this->data = $data;
36
-        if (! $this->isValid($data) ) {
36
+        if (!$this->isValid($data)) {
37 37
             $this->error = $this->getErrorMessage();
38 38
             $this->afterFailedValidation();
39 39
             return false;
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
         $this->afterSuccessValidation();
42 42
         return true;
43 43
     }
44
-    public function getErrorMessage(){
44
+    public function getErrorMessage() {
45 45
         return str_replace("{name}", $this->data->name(), $this->errorMessage);
46 46
     }
47 47
 
48 48
     abstract public function isValid(ValueObject $data);
49 49
 
50
-    protected function afterSuccessValidation(){
50
+    protected function afterSuccessValidation() {
51 51
 
52 52
     }
53 53
 
54
-    protected function afterFailedValidation(){
54
+    protected function afterFailedValidation() {
55 55
 
56 56
     }
57 57
 
Please login to merge, or discard this patch.
src/Validations/MaxLenValidation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
     public function getErrorMessage()
18 18
     {
19
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
19
+        if (!is_null($this->errorMessage)) return parent::getErrorMessage();
20 20
 
21 21
         return "{$this->data->name()} is too long (maximum {$this->options[0]} characters";
22 22
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@
 block discarded – undo
16 16
 
17 17
     public function getErrorMessage()
18 18
     {
19
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
19
+        if(!is_null($this->errorMessage)) {
20
+            return parent::getErrorMessage();
21
+        }
20 22
 
21 23
         return "{$this->data->name()} is too long (maximum {$this->options[0]} characters";
22 24
     }
Please login to merge, or discard this patch.
src/Validations/MinValidation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function getErrorMessage()
19 19
     {
20
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
20
+        if (!is_null($this->errorMessage)) return parent::getErrorMessage();
21 21
 
22 22
         return "{$this->data->name()} is too small (minimum {$this->options[0]})";
23 23
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
     public function getErrorMessage()
19 19
     {
20
-        if(!is_null($this->errorMessage)) return parent::getErrorMessage();
20
+        if(!is_null($this->errorMessage)) {
21
+            return parent::getErrorMessage();
22
+        }
21 23
 
22 24
         return "{$this->data->name()} is too small (minimum {$this->options[0]})";
23 25
     }
Please login to merge, or discard this patch.
src/Validations/RequiredValidation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 
16 16
     public function isValid(ValueObject $data)
17 17
     {
18
-        return ! ($data instanceof NullValueObject);
18
+        return !($data instanceof NullValueObject);
19 19
     }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
src/Rule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $signatures = $this->getSignatures($options);
23 23
 
24 24
         foreach ($signatures as $key => $val) {
25
-            if(is_string($key)) {
25
+            if (is_string($key)) {
26 26
                 /** @var AbstractValidation $validation */
27 27
                 $validation = $validationFactory->get($key);
28 28
                 $validation->setErrorMessage($val);
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * @param $options mixed|array|string
43 43
      */
44
-    protected function getSignatures($options){
45
-        if(is_array($options)) {
44
+    protected function getSignatures($options) {
45
+        if (is_array($options)) {
46 46
             $signatures = [];
47
-            foreach ($options as $key => $option){
47
+            foreach ($options as $key => $option) {
48 48
                 $associativeArray = is_string($key);
49
-                if($associativeArray){
49
+                if ($associativeArray) {
50 50
                     $part = $this->getSignatures($key);
51 51
                     $partValidation = [];
52 52
                     foreach ($part as $item) {
Please login to merge, or discard this patch.