@@ -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 | |
@@ -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 | } |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $parsed = $this->parseRuleOpts($ruleOpts); |
| 146 | 146 | |
| 147 | - $threshold_size = (int)$parsed['param']; |
|
| 147 | + $threshold_size = (int) $parsed['param']; |
|
| 148 | 148 | $message = $parsed['message']; |
| 149 | 149 | |
| 150 | 150 | if (is_null($message)) { |
| 151 | - $message = 'Размер файла (' . Binary::bytes((int)$value->getSize())->format(null, " ") . ')' |
|
| 151 | + $message = 'Размер файла (' . Binary::bytes((int) $value->getSize())->format(null, " ") . ')' |
|
| 152 | 152 | . ' превышает допустимый размер: ' . Binary::bytes($threshold_size)->format(null, " "); |
| 153 | 153 | } |
| 154 | - $this->setMessage((string)$message); |
|
| 154 | + $this->setMessage((string) $message); |
|
| 155 | 155 | |
| 156 | 156 | if ($value->getSize() > $threshold_size) { |
| 157 | 157 | $element->setRuleError($this->getMessage()); |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | $expected_extensions = \array_map('trim', \explode(",", $parsed['param'])); |
| 179 | 179 | $message = $parsed['message']; |
| 180 | 180 | |
| 181 | - $extension = pathinfo((string)$value->getClientFilename(), PATHINFO_EXTENSION); |
|
| 181 | + $extension = pathinfo((string) $value->getClientFilename(), PATHINFO_EXTENSION); |
|
| 182 | 182 | |
| 183 | 183 | if (is_null($message)) { |
| 184 | 184 | $message = 'Загрузка файлов с расширением .' . $extension . ' запрещена'; |
| 185 | 185 | } |
| 186 | - $this->setMessage((string)$message); |
|
| 186 | + $this->setMessage((string) $message); |
|
| 187 | 187 | |
| 188 | 188 | if (!in_array($extension, $expected_extensions)) { |
| 189 | 189 | $element->setRuleError($this->getMessage()); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | private function parseRuleOpts($opts): array |
| 201 | 201 | { |
| 202 | 202 | if (!is_array($opts)) { |
| 203 | - $opts = (array)$opts; |
|
| 203 | + $opts = (array) $opts; |
|
| 204 | 204 | $opts[1] = null; |
| 205 | 205 | } |
| 206 | 206 | list($param, $message) = $opts; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $this->addRule( |
| 30 | 30 | Rules::CALLBACK, |
| 31 | 31 | 'CSRF Attack detected', |
| 32 | - function () use ($csrf_key) { |
|
| 32 | + function() use ($csrf_key) { |
|
| 33 | 33 | return password_verify($csrf_key, $this->getRequest()->post(Form::_TOKEN_CSRF_, '')); |
| 34 | 34 | } |
| 35 | 35 | ); |