@@ -79,6 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @inheritdoc |
| 82 | + * @param string $path |
|
| 82 | 83 | */ |
| 83 | 84 | public function setPath($path) |
| 84 | 85 | { |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | - * @param $x |
|
| 295 | - * @param $y |
|
| 294 | + * @param double $x |
|
| 295 | + * @param double $y |
|
| 296 | 296 | * @param $dwidth |
| 297 | 297 | * @param $dheight |
| 298 | 298 | * @param $swidth |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
| 460 | - * @return mixed |
|
| 460 | + * @return string |
|
| 461 | 461 | */ |
| 462 | 462 | public function getFile() |
| 463 | 463 | {
|
@@ -271,10 +271,10 @@ |
||
| 271 | 271 | |
| 272 | 272 | if ($sourceRatio > $target_ratio) {
|
| 273 | 273 | $new_height = $max_height; |
| 274 | - $new_width = ( int )($max_height * $sourceRatio); |
|
| 274 | + $new_width = (int) ($max_height * $sourceRatio); |
|
| 275 | 275 | } else {
|
| 276 | 276 | $new_width = $max_width; |
| 277 | - $new_height = ( int )($max_width / $sourceRatio); |
|
| 277 | + $new_height = (int) ($max_width / $sourceRatio); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $image = imagecreatetruecolor($new_width, $new_height); |
@@ -59,6 +59,9 @@ discard block |
||
| 59 | 59 | return $this->getAttrib('id');
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + /** |
|
| 63 | + * @param string $key |
|
| 64 | + */ |
|
| 62 | 65 | public function getAttrib($key) |
| 63 | 66 | {
|
| 64 | 67 | $key = (string)$key; |
@@ -70,7 +73,7 @@ discard block |
||
| 70 | 73 | } |
| 71 | 74 | |
| 72 | 75 | /** |
| 73 | - * @return mixed |
|
| 76 | + * @return string |
|
| 74 | 77 | */ |
| 75 | 78 | public function getJSID() |
| 76 | 79 | {
|
@@ -206,7 +209,7 @@ discard block |
||
| 206 | 209 | } |
| 207 | 210 | |
| 208 | 211 | /** |
| 209 | - * @param $isRequired |
|
| 212 | + * @param boolean $isRequired |
|
| 210 | 213 | * @return $this |
| 211 | 214 | */ |
| 212 | 215 | public function setRequired($isRequired) |
@@ -217,7 +220,7 @@ discard block |
||
| 217 | 220 | } |
| 218 | 221 | |
| 219 | 222 | /** |
| 220 | - * @param $isRendered |
|
| 223 | + * @param boolean $isRendered |
|
| 221 | 224 | * @return $this |
| 222 | 225 | */ |
| 223 | 226 | public function setRendered($isRendered) |
@@ -303,7 +306,7 @@ discard block |
||
| 303 | 306 | } |
| 304 | 307 | |
| 305 | 308 | /** |
| 306 | - * @return null |
|
| 309 | + * @return string |
|
| 307 | 310 | */ |
| 308 | 311 | public function getLabel() |
| 309 | 312 | {
|
@@ -354,7 +357,7 @@ discard block |
||
| 354 | 357 | } |
| 355 | 358 | |
| 356 | 359 | /** |
| 357 | - * @param $key |
|
| 360 | + * @param string $key |
|
| 358 | 361 | * @return bool |
| 359 | 362 | */ |
| 360 | 363 | public function delAttrib($key) |
@@ -435,7 +438,7 @@ discard block |
||
| 435 | 438 | } |
| 436 | 439 | |
| 437 | 440 | /** |
| 438 | - * @param $key |
|
| 441 | + * @param string $key |
|
| 439 | 442 | * @return null |
| 440 | 443 | */ |
| 441 | 444 | public function getOption($key) |
@@ -480,7 +483,7 @@ discard block |
||
| 480 | 483 | } |
| 481 | 484 | |
| 482 | 485 | /** |
| 483 | - * @param $position |
|
| 486 | + * @param boolean $position |
|
| 484 | 487 | * @return mixed |
| 485 | 488 | */ |
| 486 | 489 | public function getDecoratorsByPosition($position) |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function setAttrib($key, $value) |
| 50 | 50 | {
|
| 51 | - $key = (string)$key; |
|
| 51 | + $key = (string) $key; |
|
| 52 | 52 | $this->_attribs[$key] = $value; |
| 53 | 53 | |
| 54 | 54 | return $this; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function getAttrib($key) |
| 63 | 63 | {
|
| 64 | - $key = (string)$key; |
|
| 64 | + $key = (string) $key; |
|
| 65 | 65 | if (!isset($this->_attribs[$key])) {
|
| 66 | 66 | return null; |
| 67 | 67 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | protected function generateUniqueId() |
| 111 | 111 | {
|
| 112 | 112 | $name = $this->getName(); |
| 113 | - $registeredNames = (array)$this->getForm()->getCache('elements_names');
|
|
| 113 | + $registeredNames = (array) $this->getForm()->getCache('elements_names');
|
|
| 114 | 114 | if (in_array($name, $registeredNames)) {
|
| 115 | 115 | $name = uniqid($name); |
| 116 | 116 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function setRequired($isRequired) |
| 213 | 213 | {
|
| 214 | - $this->_isRequired = (bool)$isRequired; |
|
| 214 | + $this->_isRequired = (bool) $isRequired; |
|
| 215 | 215 | |
| 216 | 216 | return $this; |
| 217 | 217 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function setRendered($isRendered) |
| 224 | 224 | {
|
| 225 | - $this->_isRendered = (bool)$isRendered; |
|
| 225 | + $this->_isRendered = (bool) $isRendered; |
|
| 226 | 226 | |
| 227 | 227 | return $this; |
| 228 | 228 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function isRendered() |
| 234 | 234 | {
|
| 235 | - return (bool)$this->_isRendered; |
|
| 235 | + return (bool) $this->_isRendered; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | public function validate() |
| 274 | 274 | {
|
| 275 | 275 | if ($this->isRequired() && !$this->getValue()) {
|
| 276 | - $message = $this->getForm()->getMessageTemplate('no-'.$this->getName());
|
|
| 276 | + $message = $this->getForm()->getMessageTemplate('no-' . $this->getName());
|
|
| 277 | 277 | if (!$message) {
|
| 278 | 278 | $translateSlug = 'general.form.errors.required'; |
| 279 | 279 | $message = app('translator')->translate($translateSlug, array('label' => $this->getLabel()));
|
| 280 | 280 | if ($message == $translateSlug) {
|
| 281 | - $message = $message ? $message : 'The field `'.$this->getLabel().'` is mandatory.'; |
|
| 281 | + $message = $message ? $message : 'The field `' . $this->getLabel() . '` is mandatory.'; |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | $this->addError($message); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | public function isRequired() |
| 292 | 292 | {
|
| 293 | - return (bool)$this->_isRequired; |
|
| 293 | + return (bool) $this->_isRequired; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | public function delAttrib($key) |
| 361 | 361 | {
|
| 362 | - $key = (string)$key; |
|
| 362 | + $key = (string) $key; |
|
| 363 | 363 | unset($this->_attribs[$key]); |
| 364 | 364 | |
| 365 | 365 | return true; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function setOption($key, $value) |
| 430 | 430 | {
|
| 431 | - $key = (string)$key; |
|
| 431 | + $key = (string) $key; |
|
| 432 | 432 | $this->_options[$key] = $value; |
| 433 | 433 | |
| 434 | 434 | return $this; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | public function getOption($key) |
| 442 | 442 | {
|
| 443 | - $key = (string)$key; |
|
| 443 | + $key = (string) $key; |
|
| 444 | 444 | if (!isset($this->_options[$key])) {
|
| 445 | 445 | return null; |
| 446 | 446 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function newDecorator($type = '') |
| 456 | 456 | {
|
| 457 | - $name = 'Nip_Form_Decorator_Elements_'.ucfirst($type); |
|
| 457 | + $name = 'Nip_Form_Decorator_Elements_' . ucfirst($type); |
|
| 458 | 458 | $decorator = new $name(); |
| 459 | 459 | $decorator->setElement($this); |
| 460 | 460 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @param $checked |
|
| 25 | + * @param boolean $checked |
|
| 26 | 26 | * @return $this |
| 27 | 27 | */ |
| 28 | 28 | public function setChecked($checked) |
@@ -160,7 +160,7 @@ |
||
| 160 | 160 | |
| 161 | 161 | /** @noinspection PhpMissingParentCallCommonInspection |
| 162 | 162 | * @param string $requester |
| 163 | - * @return null |
|
| 163 | + * @return string|null |
|
| 164 | 164 | */ |
| 165 | 165 | public function getValue($requester = 'abstract') |
| 166 | 166 | { |
@@ -70,7 +70,6 @@ discard block |
||
| 70 | 70 | * Transforms a date's string representation into $format |
| 71 | 71 | * |
| 72 | 72 | * @param string $format |
| 73 | - * @param string|int $datetime |
|
| 74 | 73 | * @return string/bool |
| 75 | 74 | */ |
| 76 | 75 | function _strtotime($date, $format = false) |
@@ -288,6 +287,10 @@ discard block |
||
| 288 | 287 | } |
| 289 | 288 | |
| 290 | 289 | if (!function_exists("money_format")) { |
| 290 | + |
|
| 291 | + /** |
|
| 292 | + * @param string $format |
|
| 293 | + */ |
|
| 291 | 294 | function money_format($format, $number) |
| 292 | 295 | { |
| 293 | 296 | $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?' . |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $unit = strtoupper(substr($post_max_size, -1)); |
| 126 | 126 | $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1))); |
| 127 | - $post_max_size = ((int)$post_max_size) * $multiplier; |
|
| 127 | + $post_max_size = ((int) $post_max_size) * $multiplier; |
|
| 128 | 128 | |
| 129 | 129 | $unit = strtoupper(substr($upload_max_filesize, -1)); |
| 130 | 130 | $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1))); |
| 131 | - $upload_max_filesize = ((int)$upload_max_filesize) * $multiplier; |
|
| 131 | + $upload_max_filesize = ((int) $upload_max_filesize) * $multiplier; |
|
| 132 | 132 | |
| 133 | 133 | return round((min($post_max_size, $upload_max_filesize) / 1048576), 2) . 'MB'; |
| 134 | 134 | } |
@@ -233,8 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | /* Split digits and add. */ |
| 235 | 235 | $checksum += $current_num % 10; |
| 236 | - if |
|
| 237 | - ($current_num > 9 |
|
| 236 | + if ($current_num > 9 |
|
| 238 | 237 | ) { |
| 239 | 238 | $checksum += 1; |
| 240 | 239 | } |
@@ -308,9 +307,9 @@ discard block |
||
| 308 | 307 | 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0, |
| 309 | 308 | 'isleft' => preg_match('/\-/', $fmatch[1]) > 0, |
| 310 | 309 | ); |
| 311 | - $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0; |
|
| 312 | - $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0; |
|
| 313 | - $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; |
|
| 310 | + $width = trim($fmatch[2]) ? (int) $fmatch[2] : 0; |
|
| 311 | + $left = trim($fmatch[3]) ? (int) $fmatch[3] : 0; |
|
| 312 | + $right = trim($fmatch[4]) ? (int) $fmatch[4] : $locale['int_frac_digits']; |
|
| 314 | 313 | $conversion = $fmatch[5]; |
| 315 | 314 | |
| 316 | 315 | $positive = true; |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | } |
| 445 | 444 | } #-> end of sub-call (array/object) |
| 446 | 445 | elseif ($waitfor && (strpos($waitfor, $c) !== false)) { |
| 447 | - return array($val, $n); // return current value and state |
|
| 446 | + return array($val, $n); // return current value and state |
|
| 448 | 447 | } #-= in-array |
| 449 | 448 | elseif ($state === ']') { |
| 450 | 449 | list($v, $n) = json_decode($json, 0, $n, 0, ",]"); |
@@ -454,7 +453,7 @@ discard block |
||
| 454 | 453 | } |
| 455 | 454 | } #-= in-object |
| 456 | 455 | elseif ($state === '}') { |
| 457 | - list($i, $n) = json_decode($json, 0, $n, 0, ":"); // this allowed non-string indicies |
|
| 456 | + list($i, $n) = json_decode($json, 0, $n, 0, ":"); // this allowed non-string indicies |
|
| 458 | 457 | list($v, $n) = json_decode($json, 0, $n + 1, 0, ",}"); |
| 459 | 458 | $val[$i] = $v; |
| 460 | 459 | if ($json[$n] == "}") { |
@@ -492,15 +491,15 @@ discard block |
||
| 492 | 491 | $val = $uu[1]; |
| 493 | 492 | $n += strlen($uu[0]) - 1; |
| 494 | 493 | if (strpos($val, ".")) { // float |
| 495 | - $val = (float)$val; |
|
| 494 | + $val = (float) $val; |
|
| 496 | 495 | } elseif ($val[0] == "0") { // oct |
| 497 | 496 | $val = octdec($val); |
| 498 | 497 | } else { |
| 499 | - $val = (int)$val; |
|
| 498 | + $val = (int) $val; |
|
| 500 | 499 | } |
| 501 | 500 | // exponent? |
| 502 | 501 | if (isset($uu[2])) { |
| 503 | - $val *= pow(10, (int)$uu[2]); |
|
| 502 | + $val *= pow(10, (int) $uu[2]); |
|
| 504 | 503 | } |
| 505 | 504 | } #-> boolean or null |
| 506 | 505 | elseif (preg_match("#^(true|false|null)\b#", substr($json, $n), $uu)) { |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | protected $defaultPlaceholder = "head"; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @param $file |
|
| 22 | + * @param string $file |
|
| 23 | 23 | * @param bool $placeholder |
| 24 | 24 | * @return $this |
| 25 | 25 | */ |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * @return mixed |
|
| 30 | + * @return string |
|
| 31 | 31 | */ |
| 32 | 32 | public function init() |
| 33 | 33 | { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * Handle an incoming HTTP request. |
| 80 | 80 | * |
| 81 | - * @param SymfonyRequest|ServerRequestInterface $request |
|
| 81 | + * @param SymfonyRequest $request |
|
| 82 | 82 | * @param int $type |
| 83 | 83 | * @param bool $catch |
| 84 | 84 | * @return ResponseInterface |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * Handles a request to convert it to a response. |
| 114 | 114 | * |
| 115 | - * @param SymfonyRequest|ServerRequestInterface $request A Request instance |
|
| 115 | + * @param ServerRequestInterface $request A Request instance |
|
| 116 | 116 | * @param int $type The type of the request |
| 117 | 117 | * |
| 118 | 118 | * @return ResponseInterface A Response instance |