Completed
Push — master ( 44ffe3...5c0675 )
by Helmut
03:56
created
src/Fields/Search/lang/en.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 return [
4
-	'placeholder' => 'Search&hellip;',
5
-	'button' => 'Go',
4
+    'placeholder' => 'Search&hellip;',
5
+    'button' => 'Go',
6 6
 ];
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/Search/Search.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,12 +25,16 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function setValuesFromDefaults($defaults)
27 27
     {
28
-        if (count($defaults)) $this->value = array_shift($defaults);
28
+        if (count($defaults)) {
29
+            $this->value = array_shift($defaults);
30
+        }
29 31
     }
30 32
 
31 33
     public function setValuesFromModel($model)
32 34
     {
33
-        if (property_exists($model, $this->name)) $this->value = $model->{$this->name};
35
+        if (property_exists($model, $this->name)) {
36
+            $this->value = $model->{$this->name};
37
+        }
34 38
     }
35 39
 
36 40
     public function setValuesFromRequest($request)
@@ -40,7 +44,9 @@  discard block
 block discarded – undo
40 44
 
41 45
     public function fillModelWithValues($model)
42 46
     {
43
-        if (property_exists($model, $this->name)) $model->{$this->name} = $this->value;
47
+        if (property_exists($model, $this->name)) {
48
+            $model->{$this->name} = $this->value;
49
+        }
44 50
     }   
45 51
 
46 52
     public function validateRequired()
Please login to merge, or discard this patch.
src/Validator.php 3 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -4,87 +4,87 @@
 block discarded – undo
4 4
 
5 5
 class Validator {
6 6
 	
7
-	public function required($var) 
8
-	{
9
-		if (is_null($var)) return false;
7
+    public function required($var) 
8
+    {
9
+        if (is_null($var)) return false;
10 10
         else if (is_string($var) && trim($var) === '') return false;
11 11
         return true;
12
-	}
13
-
14
-	public function stringMin($var, $min) 
15
-	{
16
-		return strlen($var) >= $min;
17
-	}
18
-
19
-	public function stringMax($var, $max) 
20
-	{
21
-		return strlen($var) <= $max;
22
-	}
23
-
24
-	public function alpha($var)
25
-	{
26
-		return is_string($var) && preg_match('/^[\pL\pM]+$/u', $var);
27
-	}
28
-
29
-	public function alphaNum($var)
30
-	{
31
- 		if (! is_string($var) && ! is_numeric($var)) return false;
12
+    }
13
+
14
+    public function stringMin($var, $min) 
15
+    {
16
+        return strlen($var) >= $min;
17
+    }
18
+
19
+    public function stringMax($var, $max) 
20
+    {
21
+        return strlen($var) <= $max;
22
+    }
23
+
24
+    public function alpha($var)
25
+    {
26
+        return is_string($var) && preg_match('/^[\pL\pM]+$/u', $var);
27
+    }
28
+
29
+    public function alphaNum($var)
30
+    {
31
+            if (! is_string($var) && ! is_numeric($var)) return false;
32 32
         return preg_match('/^[\pL\pM\pN]+$/u', $var);
33 33
     }
34 34
 
35
-	public function alphaDash($var)
36
-	{
37
- 		if (! is_string($var) && ! is_numeric($var)) return false;
35
+    public function alphaDash($var)
36
+    {
37
+            if (! is_string($var) && ! is_numeric($var)) return false;
38 38
         return preg_match('/^[\pL\pM\pN_-]+$/u', $var);
39
-	}
40
-
41
-	public function in($var, $array)
42
-	{
43
- 		return in_array($var, $array);
44
-	}
45
-
46
-	public function notIn($var, $array)
47
-	{
48
- 		return ! in_array($var, $array);
49
-	}
50
-
51
-	public function email($var)
52
-	{
53
-		return filter_var($var, FILTER_VALIDATE_EMAIL) !== false;
54
-	}
55
-
56
-	public function numeric($var)
57
-	{
58
-		return is_numeric($var);
59
-	}
60
-
61
-	public function numericMin($var, $min) 
62
-	{
63
-		return $var >= $min;
64
-	}
65
-
66
-	public function numericMax($var, $max) 
67
-	{
68
-		return $var <= $max;
69
-	}
70
-
71
-	public function integer($var)
72
-	{
73
-		return filter_var($var, FILTER_VALIDATE_INT) !== false;
74
-	}
75
-
76
-	public function snake($var)
77
-	{
78
-		if ( ! ctype_lower($var)) {
79
-    		$var = preg_replace('/\s+/', '', $var);
80
-    		$var = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.'_', $var));
81
-		}
82
-		return $var;
83
-	}
84
-
85
-	public function studly($var)
86
-	{
87
-		return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $var)));
88
-	}
39
+    }
40
+
41
+    public function in($var, $array)
42
+    {
43
+            return in_array($var, $array);
44
+    }
45
+
46
+    public function notIn($var, $array)
47
+    {
48
+            return ! in_array($var, $array);
49
+    }
50
+
51
+    public function email($var)
52
+    {
53
+        return filter_var($var, FILTER_VALIDATE_EMAIL) !== false;
54
+    }
55
+
56
+    public function numeric($var)
57
+    {
58
+        return is_numeric($var);
59
+    }
60
+
61
+    public function numericMin($var, $min) 
62
+    {
63
+        return $var >= $min;
64
+    }
65
+
66
+    public function numericMax($var, $max) 
67
+    {
68
+        return $var <= $max;
69
+    }
70
+
71
+    public function integer($var)
72
+    {
73
+        return filter_var($var, FILTER_VALIDATE_INT) !== false;
74
+    }
75
+
76
+    public function snake($var)
77
+    {
78
+        if ( ! ctype_lower($var)) {
79
+            $var = preg_replace('/\s+/', '', $var);
80
+            $var = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.'_', $var));
81
+        }
82
+        return $var;
83
+    }
84
+
85
+    public function studly($var)
86
+    {
87
+        return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $var)));
88
+    }
89 89
 
90 90
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
28 28
 
29 29
 	public function alphaNum($var)
30 30
 	{
31
- 		if (! is_string($var) && ! is_numeric($var)) return false;
31
+ 		if ( ! is_string($var) && ! is_numeric($var)) return false;
32 32
         return preg_match('/^[\pL\pM\pN]+$/u', $var);
33 33
     }
34 34
 
35 35
 	public function alphaDash($var)
36 36
 	{
37
- 		if (! is_string($var) && ! is_numeric($var)) return false;
37
+ 		if ( ! is_string($var) && ! is_numeric($var)) return false;
38 38
         return preg_match('/^[\pL\pM\pN_-]+$/u', $var);
39 39
 	}
40 40
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,11 @@  discard block
 block discarded – undo
6 6
 	
7 7
 	public function required($var) 
8 8
 	{
9
-		if (is_null($var)) return false;
10
-        else if (is_string($var) && trim($var) === '') return false;
9
+		if (is_null($var)) {
10
+		    return false;
11
+		} else if (is_string($var) && trim($var) === '') {
12
+            return false;
13
+        }
11 14
         return true;
12 15
 	}
13 16
 
@@ -28,13 +31,17 @@  discard block
 block discarded – undo
28 31
 
29 32
 	public function alphaNum($var)
30 33
 	{
31
- 		if (! is_string($var) && ! is_numeric($var)) return false;
34
+ 		if (! is_string($var) && ! is_numeric($var)) {
35
+ 		    return false;
36
+ 		}
32 37
         return preg_match('/^[\pL\pM\pN]+$/u', $var);
33 38
     }
34 39
 
35 40
 	public function alphaDash($var)
36 41
 	{
37
- 		if (! is_string($var) && ! is_numeric($var)) return false;
42
+ 		if (! is_string($var) && ! is_numeric($var)) {
43
+ 		    return false;
44
+ 		}
38 45
         return preg_match('/^[\pL\pM\pN_-]+$/u', $var);
39 46
 	}
40 47
 
Please login to merge, or discard this patch.
src/Engines/Blade.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 
7 7
 class Blade implements Engine {
8 8
 
9
-	/**
9
+    /**
10 10
      * Render the template content.
11 11
      *
12
-	 * @param  string  $path
13
-	 * @param  array  $properties
12
+     * @param  string  $path
13
+     * @param  array  $properties
14 14
      * @return string
15 15
      */
16
-	public function render($path, $properties = []) 
17
-	{
18
-		if ( ! function_exists('app')) throw new \Exception('Laravel required for blade rendering engine.');
16
+    public function render($path, $properties = []) 
17
+    {
18
+        if ( ! function_exists('app')) throw new \Exception('Laravel required for blade rendering engine.');
19 19
 
20
-		return app()->make('view')->file($path, $properties);
21
-	}
20
+        return app()->make('view')->file($path, $properties);
21
+    }
22 22
 
23 23
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
15 15
      */
16 16
 	public function render($path, $properties = []) 
17 17
 	{
18
-		if ( ! function_exists('app')) throw new \Exception('Laravel required for blade rendering engine.');
18
+		if ( ! function_exists('app')) {
19
+		    throw new \Exception('Laravel required for blade rendering engine.');
20
+		}
19 21
 
20 22
 		return app()->make('view')->file($path, $properties);
21 23
 	}
Please login to merge, or discard this patch.
src/Engines/Mustache.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,32 +12,32 @@
 block discarded – undo
12 12
      *
13 13
      * @var \Mustache_Engine
14 14
      */	
15
-	protected $compiler;
15
+    protected $compiler;
16 16
 
17
-	/**
17
+    /**
18 18
      * Fetch the compiler.
19 19
      *
20 20
      * @return \Mustache_Engine
21 21
      */
22
-	public function compiler()
23
-	{
24
-		if ( ! $this->compiler) $this->compiler = new Mustache_Engine;
22
+    public function compiler()
23
+    {
24
+        if ( ! $this->compiler) $this->compiler = new Mustache_Engine;
25 25
 
26
-		return $this->compiler;
27
-	}
26
+        return $this->compiler;
27
+    }
28 28
 
29
-	/**
29
+    /**
30 30
      * Render the template content.
31 31
      *
32
-	 * @param  string  $path
33
-	 * @param  array  $properties
32
+     * @param  string  $path
33
+     * @param  array  $properties
34 34
      * @return string
35 35
      */
36
-	public function render($path, $properties = []) 
37
-	{
38
-		$content = file_get_contents($path);
36
+    public function render($path, $properties = []) 
37
+    {
38
+        $content = file_get_contents($path);
39 39
 
40
-		return $this->compiler()->render($content, $properties);
41
-	}
40
+        return $this->compiler()->render($content, $properties);
41
+    }
42 42
 
43 43
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
      */
22 22
 	public function compiler()
23 23
 	{
24
-		if ( ! $this->compiler) $this->compiler = new Mustache_Engine;
24
+		if ( ! $this->compiler) {
25
+		    $this->compiler = new Mustache_Engine;
26
+		}
25 27
 
26 28
 		return $this->compiler;
27 29
 	}
Please login to merge, or discard this patch.
src/Engine.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 interface Engine {
6 6
 	
7
-	/**
7
+    /**
8 8
      * Render the template content.
9 9
      *
10
-	 * @param  string  $path
11
-	 * @param  array  $properties
10
+     * @param  string  $path
11
+     * @param  array  $properties
12 12
      * @return string
13 13
      */
14
-	public function render($path, $properties = []);
14
+    public function render($path, $properties = []);
15 15
 
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Requests/Symfony.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
 
8 8
 class Symfony implements Request {
9 9
 	
10
-	protected $request;
11
-
12
-	public function __construct()
13
-	{
14
-		$this->request = SymfonyRequest::createFromGlobals();
15
-	}
16
-
17
-	public function all()
18
-	{
19
-		return $this->request->request->all();
20
-	}
21
-
22
-	public function get($key)
23
-	{
24
-		return $this->request->request->get($key);
25
-	}
26
-
27
-	public function csrf()
28
-	{
29
-		return ['name' => '_token', 'value' => csrf_token()];
30
-	}
10
+    protected $request;
11
+
12
+    public function __construct()
13
+    {
14
+        $this->request = SymfonyRequest::createFromGlobals();
15
+    }
16
+
17
+    public function all()
18
+    {
19
+        return $this->request->request->all();
20
+    }
21
+
22
+    public function get($key)
23
+    {
24
+        return $this->request->request->get($key);
25
+    }
26
+
27
+    public function csrf()
28
+    {
29
+        return ['name' => '_token', 'value' => csrf_token()];
30
+    }
31 31
 
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
src/Requests/Laravel.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
 
8 8
 class Laravel implements Request {
9 9
 	
10
-	protected $request;
11
-
12
-	public function __construct(IlluminateRequest $request)
13
-	{
14
-		$this->request = $request;
15
-	}
16
-
17
-	public function all()
18
-	{
19
-		return $this->request->all();
20
-	}
21
-
22
-	public function get($key)
23
-	{
24
-		return $this->request->get($key);
25
-	}
26
-
27
-	public function csrf()
28
-	{
29
-		return ['name' => '_token', 'value' => csrf_token()];
30
-	}
10
+    protected $request;
11
+
12
+    public function __construct(IlluminateRequest $request)
13
+    {
14
+        $this->request = $request;
15
+    }
16
+
17
+    public function all()
18
+    {
19
+        return $this->request->all();
20
+    }
21
+
22
+    public function get($key)
23
+    {
24
+        return $this->request->get($key);
25
+    }
26
+
27
+    public function csrf()
28
+    {
29
+        return ['name' => '_token', 'value' => csrf_token()];
30
+    }
31 31
 
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
src/Form.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     public function completed($name = null)
359 359
     {
360
-        if($this->submitted($name) && $this->valid()) {
360
+        if ($this->submitted($name) && $this->valid()) {
361 361
             $this->broadcast('completed');
362 362
             return true;
363 363
         }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
         $errors = [];
498 498
 
499 499
         foreach ($this->fields as $field) {
500
-            foreach($field->errors() as $error) {
500
+            foreach ($field->errors() as $error) {
501 501
                 $errors[] = $error;
502 502
             }
503 503
         }
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
     {
620 620
         $config = $this->templateConfig($template);
621 621
 
622
-        if ( isset($config['plugins']) && is_array($config['plugins'])) {
623
-            foreach($config['plugins'] as $plugin) {
622
+        if (isset($config['plugins']) && is_array($config['plugins'])) {
623
+            foreach ($config['plugins'] as $plugin) {
624 624
                 $this->addPlugin($plugin);
625 625
             }
626 626
         }
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
     {
637 637
         $config = $this->templateConfig($template);
638 638
 
639
-        if ( isset($config['plugins']) && is_array($config['plugins'])) {
640
-            foreach($config['plugins'] as $plugin) {
639
+        if (isset($config['plugins']) && is_array($config['plugins'])) {
640
+            foreach ($config['plugins'] as $plugin) {
641 641
                 $this->removePlugin($plugin);
642 642
             }
643 643
         }
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
             foreach ($field->errors() as $error => $parameters) {
675 675
 
676 676
                 if ($error == 'userDefined') {
677
-                    foreach($parameters as $message) {
677
+                    foreach ($parameters as $message) {
678 678
                         $properties['errors'][] = ['error' => $message];
679 679
                     }
680 680
                 } else {
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
                     $message = $this->translate($error, $field);
685 685
 
686
-                    foreach($parameters as $key => $value) {
686
+                    foreach ($parameters as $key => $value) {
687 687
                         if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value;
688 688
                         if (is_array($value)) $value = implode(', ', $value);
689 689
                         $message = str_replace('['.$key.']', $value, $message);
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
      */
931 931
     private function broadcast($event, $params = []) 
932 932
     {
933
-        foreach($this->plugins as $plugin) {
933
+        foreach ($this->plugins as $plugin) {
934 934
             $plugin->event($this, $event, $params);
935 935
         }
936 936
     }
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
     {
1079 1079
         if ( ! method_exists($this, $method))
1080 1080
         {
1081
-            if ( $this->typeExists($method)) {
1081
+            if ($this->typeExists($method)) {
1082 1082
                 return $this->addField($method, array_shift($parameters));
1083 1083
             }
1084 1084
         }
Please login to merge, or discard this patch.
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -257,7 +257,9 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public function fields($names = null)
259 259
     {
260
-        if (is_null($names)) return $this->fields;
260
+        if (is_null($names)) {
261
+            return $this->fields;
262
+        }
261 263
 
262 264
         return array_filter($this->fields, function($field) use ($names) {
263 265
             return array_key_exists($field->name, $names);
@@ -440,7 +442,9 @@  discard block
 block discarded – undo
440 442
      */
441 443
     public function addNamespaceForClass($class)
442 444
     {
443
-        if (is_object($class)) $class = get_class($class);
445
+        if (is_object($class)) {
446
+            $class = get_class($class);
447
+        }
444 448
 
445 449
         $reflector = new \ReflectionClass($class);
446 450
 
@@ -475,7 +479,9 @@  discard block
 block discarded – undo
475 479
         $class = '\\Fields\\'.ucwords($class).'\\'.ucwords($class);
476 480
 
477 481
         foreach ($this->namespaces as $namespace) {
478
-            if (class_exists($namespace.$class)) return $namespace.$class;
482
+            if (class_exists($namespace.$class)) {
483
+                return $namespace.$class;
484
+            }
479 485
         }
480 486
     }
481 487
 
@@ -488,9 +494,13 @@  discard block
 block discarded – undo
488 494
      */
489 495
     public function errors($name = null)
490 496
     {
491
-        if ($this->submitted()) $this->validate();
497
+        if ($this->submitted()) {
498
+            $this->validate();
499
+        }
492 500
 
493
-        if ( ! is_null($name)) return $this->field($name)->errors();
501
+        if ( ! is_null($name)) {
502
+            return $this->field($name)->errors();
503
+        }
494 504
 
495 505
         $errors = [];
496 506
 
@@ -682,8 +692,12 @@  discard block
 block discarded – undo
682 692
                     $message = $this->translate($error, $field);
683 693
 
684 694
                     foreach($parameters as $key => $value) {
685
-                        if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value;
686
-                        if (is_array($value)) $value = implode(', ', $value);
695
+                        if (is_object($value) && method_exists($value, '__toString')) {
696
+                            $value = (string) $value;
697
+                        }
698
+                        if (is_array($value)) {
699
+                            $value = implode(', ', $value);
700
+                        }
687 701
                         $message = str_replace('['.$key.']', $value, $message);
688 702
                     }
689 703
                     $properties['errors'][] = ['error' => $message];
@@ -703,7 +717,9 @@  discard block
 block discarded – undo
703 717
      */
704 718
     public function renderField($field, $properties = null) 
705 719
     {   
706
-        if (is_null($properties)) $properties = $this->fieldProperties($field);
720
+        if (is_null($properties)) {
721
+            $properties = $this->fieldProperties($field);
722
+        }
707 723
 
708 724
         return $this->renderTemplate($field->type, $properties, $field);
709 725
     }
@@ -717,7 +733,9 @@  discard block
 block discarded – undo
717 733
      */
718 734
     public function renderFieldErrors($field, $properties = null) 
719 735
     {   
720
-        if (is_null($properties)) $properties = $this->fieldProperties($field);
736
+        if (is_null($properties)) {
737
+            $properties = $this->fieldProperties($field);
738
+        }
721 739
 
722 740
         return $this->renderTemplate('errors', $properties, $field);
723 741
     }   
@@ -734,9 +752,13 @@  discard block
 block discarded – undo
734 752
 
735 753
         $this->setValues();
736 754
 
737
-        if ($this->submitted()) $this->validate();
755
+        if ($this->submitted()) {
756
+            $this->validate();
757
+        }
738 758
 
739
-        if ( ! is_null($template)) $this->setTemplate($template);
759
+        if ( ! is_null($template)) {
760
+            $this->setTemplate($template);
761
+        }
740 762
 
741 763
         $properties = [];
742 764
         $properties['id'] = $this->id;
@@ -990,7 +1012,9 @@  discard block
 block discarded – undo
990 1012
      */
991 1013
     public function pathForClass($class)
992 1014
     {
993
-        if (is_object($class)) $class = get_class($class);
1015
+        if (is_object($class)) {
1016
+            $class = get_class($class);
1017
+        }
994 1018
 
995 1019
         $reflector = new \ReflectionClass($class);
996 1020
         $path = dirname($reflector->getFileName()); 
Please login to merge, or discard this patch.