Passed
Push — master ( e7a5ba...0bab4c )
by Sebastian
03:04
created
src/Traits/Optionable.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     */
41 41
     public function setOption(string $name, $value)
42 42
     {
43
-        if(!isset($this->options)) {
43
+        if (!isset($this->options)) {
44 44
             $this->options = $this->getDefaultOptions();
45 45
         }
46 46
         
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     */
57 57
     public function setOptions(array $options)
58 58
     {
59
-        foreach($options as $name => $value) {
59
+        foreach ($options as $name => $value) {
60 60
             $this->setOption($name, $value);
61 61
         }
62 62
         
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
     * @param mixed $default The default value to return if the option does not exist.
74 74
     * @return mixed
75 75
     */
76
-    public function getOption(string $name, $default=null)
76
+    public function getOption(string $name, $default = null)
77 77
     {
78
-        if(!isset($this->options)) {
78
+        if (!isset($this->options)) {
79 79
             $this->options = $this->getDefaultOptions();
80 80
         }
81 81
         
82
-        if(isset($this->options[$name])) {
82
+        if (isset($this->options[$name])) {
83 83
             return $this->options[$name];
84 84
         }
85 85
         
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
     * @param string $default Used if the option does not exist, is invalid, or empty.
97 97
     * @return string
98 98
     */
99
-    public function getStringOption(string $name, string $default='') : string
99
+    public function getStringOption(string $name, string $default = '') : string
100 100
     {
101 101
         $value = $this->getOption($name, false);
102 102
         
103
-        if((is_string($value) || is_numeric($value)) && !empty($value)) {
103
+        if ((is_string($value) || is_numeric($value)) && !empty($value)) {
104 104
             return (string)$value;
105 105
         }
106 106
         
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     * @param string $name
117 117
     * @return bool
118 118
     */
119
-    public function getBoolOption(string $name, bool $default=false) : bool
119
+    public function getBoolOption(string $name, bool $default = false) : bool
120 120
     {
121
-        if($this->getOption($name) === true) {
121
+        if ($this->getOption($name) === true) {
122 122
             return true;
123 123
         }
124 124
         
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
     * @param int $default
135 135
     * @return int
136 136
     */
137
-    public function getIntOption(string $name, int $default=0) : int
137
+    public function getIntOption(string $name, int $default = 0) : int
138 138
     {
139 139
         $value = $this->getOption($name);
140
-        if(ConvertHelper::isInteger($value)) {
140
+        if (ConvertHelper::isInteger($value)) {
141 141
             return (int)$value;
142 142
         }
143 143
         
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     public function getArrayOption(string $name) : array
156 156
     {
157 157
         $val = $this->getOption($name);
158
-        if(is_array($val)) {
158
+        if (is_array($val)) {
159 159
             return $val;
160 160
         }
161 161
         
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     */
172 172
     public function hasOption(string $name) : bool
173 173
     {
174
-        if(!isset($this->options)) {
174
+        if (!isset($this->options)) {
175 175
             $this->options = $this->getDefaultOptions();
176 176
         }
177 177
         
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     */
185 185
     public function getOptions() : array
186 186
     {
187
-        if(!isset($this->options)) {
187
+        if (!isset($this->options)) {
188 188
             $this->options = $this->getDefaultOptions();
189 189
         }
190 190
         
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     * @param mixed $default
239 239
     * @return $this
240 240
     */
241
-    function getOption(string $name, $default=null);
241
+    function getOption(string $name, $default = null);
242 242
     
243 243
    /**
244 244
     * @param array $options
Please login to merge, or discard this patch.