@@ -12,6 +12,9 @@ discard block |
||
| 12 | 12 | protected $_values; |
| 13 | 13 | protected $_query; |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $string |
|
| 17 | + */ |
|
| 15 | 18 | public function __construct($string, $values = array()) |
| 16 | 19 | { |
| 17 | 20 | $this->_string = $string; |
@@ -75,6 +78,9 @@ discard block |
||
| 75 | 78 | return $string; |
| 76 | 79 | } |
| 77 | 80 | |
| 81 | + /** |
|
| 82 | + * @param Query $value |
|
| 83 | + */ |
|
| 78 | 84 | protected function parseValueQuery($value) |
| 79 | 85 | { |
| 80 | 86 | return "(".$value->assemble().")"; |
@@ -99,11 +105,17 @@ discard block |
||
| 99 | 105 | return $this; |
| 100 | 106 | } |
| 101 | 107 | |
| 108 | + /** |
|
| 109 | + * @param Condition $condition |
|
| 110 | + */ |
|
| 102 | 111 | public function and_($condition) |
| 103 | 112 | { |
| 104 | 113 | return new AndCondition($this, $condition); |
| 105 | 114 | } |
| 106 | 115 | |
| 116 | + /** |
|
| 117 | + * @param Condition $condition |
|
| 118 | + */ |
|
| 107 | 119 | public function or_($condition) |
| 108 | 120 | { |
| 109 | 121 | return new OrCondition($this, $condition); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | protected function parseValueQuery($value) |
| 79 | 79 | { |
| 80 | - return "(".$value->assemble().")"; |
|
| 80 | + return "(" . $value->assemble() . ")"; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | public function protectCondition($condition) |
| 113 | 113 | { |
| 114 | - return strpos($condition, ' AND ') || strpos($condition, ' OR ') ? '('.$condition.')' : $condition; |
|
| 114 | + return strpos($condition, ' AND ') || strpos($condition, ' OR ') ? '(' . $condition . ')' : $condition; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | \ No newline at end of file |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * @param bool|Dispatcher $dispatcher |
|
| 41 | + * @param Dispatcher $dispatcher |
|
| 42 | 42 | * @return $this |
| 43 | 43 | */ |
| 44 | 44 | public function setDispatcher($dispatcher = false) |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * @return $this |
|
| 78 | + * @return Nip_File_System |
|
| 79 | 79 | */ |
| 80 | 80 | public function delete() |
| 81 | 81 | { |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | - * @param $x |
|
| 293 | - * @param $y |
|
| 292 | + * @param double $x |
|
| 293 | + * @param double $y |
|
| 294 | 294 | * @param $dwidth |
| 295 | 295 | * @param $dheight |
| 296 | 296 | * @param $swidth |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
| 458 | - * @return mixed |
|
| 458 | + * @return string |
|
| 459 | 459 | */ |
| 460 | 460 | public function getFile() |
| 461 | 461 | { |
@@ -269,10 +269,10 @@ |
||
| 269 | 269 | |
| 270 | 270 | if ($sourceRatio > $target_ratio) { |
| 271 | 271 | $new_height = $max_height; |
| 272 | - $new_width = ( int )($max_height * $sourceRatio); |
|
| 272 | + $new_width = (int) ($max_height * $sourceRatio); |
|
| 273 | 273 | } else { |
| 274 | 274 | $new_width = $max_width; |
| 275 | - $new_height = ( int )($max_width / $sourceRatio); |
|
| 275 | + $new_height = (int) ($max_width / $sourceRatio); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | $image = imagecreatetruecolor($new_width, $new_height); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @param string $file |
| 67 | 67 | * @param array $extensions |
| 68 | - * @return mixed |
|
| 68 | + * @return string|false |
|
| 69 | 69 | */ |
| 70 | 70 | public function getUploadErrorNo($file, $extensions = array()) |
| 71 | 71 | { |
@@ -236,6 +236,9 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | + /** |
|
| 240 | + * @param null|string $path |
|
| 241 | + */ |
|
| 239 | 242 | public function deleteFile($path) |
| 240 | 243 | { |
| 241 | 244 | if (file_exists($path)) { |
@@ -267,6 +270,9 @@ discard block |
||
| 267 | 270 | return sprintf('%.2f '.$s[$e], ($bytes / pow(1024, floor($e)))); |
| 268 | 271 | } |
| 269 | 272 | |
| 273 | + /** |
|
| 274 | + * @param integer $mode |
|
| 275 | + */ |
|
| 270 | 276 | public function chmod($file, $mode) |
| 271 | 277 | { |
| 272 | 278 | if (true !== @chmod($file, $mode)) { |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $errorCode = $this->getUploadErrorNo($file, $extensions); |
| 50 | 50 | if (is_int($errorCode)) { |
| 51 | - $translateSlug = 'general.errors.upload.code-'.$errorCode; |
|
| 51 | + $translateSlug = 'general.errors.upload.code-' . $errorCode; |
|
| 52 | 52 | |
| 53 | 53 | return app('translator')->hasTranslation($translateSlug) ? __($translateSlug) : $this->_uploadErrors[$errorCode]; |
| 54 | 54 | } elseif (is_string($errorCode)) { |
| 55 | - $translateSlug = 'general.errors.upload.'.$errorCode; |
|
| 55 | + $translateSlug = 'general.errors.upload.' . $errorCode; |
|
| 56 | 56 | |
| 57 | 57 | return app('translator')->hasTranslation($translateSlug) ? __($translateSlug) : $messages[$errorCode]; |
| 58 | 58 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $unit = strtoupper(substr($maxUpload, -1)); |
| 76 | 76 | $multiplier = $unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)); |
| 77 | 77 | |
| 78 | - if ($maxUpload && ((int)$_SERVER['CONTENT_LENGTH'] > $multiplier * (int)$maxUpload)) { |
|
| 78 | + if ($maxUpload && ((int) $_SERVER['CONTENT_LENGTH'] > $multiplier * (int) $maxUpload)) { |
|
| 79 | 79 | $result = "max_post"; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $iterator = new RecursiveDirectoryIterator($dir); |
| 130 | 130 | foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { |
| 131 | 131 | if ($file->isFile()) { |
| 132 | - $result[] = ($fullPaths ? $file->getPath().DIRECTORY_SEPARATOR : '').$file->getFilename(); |
|
| 132 | + $result[] = ($fullPaths ? $file->getPath() . DIRECTORY_SEPARATOR : '') . $file->getFilename(); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } else { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $d = dir($dir); |
| 171 | 171 | |
| 172 | 172 | while (false != ($entry = $d->read())) { |
| 173 | - $complete = $d->path."/".$entry; |
|
| 173 | + $complete = $d->path . "/" . $entry; |
|
| 174 | 174 | if (!in_array($entry, array(".", "..", ".svn"))) { |
| 175 | 175 | if (is_dir($complete)) { |
| 176 | 176 | $tree[$entry] = $this->directoryTree($complete, $tree[$dir][$entry]); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | array_shift($files); |
| 200 | 200 | |
| 201 | 201 | foreach ($files as $file) { |
| 202 | - $file = $dir.'/'.$file; |
|
| 202 | + $file = $dir . '/' . $file; |
|
| 203 | 203 | if (is_dir($file)) { |
| 204 | 204 | $this->removeDirectory($file); |
| 205 | 205 | } else { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | foreach ($files as $file) { |
| 225 | 225 | if (!in_array($file, array(".", ".."))) { |
| 226 | - $file = $dir.DIRECTORY_SEPARATOR.$file; |
|
| 226 | + $file = $dir . DIRECTORY_SEPARATOR . $file; |
|
| 227 | 227 | if (is_dir($file)) { |
| 228 | 228 | $this->removeDirectory($file); |
| 229 | 229 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $s = array('b', 'kb', 'MB', 'GB', 'TB', 'PB'); |
| 265 | 265 | $e = floor(log($bytes) / log(1024)); |
| 266 | 266 | |
| 267 | - return sprintf('%.2f '.$s[$e], ($bytes / pow(1024, floor($e)))); |
|
| 267 | + return sprintf('%.2f ' . $s[$e], ($bytes / pow(1024, floor($e)))); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | public function chmod($file, $mode) |
@@ -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; |
@@ -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; |
@@ -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 | } |
@@ -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 | } |
@@ -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 | |