@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * @param $action |
|
| 63 | + * @param string $action |
|
| 64 | 64 | * @return AbstractForm |
| 65 | 65 | */ |
| 66 | 66 | public function setAction($action) |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * @param $type |
|
| 108 | + * @param string $type |
|
| 109 | 109 | * @return ElementAbstract |
| 110 | 110 | */ |
| 111 | 111 | public function getNewElement($type) |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param $name |
| 301 | 301 | * @param bool $label |
| 302 | 302 | * @param string $type |
| 303 | - * @return mixed |
|
| 303 | + * @return ButtonAbstract |
|
| 304 | 304 | */ |
| 305 | 305 | protected function newButton($name, $label = false, $type = 'button') |
| 306 | 306 | { |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
| 425 | - * @param $key |
|
| 425 | + * @param string $key |
|
| 426 | 426 | * @return mixed|null |
| 427 | 427 | */ |
| 428 | 428 | public function getOption($key) |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
| 454 | - * @param $key |
|
| 455 | - * @return mixed|null |
|
| 454 | + * @param string $key |
|
| 455 | + * @return string |
|
| 456 | 456 | */ |
| 457 | 457 | public function getAttrib($key) |
| 458 | 458 | { |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | /** |
| 488 | - * @param $class |
|
| 488 | + * @param string $class |
|
| 489 | 489 | * @return bool |
| 490 | 490 | */ |
| 491 | 491 | public function hasClass($class) |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | /** |
| 751 | - * @param $name |
|
| 751 | + * @param string $name |
|
| 752 | 752 | * @return mixed |
| 753 | 753 | */ |
| 754 | 754 | public function getMessageTemplate($name) |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /** |
| 795 | - * @param $key |
|
| 795 | + * @param string $key |
|
| 796 | 796 | * @param $value |
| 797 | 797 | */ |
| 798 | 798 | public function setCache($key, $value) |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
| 821 | - * @return null |
|
| 821 | + * @return null|string |
|
| 822 | 822 | */ |
| 823 | 823 | public function __toString() |
| 824 | 824 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setAction($action) |
| 67 | 67 | { |
| 68 | - return $this->setAttrib('action', (string)$action); |
|
| 68 | + return $this->setAttrib('action', (string) $action); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function setAttrib($key, $value) |
| 77 | 77 | { |
| 78 | - $key = (string)$key; |
|
| 78 | + $key = (string) $key; |
|
| 79 | 79 | $this->_attribs[$key] = $value; |
| 80 | 80 | |
| 81 | 81 | return $this; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function getElementClassName($type) |
| 123 | 123 | { |
| 124 | - return 'Nip_Form_Element_'.ucfirst($type); |
|
| 124 | + return 'Nip_Form_Element_' . ucfirst($type); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | trigger_error('No valid elements specified for display group'); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $name = (string)$name; |
|
| 247 | + $name = (string) $name; |
|
| 248 | 248 | $group->setLegend($name); |
| 249 | 249 | |
| 250 | 250 | $this->_displayGroups[$name] = $group; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | protected function newButton($name, $label = false, $type = 'button') |
| 306 | 306 | { |
| 307 | - $class = 'Nip_Form_Button_'.ucfirst($type); |
|
| 307 | + $class = 'Nip_Form_Button_' . ucfirst($type); |
|
| 308 | 308 | /** @var ButtonAbstract $button */ |
| 309 | 309 | $button = new $class($this); |
| 310 | 310 | $button->setName($name) |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | public function setOption($key, $value) |
| 417 | 417 | { |
| 418 | - $key = (string)$key; |
|
| 418 | + $key = (string) $key; |
|
| 419 | 419 | $this->_options[$key] = $value; |
| 420 | 420 | |
| 421 | 421 | return $this; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function getOption($key) |
| 429 | 429 | { |
| 430 | - $key = (string)$key; |
|
| 430 | + $key = (string) $key; |
|
| 431 | 431 | if (!isset($this->_options[$key])) { |
| 432 | 432 | return null; |
| 433 | 433 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | public function getAttrib($key) |
| 458 | 458 | { |
| 459 | - $key = (string)$key; |
|
| 459 | + $key = (string) $key; |
|
| 460 | 460 | if (!isset($this->_attribs[$key])) { |
| 461 | 461 | return null; |
| 462 | 462 | } |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | public function getErrors() |
| 681 | 681 | { |
| 682 | - $errors = array_merge((array)$this->getMessagesType('error'), $this->getElementsErrors()); |
|
| 682 | + $errors = array_merge((array) $this->getMessagesType('error'), $this->getElementsErrors()); |
|
| 683 | 683 | |
| 684 | 684 | return $errors; |
| 685 | 685 | } |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | */ |
| 775 | 775 | public function getNewRenderer($type = 'basic') |
| 776 | 776 | { |
| 777 | - $name = 'Nip_Form_Renderer_'.ucfirst($type); |
|
| 777 | + $name = 'Nip_Form_Renderer_' . ucfirst($type); |
|
| 778 | 778 | /** @var AbstractRenderer $renderer */ |
| 779 | 779 | $renderer = new $name(); |
| 780 | 780 | $renderer->setForm($this); |
@@ -34,6 +34,11 @@ discard block |
||
| 34 | 34 | return $this; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param string $key |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 37 | 42 | public function getAttrib($key) |
| 38 | 43 | { |
| 39 | 44 | $key = (string)$key; |
@@ -45,7 +50,7 @@ discard block |
||
| 45 | 50 | } |
| 46 | 51 | |
| 47 | 52 | /** |
| 48 | - * @return Nip_Form_Element_Abstract |
|
| 53 | + * @return Nip_Form_Button_Abstract |
|
| 49 | 54 | */ |
| 50 | 55 | public function setAttrib($key, $value) |
| 51 | 56 | { |
@@ -74,11 +79,17 @@ discard block |
||
| 74 | 79 | return $this; |
| 75 | 80 | } |
| 76 | 81 | |
| 82 | + /** |
|
| 83 | + * @return Nip_Form_Button_Abstract |
|
| 84 | + */ |
|
| 77 | 85 | public function getName() |
| 78 | 86 | { |
| 79 | 87 | return $this->getAttrib('name'); |
| 80 | 88 | } |
| 81 | 89 | |
| 90 | + /** |
|
| 91 | + * @param boolean $label |
|
| 92 | + */ |
|
| 82 | 93 | public function setLabel($label) |
| 83 | 94 | { |
| 84 | 95 | $this->setAttrib('label', $label); |
@@ -118,7 +129,7 @@ discard block |
||
| 118 | 129 | |
| 119 | 130 | /** |
| 120 | 131 | * @param array $attribs |
| 121 | - * @return Nip_Form_Element_Abstract |
|
| 132 | + * @return Nip_Form_Button_Abstract |
|
| 122 | 133 | */ |
| 123 | 134 | public function setAttribs(array $attribs) |
| 124 | 135 | { |
@@ -128,7 +139,7 @@ discard block |
||
| 128 | 139 | } |
| 129 | 140 | |
| 130 | 141 | /** |
| 131 | - * @return Nip_Form_Element_Abstract |
|
| 142 | + * @return Nip_Form_Button_Abstract |
|
| 132 | 143 | */ |
| 133 | 144 | public function clearAttribs() |
| 134 | 145 | { |
@@ -139,7 +150,7 @@ discard block |
||
| 139 | 150 | |
| 140 | 151 | /** |
| 141 | 152 | * @param array $attribs |
| 142 | - * @return Nip_Form_Element_Abstract |
|
| 153 | + * @return Nip_Form_Button_Abstract |
|
| 143 | 154 | */ |
| 144 | 155 | public function addAttribs(array $attribs) |
| 145 | 156 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function getAttrib($key) |
| 38 | 38 | { |
| 39 | - $key = (string)$key; |
|
| 39 | + $key = (string) $key; |
|
| 40 | 40 | if (!isset($this->_attribs[$key])) { |
| 41 | 41 | return null; |
| 42 | 42 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function setAttrib($key, $value) |
| 51 | 51 | { |
| 52 | - $key = (string)$key; |
|
| 52 | + $key = (string) $key; |
|
| 53 | 53 | $this->_attribs[$key] = $value; |
| 54 | 54 | |
| 55 | 55 | return $this; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function delAttrib($key) |
| 107 | 107 | { |
| 108 | - $key = (string)$key; |
|
| 108 | + $key = (string) $key; |
|
| 109 | 109 | unset($this->_attribs[$key]); |
| 110 | 110 | |
| 111 | 111 | return true; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * @param $legend |
|
| 53 | + * @param string $legend |
|
| 54 | 54 | * @return Nip_Form_DisplayGroup |
| 55 | 55 | */ |
| 56 | 56 | public function setLegend($legend) |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | - * @param $key |
|
| 83 | + * @param string $key |
|
| 84 | 84 | * @return mixed|null |
| 85 | 85 | */ |
| 86 | 86 | public function getAttrib($key) |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function setLegend($legend) |
| 57 | 57 | { |
| 58 | - return $this->setAttrib('legend', (string)$legend); |
|
| 58 | + return $this->setAttrib('legend', (string) $legend); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setAttrib($key, $value) |
| 67 | 67 | { |
| 68 | - $key = (string)$key; |
|
| 68 | + $key = (string) $key; |
|
| 69 | 69 | $this->_attribs[$key] = $value; |
| 70 | 70 | |
| 71 | 71 | return $this; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function getAttrib($key) |
| 87 | 87 | { |
| 88 | - $key = (string)$key; |
|
| 88 | + $key = (string) $key; |
|
| 89 | 89 | if (!isset($this->_attribs[$key])) { |
| 90 | 90 | return null; |
| 91 | 91 | } |
@@ -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) |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * @param $type |
|
| 93 | + * @param string[] $type |
|
| 94 | 94 | * @return boolean |
| 95 | 95 | */ |
| 96 | 96 | public function isElementsType($type) |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * @param $type |
|
| 118 | + * @param string[] $type |
|
| 119 | 119 | * @param $arguments |
| 120 | 120 | * @return mixed |
| 121 | 121 | */ |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return $addElements; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - trigger_error('Call to undefined method: ['.$name.']', E_USER_ERROR); |
|
| 58 | + trigger_error('Call to undefined method: [' . $name . ']', E_USER_ERROR); |
|
| 59 | 59 | |
| 60 | 60 | return $this; |
| 61 | 61 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($this->isElementsType($type)) { |
| 74 | 74 | return $this->magicMethodAddElement($type, $arguments); |
| 75 | 75 | } else { |
| 76 | - trigger_error('Undefined element type for add operation: ['.$type.']', E_USER_ERROR); |
|
| 76 | + trigger_error('Undefined element type for add operation: [' . $type . ']', E_USER_ERROR); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -120,7 +120,6 @@ discard block |
||
| 120 | 120 | * Transforms a date's string representation into $format |
| 121 | 121 | * |
| 122 | 122 | * @param string $format |
| 123 | - * @param string|int $datetime |
|
| 124 | 123 | * @return string/bool |
| 125 | 124 | */ |
| 126 | 125 | function _strtotime($date, $format = false) |
@@ -338,6 +337,10 @@ discard block |
||
| 338 | 337 | } |
| 339 | 338 | |
| 340 | 339 | if (!function_exists("money_format")) { |
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * @param string $format |
|
| 343 | + */ |
|
| 341 | 344 | function money_format($format, $number) |
| 342 | 345 | { |
| 343 | 346 | $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'. |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $unit = strtoupper(substr($post_max_size, -1)); |
| 176 | 176 | $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1))); |
| 177 | - $post_max_size = ((int)$post_max_size) * $multiplier; |
|
| 177 | + $post_max_size = ((int) $post_max_size) * $multiplier; |
|
| 178 | 178 | |
| 179 | 179 | $unit = strtoupper(substr($upload_max_filesize, -1)); |
| 180 | 180 | $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1))); |
| 181 | - $upload_max_filesize = ((int)$upload_max_filesize) * $multiplier; |
|
| 181 | + $upload_max_filesize = ((int) $upload_max_filesize) * $multiplier; |
|
| 182 | 182 | |
| 183 | - return round((min($post_max_size, $upload_max_filesize) / 1048576), 2).'MB'; |
|
| 183 | + return round((min($post_max_size, $upload_max_filesize) / 1048576), 2) . 'MB'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | function valid_url($input) |
@@ -283,8 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | /* Split digits and add. */ |
| 285 | 285 | $checksum += $current_num % 10; |
| 286 | - if |
|
| 287 | - ($current_num > 9 |
|
| 286 | + if ($current_num > 9 |
|
| 288 | 287 | ) { |
| 289 | 288 | $checksum += 1; |
| 290 | 289 | } |
@@ -340,7 +339,7 @@ discard block |
||
| 340 | 339 | if (!function_exists("money_format")) { |
| 341 | 340 | function money_format($format, $number) |
| 342 | 341 | { |
| 343 | - $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'. |
|
| 342 | + $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?' . |
|
| 344 | 343 | '(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/'; |
| 345 | 344 | if (setlocale(LC_MONETARY, 0) == 'C') { |
| 346 | 345 | setlocale(LC_MONETARY, ''); |
@@ -358,9 +357,9 @@ discard block |
||
| 358 | 357 | 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0, |
| 359 | 358 | 'isleft' => preg_match('/\-/', $fmatch[1]) > 0, |
| 360 | 359 | ); |
| 361 | - $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0; |
|
| 362 | - $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0; |
|
| 363 | - $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; |
|
| 360 | + $width = trim($fmatch[2]) ? (int) $fmatch[2] : 0; |
|
| 361 | + $left = trim($fmatch[3]) ? (int) $fmatch[3] : 0; |
|
| 362 | + $right = trim($fmatch[4]) ? (int) $fmatch[4] : $locale['int_frac_digits']; |
|
| 364 | 363 | $conversion = $fmatch[5]; |
| 365 | 364 | |
| 366 | 365 | $positive = true; |
@@ -393,8 +392,8 @@ discard block |
||
| 393 | 392 | break; |
| 394 | 393 | } |
| 395 | 394 | if (!$flags['nosimbol']) { |
| 396 | - $currency = $cprefix. |
|
| 397 | - ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']). |
|
| 395 | + $currency = $cprefix . |
|
| 396 | + ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) . |
|
| 398 | 397 | $csuffix; |
| 399 | 398 | } else { |
| 400 | 399 | $currency = ''; |
@@ -407,13 +406,13 @@ discard block |
||
| 407 | 406 | |
| 408 | 407 | $n = strlen($prefix) + strlen($currency) + strlen($value[0]); |
| 409 | 408 | if ($left > 0 && $left > $n) { |
| 410 | - $value[0] = str_repeat($flags['fillchar'], $left - $n).$value[0]; |
|
| 409 | + $value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0]; |
|
| 411 | 410 | } |
| 412 | 411 | $value = implode($locale['mon_decimal_point'], $value); |
| 413 | 412 | if ($locale["{$letter}_cs_precedes"]) { |
| 414 | - $value = $prefix.$currency.$space.$value.$suffix; |
|
| 413 | + $value = $prefix . $currency . $space . $value . $suffix; |
|
| 415 | 414 | } else { |
| 416 | - $value = $prefix.$value.$space.$currency.$suffix; |
|
| 415 | + $value = $prefix . $value . $space . $currency . $suffix; |
|
| 417 | 416 | } |
| 418 | 417 | if ($width > 0) { |
| 419 | 418 | $value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ? |
@@ -472,9 +471,9 @@ discard block |
||
| 472 | 471 | if ($hex < 0x80) { // plain ASCII character |
| 473 | 472 | $val .= chr($hex); |
| 474 | 473 | } elseif ($hex < 0x800) { // 110xxxxx 10xxxxxx |
| 475 | - $val .= chr(0xC0 + $hex >> 6).chr(0x80 + $hex & 63); |
|
| 474 | + $val .= chr(0xC0 + $hex >> 6) . chr(0x80 + $hex & 63); |
|
| 476 | 475 | } elseif ($hex <= 0xFFFF) { // 1110xxxx 10xxxxxx 10xxxxxx |
| 477 | - $val .= chr(0xE0 + $hex >> 12).chr(0x80 + ($hex >> 6) & 63).chr(0x80 + $hex & 63); |
|
| 476 | + $val .= chr(0xE0 + $hex >> 12) . chr(0x80 + ($hex >> 6) & 63) . chr(0x80 + $hex & 63); |
|
| 478 | 477 | } |
| 479 | 478 | // other ranges, like 0x1FFFFF=0xF0, 0x3FFFFFF=0xF8 and 0x7FFFFFFF=0xFC do not apply |
| 480 | 479 | } |
@@ -482,7 +481,7 @@ discard block |
||
| 482 | 481 | // no escape, just a redundant backslash |
| 483 | 482 | //@COMPAT: we could throw an exception here |
| 484 | 483 | else { |
| 485 | - $val .= "\\".$c; |
|
| 484 | + $val .= "\\" . $c; |
|
| 486 | 485 | } |
| 487 | 486 | } // end of string |
| 488 | 487 | elseif ($c == '"') { |
@@ -493,7 +492,7 @@ discard block |
||
| 493 | 492 | } |
| 494 | 493 | } #-> end of sub-call (array/object) |
| 495 | 494 | elseif ($waitfor && (strpos($waitfor, $c) !== false)) { |
| 496 | - return array($val, $n); // return current value and state |
|
| 495 | + return array($val, $n); // return current value and state |
|
| 497 | 496 | } #-= in-array |
| 498 | 497 | elseif ($state === ']') { |
| 499 | 498 | list($v, $n) = json_decode($json, 0, $n, 0, ",]"); |
@@ -503,7 +502,7 @@ discard block |
||
| 503 | 502 | } |
| 504 | 503 | } #-= in-object |
| 505 | 504 | elseif ($state === '}') { |
| 506 | - list($i, $n) = json_decode($json, 0, $n, 0, ":"); // this allowed non-string indicies |
|
| 505 | + list($i, $n) = json_decode($json, 0, $n, 0, ":"); // this allowed non-string indicies |
|
| 507 | 506 | list($v, $n) = json_decode($json, 0, $n + 1, 0, ",}"); |
| 508 | 507 | $val[$i] = $v; |
| 509 | 508 | if ($json[$n] == "}") { |
@@ -541,15 +540,15 @@ discard block |
||
| 541 | 540 | $val = $uu[1]; |
| 542 | 541 | $n += strlen($uu[0]) - 1; |
| 543 | 542 | if (strpos($val, ".")) { // float |
| 544 | - $val = (float)$val; |
|
| 543 | + $val = (float) $val; |
|
| 545 | 544 | } elseif ($val[0] == "0") { // oct |
| 546 | 545 | $val = octdec($val); |
| 547 | 546 | } else { |
| 548 | - $val = (int)$val; |
|
| 547 | + $val = (int) $val; |
|
| 549 | 548 | } |
| 550 | 549 | // exponent? |
| 551 | 550 | if (isset($uu[2])) { |
| 552 | - $val *= pow(10, (int)$uu[2]); |
|
| 551 | + $val *= pow(10, (int) $uu[2]); |
|
| 553 | 552 | } |
| 554 | 553 | } #-> boolean or null |
| 555 | 554 | elseif (preg_match("#^(true|false|null)\b#", substr($json, $n), $uu)) { |
@@ -581,5 +580,5 @@ discard block |
||
| 581 | 580 | $decimalPosition = strrpos($distance, '.'); |
| 582 | 581 | $decimal = $decimalPosition === false ? false : substr($distance, $decimalPosition); |
| 583 | 582 | |
| 584 | - return intval($distance).($decimal ? '<small>'.$decimal.'</small>' : ''); |
|
| 583 | + return intval($distance) . ($decimal ? '<small>' . $decimal . '</small>' : ''); |
|
| 585 | 584 | } |
| 586 | 585 | \ No newline at end of file |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * Fetch the same property for all the elements. |
| 108 | 108 | * |
| 109 | - * @param array|\Nip\Records\Collections\Collection $array |
|
| 109 | + * @param Nip\Records\Collections\Collection $array |
|
| 110 | 110 | * @param string $property |
| 111 | 111 | * @param bool|string $return |
| 112 | 112 | * @return array The property values |
@@ -177,7 +177,6 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @param array $array |
| 179 | 179 | * @param array $params |
| 180 | - * @param string $key |
|
| 181 | 180 | * @return array |
| 182 | 181 | */ |
| 183 | 182 | public function findAll($array, $params, $returnKey = false) |
@@ -237,8 +237,9 @@ discard block |
||
| 237 | 237 | public function toXML($data, $rootNodeName = 'ResultSet', &$xml = null) |
| 238 | 238 | { |
| 239 | 239 | // turn off compatibility mode as simple xml throws a wobbly if you don't. |
| 240 | - if (ini_get('zend.ze1_compatibility_mode') == 1) |
|
| 241 | - ini_set('zend.ze1_compatibility_mode', 0); |
|
| 240 | + if (ini_get('zend.ze1_compatibility_mode') == 1) { |
|
| 241 | + ini_set('zend.ze1_compatibility_mode', 0); |
|
| 242 | + } |
|
| 242 | 243 | |
| 243 | 244 | if (is_null($xml)) { |
| 244 | 245 | $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />"); |
@@ -260,8 +261,9 @@ discard block |
||
| 260 | 261 | $node = $this->isAssoc($value) || $numeric ? $xml->addChild($key) : $xml; |
| 261 | 262 | |
| 262 | 263 | // recursive call |
| 263 | - if ($numeric) |
|
| 264 | - $key = 'anon'; |
|
| 264 | + if ($numeric) { |
|
| 265 | + $key = 'anon'; |
|
| 266 | + } |
|
| 265 | 267 | $this->toXML($value, $key, $node); |
| 266 | 268 | } else { |
| 267 | 269 | // add single node. |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @param $name |
| 44 | 44 | * @param bool $params |
| 45 | - * @return mixed |
|
| 45 | + * @return string|null |
|
| 46 | 46 | */ |
| 47 | 47 | public function assemble($name, $params = false) |
| 48 | 48 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @param $name |
| 54 | 54 | * @param bool $params |
| 55 | - * @return mixed |
|
| 55 | + * @return string|null |
|
| 56 | 56 | */ |
| 57 | 57 | public function get($name, $params = false) |
| 58 | 58 | { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * @param $name |
| 64 | 64 | * @param bool $params |
| 65 | - * @return mixed|string |
|
| 65 | + * @return string|null |
|
| 66 | 66 | */ |
| 67 | 67 | public function route($name, $params = false) |
| 68 | 68 | { |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $currentRoute = $this->getRouter()->getCurrent(); |
| 79 | 79 | $base = $currentRoute ? $currentRoute->getBase($params) : BASE_URL; |
| 80 | 80 | |
| 81 | - return $base.($params ? "?".http_build_query($params) : ''); |
|
| 81 | + return $base . ($params ? "?" . http_build_query($params) : ''); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |