@@ -42,7 +42,7 @@ |
||
42 | 42 | protected function renderRadio(\Enjoys\Forms\Element $element): string |
43 | 43 | { |
44 | 44 | $return = ''; |
45 | - /** @var \Enjoys\Forms\Elements\Radio $element */ |
|
45 | + /** @var \Enjoys\Forms\Elements\Radio $element */ |
|
46 | 46 | foreach ($element->getElements() as $data) { |
47 | 47 | $data->addClass('custom-control-input'); |
48 | 48 | $data->addClass('custom-control-label', \Enjoys\Forms\Form::ATTRIBUTES_LABEL); |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $this->generateCode($element); |
70 | 70 | $img = $this->createImage( |
71 | 71 | $this->getCode(), |
72 | - (int)$this->getOption('width', 150), |
|
73 | - (int)$this->getOption('height', 50) |
|
72 | + (int) $this->getOption('width', 150), |
|
73 | + (int) $this->getOption('height', 50) |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | //dump($this->session->get($this->getName())); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | private function generateCode(\Enjoys\Forms\Element $element): void |
90 | 90 | { |
91 | - $max = (int)$this->getOption('size', 6); |
|
91 | + $max = (int) $this->getOption('size', 6); |
|
92 | 92 | $chars = $this->getOption('chars', 'qwertyuiopasdfghjklzxcvbnm1234567890'); |
93 | 93 | $size = StrLen($chars) - 1; |
94 | 94 | // Определяем пустую переменную, в которую и будем записывать символы. |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | |
149 | 149 | // Формируем координаты для вывода символа |
150 | 150 | if (empty($x)) { |
151 | - $x = (int)($width * 0.08); |
|
151 | + $x = (int) ($width * 0.08); |
|
152 | 152 | } else { |
153 | - $x = (int)($x + ($width * 0.8) / \count($letters) + \rand(0, (int)($width * 0.01))); |
|
153 | + $x = (int) ($x + ($width * 0.8) / \count($letters) + \rand(0, (int) ($width * 0.01))); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if ($h == rand(1, 2)) { |
157 | - $y = (int)((($height * 1) / 4) + \rand(0, (int)($height * 0.1))); |
|
157 | + $y = (int) ((($height * 1) / 4) + \rand(0, (int) ($height * 0.1))); |
|
158 | 158 | } else { |
159 | - $y = (int)((($height * 1) / 4) - \rand(0, (int)($height * 0.1))); |
|
159 | + $y = (int) ((($height * 1) / 4) - \rand(0, (int) ($height * 0.1))); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 |
@@ -207,11 +207,11 @@ |
||
207 | 207 | */ |
208 | 208 | public function setDefaults($data): self |
209 | 209 | { |
210 | - if($data instanceof \Closure){ |
|
210 | + if ($data instanceof \Closure) { |
|
211 | 211 | $data = $data(); |
212 | 212 | } |
213 | 213 | |
214 | - if(!is_array($data)){ |
|
214 | + if (!is_array($data)) { |
|
215 | 215 | throw new \InvalidArgumentException('Invalid argument, expected array or closure with retun array.'); |
216 | 216 | } |
217 | 217 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $key = $value; |
58 | 58 | $value = null; |
59 | 59 | } |
60 | - $this->setAttribute((string)$key, $value, $namespace); |
|
60 | + $this->setAttribute((string) $key, $value, $namespace); |
|
61 | 61 | } |
62 | 62 | return $this; |
63 | 63 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if (in_array($name, ['class'])) { |
81 | 81 | if ( |
82 | 82 | isset($this->attributes[$namespace][$name]) && |
83 | - in_array($value, (array)$this->attributes[$namespace][$name]) |
|
83 | + in_array($value, (array) $this->attributes[$namespace][$name]) |
|
84 | 84 | ) { |
85 | 85 | return $this; |
86 | 86 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | return $this; |
196 | 196 | } |
197 | - $values = explode(" ", (string)$class); |
|
197 | + $values = explode(" ", (string) $class); |
|
198 | 198 | foreach ($values as $value) { |
199 | 199 | $this->setAttribute('class', $value, $namespace); |
200 | 200 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return $this; |
215 | 215 | } |
216 | 216 | |
217 | - if (false !== $key = array_search($classValue, (array)$this->attributes[$namespace]['class'])) { |
|
217 | + if (false !== $key = array_search($classValue, (array) $this->attributes[$namespace]['class'])) { |
|
218 | 218 | unset($this->attributes[$namespace]['class'][$key]); |
219 | 219 | } |
220 | 220 | return $this; |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | public function __construct($value, $title, $useTitleAsValue = false) |
53 | 53 | { |
54 | 54 | if (is_array($title)) { |
55 | - $this->title = (string)$title[0]; |
|
55 | + $this->title = (string) $title[0]; |
|
56 | 56 | |
57 | 57 | if (isset($title[1]) && is_array($title[1])) { |
58 | 58 | $this->attributes = array_merge($this->attributes, $title[1]); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - $this->title ??= (string)$title; |
|
62 | + $this->title ??= (string) $title; |
|
63 | 63 | |
64 | 64 | /** @since 2.4.0 */ |
65 | 65 | if (is_string($value)) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | public function getValue(): ?string |
88 | 88 | { |
89 | - return (string)$this->value; |
|
89 | + return (string) $this->value; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public function getLabel(): ?string |
@@ -68,7 +68,7 @@ |
||
68 | 68 | { |
69 | 69 | $this->form = $form; |
70 | 70 | $this->setDefault(); |
71 | - if($this instanceof FillableInterface){ |
|
71 | + if ($this instanceof FillableInterface) { |
|
72 | 72 | foreach ($this->getElements() as $element) { |
73 | 73 | $element->setDefault($this->getDefaultValue()); |
74 | 74 | } |