Passed
Branch master (539d05)
by Alfred
02:00
created
Core/FormElement.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,25 +26,25 @@  discard block
 block discarded – undo
26 26
      * @param LabelGenerator|string $label
27 27
      * @param AttributesBuilder|array $attributes
28 28
      */
29
-    public function __construct($label, $attributes=[])
29
+    public function __construct($label, $attributes = [])
30 30
     {
31
-        if(!$label instanceof LabelGenerator)
32
-            $label  = new LabelGenerator($label,[]);
31
+        if (!$label instanceof LabelGenerator)
32
+            $label = new LabelGenerator($label, []);
33 33
         $this->label = $label;
34 34
 
35
-        if(!$attributes instanceof AttributesBuilder)
36
-            $attributes  = new AttributesBuilder($attributes);
35
+        if (!$attributes instanceof AttributesBuilder)
36
+            $attributes = new AttributesBuilder($attributes);
37 37
         $this->attributes = $attributes;
38 38
 
39
-        if(!$this->attributes->has('name'))
40
-            $this->attributes->set('name',$this->normalize($this->label->getItem()));
39
+        if (!$this->attributes->has('name'))
40
+            $this->attributes->set('name', $this->normalize($this->label->getItem()));
41 41
 
42
-        if(!$this->attributes->has('type'))
43
-            $this->attributes->set('type','text');
42
+        if (!$this->attributes->has('type'))
43
+            $this->attributes->set('type', 'text');
44 44
         if (!$this->attributes->has('id'))
45 45
             $this->attributes->createElementID($this->attributes->get('name', $this->label->getItemID()));
46 46
 
47
-        $this->attributes->set('autocomplete','off');
47
+        $this->attributes->set('autocomplete', 'off');
48 48
 
49 49
         $this->Types = new Collection(array_flip([
50 50
             'button',
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
     public function RenderHtml()
102 102
     {
103 103
         $html = '';
104
-        if($this->Types->has($this->attributes->get('type')))
104
+        if ($this->Types->has($this->attributes->get('type')))
105 105
         {
106
-            $this->label->Attribute()->set('fieldtype',$this->attributes->get('type'));
107
-            $this->label->Attribute()->set('for',$this->attributes->get('id'));
106
+            $this->label->Attribute()->set('fieldtype', $this->attributes->get('type'));
107
+            $this->label->Attribute()->set('for', $this->attributes->get('id'));
108 108
 
109 109
             $html .= $this->Label()->RenderHtml();
110 110
             $html .= '<input';
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,21 +28,26 @@
 block discarded – undo
28 28
      */
29 29
     public function __construct($label, $attributes=[])
30 30
     {
31
-        if(!$label instanceof LabelGenerator)
32
-            $label  = new LabelGenerator($label,[]);
31
+        if(!$label instanceof LabelGenerator) {
32
+                    $label  = new LabelGenerator($label,[]);
33
+        }
33 34
         $this->label = $label;
34 35
 
35
-        if(!$attributes instanceof AttributesBuilder)
36
-            $attributes  = new AttributesBuilder($attributes);
36
+        if(!$attributes instanceof AttributesBuilder) {
37
+                    $attributes  = new AttributesBuilder($attributes);
38
+        }
37 39
         $this->attributes = $attributes;
38 40
 
39
-        if(!$this->attributes->has('name'))
40
-            $this->attributes->set('name',$this->normalize($this->label->getItem()));
41
+        if(!$this->attributes->has('name')) {
42
+                    $this->attributes->set('name',$this->normalize($this->label->getItem()));
43
+        }
41 44
 
42
-        if(!$this->attributes->has('type'))
43
-            $this->attributes->set('type','text');
44
-        if (!$this->attributes->has('id'))
45
-            $this->attributes->createElementID($this->attributes->get('name', $this->label->getItemID()));
45
+        if(!$this->attributes->has('type')) {
46
+                    $this->attributes->set('type','text');
47
+        }
48
+        if (!$this->attributes->has('id')) {
49
+                    $this->attributes->createElementID($this->attributes->get('name', $this->label->getItemID()));
50
+        }
46 51
 
47 52
         $this->attributes->set('autocomplete','off');
48 53
 
Please login to merge, or discard this patch.
Core/Form.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct($attributes = [])
25 25
     {
26
-        if(!$attributes instanceof AttributesBuilder)
27
-            $attributes  = new AttributesBuilder($attributes);
26
+        if (!$attributes instanceof AttributesBuilder)
27
+            $attributes = new AttributesBuilder($attributes);
28 28
         $this->attributes = $attributes;
29
-        if(!$this->attributes->has('name'))
29
+        if (!$this->attributes->has('name'))
30 30
             $this->addName(date('Ymd H:i:s'));
31 31
         else
32 32
             $this->addName($this->attributes->get('name'));
33 33
 
34
-        $this->attributes->set('type','form');
34
+        $this->attributes->set('type', 'form');
35 35
 
36
-        if(!$this->attributes->has('enctype'))
37
-        $this->attributes->set('enctype','application/x-www-form-urlencoded');
36
+        if (!$this->attributes->has('enctype'))
37
+        $this->attributes->set('enctype', 'application/x-www-form-urlencoded');
38 38
 
39
-        if(!$this->attributes->has('method'))
40
-        $this->attributes->set('method','post');
39
+        if (!$this->attributes->has('method'))
40
+        $this->attributes->set('method', 'post');
41 41
 
42
-        if(!$this->attributes->has('action'))
43
-            $this->attributes->set('action',$_SERVER['REQUEST_URI']);
42
+        if (!$this->attributes->has('action'))
43
+            $this->attributes->set('action', $_SERVER['REQUEST_URI']);
44 44
 
45
-        $this->attributes->set('autocomplete','off');
45
+        $this->attributes->set('autocomplete', 'off');
46 46
 
47 47
         $this->attributes->Ignore('form');
48 48
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     public function addName($token = null)
62 62
     {
63 63
         $token .= microtime(true);
64
-        if(strpos($token,'form-')!==0)
64
+        if (strpos($token, 'form-') !== 0)
65 65
             $token = 'form-'.$token;
66
-        $this->attributes->set('name',md5($token));
66
+        $this->attributes->set('name', md5($token));
67 67
         return  $this;
68 68
     }
69 69
     /**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function append($element)
74 74
     {
75
-        if($element instanceof FormElement)
75
+        if ($element instanceof FormElement)
76 76
             $this->Content .= $element->RenderHtml();
77 77
         else
78
-            $this->Content .=  $element;
78
+            $this->Content .= $element;
79 79
         return $this;
80 80
     }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function RenderHtml(): string
86 86
     {
87
-        if(strcasecmp($this->attributes->get('method'),'get') == 0)
87
+        if (strcasecmp($this->attributes->get('method'), 'get') == 0)
88 88
             $this->attributes->remove('enctype');
89 89
         $html  = '<form';
90 90
         $html .= $this->attributes->RenderHtml();
Please login to merge, or discard this patch.
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,24 +23,29 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct($attributes = [])
25 25
     {
26
-        if(!$attributes instanceof AttributesBuilder)
27
-            $attributes  = new AttributesBuilder($attributes);
26
+        if(!$attributes instanceof AttributesBuilder) {
27
+                    $attributes  = new AttributesBuilder($attributes);
28
+        }
28 29
         $this->attributes = $attributes;
29
-        if(!$this->attributes->has('name'))
30
-            $this->addName(date('Ymd H:i:s'));
31
-        else
32
-            $this->addName($this->attributes->get('name'));
30
+        if(!$this->attributes->has('name')) {
31
+                    $this->addName(date('Ymd H:i:s'));
32
+        } else {
33
+                    $this->addName($this->attributes->get('name'));
34
+        }
33 35
 
34 36
         $this->attributes->set('type','form');
35 37
 
36
-        if(!$this->attributes->has('enctype'))
37
-        $this->attributes->set('enctype','application/x-www-form-urlencoded');
38
+        if(!$this->attributes->has('enctype')) {
39
+                $this->attributes->set('enctype','application/x-www-form-urlencoded');
40
+        }
38 41
 
39
-        if(!$this->attributes->has('method'))
40
-        $this->attributes->set('method','post');
42
+        if(!$this->attributes->has('method')) {
43
+                $this->attributes->set('method','post');
44
+        }
41 45
 
42
-        if(!$this->attributes->has('action'))
43
-            $this->attributes->set('action',$_SERVER['REQUEST_URI']);
46
+        if(!$this->attributes->has('action')) {
47
+                    $this->attributes->set('action',$_SERVER['REQUEST_URI']);
48
+        }
44 49
 
45 50
         $this->attributes->set('autocomplete','off');
46 51
 
@@ -61,8 +66,9 @@  discard block
 block discarded – undo
61 66
     public function addName($token = null)
62 67
     {
63 68
         $token .= microtime(true);
64
-        if(strpos($token,'form-')!==0)
65
-            $token = 'form-'.$token;
69
+        if(strpos($token,'form-')!==0) {
70
+                    $token = 'form-'.$token;
71
+        }
66 72
         $this->attributes->set('name',md5($token));
67 73
         return  $this;
68 74
     }
@@ -72,10 +78,11 @@  discard block
 block discarded – undo
72 78
      */
73 79
     public function append($element)
74 80
     {
75
-        if($element instanceof FormElement)
76
-            $this->Content .= $element->RenderHtml();
77
-        else
78
-            $this->Content .=  $element;
81
+        if($element instanceof FormElement) {
82
+                    $this->Content .= $element->RenderHtml();
83
+        } else {
84
+                    $this->Content .=  $element;
85
+        }
79 86
         return $this;
80 87
     }
81 88
 
@@ -84,8 +91,9 @@  discard block
 block discarded – undo
84 91
      */
85 92
     public function RenderHtml(): string
86 93
     {
87
-        if(strcasecmp($this->attributes->get('method'),'get') == 0)
88
-            $this->attributes->remove('enctype');
94
+        if(strcasecmp($this->attributes->get('method'),'get') == 0) {
95
+                    $this->attributes->remove('enctype');
96
+        }
89 97
         $html  = '<form';
90 98
         $html .= $this->attributes->RenderHtml();
91 99
         $html .= ' >';
Please login to merge, or discard this patch.