Passed
Push — master ( a69d30...a6434e )
by Oleg
03:35
created
validator/EmailValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     {
26 26
         foreach ($this->elements AS $element) {
27 27
             if (!$model->checkAttributeExists($element)) {
28
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
28
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
29 29
 
30 30
                 return false;
31 31
             }
32 32
             if (!filter_var($model->$element, FILTER_VALIDATE_EMAIL)) {
33
-                $this->errors[] = 'Parameter ' . $element . ' is not a valid E-mail address';
33
+                $this->errors[] = 'Parameter '.$element.' is not a valid E-mail address';
34 34
 
35 35
                 return false;
36 36
             }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function client(IFormModel $model)
46 46
     {
47
-        $js = 'if (/^[\w.-]{1,}@[\w.-]{1,}$/.test(this.value) != true) {' .
47
+        $js = 'if (/^[\w.-]{1,}@[\w.-]{1,}$/.test(this.value) != true) {'.
48 48
             ' e.preventDefault(); this.focus(); alert(\'Value is not a valid e-mail\'); }';
49 49
 
50 50
         return $js;
Please login to merge, or discard this patch.
validator/Validator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
                 return true;
99 99
             } else {
100
-                throw new Exception('Validator ' . $name . ' not defined.');
100
+                throw new Exception('Validator '.$name.' not defined.');
101 101
             }
102 102
         }
103 103
 
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
     protected function getValidatorClass($name)
126 126
     {
127 127
         if (!empty(self::$validators[$name])) {
128
-            return '\\Micro\\Validator\\' . self::$validators[$name];
128
+            return '\\Micro\\Validator\\'.self::$validators[$name];
129 129
         } elseif (class_exists($name) && is_subclass_of($name, '\Micro\Validator\IValidator')) {
130 130
             return $name;
131
-        } elseif (file_exists($this->container->kernel->getAppDir() . '/validator/' . $name . '.php')) {
132
-            return '\\App\\Validator\\' . $name;
131
+        } elseif (file_exists($this->container->kernel->getAppDir().'/validator/'.$name.'.php')) {
132
+            return '\\App\\Validator\\'.$name;
133 133
         }
134 134
 
135 135
         return false;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 
152 152
         $result = null;
153 153
         foreach ($validator->elements AS $element) {
154
-            $id = $object . '_' . $element;
154
+            $id = $object.'_'.$element;
155 155
             /** @noinspection PhpUndefinedMethodInspection */
156
-            $result .= 'jQuery("#' . $id . '").bind("change blur submit", function(e){ ';
156
+            $result .= 'jQuery("#'.$id.'").bind("change blur submit", function(e){ ';
157 157
             /** @noinspection DisconnectedForeachInstructionInspection */
158 158
             $result .= $validator->client($model);
159 159
             $result .= ' });';
Please login to merge, or discard this patch.
validator/RangeValidator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 
36 36
         foreach ($this->elements AS $element) {
37 37
             if (!$model->checkAttributeExists($element)) {
38
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
38
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
39 39
 
40 40
                 return false;
41 41
             }
42 42
             if (!in_array($model->$element, $rang, true)) {
43
-                $this->errors[] = 'Parameter ' . $element . ' not find in rage ' .
44
-                    $this->params['min'] . '..' . $this->params['max'];
43
+                $this->errors[] = 'Parameter '.$element.' not find in rage '.
44
+                    $this->params['min'].'..'.$this->params['max'];
45 45
 
46 46
                 return false;
47 47
             }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function client(IFormModel $model)
57 57
     {
58
-        $js = 'if (this.value < ' . $this->params['min'] . ' || this.value > ' . $this->params['max'] . ') {' .
58
+        $js = 'if (this.value < '.$this->params['min'].' || this.value > '.$this->params['max'].') {'.
59 59
             ' e.preventDefault(); this.focus(); alert(\'Value not find in range\'); }';
60 60
 
61 61
         return $js;
Please login to merge, or discard this patch.
validator/UniqueValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         foreach ($this->elements AS $element) {
28 28
             if (!$model->checkAttributeExists($element)) {
29
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
29
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
30 30
 
31 31
                 return false;
32 32
             }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $query = new Query($this->container->db);
36 36
             $query->select = $this->params['attribute'];
37 37
             $query->table = $this->params['table'];
38
-            $query->addWhere($this->params['attribute'] . '="' . $elementValue . '"');
38
+            $query->addWhere($this->params['attribute'].'="'.$elementValue.'"');
39 39
             $query->limit = 1;
40 40
             $query->single = true;
41 41
 
Please login to merge, or discard this patch.
validator/RegexpValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
     {
26 26
         foreach ($this->elements AS $element) {
27 27
             if (!$model->checkAttributeExists($element)) {
28
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
28
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
29 29
 
30 30
                 return false;
31 31
             }
32 32
             $elementValue = $model->$element;
33 33
             if (preg_match($this->params['pattern'], $elementValue) === false) {
34
-                $this->errors[] = 'Parameter ' . $element . ' not valid with regular expression';
34
+                $this->errors[] = 'Parameter '.$element.' not valid with regular expression';
35 35
 
36 36
                 return false;
37 37
             }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function client(IFormModel $model)
47 47
     {
48
-        $js = 'if (!this.value.match(' . $this->params['pattern'] . ')) {' .
48
+        $js = 'if (!this.value.match('.$this->params['pattern'].')) {'.
49 49
             ' e.preventDefault(); this.focus(); alert(\'Value not valid with regular expression\'); }';
50 50
 
51 51
         return $js;
Please login to merge, or discard this patch.
validator/RequiredValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
     {
26 26
         foreach ($this->elements AS $element) {
27 27
             if (!$model->checkAttributeExists($element)) {
28
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
28
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
29 29
 
30 30
                 return false;
31 31
             }
32 32
             if (!$model->$element) {
33
-                $this->errors[] = $element . ' error: required element is empty.';
33
+                $this->errors[] = $element.' error: required element is empty.';
34 34
 
35 35
                 return false;
36 36
             }
Please login to merge, or discard this patch.
validator/BooleanValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
     {
41 41
         foreach ($this->elements AS $element) {
42 42
             if (!$model->checkAttributeExists($element)) {
43
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
43
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
44 44
 
45 45
                 return false;
46 46
             }
47 47
             $elementValue = $model->$element;
48 48
 
49 49
             if (($elementValue !== $this->params['true']) && ($elementValue !== $this->params['false'])) {
50
-                $this->errors[] = $element . ' error: required element is empty.';
50
+                $this->errors[] = $element.' error: required element is empty.';
51 51
 
52 52
                 return false;
53 53
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function client(IFormModel $model)
63 63
     {
64
-        return 'if (this.value != ' . $this->params['true'] . ' && this.value != ' . $this->params['false'] . ') {' .
64
+        return 'if (this.value != '.$this->params['true'].' && this.value != '.$this->params['false'].') {'.
65 65
         ' e.preventDefault(); this.focus(); alert(\'Value not compatible\'); }';
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
validator/FileValidator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             if (!$model->checkAttributeExists($element)) {
28 28
                 $files = $this->container->request->getFiles();
29 29
                 if (!empty($this->params['maxFiles']) && (count($files->files) > $this->params['maxFiles'])) {
30
-                    $this->errors[] = 'Too many files in parameter ' . $element;
30
+                    $this->errors[] = 'Too many files in parameter '.$element;
31 31
 
32 32
                     return false;
33 33
                 }
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
                     if (!empty($this->params['types']) && (strpos($this->params['types'],
36 36
                                 $fContext['type']) === false)
37 37
                     ) {
38
-                        $this->errors[] = 'File ' . $fContext['name'] . ' not allowed type';
38
+                        $this->errors[] = 'File '.$fContext['name'].' not allowed type';
39 39
 
40 40
                         return false;
41 41
                     }
42 42
                     if (!empty($this->params['minSize']) && ($fContext['size'] < $this->params['minSize'])) {
43
-                        $this->errors[] = 'File ' . $fContext['name'] . ' too small size';
43
+                        $this->errors[] = 'File '.$fContext['name'].' too small size';
44 44
 
45 45
                         return false;
46 46
                     }
47 47
                     if (!empty($this->params['maxSize']) && ($fContext['type'] > $this->params['maxSize'])) {
48
-                        $this->errors[] = 'File ' . $fContext['name'] . ' too many size';
48
+                        $this->errors[] = 'File '.$fContext['name'].' too many size';
49 49
 
50 50
                         return false;
51 51
                     }
Please login to merge, or discard this patch.
validator/UrlValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     {
26 26
         foreach ($this->elements AS $element) {
27 27
             if (!$model->checkAttributeExists($element)) {
28
-                $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model);
28
+                $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
29 29
 
30 30
                 return false;
31 31
             }
32 32
             if (filter_var($model->$element, FILTER_VALIDATE_URL) === false) {
33
-                $this->errors[] = 'Parameter ' . $element . ' is not a valid URL address';
33
+                $this->errors[] = 'Parameter '.$element.' is not a valid URL address';
34 34
 
35 35
                 return false;
36 36
             }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function client(IFormModel $model)
46 46
     {
47
-        $jsString = 'if (/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(this.value' .
47
+        $jsString = 'if (/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(this.value'.
48 48
             ') != true) { e.preventDefault(); this.focus(); alert(\'Value is not a URL\'); }';
49 49
 
50 50
         return $jsString;
Please login to merge, or discard this patch.