Completed
Push — master ( 0196bf...0df159 )
by Helmut
02:29
created
src/Plugin.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,7 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
      * Get autoload path.
37 37
      *
38
+     * @param string $append
38 39
      * @return string
39 40
      */
40 41
 	public function path($append = null) 
@@ -46,7 +47,7 @@  discard block
 block discarded – undo
46 47
 	/**
47 48
      * Get paths to templates.
48 49
      *
49
-     * @return string
50
+     * @return string[]
50 51
      */
51 52
 	public function templatePaths() 
52 53
 	{
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Helmut\Forms;
4 4
 
5
-use Helmut\Forms\Utility\Str;
6 5
 use Helmut\Forms\Utility\Reflect;
6
+use Helmut\Forms\Utility\Str;
7 7
 
8 8
 abstract class Field {
9 9
 
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      *
13 13
      * @var string
14 14
      */
15
-	protected $path;
15
+    protected $path;
16 16
 
17 17
     /**
18 18
      * Create a new plugin instance.
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
      * @param  array  $config
21 21
      * @return void
22 22
      */
23
-	public function __construct($config = null) 
24
-	{
23
+    public function __construct($config = null) 
24
+    {
25 25
         $this->configure($config);
26 26
 
27
-		$this->setPath();
28
-	}
27
+        $this->setPath();
28
+    }
29 29
 
30 30
     /**
31 31
      * Configure the plugin.
@@ -43,39 +43,39 @@  discard block
 block discarded – undo
43 43
         }        
44 44
     }
45 45
 
46
-	/**
46
+    /**
47 47
      * Set the plugin autoload path.
48 48
      *
49 49
      * @return void
50 50
      */
51
-	public function setPath()
52
-	{
51
+    public function setPath()
52
+    {
53 53
         $this->path = Reflect::getDirectory($this);
54
-	}
54
+    }
55 55
 
56
-	/**
56
+    /**
57 57
      * Get autoload path.
58 58
      *
59 59
      * @return string
60 60
      */
61
-	public function path($append = null) 
62
-	{
63
-		return is_null($append) ? $this->path 
64
-			: $this->path.'/'.ltrim(rtrim($append, '/'), '/').'/';
65
-	}
61
+    public function path($append = null) 
62
+    {
63
+        return is_null($append) ? $this->path 
64
+            : $this->path.'/'.ltrim(rtrim($append, '/'), '/').'/';
65
+    }
66 66
 
67
-	/**
67
+    /**
68 68
      * Get paths to templates.
69 69
      *
70 70
      * @return string
71 71
      */
72
-	public function templatePaths() 
73
-	{
74
-		$path = $this->path('templates');
75
-		return [$path];
76
-	}
72
+    public function templatePaths() 
73
+    {
74
+        $path = $this->path('templates');
75
+        return [$path];
76
+    }
77 77
 
78
-	/**
78
+    /**
79 79
      * Trigger an event callback. This allows
80 80
      * you to hook into events from within the plugin.
81 81
      * - onLoad
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
      * - onValid
89 89
      * - onInvalid
90 90
      *
91
-	 * @param  \Helmut\Forms\Form  $form
92
-	 * @param  string  $name
93
-	 * @param  array  $params
91
+     * @param  \Helmut\Forms\Form  $form
92
+     * @param  string  $name
93
+     * @param  array  $params
94 94
      * @return mixed
95 95
      */
96
-	public function event($form, $name, $params = []) 
97
-	{
98
-		$name = Str::studly($name);
96
+    public function event($form, $name, $params = []) 
97
+    {
98
+        $name = Str::studly($name);
99 99
 
100
-		if (method_exists($this, 'on'.$name)) {
101
-			return call_user_func_array(array($this, 'on'.$name), [$form, $params]);
102
-		}
100
+        if (method_exists($this, 'on'.$name)) {
101
+            return call_user_func_array(array($this, 'on'.$name), [$form, $params]);
102
+        }
103 103
 
104
-	}
104
+    }
105 105
 
106 106
 }
Please login to merge, or discard this patch.
src/Plugins/Memory/Memory.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 class Memory extends Plugin {
8 8
 
9
-	// Protects input from accidental loss
9
+    // Protects input from accidental loss
10 10
     // by saving as you type. WIP
11 11
 
12 12
 }
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
src/Plugins/Feedback/Feedback.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,40 +6,40 @@
 block discarded – undo
6 6
 
7 7
 class Feedback extends Plugin {
8 8
 
9
-	public function onLoad($form)
10
-	{
11
-		$form->addButton('feedback_trigger_'.$form->id);
12
-	}
9
+    public function onLoad($form)
10
+    {
11
+        $form->addButton('feedback_trigger_'.$form->id);
12
+    }
13 13
 
14
-	public function onSubmitted($form) 
15
-	{
16
-		$request = $form->getRequest();
14
+    public function onSubmitted($form) 
15
+    {
16
+        $request = $form->getRequest();
17 17
 
18
-		if ($request->get('feedback_trigger_'.$form->id)) {
18
+        if ($request->get('feedback_trigger_'.$form->id)) {
19 19
 
20
-			$field = $form->field($request->get('name'));
20
+            $field = $form->field($request->get('name'));
21 21
 
22
-			if ( ! is_null($field)) {
22
+            if ( ! is_null($field)) {
23 23
 
24
-				$field->setFromRequest($request);
25
-				$field->runValidations();
24
+                $field->setFromRequest($request);
25
+                $field->runValidations();
26 26
 
27
-				$response = [
28
-					'id' => $field->id, 
29
-					'valid' => $field->valid(), 
30
-					'error_id' => 'feedback_errors_'.$field->id,
31
-					'error' => '', 
32
-				];
27
+                $response = [
28
+                    'id' => $field->id, 
29
+                    'valid' => $field->valid(), 
30
+                    'error_id' => 'feedback_errors_'.$field->id,
31
+                    'error' => '', 
32
+                ];
33 33
 
34
-				if ( ! $field->valid()) {
35
-					$response['error'] = $form->renderFieldErrors($field);
36
-				}
34
+                if ( ! $field->valid()) {
35
+                    $response['error'] = $form->renderFieldErrors($field);
36
+                }
37 37
 
38
-				header('Content-Type: application/json');
39
-				echo json_encode($response);
40
-				exit();
41
-			}
42
-		}
43
-	}
38
+                header('Content-Type: application/json');
39
+                echo json_encode($response);
40
+                exit();
41
+            }
42
+        }
43
+    }
44 44
 
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
src/templates/bootstrap/config.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 return [
4
-	'plugins' => [
5
-		'feedback',
6
-	],
4
+    'plugins' => [
5
+        'feedback',
6
+    ],
7 7
 ];
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/Number/lang/es.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 return [
4
-	'validate_min' => 'El tamaño de [field] debe ser de al menos [min].',
5
-	'validate_max' => 'El campo [field] no debe ser mayor a [max].',
6
-	'validate_between' => 'El campo [field] tiene que estar entre [min] - [max].',
4
+    'validate_min' => 'El tamaño de [field] debe ser de al menos [min].',
5
+    'validate_max' => 'El campo [field] no debe ser mayor a [max].',
6
+    'validate_between' => 'El campo [field] tiene que estar entre [min] - [max].',
7 7
 ];
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/Number/lang/en.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 return [
4
-	'validate_min' => 'The [field] field must be a minimum of [min].',
5
-	'validate_max' => 'The [field] field must be a maximum of [min].',
6
-	'validate_between' => 'The [field] field must be between [min] and [max].',
4
+    'validate_min' => 'The [field] field must be a minimum of [min].',
5
+    'validate_max' => 'The [field] field must be a maximum of [min].',
6
+    'validate_between' => 'The [field] field must be between [min] and [max].',
7 7
 ];
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/Name/lang/es.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_first' => 'Nombre',
5
-	'placeholder_surname' => 'Apellido',
4
+    'placeholder_first' => 'Nombre',
5
+    'placeholder_surname' => 'Apellido',
6 6
 ];
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/Name/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_first' => 'First',
5
-	'placeholder_surname' => 'Surname',
4
+    'placeholder_first' => 'First',
5
+    'placeholder_surname' => 'Surname',
6 6
 ];
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/Checkbox/Checkbox.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function setValuesFromModel($model)
44 44
     {
45
-        if (property_exists($model, $this->name)) $this->value = $model->{$this->name} ? true : false;
45
+        if (property_exists($model, $this->name)) {
46
+            $this->value = $model->{$this->name} ? true : false;
47
+        }
46 48
     }   
47 49
 
48 50
     public function setValuesFromRequest($request)
@@ -52,7 +54,9 @@  discard block
 block discarded – undo
52 54
 
53 55
     public function fillModelWithValues($model)
54 56
     {
55
-        if (property_exists($model, $this->name)) $model->{$this->name} = $this->value ? 1 : 0;
57
+        if (property_exists($model, $this->name)) {
58
+            $model->{$this->name} = $this->value ? 1 : 0;
59
+        }
56 60
     }
57 61
 
58 62
     public function validateRequired()
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@
 block discarded – undo
25 25
 
26 26
     public function setChecked()
27 27
     {
28
-         $this->default = true;
29
-         return $this;
28
+            $this->default = true;
29
+            return $this;
30 30
     }
31 31
 
32 32
     public function setUnchecked()
33 33
     {
34
-         $this->default = false;
35
-         return $this;
34
+            $this->default = false;
35
+            return $this;
36 36
     }   
37 37
 
38 38
     public function setValueFromDefault()
Please login to merge, or discard this patch.