@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @param string $path The path to chmod |
370 | 370 | * @param integer $mode octal value 0755 |
371 | 371 | * @param boolean $recursive chmod recursively, set to false to only change the current directory. |
372 | - * @param array $exceptions array of files, directories to skip |
|
372 | + * @param string[] $exceptions array of files, directories to skip |
|
373 | 373 | * @return boolean Returns TRUE on success, FALSE on failure |
374 | 374 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::chmod |
375 | 375 | */ |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * Recursively Remove directories if the system allows. |
566 | 566 | * |
567 | 567 | * @param string $path Path of directory to delete |
568 | - * @return boolean Success |
|
568 | + * @return null|boolean Success |
|
569 | 569 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::delete |
570 | 570 | */ |
571 | 571 | public function delete($path = null) { |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | $this->mode = $mode; |
116 | 116 | } |
117 | 117 | |
118 | - if (!file_exists($path) && $create === true) { |
|
118 | + if ( ! file_exists($path) && $create === true) { |
|
119 | 119 | $this->create($path, $this->mode); |
120 | 120 | } |
121 | - if (!Folder::isAbsolute($path)) { |
|
121 | + if ( ! Folder::isAbsolute($path)) { |
|
122 | 122 | $path = realpath($path); |
123 | 123 | } |
124 | - if (!empty($path)) { |
|
124 | + if ( ! empty($path)) { |
|
125 | 125 | $this->cd($path); |
126 | 126 | } |
127 | 127 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function read($sort = true, $exceptions = false, $fullPath = false) { |
166 | 166 | $dirs = $files = array(); |
167 | 167 | |
168 | - if (!$this->pwd()) { |
|
168 | + if ( ! $this->pwd()) { |
|
169 | 169 | return array($dirs, $files); |
170 | 170 | } |
171 | 171 | if (is_array($exceptions)) { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function find($regexpPattern = '.*', $sort = false) { |
215 | 215 | list(, $files) = $this->read($sort); |
216 | - return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files)); |
|
216 | + return array_values(preg_grep('/^'.$regexpPattern.'$/i', $files)); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::findRecursive |
226 | 226 | */ |
227 | 227 | public function findRecursive($pattern = '.*', $sort = false) { |
228 | - if (!$this->pwd()) { |
|
228 | + if ( ! $this->pwd()) { |
|
229 | 229 | return array(); |
230 | 230 | } |
231 | 231 | $startsOn = $this->path; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $found = array(); |
247 | 247 | |
248 | 248 | foreach ($files as $file) { |
249 | - if (preg_match('/^' . $pattern . '$/i', $file)) { |
|
249 | + if (preg_match('/^'.$pattern.'$/i', $file)) { |
|
250 | 250 | $found[] = Folder::addPathElement($this->path, $file); |
251 | 251 | } |
252 | 252 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::isAbsolute |
279 | 279 | */ |
280 | 280 | public static function isAbsolute($path) { |
281 | - return !empty($path) && ($path[0] === '/' || preg_match('/^[A-Z]:\\\\/i', $path) || substr($path, 0, 2) === '\\\\'); |
|
281 | + return ! empty($path) && ($path[0] === '/' || preg_match('/^[A-Z]:\\\\/i', $path) || substr($path, 0, 2) === '\\\\'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if (Folder::isSlashTerm($path)) { |
315 | 315 | return $path; |
316 | 316 | } |
317 | - return $path . Folder::correctSlashFor($path); |
|
317 | + return $path.Folder::correctSlashFor($path); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::addPathElement |
327 | 327 | */ |
328 | 328 | public static function addPathElement($path, $element) { |
329 | - return rtrim($path, DS) . DS . $element; |
|
329 | + return rtrim($path, DS).DS.$element; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function inCakePath($path = '') { |
340 | 340 | $dir = substr(Folder::slashTerm(ROOT), 0, -1); |
341 | - $newdir = $dir . $path; |
|
341 | + $newdir = $dir.$path; |
|
342 | 342 | |
343 | 343 | return $this->inPath($newdir); |
344 | 344 | } |
@@ -355,12 +355,12 @@ discard block |
||
355 | 355 | $dir = Folder::slashTerm($path); |
356 | 356 | $current = Folder::slashTerm($this->pwd()); |
357 | 357 | |
358 | - if (!$reverse) { |
|
359 | - $return = preg_match('/^(.*)' . preg_quote($dir, '/') . '(.*)/', $current); |
|
358 | + if ( ! $reverse) { |
|
359 | + $return = preg_match('/^(.*)'.preg_quote($dir, '/').'(.*)/', $current); |
|
360 | 360 | } else { |
361 | - $return = preg_match('/^(.*)' . preg_quote($current, '/') . '(.*)/', $dir); |
|
361 | + $return = preg_match('/^(.*)'.preg_quote($current, '/').'(.*)/', $dir); |
|
362 | 362 | } |
363 | - return (bool)$return; |
|
363 | + return (bool) $return; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::chmod |
375 | 375 | */ |
376 | 376 | public function chmod($path, $mode = false, $recursive = true, $exceptions = array()) { |
377 | - if (!$mode) { |
|
377 | + if ( ! $mode) { |
|
378 | 378 | $mode = $this->mode; |
379 | 379 | } |
380 | 380 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::tree |
431 | 431 | */ |
432 | 432 | public function tree($path = null, $exceptions = false, $type = null) { |
433 | - if (!$path) { |
|
433 | + if ( ! $path) { |
|
434 | 434 | $path = $this->path; |
435 | 435 | } |
436 | 436 | $files = array(); |
@@ -460,18 +460,18 @@ discard block |
||
460 | 460 | foreach ($iterator as $itemPath => $fsIterator) { |
461 | 461 | if ($skipHidden) { |
462 | 462 | $subPathName = $fsIterator->getSubPathname(); |
463 | - if ($subPathName{0} === '.' || strpos($subPathName, DS . '.') !== false) { |
|
463 | + if ($subPathName{0} === '.' || strpos($subPathName, DS.'.') !== false) { |
|
464 | 464 | continue; |
465 | 465 | } |
466 | 466 | } |
467 | 467 | $item = $fsIterator->current(); |
468 | - if (!empty($exceptions) && isset($exceptions[$item->getFilename()])) { |
|
468 | + if ( ! empty($exceptions) && isset($exceptions[$item->getFilename()])) { |
|
469 | 469 | continue; |
470 | 470 | } |
471 | 471 | |
472 | 472 | if ($item->isFile()) { |
473 | 473 | $files[] = $itemPath; |
474 | - } elseif ($item->isDir() && !$item->isDot()) { |
|
474 | + } elseif ($item->isDir() && ! $item->isDot()) { |
|
475 | 475 | $directories[] = $itemPath; |
476 | 476 | } |
477 | 477 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | return true; |
499 | 499 | } |
500 | 500 | |
501 | - if (!$mode) { |
|
501 | + if ( ! $mode) { |
|
502 | 502 | $mode = $this->mode; |
503 | 503 | } |
504 | 504 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $nextPathname = substr($pathname, 0, strrpos($pathname, DS)); |
511 | 511 | |
512 | 512 | if ($this->create($nextPathname, $mode)) { |
513 | - if (!file_exists($pathname)) { |
|
513 | + if ( ! file_exists($pathname)) { |
|
514 | 514 | $old = umask(0); |
515 | 515 | if (mkdir($pathname, $mode)) { |
516 | 516 | umask($old); |
@@ -546,9 +546,9 @@ discard block |
||
546 | 546 | if ($entry === '.' || $entry === '..') { |
547 | 547 | continue; |
548 | 548 | } |
549 | - $add = $stack[$i] . $entry; |
|
549 | + $add = $stack[$i].$entry; |
|
550 | 550 | |
551 | - if (is_dir($stack[$i] . $entry)) { |
|
551 | + if (is_dir($stack[$i].$entry)) { |
|
552 | 552 | $add = Folder::slashTerm($add); |
553 | 553 | } |
554 | 554 | $stack[] = $add; |
@@ -569,10 +569,10 @@ discard block |
||
569 | 569 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::delete |
570 | 570 | */ |
571 | 571 | public function delete($path = null) { |
572 | - if (!$path) { |
|
572 | + if ( ! $path) { |
|
573 | 573 | $path = $this->pwd(); |
574 | 574 | } |
575 | - if (!$path) { |
|
575 | + if ( ! $path) { |
|
576 | 576 | return null; |
577 | 577 | } |
578 | 578 | $path = Folder::slashTerm($path); |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | } else { |
595 | 595 | $this->_errors[] = __d('cake_dev', '%s NOT removed', $filePath); |
596 | 596 | } |
597 | - } elseif ($item->isDir() && !$item->isDot()) { |
|
597 | + } elseif ($item->isDir() && ! $item->isDot()) { |
|
598 | 598 | //@codingStandardsIgnoreStart |
599 | 599 | if (@rmdir($filePath)) { |
600 | 600 | //@codingStandardsIgnoreEnd |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::copy |
636 | 636 | */ |
637 | 637 | public function copy($options) { |
638 | - if (!$this->pwd()) { |
|
638 | + if ( ! $this->pwd()) { |
|
639 | 639 | return false; |
640 | 640 | } |
641 | 641 | $to = null; |
@@ -649,16 +649,16 @@ discard block |
||
649 | 649 | $toDir = $options['to']; |
650 | 650 | $mode = $options['mode']; |
651 | 651 | |
652 | - if (!$this->cd($fromDir)) { |
|
652 | + if ( ! $this->cd($fromDir)) { |
|
653 | 653 | $this->_errors[] = __d('cake_dev', '%s not found', $fromDir); |
654 | 654 | return false; |
655 | 655 | } |
656 | 656 | |
657 | - if (!is_dir($toDir)) { |
|
657 | + if ( ! is_dir($toDir)) { |
|
658 | 658 | $this->create($toDir, $mode); |
659 | 659 | } |
660 | 660 | |
661 | - if (!is_writable($toDir)) { |
|
661 | + if ( ! is_writable($toDir)) { |
|
662 | 662 | $this->_errors[] = __d('cake_dev', '%s not writable', $toDir); |
663 | 663 | return false; |
664 | 664 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | //@codingStandardsIgnoreEnd |
670 | 670 | while (($item = readdir($handle)) !== false) { |
671 | 671 | $to = Folder::addPathElement($toDir, $item); |
672 | - if (($options['scheme'] != Folder::SKIP || !is_dir($to)) && !in_array($item, $exceptions)) { |
|
672 | + if (($options['scheme'] != Folder::SKIP || ! is_dir($to)) && ! in_array($item, $exceptions)) { |
|
673 | 673 | $from = Folder::addPathElement($fromDir, $item); |
674 | 674 | if (is_file($from)) { |
675 | 675 | if (copy($from, $to)) { |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | $this->delete($to); |
686 | 686 | } |
687 | 687 | |
688 | - if (is_dir($from) && !file_exists($to)) { |
|
688 | + if (is_dir($from) && ! file_exists($to)) { |
|
689 | 689 | $old = umask(0); |
690 | 690 | if (mkdir($to, $mode)) { |
691 | 691 | umask($old); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | return false; |
710 | 710 | } |
711 | 711 | |
712 | - if (!empty($this->_errors)) { |
|
712 | + if ( ! empty($this->_errors)) { |
|
713 | 713 | return false; |
714 | 714 | } |
715 | 715 | return true; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $to = null; |
735 | 735 | if (is_string($options)) { |
736 | 736 | $to = $options; |
737 | - $options = (array)$options; |
|
737 | + $options = (array) $options; |
|
738 | 738 | } |
739 | 739 | $options = array_merge( |
740 | 740 | array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array()), |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | if ($this->copy($options)) { |
745 | 745 | if ($this->delete($options['from'])) { |
746 | - return (bool)$this->cd($options['to']); |
|
746 | + return (bool) $this->cd($options['to']); |
|
747 | 747 | } |
748 | 748 | } |
749 | 749 | return false; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | public function realpath($path) { |
790 | 790 | $path = str_replace('/', DS, trim($path)); |
791 | 791 | if (strpos($path, '..') === false) { |
792 | - if (!Folder::isAbsolute($path)) { |
|
792 | + if ( ! Folder::isAbsolute($path)) { |
|
793 | 793 | $path = Folder::addPathElement($this->path, $path); |
794 | 794 | } |
795 | 795 | return $path; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | continue; |
807 | 807 | } |
808 | 808 | if ($part === '..') { |
809 | - if (!empty($newparts)) { |
|
809 | + if ( ! empty($newparts)) { |
|
810 | 810 | array_pop($newparts); |
811 | 811 | continue; |
812 | 812 | } |
@@ -630,7 +630,6 @@ discard block |
||
630 | 630 | /** |
631 | 631 | * Checks to see if all the values in the array are numeric |
632 | 632 | * |
633 | - * @param array $array The array to check. |
|
634 | 633 | * @return boolean true if values are numeric, false otherwise |
635 | 634 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::numeric |
636 | 635 | */ |
@@ -648,7 +647,6 @@ discard block |
||
648 | 647 | * If you have an un-even or heterogenous array, consider using Hash::maxDimensions() |
649 | 648 | * to get the dimensions of the array. |
650 | 649 | * |
651 | - * @param array $array Array to count dimensions on |
|
652 | 650 | * @return integer The number of dimensions in $data |
653 | 651 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::dimensions |
654 | 652 | */ |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | foreach ($parts as $key) { |
53 | 53 | if (is_array($data) && isset($data[$key])) { |
54 | - $data =& $data[$key]; |
|
54 | + $data = & $data[$key]; |
|
55 | 55 | } else { |
56 | 56 | return null; |
57 | 57 | } |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | // Simple paths. |
97 | - if (!preg_match('/[{\[]/', $path)) { |
|
98 | - return (array)self::get($data, $path); |
|
97 | + if ( ! preg_match('/[{\[]/', $path)) { |
|
98 | + return (array) self::get($data, $path); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if (strpos($path, '[') === false) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | foreach ($context[$_key] as $item) { |
122 | - foreach ((array)$item as $k => $v) { |
|
122 | + foreach ((array) $item as $k => $v) { |
|
123 | 123 | if (self::_matchToken($k, $token)) { |
124 | 124 | $next[] = $v; |
125 | 125 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | $val = isset($cond['val']) ? $cond['val'] : null; |
184 | 184 | |
185 | 185 | // Presence test. |
186 | - if (empty($op) && empty($val) && !isset($data[$attr])) { |
|
186 | + if (empty($op) && empty($val) && ! isset($data[$attr])) { |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | |
190 | 190 | // Empty attribute = fail. |
191 | - if (!(isset($data[$attr]) || array_key_exists($attr, $data))) { |
|
191 | + if ( ! (isset($data[$attr]) || array_key_exists($attr, $data))) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | // Pattern matches and other operators. |
204 | 204 | if ($op === '=' && $val && $val[0] === '/') { |
205 | - if (!preg_match($val, $prop)) { |
|
205 | + if ( ! preg_match($val, $prop)) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | } elseif ( |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return array $data. |
257 | 257 | */ |
258 | 258 | protected static function _simpleOp($op, $data, $path, $values = null) { |
259 | - $_list =& $data; |
|
259 | + $_list = & $data; |
|
260 | 260 | |
261 | 261 | $count = count($path); |
262 | 262 | $last = $count - 1; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | $_list[$key] = $values; |
270 | 270 | return $data; |
271 | 271 | } |
272 | - if (!isset($_list[$key])) { |
|
272 | + if ( ! isset($_list[$key])) { |
|
273 | 273 | $_list[$key] = array(); |
274 | 274 | } |
275 | - $_list =& $_list[$key]; |
|
276 | - if (!is_array($_list)) { |
|
275 | + $_list = & $_list[$key]; |
|
276 | + if ( ! is_array($_list)) { |
|
277 | 277 | $_list = array(); |
278 | 278 | } |
279 | 279 | } elseif ($op === 'remove') { |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | unset($_list[$key]); |
282 | 282 | return $data; |
283 | 283 | } |
284 | - if (!isset($_list[$key])) { |
|
284 | + if ( ! isset($_list[$key])) { |
|
285 | 285 | return $data; |
286 | 286 | } |
287 | - $_list =& $_list[$key]; |
|
287 | + $_list = & $_list[$key]; |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | } |
@@ -347,10 +347,10 @@ discard block |
||
347 | 347 | return array(); |
348 | 348 | } |
349 | 349 | |
350 | - if (!empty($valuePath) && is_array($valuePath)) { |
|
350 | + if ( ! empty($valuePath) && is_array($valuePath)) { |
|
351 | 351 | $format = array_shift($valuePath); |
352 | 352 | $vals = self::format($data, $valuePath, $format); |
353 | - } elseif (!empty($valuePath)) { |
|
353 | + } elseif ( ! empty($valuePath)) { |
|
354 | 354 | $vals = self::extract($data, $valuePath); |
355 | 355 | } |
356 | 356 | if (empty($vals)) { |
@@ -366,13 +366,13 @@ discard block |
||
366 | 366 | |
367 | 367 | if ($groupPath !== null) { |
368 | 368 | $group = self::extract($data, $groupPath); |
369 | - if (!empty($group)) { |
|
369 | + if ( ! empty($group)) { |
|
370 | 370 | $c = count($keys); |
371 | 371 | for ($i = 0; $i < $c; $i++) { |
372 | - if (!isset($group[$i])) { |
|
372 | + if ( ! isset($group[$i])) { |
|
373 | 373 | $group[$i] = 0; |
374 | 374 | } |
375 | - if (!isset($out[$group[$i]])) { |
|
375 | + if ( ! isset($out[$group[$i]])) { |
|
376 | 376 | $out[$group[$i]] = array(); |
377 | 377 | } |
378 | 378 | $out[$group[$i]][$keys[$i]] = $vals[$i]; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $extracted = array(); |
412 | 412 | $count = count($paths); |
413 | 413 | |
414 | - if (!$count) { |
|
414 | + if ( ! $count) { |
|
415 | 415 | return; |
416 | 416 | } |
417 | 417 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | $stack = array(); |
451 | 451 | |
452 | - while (!empty($needle)) { |
|
452 | + while ( ! empty($needle)) { |
|
453 | 453 | $key = key($needle); |
454 | 454 | $val = $needle[$key]; |
455 | 455 | unset($needle[$key]); |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | $next = $data[$key]; |
459 | 459 | unset($data[$key]); |
460 | 460 | |
461 | - if (!empty($val)) { |
|
461 | + if ( ! empty($val)) { |
|
462 | 462 | $stack[] = array($val, $next); |
463 | 463 | } |
464 | - } elseif (!array_key_exists($key, $data) || $data[$key] != $val) { |
|
464 | + } elseif ( ! array_key_exists($key, $data) || $data[$key] != $val) { |
|
465 | 465 | return false; |
466 | 466 | } |
467 | 467 | |
468 | - if (empty($needle) && !empty($stack)) { |
|
468 | + if (empty($needle) && ! empty($stack)) { |
|
469 | 469 | list($needle, $data) = array_pop($stack); |
470 | 470 | } |
471 | 471 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | public static function check(array $data, $path) { |
489 | 489 | $results = self::extract($data, $path); |
490 | - if (!is_array($results)) { |
|
490 | + if ( ! is_array($results)) { |
|
491 | 491 | return false; |
492 | 492 | } |
493 | 493 | return count($results) > 0; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * @return boolean |
519 | 519 | */ |
520 | 520 | protected static function _filter($var) { |
521 | - if ($var === 0 || $var === '0' || !empty($var)) { |
|
521 | + if ($var === 0 || $var === '0' || ! empty($var)) { |
|
522 | 522 | return true; |
523 | 523 | } |
524 | 524 | return false; |
@@ -540,23 +540,23 @@ discard block |
||
540 | 540 | $path = null; |
541 | 541 | |
542 | 542 | reset($data); |
543 | - while (!empty($data)) { |
|
543 | + while ( ! empty($data)) { |
|
544 | 544 | $key = key($data); |
545 | 545 | $element = $data[$key]; |
546 | 546 | unset($data[$key]); |
547 | 547 | |
548 | - if (is_array($element) && !empty($element)) { |
|
549 | - if (!empty($data)) { |
|
548 | + if (is_array($element) && ! empty($element)) { |
|
549 | + if ( ! empty($data)) { |
|
550 | 550 | $stack[] = array($data, $path); |
551 | 551 | } |
552 | 552 | $data = $element; |
553 | 553 | reset($data); |
554 | - $path .= $key . $separator; |
|
554 | + $path .= $key.$separator; |
|
555 | 555 | } else { |
556 | - $result[$path . $key] = $element; |
|
556 | + $result[$path.$key] = $element; |
|
557 | 557 | } |
558 | 558 | |
559 | - if (empty($data) && !empty($stack)) { |
|
559 | + if (empty($data) && ! empty($stack)) { |
|
560 | 560 | list($data, $path) = array_pop($stack); |
561 | 561 | reset($data); |
562 | 562 | } |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | $return = current($args); |
615 | 615 | |
616 | 616 | while (($arg = next($args)) !== false) { |
617 | - foreach ((array)$arg as $key => $val) { |
|
618 | - if (!empty($return[$key]) && is_array($return[$key]) && is_array($val)) { |
|
617 | + foreach ((array) $arg as $key => $val) { |
|
618 | + if ( ! empty($return[$key]) && is_array($return[$key]) && is_array($val)) { |
|
619 | 619 | $return[$key] = self::merge($return[$key], $val); |
620 | 620 | } elseif (is_int($key) && isset($return[$key])) { |
621 | 621 | $return[] = $val; |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | while ($elem = array_shift($data)) { |
662 | 662 | if (is_array($elem)) { |
663 | 663 | $depth += 1; |
664 | - $data =& $elem; |
|
664 | + $data = & $elem; |
|
665 | 665 | } else { |
666 | 666 | break; |
667 | 667 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $depth = array(); |
682 | 682 | if (is_array($data) && reset($data) !== false) { |
683 | 683 | foreach ($data as $value) { |
684 | - $depth[] = self::dimensions((array)$value) + 1; |
|
684 | + $depth[] = self::dimensions((array) $value) + 1; |
|
685 | 685 | } |
686 | 686 | } |
687 | 687 | return max($depth); |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::map |
699 | 699 | */ |
700 | 700 | public static function map(array $data, $path, $function) { |
701 | - $values = (array)self::extract($data, $path); |
|
701 | + $values = (array) self::extract($data, $path); |
|
702 | 702 | return array_map($function, $values); |
703 | 703 | } |
704 | 704 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::reduce |
713 | 713 | */ |
714 | 714 | public static function reduce(array $data, $path, $function) { |
715 | - $values = (array)self::extract($data, $path); |
|
715 | + $values = (array) self::extract($data, $path); |
|
716 | 716 | return array_reduce($values, $function); |
717 | 717 | } |
718 | 718 | |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | * @return mixed The results of the applied method. |
738 | 738 | */ |
739 | 739 | public static function apply(array $data, $path, $function) { |
740 | - $values = (array)self::extract($data, $path); |
|
740 | + $values = (array) self::extract($data, $path); |
|
741 | 741 | return call_user_func($function, $values); |
742 | 742 | } |
743 | 743 | |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | if ($key !== null) { |
839 | 839 | $id = $key; |
840 | 840 | } |
841 | - if (is_array($r) && !empty($r)) { |
|
841 | + if (is_array($r) && ! empty($r)) { |
|
842 | 842 | $stack = array_merge($stack, self::_squash($r, $id)); |
843 | 843 | } else { |
844 | 844 | $stack[] = array('id' => $id, 'value' => $r); |
@@ -860,10 +860,10 @@ discard block |
||
860 | 860 | */ |
861 | 861 | public static function diff(array $data, $compare) { |
862 | 862 | if (empty($data)) { |
863 | - return (array)$compare; |
|
863 | + return (array) $compare; |
|
864 | 864 | } |
865 | 865 | if (empty($compare)) { |
866 | - return (array)$data; |
|
866 | + return (array) $data; |
|
867 | 867 | } |
868 | 868 | $intersection = array_intersect_key($data, $compare); |
869 | 869 | while (($key = key($intersection)) !== null) { |
@@ -885,14 +885,14 @@ discard block |
||
885 | 885 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::mergeDiff |
886 | 886 | */ |
887 | 887 | public static function mergeDiff(array $data, $compare) { |
888 | - if (empty($data) && !empty($compare)) { |
|
888 | + if (empty($data) && ! empty($compare)) { |
|
889 | 889 | return $compare; |
890 | 890 | } |
891 | 891 | if (empty($compare)) { |
892 | 892 | return $data; |
893 | 893 | } |
894 | 894 | foreach ($compare as $key => $value) { |
895 | - if (!array_key_exists($key, $data)) { |
|
895 | + if ( ! array_key_exists($key, $data)) { |
|
896 | 896 | $data[$key] = $value; |
897 | 897 | } elseif (is_array($value)) { |
898 | 898 | $data[$key] = self::mergeDiff($data[$key], $compare[$key]); |
@@ -914,15 +914,15 @@ discard block |
||
914 | 914 | $count = count($keys); |
915 | 915 | $numeric = true; |
916 | 916 | |
917 | - if (!$assoc) { |
|
917 | + if ( ! $assoc) { |
|
918 | 918 | for ($i = 0; $i < $count; $i++) { |
919 | - if (!is_int($keys[$i])) { |
|
919 | + if ( ! is_int($keys[$i])) { |
|
920 | 920 | $numeric = false; |
921 | 921 | break; |
922 | 922 | } |
923 | 923 | } |
924 | 924 | } |
925 | - if (!$numeric || $assoc) { |
|
925 | + if ( ! $numeric || $assoc) { |
|
926 | 926 | $newList = array(); |
927 | 927 | for ($i = 0; $i < $count; $i++) { |
928 | 928 | if (is_int($keys[$i])) { |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::nest |
956 | 956 | */ |
957 | 957 | public static function nest(array $data, $options = array()) { |
958 | - if (!$data) { |
|
958 | + if ( ! $data) { |
|
959 | 959 | return $data; |
960 | 960 | } |
961 | 961 | |
@@ -983,14 +983,14 @@ discard block |
||
983 | 983 | $parentId = self::get($result, $parentKeys); |
984 | 984 | |
985 | 985 | if (isset($idMap[$id][$options['children']])) { |
986 | - $idMap[$id] = array_merge($result, (array)$idMap[$id]); |
|
986 | + $idMap[$id] = array_merge($result, (array) $idMap[$id]); |
|
987 | 987 | } else { |
988 | 988 | $idMap[$id] = array_merge($result, array($options['children'] => array())); |
989 | 989 | } |
990 | - if (!$parentId || !in_array($parentId, $ids)) { |
|
991 | - $return[] =& $idMap[$id]; |
|
990 | + if ( ! $parentId || ! in_array($parentId, $ids)) { |
|
991 | + $return[] = & $idMap[$id]; |
|
992 | 992 | } else { |
993 | - $idMap[$parentId][$options['children']][] =& $idMap[$id]; |
|
993 | + $idMap[$parentId][$options['children']][] = & $idMap[$id]; |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 |
@@ -83,10 +83,6 @@ |
||
83 | 83 | * Defaults to false. |
84 | 84 | * |
85 | 85 | * |
86 | - * @param string $callback|CakeEvent Method to fire on all the objects. Its assumed all the objects implement |
|
87 | - * the method you are calling. If an instance of CakeEvent is provided, then then Event name will parsed to |
|
88 | - * get the callback name. This is done by getting the last word after any dot in the event name |
|
89 | - * (eg. `Model.afterSave` event will trigger the `afterSave` callback) |
|
90 | 86 | * @param array $params Array of parameters for the triggered callback. |
91 | 87 | * @param array $options Array of options. |
92 | 88 | * @return mixed Either the last result or all results if collectReturn is on. |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if ($callback instanceof CakeEvent) { |
100 | 100 | $event = $callback; |
101 | 101 | if (is_array($event->data)) { |
102 | - $params =& $event->data; |
|
102 | + $params = & $event->data; |
|
103 | 103 | } |
104 | 104 | if (empty($event->omitSubject)) { |
105 | 105 | $subject = $event->subject(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | $collected = array(); |
126 | 126 | $list = array_keys($this->_enabled); |
127 | - if ($options['modParams'] !== false && !isset($params[$options['modParams']])) { |
|
127 | + if ($options['modParams'] !== false && ! isset($params[$options['modParams']])) { |
|
128 | 128 | throw new CakeException(__d('cake_dev', 'Cannot use modParams with indexes that do not exist.')); |
129 | 129 | } |
130 | 130 | $result = null; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | (is_array($options['breakOn']) && in_array($result, $options['breakOn'], true))) |
139 | 139 | ) { |
140 | 140 | return $result; |
141 | - } elseif ($options['modParams'] !== false && !in_array($result, array(true, false, null), true)) { |
|
141 | + } elseif ($options['modParams'] !== false && ! in_array($result, array(true, false, null), true)) { |
|
142 | 142 | $params[$options['modParams']] = $result; |
143 | 143 | } |
144 | 144 | } |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function enable($name, $prioritize = true) { |
182 | 182 | $enabled = false; |
183 | - foreach ((array)$name as $object) { |
|
184 | - if (isset($this->_loaded[$object]) && !isset($this->_enabled[$object])) { |
|
183 | + foreach ((array) $name as $object) { |
|
184 | + if (isset($this->_loaded[$object]) && ! isset($this->_enabled[$object])) { |
|
185 | 185 | $priority = $this->defaultPriority; |
186 | 186 | if (isset($this->_loaded[$object]->settings['priority'])) { |
187 | 187 | $priority = $this->_loaded[$object]->settings['priority']; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return void |
246 | 246 | */ |
247 | 247 | public function disable($name) { |
248 | - foreach ((array)$name as $object) { |
|
248 | + foreach ((array) $name as $object) { |
|
249 | 249 | unset($this->_enabled[$object]); |
250 | 250 | } |
251 | 251 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Otherwise, returns an array of all enabled objects. |
260 | 260 | */ |
261 | 261 | public function enabled($name = null) { |
262 | - if (!empty($name)) { |
|
262 | + if ( ! empty($name)) { |
|
263 | 263 | return isset($this->_enabled[$name]); |
264 | 264 | } |
265 | 265 | return array_keys($this->_enabled); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * Otherwise, returns an array of all loaded objects. |
288 | 288 | */ |
289 | 289 | public function loaded($name = null) { |
290 | - if (!empty($name)) { |
|
290 | + if ( ! empty($name)) { |
|
291 | 291 | return isset($this->_loaded[$name]); |
292 | 292 | } |
293 | 293 | return array_keys($this->_loaded); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return array Loaded objects |
313 | 313 | */ |
314 | 314 | public function set($name = null, $object = null) { |
315 | - if (!empty($name) && !empty($object)) { |
|
315 | + if ( ! empty($name) && ! empty($object)) { |
|
316 | 316 | list(, $name) = pluginSplit($name); |
317 | 317 | $this->_loaded[$name] = $object; |
318 | 318 | } |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | $normal = array(); |
331 | 331 | foreach ($objects as $i => $objectName) { |
332 | 332 | $options = array(); |
333 | - if (!is_int($i)) { |
|
334 | - $options = (array)$objectName; |
|
333 | + if ( ! is_int($i)) { |
|
334 | + $options = (array) $objectName; |
|
335 | 335 | $objectName = $i; |
336 | 336 | } |
337 | 337 | list(, $name) = pluginSplit($objectName); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * Removes any non-alphanumeric characters. |
36 | 36 | * |
37 | 37 | * @param string $string String to sanitize |
38 | - * @param array $allowed An array of additional characters that are not to be removed. |
|
38 | + * @param string[] $allowed An array of additional characters that are not to be removed. |
|
39 | 39 | * @return string Sanitized string |
40 | 40 | */ |
41 | 41 | public static function paranoid($string, $allowed = array()) { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * |
185 | 185 | * Will remove all `<b>`, `<p>`, and `<div>` tags from the $dirty string. |
186 | 186 | * |
187 | - * @param string $str,... String to sanitize |
|
187 | + * @param string $str |
|
188 | 188 | * @return string sanitized String |
189 | 189 | */ |
190 | 190 | public static function stripTags($str) { |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function paranoid($string, $allowed = array()) { |
42 | 42 | $allow = null; |
43 | - if (!empty($allowed)) { |
|
43 | + if ( ! empty($allowed)) { |
|
44 | 44 | foreach ($allowed as $value) { |
45 | 45 | $allow .= "\\$value"; |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - if (!is_array($string)) { |
|
49 | + if ( ! is_array($string)) { |
|
50 | 50 | return preg_replace("/[^{$allow}a-zA-Z0-9]/", '', $string); |
51 | 51 | } |
52 | 52 | |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public static function stripScripts($str) { |
156 | 156 | $regex = |
157 | - '/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|' . |
|
158 | - '<img[^>]*>|style="[^"]*")|' . |
|
159 | - '<script[^>]*>.*?<\/script>|' . |
|
160 | - '<style[^>]*>.*?<\/style>|' . |
|
157 | + '/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|'. |
|
158 | + '<img[^>]*>|style="[^"]*")|'. |
|
159 | + '<script[^>]*>.*?<\/script>|'. |
|
160 | + '<style[^>]*>.*?<\/style>|'. |
|
161 | 161 | '<!--.*?-->/is'; |
162 | 162 | return preg_replace($regex, '', $str); |
163 | 163 | } |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | $params = func_get_args(); |
192 | 192 | |
193 | 193 | for ($i = 1, $count = count($params); $i < $count; $i++) { |
194 | - $str = preg_replace('/<' . $params[$i] . '\b[^>]*>/i', '', $str); |
|
195 | - $str = preg_replace('/<\/' . $params[$i] . '[^>]*>/i', '', $str); |
|
194 | + $str = preg_replace('/<'.$params[$i].'\b[^>]*>/i', '', $str); |
|
195 | + $str = preg_replace('/<\/'.$params[$i].'[^>]*>/i', '', $str); |
|
196 | 196 | } |
197 | 197 | return $str; |
198 | 198 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | return $data; |
221 | 221 | } |
222 | 222 | |
223 | - if (!is_array($options)) { |
|
223 | + if ( ! is_array($options)) { |
|
224 | 224 | $options = array('connection' => $options); |
225 | 225 | } |
226 | 226 |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | * |
929 | 929 | * @param array $results |
930 | 930 | * @param string $key |
931 | - * @return array |
|
931 | + * @return string |
|
932 | 932 | */ |
933 | 933 | protected static function _flatten($results, $key = null) { |
934 | 934 | $stack = array(); |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | * Allows the application of a callback method to elements of an |
997 | 997 | * array extracted by a Set::extract() compatible path. |
998 | 998 | * |
999 | - * @param mixed $path Set-compatible path to the array value |
|
999 | + * @param string $path Set-compatible path to the array value |
|
1000 | 1000 | * @param array $data An array of data to extract from & then process with the $callback. |
1001 | 1001 | * @param mixed $callback Callback method to be applied to extracted data. |
1002 | 1002 | * See http://ca2.php.net/manual/en/language.pseudo-types.php#language.types.callback for examples |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | public static function merge($data, $merge = null) { |
47 | 47 | $args = func_get_args(); |
48 | 48 | if (empty($args[1]) && count($args) <= 2) { |
49 | - return (array)$args[0]; |
|
49 | + return (array) $args[0]; |
|
50 | 50 | } |
51 | - if (!is_array($args[0])) { |
|
52 | - $args[0] = (array)$args[0]; |
|
51 | + if ( ! is_array($args[0])) { |
|
52 | + $args[0] = (array) $args[0]; |
|
53 | 53 | } |
54 | 54 | return call_user_func_array('Hash::merge', $args); |
55 | 55 | } |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::pushDiff |
75 | 75 | */ |
76 | 76 | public static function pushDiff($array, $array2) { |
77 | - if (empty($array) && !empty($array2)) { |
|
77 | + if (empty($array) && ! empty($array2)) { |
|
78 | 78 | return $array2; |
79 | 79 | } |
80 | - if (!empty($array) && !empty($array2)) { |
|
80 | + if ( ! empty($array) && ! empty($array2)) { |
|
81 | 81 | foreach ($array2 as $key => $value) { |
82 | - if (!array_key_exists($key, $array)) { |
|
82 | + if ( ! array_key_exists($key, $array)) { |
|
83 | 83 | $array[$key] = $value; |
84 | 84 | } else { |
85 | 85 | if (is_array($value)) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $out[$key] = Set::_map($value, $class); |
145 | 145 | if (is_object($out[$key])) { |
146 | 146 | if ($primary !== true && is_array($value) && Set::countDim($value, true) === 2) { |
147 | - if (!isset($out[$key]->_name_)) { |
|
147 | + if ( ! isset($out[$key]->_name_)) { |
|
148 | 148 | $out[$key]->_name_ = $primary; |
149 | 149 | } |
150 | 150 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } elseif (is_array($value)) { |
153 | 153 | if ($primary === true) { |
154 | 154 | // @codingStandardsIgnoreStart Legacy junk |
155 | - if (!isset($out->_name_)) { |
|
155 | + if ( ! isset($out->_name_)) { |
|
156 | 156 | $out->_name_ = $key; |
157 | 157 | } |
158 | 158 | // @codingStandardsIgnoreEnd |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | $out->{$key2} = Set::_map($value2, true); |
162 | 162 | } |
163 | 163 | } else { |
164 | - if (!is_numeric($key)) { |
|
164 | + if ( ! is_numeric($key)) { |
|
165 | 165 | $out->{$key} = Set::_map($value, true, $key); |
166 | - if (is_object($out->{$key}) && !is_numeric($key)) { |
|
167 | - if (!isset($out->{$key}->_name_)) { |
|
166 | + if (is_object($out->{$key}) && ! is_numeric($key)) { |
|
167 | + if ( ! isset($out->{$key}->_name_)) { |
|
168 | 168 | $out->{$key}->_name_ = $key; |
169 | 169 | } |
170 | 170 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $extracted = array(); |
236 | 236 | $count = count($keys); |
237 | 237 | |
238 | - if (!$count) { |
|
238 | + if ( ! $count) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | } |
329 | 329 | $contexts = $data; |
330 | 330 | $options = array_merge(array('flatten' => true), $options); |
331 | - if (!isset($contexts[0])) { |
|
331 | + if ( ! isset($contexts[0])) { |
|
332 | 332 | $current = current($data); |
333 | - if ((is_array($current) && count($data) < 1) || !is_array($current) || !Set::numeric(array_keys($data))) { |
|
333 | + if ((is_array($current) && count($data) < 1) || ! is_array($current) || ! Set::numeric(array_keys($data))) { |
|
334 | 334 | $contexts = array($data); |
335 | 335 | } |
336 | 336 | } |
@@ -345,19 +345,19 @@ discard block |
||
345 | 345 | } |
346 | 346 | $matches = array(); |
347 | 347 | foreach ($contexts as $key => $context) { |
348 | - if (!isset($context['trace'])) { |
|
348 | + if ( ! isset($context['trace'])) { |
|
349 | 349 | $context = array('trace' => array(null), 'item' => $context, 'key' => $key); |
350 | 350 | } |
351 | 351 | if ($token === '..') { |
352 | 352 | if (count($context['trace']) === 1) { |
353 | 353 | $context['trace'][] = $context['key']; |
354 | 354 | } |
355 | - $parent = implode('/', $context['trace']) . '/.'; |
|
355 | + $parent = implode('/', $context['trace']).'/.'; |
|
356 | 356 | $context['item'] = Set::extract($parent, $data); |
357 | 357 | $context['key'] = array_pop($context['trace']); |
358 | 358 | if (isset($context['trace'][1]) && $context['trace'][1] > 0) { |
359 | 359 | $context['item'] = $context['item'][0]; |
360 | - } elseif (!empty($context['item'][$key])) { |
|
360 | + } elseif ( ! empty($context['item'][$key])) { |
|
361 | 361 | $context['item'] = $context['item'][$key]; |
362 | 362 | } else { |
363 | 363 | $context['item'] = array_shift($context['item']); |
@@ -367,27 +367,27 @@ discard block |
||
367 | 367 | } |
368 | 368 | if ($token === '@*' && is_array($context['item'])) { |
369 | 369 | $matches[] = array( |
370 | - 'trace' => array_merge($context['trace'], (array)$key), |
|
370 | + 'trace' => array_merge($context['trace'], (array) $key), |
|
371 | 371 | 'key' => $key, |
372 | 372 | 'item' => array_keys($context['item']), |
373 | 373 | ); |
374 | 374 | } elseif (is_array($context['item']) |
375 | 375 | && array_key_exists($token, $context['item']) |
376 | - && !(strval($key) === strval($token) && count($tokens) === 1 && $tokens[0] === '.')) { |
|
376 | + && ! (strval($key) === strval($token) && count($tokens) === 1 && $tokens[0] === '.')) { |
|
377 | 377 | $items = $context['item'][$token]; |
378 | - if (!is_array($items)) { |
|
378 | + if ( ! is_array($items)) { |
|
379 | 379 | $items = array($items); |
380 | - } elseif (!isset($items[0])) { |
|
380 | + } elseif ( ! isset($items[0])) { |
|
381 | 381 | $current = current($items); |
382 | 382 | $currentKey = key($items); |
383 | - if (!is_array($current) || (is_array($current) && count($items) <= 1 && !is_numeric($currentKey))) { |
|
383 | + if ( ! is_array($current) || (is_array($current) && count($items) <= 1 && ! is_numeric($currentKey))) { |
|
384 | 384 | $items = array($items); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | 388 | foreach ($items as $key => $item) { |
389 | 389 | $ctext = array($context['key']); |
390 | - if (!is_numeric($key)) { |
|
390 | + if ( ! is_numeric($key)) { |
|
391 | 391 | $ctext[] = $token; |
392 | 392 | $tok = array_shift($tokens); |
393 | 393 | if (isset($items[$tok])) { |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $r = array(); |
444 | 444 | |
445 | 445 | foreach ($matches as $match) { |
446 | - if ((!$options['flatten'] || is_array($match['item'])) && !is_int($match['key'])) { |
|
446 | + if (( ! $options['flatten'] || is_array($match['item'])) && ! is_int($match['key'])) { |
|
447 | 447 | $r[] = array($match['key'] => $match['item']); |
448 | 448 | } else { |
449 | 449 | $r[] = $match['item']; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | return true; |
468 | 468 | } |
469 | 469 | if (is_string($conditions)) { |
470 | - return (bool)Set::extract($conditions, $data); |
|
470 | + return (bool) Set::extract($conditions, $data); |
|
471 | 471 | } |
472 | 472 | foreach ($conditions as $condition) { |
473 | 473 | if ($condition === ':last') { |
@@ -481,20 +481,20 @@ discard block |
||
481 | 481 | } |
482 | 482 | continue; |
483 | 483 | } |
484 | - if (!preg_match('/(.+?)([><!]?[=]|[><])(.*)/', $condition, $match)) { |
|
484 | + if ( ! preg_match('/(.+?)([><!]?[=]|[><])(.*)/', $condition, $match)) { |
|
485 | 485 | if (ctype_digit($condition)) { |
486 | 486 | if ($i != $condition) { |
487 | 487 | return false; |
488 | 488 | } |
489 | 489 | } elseif (preg_match_all('/(?:^[0-9]+|(?<=,)[0-9]+)/', $condition, $matches)) { |
490 | 490 | return in_array($i, $matches[0]); |
491 | - } elseif (!array_key_exists($condition, $data)) { |
|
491 | + } elseif ( ! array_key_exists($condition, $data)) { |
|
492 | 492 | return false; |
493 | 493 | } |
494 | 494 | continue; |
495 | 495 | } |
496 | 496 | list(, $key, $op, $expected) = $match; |
497 | - if (!(isset($data[$key]) || array_key_exists($key, $data))) { |
|
497 | + if ( ! (isset($data[$key]) || array_key_exists($key, $data))) { |
|
498 | 498 | return false; |
499 | 499 | } |
500 | 500 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | return $data; |
542 | 542 | } |
543 | 543 | if (is_object($data)) { |
544 | - if (!($data instanceof ArrayAccess || $data instanceof Traversable)) { |
|
544 | + if ( ! ($data instanceof ArrayAccess || $data instanceof Traversable)) { |
|
545 | 545 | $data = get_object_vars($data); |
546 | 546 | } |
547 | 547 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $pattern = substr($key, 1, -1); |
595 | 595 | |
596 | 596 | foreach ($data as $j => $val) { |
597 | - if (preg_match('/^' . $pattern . '/s', $j) !== 0) { |
|
597 | + if (preg_match('/^'.$pattern.'/s', $j) !== 0) { |
|
598 | 598 | $tmpPath = array_slice($path, $i + 1); |
599 | 599 | if (empty($tmpPath)) { |
600 | 600 | $tmp[$j] = $val; |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | if (empty($path)) { |
653 | 653 | return $data; |
654 | 654 | } |
655 | - if (!is_array($path)) { |
|
655 | + if ( ! is_array($path)) { |
|
656 | 656 | $path = explode('.', $path); |
657 | 657 | } |
658 | 658 | |
@@ -664,10 +664,10 @@ discard block |
||
664 | 664 | return (is_array($data) && array_key_exists($key, $data)); |
665 | 665 | } |
666 | 666 | |
667 | - if (!is_array($data) || !array_key_exists($key, $data)) { |
|
667 | + if ( ! is_array($data) || ! array_key_exists($key, $data)) { |
|
668 | 668 | return false; |
669 | 669 | } |
670 | - $data =& $data[$key]; |
|
670 | + $data = & $data[$key]; |
|
671 | 671 | } |
672 | 672 | return true; |
673 | 673 | } |
@@ -683,10 +683,10 @@ discard block |
||
683 | 683 | */ |
684 | 684 | public static function diff($val1, $val2 = null) { |
685 | 685 | if (empty($val1)) { |
686 | - return (array)$val2; |
|
686 | + return (array) $val2; |
|
687 | 687 | } |
688 | 688 | if (empty($val2)) { |
689 | - return (array)$val1; |
|
689 | + return (array) $val1; |
|
690 | 690 | } |
691 | 691 | $intersection = array_intersect_key($val1, $val2); |
692 | 692 | while (($key = key($intersection)) !== null) { |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | if (is_numeric($key)) { |
718 | 718 | Set::contains($val, $val1); |
719 | 719 | } else { |
720 | - if (!isset($val1[$key]) || $val1[$key] != $val) { |
|
720 | + if ( ! isset($val1[$key]) || $val1[$key] != $val) { |
|
721 | 721 | return false; |
722 | 722 | } |
723 | 723 | } |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | } |
801 | 801 | |
802 | 802 | if (is_object($data)) { |
803 | - if (!($data instanceof ArrayAccess || $data instanceof Traversable)) { |
|
803 | + if ( ! ($data instanceof ArrayAccess || $data instanceof Traversable)) { |
|
804 | 804 | $data = get_object_vars($data); |
805 | 805 | } |
806 | 806 | } |
@@ -815,10 +815,10 @@ discard block |
||
815 | 815 | return array(); |
816 | 816 | } |
817 | 817 | |
818 | - if (!empty($path2) && is_array($path2)) { |
|
818 | + if ( ! empty($path2) && is_array($path2)) { |
|
819 | 819 | $format = array_shift($path2); |
820 | 820 | $vals = Set::format($data, $format, $path2); |
821 | - } elseif (!empty($path2)) { |
|
821 | + } elseif ( ! empty($path2)) { |
|
822 | 822 | $vals = Set::extract($data, $path2); |
823 | 823 | } else { |
824 | 824 | $count = count($keys); |
@@ -829,13 +829,13 @@ discard block |
||
829 | 829 | |
830 | 830 | if ($groupPath) { |
831 | 831 | $group = Set::extract($data, $groupPath); |
832 | - if (!empty($group)) { |
|
832 | + if ( ! empty($group)) { |
|
833 | 833 | $c = count($keys); |
834 | 834 | for ($i = 0; $i < $c; $i++) { |
835 | - if (!isset($group[$i])) { |
|
835 | + if ( ! isset($group[$i])) { |
|
836 | 836 | $group[$i] = 0; |
837 | 837 | } |
838 | - if (!isset($out[$group[$i]])) { |
|
838 | + if ( ! isset($out[$group[$i]])) { |
|
839 | 839 | $out[$group[$i]] = array(); |
840 | 840 | } |
841 | 841 | $out[$group[$i]][$keys[$i]] = $vals[$i]; |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | $new = array(); |
869 | 869 | foreach ($keys as $key => $value) { |
870 | 870 | if (is_array($value)) { |
871 | - $new[$key] = (array)Set::reverse($value); |
|
871 | + $new[$key] = (array) Set::reverse($value); |
|
872 | 872 | } else { |
873 | 873 | // @codingStandardsIgnoreStart Legacy junk |
874 | 874 | if (isset($value->_name_)) { |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | if ($key !== null) { |
938 | 938 | $id = $key; |
939 | 939 | } |
940 | - if (is_array($r) && !empty($r)) { |
|
940 | + if (is_array($r) && ! empty($r)) { |
|
941 | 941 | $stack = array_merge($stack, Set::_flatten($r, $id)); |
942 | 942 | } else { |
943 | 943 | $stack[] = array('id' => $id, 'value' => $r); |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | * @link |
1037 | 1037 | */ |
1038 | 1038 | public static function nest($data, $options = array()) { |
1039 | - if (!$data) { |
|
1039 | + if ( ! $data) { |
|
1040 | 1040 | return $data; |
1041 | 1041 | } |
1042 | 1042 | |
@@ -1060,14 +1060,14 @@ discard block |
||
1060 | 1060 | $parentId = Set::get($result, $parentKeys); |
1061 | 1061 | |
1062 | 1062 | if (isset($idMap[$id][$options['children']])) { |
1063 | - $idMap[$id] = array_merge($result, (array)$idMap[$id]); |
|
1063 | + $idMap[$id] = array_merge($result, (array) $idMap[$id]); |
|
1064 | 1064 | } else { |
1065 | 1065 | $idMap[$id] = array_merge($result, array($options['children'] => array())); |
1066 | 1066 | } |
1067 | - if (!$parentId || !in_array($parentId, $ids)) { |
|
1068 | - $return[] =& $idMap[$id]; |
|
1067 | + if ( ! $parentId || ! in_array($parentId, $ids)) { |
|
1068 | + $return[] = & $idMap[$id]; |
|
1069 | 1069 | } else { |
1070 | - $idMap[$parentId][$options['children']][] =& $idMap[$id]; |
|
1070 | + $idMap[$parentId][$options['children']][] = & $idMap[$id]; |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * Generate a random UUID |
29 | 29 | * |
30 | 30 | * @see http://www.ietf.org/rfc/rfc4122.txt |
31 | - * @return RFC 4122 UUID |
|
31 | + * @return string 4122 UUID |
|
32 | 32 | */ |
33 | 33 | public static function uuid() { |
34 | 34 | $node = env('SERVER_ADDR'); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | if (strpos($node, ':') !== false) { |
37 | 37 | if (substr_count($node, '::')) { |
38 | 38 | $node = str_replace( |
39 | - '::', str_repeat(':0000', 8 - substr_count($node, ':')) . ':', $node |
|
39 | + '::', str_repeat(':0000', 8 - substr_count($node, ':')).':', $node |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | $node = explode(':', $node); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $host = env('HOST'); |
60 | 60 | } |
61 | 61 | |
62 | - if (!empty($host)) { |
|
62 | + if ( ! empty($host)) { |
|
63 | 63 | $ip = gethostbyname($host); |
64 | 64 | |
65 | 65 | if ($ip === $host) { |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | $pid = getmypid(); |
87 | 87 | } |
88 | 88 | |
89 | - if (!$pid || $pid > 65535) { |
|
89 | + if ( ! $pid || $pid > 65535) { |
|
90 | 90 | $pid = mt_rand(0, 0xfff) | 0x4000; |
91 | 91 | } |
92 | 92 | |
93 | 93 | list($timeMid, $timeLow) = explode(' ', microtime()); |
94 | 94 | return sprintf( |
95 | - "%08x-%04x-%04x-%02x%02x-%04x%08x", (int)$timeLow, (int)substr($timeMid, 2) & 0xffff, |
|
95 | + "%08x-%04x-%04x-%02x%02x-%04x%08x", (int) $timeLow, (int) substr($timeMid, 2) & 0xffff, |
|
96 | 96 | mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3f) | 0x80, mt_rand(0, 0xff), $pid, $node |
97 | 97 | ); |
98 | 98 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | if ($tmpOffset !== -1) { |
135 | 135 | $buffer .= substr($data, $offset, ($tmpOffset - $offset)); |
136 | - if (!$depth && $data{$tmpOffset} == $separator) { |
|
136 | + if ( ! $depth && $data{$tmpOffset} == $separator) { |
|
137 | 137 | $results[] = $buffer; |
138 | 138 | $buffer = ''; |
139 | 139 | } else { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } else { |
150 | 150 | if ($data{$tmpOffset} == $leftBound) { |
151 | - if (!$open) { |
|
151 | + if ( ! $open) { |
|
152 | 152 | $depth++; |
153 | 153 | $open = true; |
154 | 154 | } else { |
@@ -158,15 +158,15 @@ discard block |
||
158 | 158 | } |
159 | 159 | $offset = ++$tmpOffset; |
160 | 160 | } else { |
161 | - $results[] = $buffer . substr($data, $offset); |
|
161 | + $results[] = $buffer.substr($data, $offset); |
|
162 | 162 | $offset = $length + 1; |
163 | 163 | } |
164 | 164 | } |
165 | - if (empty($results) && !empty($buffer)) { |
|
165 | + if (empty($results) && ! empty($buffer)) { |
|
166 | 166 | $results[] = $buffer; |
167 | 167 | } |
168 | 168 | |
169 | - if (!empty($results)) { |
|
169 | + if ( ! empty($results)) { |
|
170 | 170 | return array_map('trim', $results); |
171 | 171 | } |
172 | 172 | |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | ); |
201 | 201 | $options += $defaults; |
202 | 202 | $format = $options['format']; |
203 | - $data = (array)$data; |
|
203 | + $data = (array) $data; |
|
204 | 204 | if (empty($data)) { |
205 | 205 | return ($options['clean']) ? String::cleanInsert($str, $options) : $str; |
206 | 206 | } |
207 | 207 | |
208 | - if (!isset($format)) { |
|
208 | + if ( ! isset($format)) { |
|
209 | 209 | $format = sprintf( |
210 | 210 | '/(?<!%s)%s%%s%s/', |
211 | 211 | preg_quote($options['escape'], '/'), |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $str = str_replace($tmpHash, $tmpValue, $str); |
242 | 242 | } |
243 | 243 | |
244 | - if (!isset($options['format']) && isset($options['before'])) { |
|
245 | - $str = str_replace($options['escape'] . $options['before'], $options['before'], $str); |
|
244 | + if ( ! isset($options['format']) && isset($options['before'])) { |
|
245 | + $str = str_replace($options['escape'].$options['before'], $options['before'], $str); |
|
246 | 246 | } |
247 | 247 | return ($options['clean']) ? String::cleanInsert($str, $options) : $str; |
248 | 248 | } |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public static function cleanInsert($str, $options) { |
262 | 262 | $clean = $options['clean']; |
263 | - if (!$clean) { |
|
263 | + if ( ! $clean) { |
|
264 | 264 | return $str; |
265 | 265 | } |
266 | 266 | if ($clean === true) { |
267 | 267 | $clean = array('method' => 'text'); |
268 | 268 | } |
269 | - if (!is_array($clean)) { |
|
269 | + if ( ! is_array($clean)) { |
|
270 | 270 | $clean = array('method' => $options['clean']); |
271 | 271 | } |
272 | 272 | switch ($clean['method']) { |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | } else { |
337 | 337 | $wrapped = trim(chunk_split($text, $options['width'] - 1, "\n")); |
338 | 338 | } |
339 | - if (!empty($options['indent'])) { |
|
339 | + if ( ! empty($options['indent'])) { |
|
340 | 340 | $chunks = explode("\n", $wrapped); |
341 | 341 | for ($i = $options['indentAt'], $len = count($chunks); $i < $len; $i++) { |
342 | - $chunks[$i] = $options['indent'] . $chunks[$i]; |
|
342 | + $chunks[$i] = $options['indent'].$chunks[$i]; |
|
343 | 343 | } |
344 | 344 | $wrapped = implode("\n", $chunks); |
345 | 345 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $with = array(); |
430 | 430 | |
431 | 431 | foreach ($phrase as $key => $segment) { |
432 | - $segment = '(' . preg_quote($segment, '|') . ')'; |
|
432 | + $segment = '('.preg_quote($segment, '|').')'; |
|
433 | 433 | if ($html) { |
434 | 434 | $segment = "(?![^<]+>)$segment(?![^<]+>)"; |
435 | 435 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | return preg_replace($replace, $with, $text); |
442 | 442 | } |
443 | 443 | |
444 | - $phrase = '(' . preg_quote($phrase, '|') . ')'; |
|
444 | + $phrase = '('.preg_quote($phrase, '|').')'; |
|
445 | 445 | if ($html) { |
446 | 446 | $phrase = "(?![^<]+>)$phrase(?![^<]+>)"; |
447 | 447 | } |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $options = array_merge($default, $options); |
484 | 484 | extract($options); |
485 | 485 | |
486 | - if (!function_exists('mb_strlen')) { |
|
486 | + if ( ! function_exists('mb_strlen')) { |
|
487 | 487 | class_exists('Multibyte'); |
488 | 488 | } |
489 | 489 | |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | } |
493 | 493 | |
494 | 494 | $truncate = mb_substr($text, mb_strlen($text) - $length + mb_strlen($ellipsis)); |
495 | - if (!$exact) { |
|
495 | + if ( ! $exact) { |
|
496 | 496 | $spacepos = mb_strpos($truncate, ' '); |
497 | 497 | $truncate = $spacepos === false ? '' : trim(mb_substr($truncate, $spacepos)); |
498 | 498 | } |
499 | 499 | |
500 | - return $ellipsis . $truncate; |
|
500 | + return $ellipsis.$truncate; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -524,13 +524,13 @@ discard block |
||
524 | 524 | ); |
525 | 525 | if (isset($options['ending'])) { |
526 | 526 | $default['ellipsis'] = $options['ending']; |
527 | - } elseif (!empty($options['html']) && Configure::read('App.encoding') === 'UTF-8') { |
|
527 | + } elseif ( ! empty($options['html']) && Configure::read('App.encoding') === 'UTF-8') { |
|
528 | 528 | $default['ellipsis'] = "\xe2\x80\xa6"; |
529 | 529 | } |
530 | 530 | $options = array_merge($default, $options); |
531 | 531 | extract($options); |
532 | 532 | |
533 | - if (!function_exists('mb_strlen')) { |
|
533 | + if ( ! function_exists('mb_strlen')) { |
|
534 | 534 | class_exists('Multibyte'); |
535 | 535 | } |
536 | 536 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
546 | 546 | foreach ($tags as $tag) { |
547 | - if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) { |
|
547 | + if ( ! preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) { |
|
548 | 548 | if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) { |
549 | 549 | array_unshift($openTags, $tag[2]); |
550 | 550 | } elseif (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) { |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | } |
588 | 588 | $truncate = mb_substr($text, 0, $length - mb_strlen($ellipsis)); |
589 | 589 | } |
590 | - if (!$exact) { |
|
590 | + if ( ! $exact) { |
|
591 | 591 | $spacepos = mb_strrpos($truncate, ' '); |
592 | 592 | if ($html) { |
593 | 593 | $truncateCheck = mb_substr($truncate, 0, $spacepos); |
@@ -600,10 +600,10 @@ discard block |
||
600 | 600 | } |
601 | 601 | $bits = mb_substr($truncate, $spacepos); |
602 | 602 | preg_match_all('/<\/([a-z]+)>/', $bits, $droppedTags, PREG_SET_ORDER); |
603 | - if (!empty($droppedTags)) { |
|
604 | - if (!empty($openTags)) { |
|
603 | + if ( ! empty($droppedTags)) { |
|
604 | + if ( ! empty($openTags)) { |
|
605 | 605 | foreach ($droppedTags as $closingTag) { |
606 | - if (!in_array($closingTag[1], $openTags)) { |
|
606 | + if ( ! in_array($closingTag[1], $openTags)) { |
|
607 | 607 | array_unshift($openTags, $closingTag[1]); |
608 | 608 | } |
609 | 609 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | |
621 | 621 | if ($html) { |
622 | 622 | foreach ($openTags as $tag) { |
623 | - $truncate .= '</' . $tag . '>'; |
|
623 | + $truncate .= '</'.$tag.'>'; |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | |
651 | 651 | $pos = mb_strpos(mb_strtolower($text), mb_strtolower($phrase)); |
652 | 652 | if ($pos === false) { |
653 | - return mb_substr($text, 0, $radius) . $ellipsis; |
|
653 | + return mb_substr($text, 0, $radius).$ellipsis; |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | $startPos = $pos - $radius; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | } |
667 | 667 | |
668 | 668 | $excerpt = mb_substr($text, $startPos, $endPos - $startPos); |
669 | - $excerpt = $prepend . $excerpt . $append; |
|
669 | + $excerpt = $prepend.$excerpt.$append; |
|
670 | 670 | |
671 | 671 | return $excerpt; |
672 | 672 | } |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | */ |
683 | 683 | public static function toList($list, $and = 'and', $separator = ', ') { |
684 | 684 | if (count($list) > 1) { |
685 | - return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop($list); |
|
685 | + return implode($separator, array_slice($list, null, -1)).' '.$and.' '.array_pop($list); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | return array_pop($list); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * $check can be passed as an array: |
59 | 59 | * array('check' => 'valueToCheck'); |
60 | 60 | * |
61 | - * @param string|array $check Value to check |
|
61 | + * @param string $check Value to check |
|
62 | 62 | * @return boolean Success |
63 | 63 | */ |
64 | 64 | public static function notEmpty($check) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * Validation of credit card numbers. |
131 | 131 | * Returns true if $check is in the proper credit card format. |
132 | 132 | * |
133 | - * @param string|array $check credit card number to validate |
|
133 | + * @param string $check credit card number to validate |
|
134 | 134 | * @param string|array $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit cards |
135 | 135 | * if an array is used only the values of the array are checked. |
136 | 136 | * Example: array('amex', 'bankcard', 'maestro') |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * Check that value has a valid file extension. |
486 | 486 | * |
487 | 487 | * @param string|array $check Value to check |
488 | - * @param array $extensions file extensions to allow. By default extensions are 'gif', 'jpeg', 'png', 'jpg' |
|
488 | + * @param string[] $extensions file extensions to allow. By default extensions are 'gif', 'jpeg', 'png', 'jpg' |
|
489 | 489 | * @return boolean Success |
490 | 490 | */ |
491 | 491 | public static function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) { |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | /** |
623 | 623 | * Check that a value is a valid phone number. |
624 | 624 | * |
625 | - * @param string|array $check Value to check (string or array) |
|
625 | + * @param string $check Value to check (string or array) |
|
626 | 626 | * @param string $regex Regular expression to use |
627 | 627 | * @param string $country Country code (defaults to 'all') |
628 | 628 | * @return boolean Success |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | /** |
668 | 668 | * Checks that a given value is a valid postal code. |
669 | 669 | * |
670 | - * @param string|array $check Value to check |
|
670 | + * @param string $check Value to check |
|
671 | 671 | * @param string $regex Regular expression to use |
672 | 672 | * @param string $country Country to use for formatting |
673 | 673 | * @return boolean Success |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | /** |
729 | 729 | * Checks that a value is a valid Social Security Number. |
730 | 730 | * |
731 | - * @param string|array $check Value to check |
|
731 | + * @param string $check Value to check |
|
732 | 732 | * @param string $regex Regular expression to use |
733 | 733 | * @param string $country Country |
734 | 734 | * @return boolean Success |
@@ -800,11 +800,11 @@ discard block |
||
800 | 800 | /** |
801 | 801 | * Runs an user-defined validation. |
802 | 802 | * |
803 | - * @param string|array $check value that will be validated in user-defined methods. |
|
804 | - * @param object $object class that holds validation method |
|
803 | + * @param string $check value that will be validated in user-defined methods. |
|
804 | + * @param CustomValidator $object class that holds validation method |
|
805 | 805 | * @param string $method class method name for validation to run |
806 | 806 | * @param array $args arguments to send to method |
807 | - * @return mixed user-defined class class method returns |
|
807 | + * @return boolean user-defined class class method returns |
|
808 | 808 | */ |
809 | 809 | public static function userDefined($check, $object, $method, $args = null) { |
810 | 810 | return call_user_func_array(array($object, $method), array($check, $args)); |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | * Checks the mime type of a file |
920 | 920 | * |
921 | 921 | * @param string|array $check |
922 | - * @param array $mimeTypes to check for |
|
922 | + * @param string[] $mimeTypes to check for |
|
923 | 923 | * @return boolean Success |
924 | 924 | * @throws CakeException when mime type can not be determined. |
925 | 925 | */ |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * |
|
4 | - * |
|
5 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
6 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
7 | - * |
|
8 | - * Licensed under The MIT License |
|
9 | - * For full copyright and license information, please see the LICENSE.txt |
|
10 | - * Redistributions of files must retain the above copyright notice. |
|
11 | - * |
|
12 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
13 | - * @link http://cakephp.org CakePHP(tm) Project |
|
14 | - * @since CakePHP(tm) v 1.2.0.3830 |
|
15 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
16 | - */ |
|
3 | + * |
|
4 | + * |
|
5 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
6 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
7 | + * |
|
8 | + * Licensed under The MIT License |
|
9 | + * For full copyright and license information, please see the LICENSE.txt |
|
10 | + * Redistributions of files must retain the above copyright notice. |
|
11 | + * |
|
12 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
13 | + * @link http://cakephp.org CakePHP(tm) Project |
|
14 | + * @since CakePHP(tm) v 1.2.0.3830 |
|
15 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | App::uses('Multibyte', 'I18n'); |
19 | 19 | App::uses('File', 'Utility'); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | App::uses('CakeNumber', 'Utility'); |
21 | 21 | |
22 | 22 | // Load multibyte if the extension is missing. |
23 | -if (!function_exists('mb_strlen')) { |
|
23 | +if ( ! function_exists('mb_strlen')) { |
|
24 | 24 | class_exists('Multibyte'); |
25 | 25 | } |
26 | 26 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (is_array($check)) { |
124 | 124 | extract(self::_defaults($check)); |
125 | 125 | } |
126 | - return !self::_check($check, '/[^\\s]/'); |
|
126 | + return ! self::_check($check, '/[^\\s]/'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -308,31 +308,31 @@ discard block |
||
308 | 308 | $separator = '([- /.])'; |
309 | 309 | $fourDigitYear = '(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))'; |
310 | 310 | $twoDigitYear = '([0-9]{2})'; |
311 | - $year = '(?:' . $fourDigitYear . '|' . $twoDigitYear . ')'; |
|
311 | + $year = '(?:'.$fourDigitYear.'|'.$twoDigitYear.')'; |
|
312 | 312 | |
313 | - $regex['dmy'] = '%^(?:(?:31(\\/|-|\\.|\\x20)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)' . |
|
314 | - $separator . '(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29' . |
|
315 | - $separator . '0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])' . |
|
316 | - $separator . '(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%'; |
|
313 | + $regex['dmy'] = '%^(?:(?:31(\\/|-|\\.|\\x20)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)'. |
|
314 | + $separator.'(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29'. |
|
315 | + $separator.'0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])'. |
|
316 | + $separator.'(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%'; |
|
317 | 317 | |
318 | - $regex['mdy'] = '%^(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.|\\x20)31)\\1|(?:(?:0?[13-9]|1[0-2])' . |
|
319 | - $separator . '(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:0?2' . $separator . '29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))' . |
|
320 | - $separator . '(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%'; |
|
318 | + $regex['mdy'] = '%^(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.|\\x20)31)\\1|(?:(?:0?[13-9]|1[0-2])'. |
|
319 | + $separator.'(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:0?2'.$separator.'29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))'. |
|
320 | + $separator.'(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%'; |
|
321 | 321 | |
322 | - $regex['ymd'] = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))' . |
|
323 | - $separator . '(?:0?2\\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\\d)?\\d{2})' . |
|
324 | - $separator . '(?:(?:(?:0?[13578]|1[02])\\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9]|1\\d|2[0-8]))))$%'; |
|
322 | + $regex['ymd'] = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))'. |
|
323 | + $separator.'(?:0?2\\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\\d)?\\d{2})'. |
|
324 | + $separator.'(?:(?:(?:0?[13578]|1[02])\\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9]|1\\d|2[0-8]))))$%'; |
|
325 | 325 | |
326 | 326 | $regex['dMy'] = '/^((31(?!\\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\\b|t)t?|Nov)(ember)?)))|((30|29)(?!\\ Feb(ruary)?))|(29(?=\\ Feb(ruary)?\\ (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])\\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)\\ ((1[6-9]|[2-9]\\d)\\d{2})$/'; |
327 | 327 | |
328 | 328 | $regex['Mdy'] = '/^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep)(tember)?|(Nov|Dec)(ember)?)\\ (0?[1-9]|([12]\\d)|30))|(Feb(ruary)?\\ (0?[1-9]|1\\d|2[0-8]|(29(?=,?\\ ((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))))\\,?\\ ((1[6-9]|[2-9]\\d)\\d{2}))$/'; |
329 | 329 | |
330 | - $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)' . |
|
331 | - $separator . '((1[6-9]|[2-9]\\d)\\d{2})$%'; |
|
330 | + $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)'. |
|
331 | + $separator.'((1[6-9]|[2-9]\\d)\\d{2})$%'; |
|
332 | 332 | |
333 | - $regex['my'] = '%^(' . $month . $separator . $year . ')$%'; |
|
334 | - $regex['ym'] = '%^(' . $year . $separator . $month . ')$%'; |
|
335 | - $regex['y'] = '%^(' . $fourDigitYear . ')$%'; |
|
333 | + $regex['my'] = '%^('.$month.$separator.$year.')$%'; |
|
334 | + $regex['ym'] = '%^('.$year.$separator.$month.')$%'; |
|
335 | + $regex['y'] = '%^('.$fourDigitYear.')$%'; |
|
336 | 336 | |
337 | 337 | $format = (is_array($format)) ? array_values($format) : array($format); |
338 | 338 | foreach ($format as $key) { |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | public static function datetime($check, $dateFormat = 'ymd', $regex = null) { |
359 | 359 | $valid = false; |
360 | 360 | $parts = explode(' ', $check); |
361 | - if (!empty($parts) && count($parts) > 1) { |
|
361 | + if ( ! empty($parts) && count($parts) > 1) { |
|
362 | 362 | $time = array_pop($parts); |
363 | 363 | $date = implode(' ', $parts); |
364 | 364 | $valid = self::date($date, $dateFormat, $regex) && self::time($time); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $regex = "/^{$sign}{$dnum}{$exp}$/"; |
421 | 421 | |
422 | 422 | } elseif (is_numeric($places)) { |
423 | - $places = '[0-9]{' . $places . '}'; |
|
423 | + $places = '[0-9]{'.$places.'}'; |
|
424 | 424 | $dnum = "(?:[0-9]*[\.]{$places}|{$lnum}[\.]{$places})"; |
425 | 425 | $regex = "/^{$sign}{$dnum}{$exp}$/"; |
426 | 426 | } |
@@ -451,14 +451,14 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | if ($regex === null) { |
454 | - $regex = '/^[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . self::$_pattern['hostname'] . '$/ui'; |
|
454 | + $regex = '/^[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+)*@'.self::$_pattern['hostname'].'$/ui'; |
|
455 | 455 | } |
456 | 456 | $return = self::_check($check, $regex); |
457 | 457 | if ($deep === false || $deep === null) { |
458 | 458 | return $return; |
459 | 459 | } |
460 | 460 | |
461 | - if ($return === true && preg_match('/@(' . self::$_pattern['hostname'] . ')$/i', $check, $regs)) { |
|
461 | + if ($return === true && preg_match('/@('.self::$_pattern['hostname'].')$/i', $check, $regs)) { |
|
462 | 462 | if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) { |
463 | 463 | return true; |
464 | 464 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if ($type === 'ipv6') { |
518 | 518 | $flags = FILTER_FLAG_IPV6; |
519 | 519 | } |
520 | - return (bool)filter_var($check, FILTER_VALIDATE_IP, array('flags' => $flags)); |
|
520 | + return (bool) filter_var($check, FILTER_VALIDATE_IP, array('flags' => $flags)); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | public static function money($check, $symbolPosition = 'left') { |
553 | 553 | $money = '(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{1,2})?'; |
554 | 554 | if ($symbolPosition === 'right') { |
555 | - $regex = '/^' . $money . '(?<!\x{00a2})\p{Sc}?$/u'; |
|
555 | + $regex = '/^'.$money.'(?<!\x{00a2})\p{Sc}?$/u'; |
|
556 | 556 | } else { |
557 | - $regex = '/^(?!\x{00a2})\p{Sc}?' . $money . '$/u'; |
|
557 | + $regex = '/^(?!\x{00a2})\p{Sc}?'.$money.'$/u'; |
|
558 | 558 | } |
559 | 559 | return self::_check($check, $regex); |
560 | 560 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | public static function multiple($check, $options = array(), $strict = true) { |
577 | 577 | $defaults = array('in' => null, 'max' => null, 'min' => null); |
578 | 578 | $options = array_merge($defaults, $options); |
579 | - $check = array_filter((array)$check); |
|
579 | + $check = array_filter((array) $check); |
|
580 | 580 | if (empty($check)) { |
581 | 581 | return false; |
582 | 582 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | } |
589 | 589 | if ($options['in'] && is_array($options['in'])) { |
590 | 590 | foreach ($check as $val) { |
591 | - if (!in_array($val, $options['in'], $strict)) { |
|
591 | + if ( ! in_array($val, $options['in'], $strict)) { |
|
592 | 592 | return false; |
593 | 593 | } |
594 | 594 | } |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | // Area code 555, X11 is not allowed. |
646 | 646 | $areaCode = '(?![2-9]11)(?!555)([2-9][0-8][0-9])'; |
647 | - $regex .= '(?:\(\s*' . $areaCode . '\s*\)|' . $areaCode . ')'; |
|
647 | + $regex .= '(?:\(\s*'.$areaCode.'\s*\)|'.$areaCode.')'; |
|
648 | 648 | $regex .= '\s*(?:[.-]\s*)?)'; |
649 | 649 | |
650 | 650 | // Exchange and 555-XXXX numbers |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @return boolean Success |
717 | 717 | */ |
718 | 718 | public static function range($check, $lower = null, $upper = null) { |
719 | - if (!is_numeric($check)) { |
|
719 | + if ( ! is_numeric($check)) { |
|
720 | 720 | return false; |
721 | 721 | } |
722 | 722 | if (isset($lower) && isset($upper)) { |
@@ -776,12 +776,12 @@ discard block |
||
776 | 776 | */ |
777 | 777 | public static function url($check, $strict = false) { |
778 | 778 | self::_populateIp(); |
779 | - $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9\p{L}\p{N}]|(%[0-9a-f]{2}))'; |
|
780 | - $regex = '/^(?:(?:https?|ftps?|sftp|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') . |
|
781 | - '(?:' . self::$_pattern['IPv4'] . '|\[' . self::$_pattern['IPv6'] . '\]|' . self::$_pattern['hostname'] . ')(?::[1-9][0-9]{0,4})?' . |
|
782 | - '(?:\/?|\/' . $validChars . '*)?' . |
|
783 | - '(?:\?' . $validChars . '*)?' . |
|
784 | - '(?:#' . $validChars . '*)?$/iu'; |
|
779 | + $validChars = '(['.preg_quote('!"$&\'()*+,-.@_:;=~[]').'\/0-9\p{L}\p{N}]|(%[0-9a-f]{2}))'; |
|
780 | + $regex = '/^(?:(?:https?|ftps?|sftp|file|news|gopher):\/\/)'.( ! empty($strict) ? '' : '?'). |
|
781 | + '(?:'.self::$_pattern['IPv4'].'|\['.self::$_pattern['IPv6'].'\]|'.self::$_pattern['hostname'].')(?::[1-9][0-9]{0,4})?'. |
|
782 | + '(?:\/?|\/'.$validChars.'*)?'. |
|
783 | + '(?:\?'.$validChars.'*)?'. |
|
784 | + '(?:#'.$validChars.'*)?$/iu'; |
|
785 | 785 | return self::_check($check, $regex); |
786 | 786 | } |
787 | 787 | |
@@ -832,16 +832,16 @@ discard block |
||
832 | 832 | * @return mixed Return of Passed method, false on failure |
833 | 833 | */ |
834 | 834 | protected static function _pass($method, $check, $classPrefix) { |
835 | - $className = ucwords($classPrefix) . 'Validation'; |
|
836 | - if (!class_exists($className)) { |
|
835 | + $className = ucwords($classPrefix).'Validation'; |
|
836 | + if ( ! class_exists($className)) { |
|
837 | 837 | trigger_error(__d('cake_dev', 'Could not find %s class, unable to complete validation.', $className), E_USER_WARNING); |
838 | 838 | return false; |
839 | 839 | } |
840 | - if (!method_exists($className, $method)) { |
|
840 | + if ( ! method_exists($className, $method)) { |
|
841 | 841 | trigger_error(__d('cake_dev', 'Method %s does not exist on %s unable to complete validation.', $method, $className), E_USER_WARNING); |
842 | 842 | return false; |
843 | 843 | } |
844 | - $check = (array)$check; |
|
844 | + $check = (array) $check; |
|
845 | 845 | return call_user_func_array(array($className, $method), $check); |
846 | 846 | } |
847 | 847 | |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | if ($deep !== true) { |
898 | 898 | return true; |
899 | 899 | } |
900 | - if ((int)$check === 0) { |
|
900 | + if ((int) $check === 0) { |
|
901 | 901 | return false; |
902 | 902 | } |
903 | 903 | $sum = 0; |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | $check = $check['error']; |
971 | 971 | } |
972 | 972 | |
973 | - return (int)$check === UPLOAD_ERR_OK; |
|
973 | + return (int) $check === UPLOAD_ERR_OK; |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | /** |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | * @return void |
980 | 980 | */ |
981 | 981 | protected static function _populateIp() { |
982 | - if (!isset(self::$_pattern['IPv6'])) { |
|
982 | + if ( ! isset(self::$_pattern['IPv6'])) { |
|
983 | 983 | $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}'; |
984 | 984 | $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})'; |
985 | 985 | $pattern .= '|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})'; |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | |
998 | 998 | self::$_pattern['IPv6'] = $pattern; |
999 | 999 | } |
1000 | - if (!isset(self::$_pattern['IPv4'])) { |
|
1000 | + if ( ! isset(self::$_pattern['IPv4'])) { |
|
1001 | 1001 | $pattern = '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])'; |
1002 | 1002 | self::$_pattern['IPv4'] = $pattern; |
1003 | 1003 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @param boolean $lock Whether this field should be part of the validation |
623 | 623 | * or excluded as part of the unlockedFields. |
624 | 624 | * @param string $field Reference to field to be secured. Should be dot separated to indicate nesting. |
625 | - * @param mixed $value Field value, if value should not be tampered with. |
|
625 | + * @param string $value Field value, if value should not be tampered with. |
|
626 | 626 | * @return mixed|null Not used yet |
627 | 627 | */ |
628 | 628 | protected function _secure($lock, $field = null, $value = null) { |
@@ -1235,7 +1235,7 @@ discard block |
||
1235 | 1235 | * |
1236 | 1236 | * @param string $fieldName |
1237 | 1237 | * @param array $options |
1238 | - * @return boolean|string false or Generated label element |
|
1238 | + * @return false|string false or Generated label element |
|
1239 | 1239 | */ |
1240 | 1240 | protected function _getLabel($fieldName, $options) { |
1241 | 1241 | if ($options['type'] === 'radio') { |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | * - Other options is the same of button method. |
1727 | 1727 | * |
1728 | 1728 | * @param string $title The button's caption. Not automatically HTML encoded |
1729 | - * @param string|array $url URL as string or array |
|
1729 | + * @param string $url URL as string or array |
|
1730 | 1730 | * @param array $options Array of options and HTML attributes. |
1731 | 1731 | * @return string A HTML button tag. |
1732 | 1732 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::postButton |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function __construct(View $View, $settings = array()) { |
135 | 135 | parent::__construct($View, $settings); |
136 | - $this->validationErrors =& $View->validationErrors; |
|
136 | + $this->validationErrors = & $View->validationErrors; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function _getModel($model) { |
147 | 147 | $object = null; |
148 | - if (!$model || $model === 'Model') { |
|
148 | + if ( ! $model || $model === 'Model') { |
|
149 | 149 | return $object; |
150 | 150 | } |
151 | 151 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $plugin = $this->request->params['models'][$model]['plugin']; |
160 | 160 | $plugin .= ($plugin) ? '.' : null; |
161 | 161 | $object = ClassRegistry::init(array( |
162 | - 'class' => $plugin . $this->request->params['models'][$model]['className'], |
|
162 | + 'class' => $plugin.$this->request->params['models'][$model]['className'], |
|
163 | 163 | 'alias' => $model |
164 | 164 | )); |
165 | 165 | } elseif (ClassRegistry::isKeySet($this->defaultModel)) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | $this->_models[$model] = $object; |
175 | - if (!$object) { |
|
175 | + if ( ! $object) { |
|
176 | 176 | return null; |
177 | 177 | } |
178 | 178 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function _introspectModel($model, $key, $field = null) { |
204 | 204 | $object = $this->_getModel($model); |
205 | - if (!$object) { |
|
205 | + if ( ! $object) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | if ($key === 'fields') { |
214 | - if (!isset($this->fieldset[$model]['fields'])) { |
|
214 | + if ( ! isset($this->fieldset[$model]['fields'])) { |
|
215 | 215 | $this->fieldset[$model]['fields'] = $object->schema(); |
216 | 216 | foreach ($object->hasAndBelongsToMany as $alias => $assocData) { |
217 | 217 | $this->fieldset[$object->alias]['fields'][$alias] = array('type' => 'multiple'); |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | return isset($object->hasAndBelongsToMany[$field]) ? array('type' => 'multiple') : null; |
226 | 226 | } |
227 | 227 | |
228 | - if ($key === 'errors' && !isset($this->validationErrors[$model])) { |
|
229 | - $this->validationErrors[$model] =& $object->validationErrors; |
|
228 | + if ($key === 'errors' && ! isset($this->validationErrors[$model])) { |
|
229 | + $this->validationErrors[$model] = & $object->validationErrors; |
|
230 | 230 | return $this->validationErrors[$model]; |
231 | 231 | } elseif ($key === 'errors' && isset($this->validationErrors[$model])) { |
232 | 232 | return $this->validationErrors[$model]; |
233 | 233 | } |
234 | 234 | |
235 | - if ($key === 'validates' && !isset($this->fieldset[$model]['validates'])) { |
|
235 | + if ($key === 'validates' && ! isset($this->fieldset[$model]['validates'])) { |
|
236 | 236 | $validates = array(); |
237 | 237 | foreach (iterator_to_array($object->validator(), true) as $validateField => $validateProperties) { |
238 | 238 | if ($this->_isRequiredField($validateProperties)) { |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | continue; |
270 | 270 | } |
271 | 271 | |
272 | - return !$rule->allowEmpty; |
|
272 | + return ! $rule->allowEmpty; |
|
273 | 273 | } |
274 | 274 | return false; |
275 | 275 | } |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | $errors = array(); |
296 | - if (!empty($entity) && isset($this->validationErrors[$model])) { |
|
296 | + if ( ! empty($entity) && isset($this->validationErrors[$model])) { |
|
297 | 297 | $errors = $this->validationErrors[$model]; |
298 | 298 | } |
299 | - if (!empty($entity) && empty($errors)) { |
|
299 | + if ( ! empty($entity) && empty($errors)) { |
|
300 | 300 | $errors = $this->_introspectModel($model, 'errors'); |
301 | 301 | } |
302 | 302 | if (empty($errors)) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $model = null; |
342 | 342 | } |
343 | 343 | |
344 | - if (empty($model) && $model !== false && !empty($this->request->params['models'])) { |
|
344 | + if (empty($model) && $model !== false && ! empty($this->request->params['models'])) { |
|
345 | 345 | $model = key($this->request->params['models']); |
346 | 346 | } elseif (empty($model) && empty($this->request->params['models'])) { |
347 | 347 | $model = false; |
@@ -351,15 +351,15 @@ discard block |
||
351 | 351 | $key = null; |
352 | 352 | if ($model !== false) { |
353 | 353 | list($plugin, $model) = pluginSplit($model, true); |
354 | - $key = $this->_introspectModel($plugin . $model, 'key'); |
|
354 | + $key = $this->_introspectModel($plugin.$model, 'key'); |
|
355 | 355 | $this->setEntity($model, true); |
356 | 356 | } |
357 | 357 | |
358 | 358 | if ($model !== false && $key) { |
359 | 359 | $recordExists = ( |
360 | 360 | isset($this->request->data[$model]) && |
361 | - !empty($this->request->data[$model][$key]) && |
|
362 | - !is_array($this->request->data[$model][$key]) |
|
361 | + ! empty($this->request->data[$model][$key]) && |
|
362 | + ! is_array($this->request->data[$model][$key]) |
|
363 | 363 | ); |
364 | 364 | |
365 | 365 | if ($recordExists) { |
@@ -379,18 +379,18 @@ discard block |
||
379 | 379 | $this->inputDefaults($options['inputDefaults']); |
380 | 380 | unset($options['inputDefaults']); |
381 | 381 | |
382 | - if (!isset($options['id'])) { |
|
382 | + if ( ! isset($options['id'])) { |
|
383 | 383 | $domId = isset($options['action']) ? $options['action'] : $this->request['action']; |
384 | - $options['id'] = $this->domId($domId . 'Form'); |
|
384 | + $options['id'] = $this->domId($domId.'Form'); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | if ($options['action'] === null && $options['url'] === null) { |
388 | 388 | $options['action'] = $this->request->here(false); |
389 | 389 | } elseif (empty($options['url']) || is_array($options['url'])) { |
390 | 390 | if (empty($options['url']['controller'])) { |
391 | - if (!empty($model)) { |
|
391 | + if ( ! empty($model)) { |
|
392 | 392 | $options['url']['controller'] = Inflector::underscore(Inflector::pluralize($model)); |
393 | - } elseif (!empty($this->request->params['controller'])) { |
|
393 | + } elseif ( ! empty($this->request->params['controller'])) { |
|
394 | 394 | $options['url']['controller'] = Inflector::underscore($this->request->params['controller']); |
395 | 395 | } |
396 | 396 | } |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | 'controller' => $this->_View->viewPath, |
408 | 408 | 'action' => $options['action'], |
409 | 409 | ); |
410 | - $options['action'] = array_merge($actionDefaults, (array)$options['url']); |
|
411 | - if (empty($options['action'][0]) && !empty($id)) { |
|
410 | + $options['action'] = array_merge($actionDefaults, (array) $options['url']); |
|
411 | + if (empty($options['action'][0]) && ! empty($id)) { |
|
412 | 412 | $options['action'][0] = $id; |
413 | 413 | } |
414 | 414 | } elseif (is_string($options['url'])) { |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | $action = $this->url($options['action']); |
439 | 439 | unset($options['type'], $options['action']); |
440 | 440 | |
441 | - if (!$options['default']) { |
|
442 | - if (!isset($options['onsubmit'])) { |
|
441 | + if ( ! $options['default']) { |
|
442 | + if ( ! isset($options['onsubmit'])) { |
|
443 | 443 | $options['onsubmit'] = ''; |
444 | 444 | } |
445 | - $htmlAttributes['onsubmit'] = $options['onsubmit'] . 'event.returnValue = false; return false;'; |
|
445 | + $htmlAttributes['onsubmit'] = $options['onsubmit'].'event.returnValue = false; return false;'; |
|
446 | 446 | } |
447 | 447 | unset($options['default']); |
448 | 448 | |
449 | - if (!empty($options['encoding'])) { |
|
449 | + if ( ! empty($options['encoding'])) { |
|
450 | 450 | $htmlAttributes['accept-charset'] = $options['encoding']; |
451 | 451 | unset($options['encoding']); |
452 | 452 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $append .= $this->_csrfField(); |
459 | 459 | } |
460 | 460 | |
461 | - if (!empty($append)) { |
|
461 | + if ( ! empty($append)) { |
|
462 | 462 | $append = $this->Html->useTag('hiddenblock', $append); |
463 | 463 | } |
464 | 464 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $this->_introspectModel($model, 'fields'); |
468 | 468 | } |
469 | 469 | $this->_lastAction = $action; |
470 | - return $this->Html->useTag('form', $action, $htmlAttributes) . $append; |
|
470 | + return $this->Html->useTag('form', $action, $htmlAttributes).$append; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -480,13 +480,13 @@ discard block |
||
480 | 480 | if (empty($this->request->params['_Token'])) { |
481 | 481 | return ''; |
482 | 482 | } |
483 | - if (!empty($this->request['_Token']['unlockedFields'])) { |
|
484 | - foreach ((array)$this->request['_Token']['unlockedFields'] as $unlocked) { |
|
483 | + if ( ! empty($this->request['_Token']['unlockedFields'])) { |
|
484 | + foreach ((array) $this->request['_Token']['unlockedFields'] as $unlocked) { |
|
485 | 485 | $this->_unlockedFields[] = $unlocked; |
486 | 486 | } |
487 | 487 | } |
488 | 488 | return $this->hidden('_Token.key', array( |
489 | - 'value' => $this->request->params['_Token']['key'], 'id' => 'Token' . mt_rand(), |
|
489 | + 'value' => $this->request->params['_Token']['key'], 'id' => 'Token'.mt_rand(), |
|
490 | 490 | 'secure' => self::SECURE_SKIP |
491 | 491 | )); |
492 | 492 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | if ( |
532 | 532 | $this->requestType !== 'get' && |
533 | 533 | isset($this->request['_Token']) && |
534 | - !empty($this->request['_Token']) |
|
534 | + ! empty($this->request['_Token']) |
|
535 | 535 | ) { |
536 | 536 | $out .= $this->secure($this->fields); |
537 | 537 | $this->fields = array(); |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::secure |
553 | 553 | */ |
554 | 554 | public function secure($fields = array()) { |
555 | - if (!isset($this->request['_Token']) || empty($this->request['_Token'])) { |
|
555 | + if ( ! isset($this->request['_Token']) || empty($this->request['_Token'])) { |
|
556 | 556 | return; |
557 | 557 | } |
558 | 558 | $locked = array(); |
559 | 559 | $unlockedFields = $this->_unlockedFields; |
560 | 560 | |
561 | 561 | foreach ($fields as $key => $value) { |
562 | - if (!is_int($key)) { |
|
562 | + if ( ! is_int($key)) { |
|
563 | 563 | $locked[$key] = $value; |
564 | 564 | unset($fields[$key]); |
565 | 565 | } |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | $fields = Security::hash(implode('', $hashParts), 'sha1'); |
582 | 582 | |
583 | 583 | $out = $this->hidden('_Token.fields', array( |
584 | - 'value' => urlencode($fields . ':' . $locked), |
|
585 | - 'id' => 'TokenFields' . mt_rand() |
|
584 | + 'value' => urlencode($fields.':'.$locked), |
|
585 | + 'id' => 'TokenFields'.mt_rand() |
|
586 | 586 | )); |
587 | 587 | $out .= $this->hidden('_Token.unlocked', array( |
588 | 588 | 'value' => urlencode($unlocked), |
589 | - 'id' => 'TokenUnlocked' . mt_rand() |
|
589 | + 'id' => 'TokenUnlocked'.mt_rand() |
|
590 | 590 | )); |
591 | 591 | return $this->Html->useTag('hiddenblock', $out); |
592 | 592 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | if ($name === null) { |
606 | 606 | return $this->_unlockedFields; |
607 | 607 | } |
608 | - if (!in_array($name, $this->_unlockedFields)) { |
|
608 | + if ( ! in_array($name, $this->_unlockedFields)) { |
|
609 | 609 | $this->_unlockedFields[] = $name; |
610 | 610 | } |
611 | 611 | $index = array_search($name, $this->fields); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @return mixed|null Not used yet |
627 | 627 | */ |
628 | 628 | protected function _secure($lock, $field = null, $value = null) { |
629 | - if (!$field) { |
|
629 | + if ( ! $field) { |
|
630 | 630 | $field = $this->entity(); |
631 | 631 | } elseif (is_string($field)) { |
632 | 632 | $field = Hash::filter(explode('.', $field)); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $field = preg_replace('/(\.\d+)+$/', '', $field); |
644 | 644 | |
645 | 645 | if ($lock) { |
646 | - if (!in_array($field, $this->fields)) { |
|
646 | + if ( ! in_array($field, $this->fields)) { |
|
647 | 647 | if ($value !== null) { |
648 | 648 | return $this->fields[$field] = $value; |
649 | 649 | } |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function isFieldError($field) { |
665 | 665 | $this->setEntity($field); |
666 | - return (bool)$this->tagIsInvalid(); |
|
666 | + return (bool) $this->tagIsInvalid(); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -871,21 +871,21 @@ discard block |
||
871 | 871 | $modelFields = array(); |
872 | 872 | $model = $this->model(); |
873 | 873 | if ($model) { |
874 | - $modelFields = array_keys((array)$this->_introspectModel($model, 'fields')); |
|
874 | + $modelFields = array_keys((array) $this->_introspectModel($model, 'fields')); |
|
875 | 875 | } |
876 | 876 | if (is_array($fields)) { |
877 | - if (array_key_exists('legend', $fields) && !in_array('legend', $modelFields)) { |
|
877 | + if (array_key_exists('legend', $fields) && ! in_array('legend', $modelFields)) { |
|
878 | 878 | $legend = $fields['legend']; |
879 | 879 | unset($fields['legend']); |
880 | 880 | } |
881 | 881 | |
882 | - if (isset($fields['fieldset']) && !in_array('fieldset', $modelFields)) { |
|
882 | + if (isset($fields['fieldset']) && ! in_array('fieldset', $modelFields)) { |
|
883 | 883 | $fieldset = $fields['fieldset']; |
884 | 884 | unset($fields['fieldset']); |
885 | 885 | } |
886 | 886 | } elseif ($fields !== null) { |
887 | 887 | $fieldset = $legend = $fields; |
888 | - if (!is_bool($fieldset)) { |
|
888 | + if ( ! is_bool($fieldset)) { |
|
889 | 889 | $fieldset = true; |
890 | 890 | } |
891 | 891 | $fields = array(); |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | $out = null; |
919 | 919 | foreach ($fields as $name => $options) { |
920 | - if (is_numeric($name) && !is_array($options)) { |
|
920 | + if (is_numeric($name) && ! is_array($options)) { |
|
921 | 921 | $name = $options; |
922 | 922 | $options = array(); |
923 | 923 | } |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | |
941 | 941 | if ($fieldset) { |
942 | 942 | if ($legend) { |
943 | - $out = $this->Html->useTag('legend', $legend) . $out; |
|
943 | + $out = $this->Html->useTag('legend', $legend).$out; |
|
944 | 944 | } |
945 | 945 | $out = $this->Html->useTag('fieldset', $fieldsetClass, $out); |
946 | 946 | } |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | unset($options['div']); |
989 | 989 | |
990 | 990 | if ($options['type'] === 'radio' && isset($options['options'])) { |
991 | - $radioOptions = (array)$options['options']; |
|
991 | + $radioOptions = (array) $options['options']; |
|
992 | 992 | unset($options['options']); |
993 | 993 | } |
994 | 994 | |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $output .= $out[$element]; |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - if (!empty($divOptions['tag'])) { |
|
1043 | + if ( ! empty($divOptions['tag'])) { |
|
1044 | 1044 | $tag = $divOptions['tag']; |
1045 | 1045 | unset($divOptions['tag']); |
1046 | 1046 | $output = $this->Html->tag($tag, $output, $divOptions); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | $options |
1102 | 1102 | ); |
1103 | 1103 | |
1104 | - if (!isset($options['type'])) { |
|
1104 | + if ( ! isset($options['type'])) { |
|
1105 | 1105 | $options = $this->_magicOptions($options); |
1106 | 1106 | } |
1107 | 1107 | |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | Inflector::pluralize(preg_replace('/_id$/', '', $this->field())) |
1134 | 1134 | ); |
1135 | 1135 | $varOptions = $this->_View->get($varName); |
1136 | - if (!is_array($varOptions)) { |
|
1136 | + if ( ! is_array($varOptions)) { |
|
1137 | 1137 | return $options; |
1138 | 1138 | } |
1139 | 1139 | if ($options['type'] !== 'radio') { |
@@ -1185,7 +1185,7 @@ discard block |
||
1185 | 1185 | if ( |
1186 | 1186 | $options['type'] === 'number' && |
1187 | 1187 | $type === 'float' && |
1188 | - !isset($options['step']) |
|
1188 | + ! isset($options['step']) |
|
1189 | 1189 | ) { |
1190 | 1190 | $options['step'] = 'any'; |
1191 | 1191 | } |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | if ($modelKey === $fieldKey) { |
1199 | 1199 | $options['type'] = 'select'; |
1200 | - if (!isset($options['multiple'])) { |
|
1200 | + if ( ! isset($options['multiple'])) { |
|
1201 | 1201 | $options['multiple'] = 'multiple'; |
1202 | 1202 | } |
1203 | 1203 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | protected function _maxLength($options) { |
1263 | 1263 | $fieldDef = $this->_introspectModel($this->model(), 'fields', $this->field()); |
1264 | 1264 | $autoLength = ( |
1265 | - !array_key_exists('maxlength', $options) && |
|
1265 | + ! array_key_exists('maxlength', $options) && |
|
1266 | 1266 | isset($fieldDef['length']) && |
1267 | 1267 | is_scalar($fieldDef['length']) && |
1268 | 1268 | $options['type'] !== 'select' |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | return array(); |
1287 | 1287 | } |
1288 | 1288 | $div = $this->_extractOption('div', $options, true); |
1289 | - if (!$div) { |
|
1289 | + if ( ! $div) { |
|
1290 | 1290 | return array(); |
1291 | 1291 | } |
1292 | 1292 | |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | ) { |
1304 | 1304 | $divOptions = $this->addClass($divOptions, 'required'); |
1305 | 1305 | } |
1306 | - if (!isset($divOptions['tag'])) { |
|
1306 | + if ( ! isset($divOptions['tag'])) { |
|
1307 | 1307 | $divOptions['tag'] = 'div'; |
1308 | 1308 | } |
1309 | 1309 | return $divOptions; |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | ($options['dateFormat'] === null || $options['dateFormat'] === 'NONE') |
1346 | 1346 | ) { |
1347 | 1347 | $firstInput = 'H'; |
1348 | - } elseif (!empty($options['dateFormat'])) { |
|
1348 | + } elseif ( ! empty($options['dateFormat'])) { |
|
1349 | 1349 | $firstInput = substr($options['dateFormat'], 0, 1); |
1350 | 1350 | } |
1351 | 1351 | switch ($firstInput) { |
@@ -1423,14 +1423,14 @@ discard block |
||
1423 | 1423 | $output = ''; |
1424 | 1424 | |
1425 | 1425 | if ( |
1426 | - (!isset($options['checked']) && !empty($value) && $value == $options['value']) || |
|
1427 | - !empty($options['checked']) |
|
1426 | + ( ! isset($options['checked']) && ! empty($value) && $value == $options['value']) || |
|
1427 | + ! empty($options['checked']) |
|
1428 | 1428 | ) { |
1429 | 1429 | $options['checked'] = 'checked'; |
1430 | 1430 | } |
1431 | 1431 | if ($options['hiddenField']) { |
1432 | 1432 | $hiddenOptions = array( |
1433 | - 'id' => $options['id'] . '_', |
|
1433 | + 'id' => $options['id'].'_', |
|
1434 | 1434 | 'name' => $options['name'], |
1435 | 1435 | 'value' => ($options['hiddenField'] !== true ? $options['hiddenField'] : '0'), |
1436 | 1436 | 'form' => isset($options['form']) ? $options['form'] : null, |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | } |
1444 | 1444 | unset($options['hiddenField']); |
1445 | 1445 | |
1446 | - return $output . $this->Html->useTag('checkbox', $options['name'], array_diff_key($options, array('name' => null))); |
|
1446 | + return $output.$this->Html->useTag('checkbox', $options['name'], array_diff_key($options, array('name' => null))); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | /** |
@@ -1535,10 +1535,10 @@ discard block |
||
1535 | 1535 | $optionsHere['checked'] = 'checked'; |
1536 | 1536 | } |
1537 | 1537 | $isNumeric = is_numeric($optValue); |
1538 | - if ($disabled && (!is_array($disabled) || in_array((string)$optValue, $disabled, !$isNumeric))) { |
|
1538 | + if ($disabled && ( ! is_array($disabled) || in_array((string) $optValue, $disabled, ! $isNumeric))) { |
|
1539 | 1539 | $optionsHere['disabled'] = true; |
1540 | 1540 | } |
1541 | - $tagName = $attributes['id'] . $this->domIdSuffix($optValue); |
|
1541 | + $tagName = $attributes['id'].$this->domIdSuffix($optValue); |
|
1542 | 1542 | |
1543 | 1543 | if ($label) { |
1544 | 1544 | $labelOpts = is_array($label) ? $label : array(); |
@@ -1558,22 +1558,22 @@ discard block |
||
1558 | 1558 | $hidden = null; |
1559 | 1559 | |
1560 | 1560 | if ($hiddenField) { |
1561 | - if (!isset($value) || $value === '') { |
|
1561 | + if ( ! isset($value) || $value === '') { |
|
1562 | 1562 | $hidden = $this->hidden($fieldName, array( |
1563 | 1563 | 'form' => isset($attributes['form']) ? $attributes['form'] : null, |
1564 | - 'id' => $attributes['id'] . '_', |
|
1564 | + 'id' => $attributes['id'].'_', |
|
1565 | 1565 | 'value' => '', |
1566 | 1566 | 'name' => $attributes['name'] |
1567 | 1567 | )); |
1568 | 1568 | } |
1569 | 1569 | } |
1570 | - $out = $hidden . implode($separator, $out); |
|
1570 | + $out = $hidden.implode($separator, $out); |
|
1571 | 1571 | |
1572 | 1572 | if (is_array($between)) { |
1573 | 1573 | $between = ''; |
1574 | 1574 | } |
1575 | 1575 | if ($legend) { |
1576 | - $out = $this->Html->useTag('fieldset', '', $this->Html->useTag('legend', $legend) . $between . $out); |
|
1576 | + $out = $this->Html->useTag('fieldset', '', $this->Html->useTag('legend', $legend).$between.$out); |
|
1577 | 1577 | } |
1578 | 1578 | return $out; |
1579 | 1579 | } |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | if (isset($params[1])) { |
1608 | 1608 | $options = $params[1]; |
1609 | 1609 | } |
1610 | - if (!isset($options['type'])) { |
|
1610 | + if ( ! isset($options['type'])) { |
|
1611 | 1611 | $options['type'] = $method; |
1612 | 1612 | } |
1613 | 1613 | $options = $this->_initInputField($params[0], $options); |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | |
1633 | 1633 | if (array_key_exists('value', $options)) { |
1634 | 1634 | $value = $options['value']; |
1635 | - if (!array_key_exists('escape', $options) || $options['escape'] !== false) { |
|
1635 | + if ( ! array_key_exists('escape', $options) || $options['escape'] !== false) { |
|
1636 | 1636 | $value = h($value); |
1637 | 1637 | } |
1638 | 1638 | unset($options['value']); |
@@ -1659,7 +1659,7 @@ discard block |
||
1659 | 1659 | )); |
1660 | 1660 | |
1661 | 1661 | if ($secure === true) { |
1662 | - $this->_secure(true, null, '' . $options['value']); |
|
1662 | + $this->_secure(true, null, ''.$options['value']); |
|
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | return $this->Html->useTag('hidden', $options['name'], array_diff_key($options, array('name' => null))); |
@@ -1768,11 +1768,11 @@ discard block |
||
1768 | 1768 | */ |
1769 | 1769 | public function postLink($title, $url = null, $options = array(), $confirmMessage = false) { |
1770 | 1770 | $requestMethod = 'POST'; |
1771 | - if (!empty($options['method'])) { |
|
1771 | + if ( ! empty($options['method'])) { |
|
1772 | 1772 | $requestMethod = strtoupper($options['method']); |
1773 | 1773 | unset($options['method']); |
1774 | 1774 | } |
1775 | - if (!empty($options['confirm'])) { |
|
1775 | + if ( ! empty($options['confirm'])) { |
|
1776 | 1776 | $confirmMessage = $options['confirm']; |
1777 | 1777 | unset($options['confirm']); |
1778 | 1778 | } |
@@ -1810,11 +1810,11 @@ discard block |
||
1810 | 1810 | $out .= $this->Html->useTag('formend'); |
1811 | 1811 | |
1812 | 1812 | $url = '#'; |
1813 | - $onClick = 'document.' . $formName . '.submit();'; |
|
1813 | + $onClick = 'document.'.$formName.'.submit();'; |
|
1814 | 1814 | if ($confirmMessage) { |
1815 | 1815 | $options['onclick'] = $this->_confirm($confirmMessage, $onClick, '', $options); |
1816 | 1816 | } else { |
1817 | - $options['onclick'] = $onClick . ' '; |
|
1817 | + $options['onclick'] = $onClick.' '; |
|
1818 | 1818 | } |
1819 | 1819 | $options['onclick'] .= 'event.returnValue = false; return false;'; |
1820 | 1820 | |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::submit |
1852 | 1852 | */ |
1853 | 1853 | public function submit($caption = null, $options = array()) { |
1854 | - if (!is_string($caption) && empty($caption)) { |
|
1854 | + if ( ! is_string($caption) && empty($caption)) { |
|
1855 | 1855 | $caption = __d('cake', 'Submit'); |
1856 | 1856 | } |
1857 | 1857 | $out = null; |
@@ -1891,7 +1891,7 @@ discard block |
||
1891 | 1891 | $unlockFields = array('x', 'y'); |
1892 | 1892 | if (isset($options['name'])) { |
1893 | 1893 | $unlockFields = array( |
1894 | - $options['name'] . '_x', $options['name'] . '_y' |
|
1894 | + $options['name'].'_x', $options['name'].'_y' |
|
1895 | 1895 | ); |
1896 | 1896 | } |
1897 | 1897 | foreach ($unlockFields as $ignore) { |
@@ -1905,7 +1905,7 @@ discard block |
||
1905 | 1905 | } elseif ($isImage) { |
1906 | 1906 | unset($options['type']); |
1907 | 1907 | if ($caption{0} !== '/') { |
1908 | - $url = $this->webroot(Configure::read('App.imageBaseUrl') . $caption); |
|
1908 | + $url = $this->webroot(Configure::read('App.imageBaseUrl').$caption); |
|
1909 | 1909 | } else { |
1910 | 1910 | $url = $this->webroot(trim($caption, '/')); |
1911 | 1911 | } |
@@ -1915,7 +1915,7 @@ discard block |
||
1915 | 1915 | $options['value'] = $caption; |
1916 | 1916 | $tag = $this->Html->useTag('submit', $options); |
1917 | 1917 | } |
1918 | - $out = $before . $tag . $after; |
|
1918 | + $out = $before.$tag.$after; |
|
1919 | 1919 | |
1920 | 1920 | if (isset($divOptions)) { |
1921 | 1921 | $tag = $divOptions['tag']; |
@@ -2008,26 +2008,26 @@ discard block |
||
2008 | 2008 | $id = $this->_extractOption('id', $attributes); |
2009 | 2009 | |
2010 | 2010 | $attributes = $this->_initInputField($fieldName, array_merge( |
2011 | - (array)$attributes, array('secure' => self::SECURE_SKIP) |
|
2011 | + (array) $attributes, array('secure' => self::SECURE_SKIP) |
|
2012 | 2012 | )); |
2013 | 2013 | |
2014 | 2014 | if (is_string($options) && isset($this->_options[$options])) { |
2015 | 2015 | $options = $this->_generateOptions($options); |
2016 | - } elseif (!is_array($options)) { |
|
2016 | + } elseif ( ! is_array($options)) { |
|
2017 | 2017 | $options = array(); |
2018 | 2018 | } |
2019 | 2019 | if (isset($attributes['type'])) { |
2020 | 2020 | unset($attributes['type']); |
2021 | 2021 | } |
2022 | 2022 | |
2023 | - if (!empty($attributes['multiple'])) { |
|
2023 | + if ( ! empty($attributes['multiple'])) { |
|
2024 | 2024 | $style = ($attributes['multiple'] === 'checkbox') ? 'checkbox' : null; |
2025 | 2025 | $template = ($style) ? 'checkboxmultiplestart' : 'selectmultiplestart'; |
2026 | 2026 | $tag = $template; |
2027 | 2027 | if ($hiddenField) { |
2028 | 2028 | $hiddenAttributes = array( |
2029 | 2029 | 'value' => '', |
2030 | - 'id' => $attributes['id'] . ($style ? '' : '_'), |
|
2030 | + 'id' => $attributes['id'].($style ? '' : '_'), |
|
2031 | 2031 | 'secure' => false, |
2032 | 2032 | 'form' => isset($attributes['form']) ? $attributes['form'] : null, |
2033 | 2033 | 'name' => $attributes['name'] |
@@ -2042,21 +2042,21 @@ discard block |
||
2042 | 2042 | unset($attributes['required']); |
2043 | 2043 | } |
2044 | 2044 | |
2045 | - if (!empty($tag) || isset($template)) { |
|
2045 | + if ( ! empty($tag) || isset($template)) { |
|
2046 | 2046 | $hasOptions = (count($options) > 0 || $showEmpty); |
2047 | 2047 | // Secure the field if there are options, or its a multi select. |
2048 | 2048 | // Single selects with no options don't submit, but multiselects do. |
2049 | 2049 | if ( |
2050 | - (!isset($secure) || $secure) && |
|
2050 | + ( ! isset($secure) || $secure) && |
|
2051 | 2051 | empty($attributes['disabled']) && |
2052 | - (!empty($attributes['multiple']) || $hasOptions) |
|
2052 | + ( ! empty($attributes['multiple']) || $hasOptions) |
|
2053 | 2053 | ) { |
2054 | 2054 | $this->_secure(true, $this->_secureFieldName($attributes)); |
2055 | 2055 | } |
2056 | 2056 | $select[] = $this->Html->useTag($tag, $attributes['name'], array_diff_key($attributes, array('name' => null, 'value' => null))); |
2057 | 2057 | } |
2058 | 2058 | $emptyMulti = ( |
2059 | - $showEmpty !== null && $showEmpty !== false && !( |
|
2059 | + $showEmpty !== null && $showEmpty !== false && ! ( |
|
2060 | 2060 | empty($showEmpty) && (isset($attributes) && |
2061 | 2061 | array_key_exists('multiple', $attributes)) |
2062 | 2062 | ) |
@@ -2067,7 +2067,7 @@ discard block |
||
2067 | 2067 | $options = array('' => $showEmpty) + $options; |
2068 | 2068 | } |
2069 | 2069 | |
2070 | - if (!$id) { |
|
2070 | + if ( ! $id) { |
|
2071 | 2071 | $attributes['id'] = Inflector::camelize($attributes['id']); |
2072 | 2072 | } |
2073 | 2073 | |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | $count = 1; |
2114 | 2114 | $suffix = $value; |
2115 | 2115 | while (in_array($suffix, $this->_domIdSuffixes)) { |
2116 | - $suffix = $value . $count++; |
|
2116 | + $suffix = $value.$count++; |
|
2117 | 2117 | } |
2118 | 2118 | $this->_domIdSuffixes[] = $suffix; |
2119 | 2119 | return $suffix; |
@@ -2146,7 +2146,7 @@ discard block |
||
2146 | 2146 | } elseif ($attributes['value'] === false) { |
2147 | 2147 | $attributes['value'] = null; |
2148 | 2148 | } |
2149 | - return $this->select($fieldName . ".day", $this->_generateOptions('day'), $attributes); |
|
2149 | + return $this->select($fieldName.".day", $this->_generateOptions('day'), $attributes); |
|
2150 | 2150 | } |
2151 | 2151 | |
2152 | 2152 | /** |
@@ -2176,10 +2176,10 @@ discard block |
||
2176 | 2176 | $attributes['value'] = $year; |
2177 | 2177 | } else { |
2178 | 2178 | if (empty($value)) { |
2179 | - if (!$attributes['empty'] && !$maxYear) { |
|
2179 | + if ( ! $attributes['empty'] && ! $maxYear) { |
|
2180 | 2180 | $attributes['value'] = 'now'; |
2181 | 2181 | |
2182 | - } elseif (!$attributes['empty'] && $maxYear && !$attributes['value']) { |
|
2182 | + } elseif ( ! $attributes['empty'] && $maxYear && ! $attributes['value']) { |
|
2183 | 2183 | $attributes['value'] = $maxYear; |
2184 | 2184 | } |
2185 | 2185 | } else { |
@@ -2203,7 +2203,7 @@ discard block |
||
2203 | 2203 | unset($attributes['orderYear']); |
2204 | 2204 | } |
2205 | 2205 | return $this->select( |
2206 | - $fieldName . '.year', $this->_generateOptions('year', $yearOptions), |
|
2206 | + $fieldName.'.year', $this->_generateOptions('year', $yearOptions), |
|
2207 | 2207 | $attributes |
2208 | 2208 | ); |
2209 | 2209 | } |
@@ -2238,12 +2238,12 @@ discard block |
||
2238 | 2238 | $attributes['value'] = null; |
2239 | 2239 | } |
2240 | 2240 | $defaults = array('monthNames' => true); |
2241 | - $attributes = array_merge($defaults, (array)$attributes); |
|
2241 | + $attributes = array_merge($defaults, (array) $attributes); |
|
2242 | 2242 | $monthNames = $attributes['monthNames']; |
2243 | 2243 | unset($attributes['monthNames']); |
2244 | 2244 | |
2245 | 2245 | return $this->select( |
2246 | - $fieldName . ".month", |
|
2246 | + $fieldName.".month", |
|
2247 | 2247 | $this->_generateOptions('month', array('monthNames' => $monthNames)), |
2248 | 2248 | $attributes |
2249 | 2249 | ); |
@@ -2283,15 +2283,15 @@ discard block |
||
2283 | 2283 | $attributes['value'] = null; |
2284 | 2284 | } |
2285 | 2285 | |
2286 | - if ($attributes['value'] > 12 && !$format24Hours) { |
|
2286 | + if ($attributes['value'] > 12 && ! $format24Hours) { |
|
2287 | 2287 | $attributes['value'] -= 12; |
2288 | 2288 | } |
2289 | - if (($attributes['value'] === 0 || $attributes['value'] === '00') && !$format24Hours) { |
|
2289 | + if (($attributes['value'] === 0 || $attributes['value'] === '00') && ! $format24Hours) { |
|
2290 | 2290 | $attributes['value'] = 12; |
2291 | 2291 | } |
2292 | 2292 | |
2293 | 2293 | return $this->select( |
2294 | - $fieldName . ".hour", |
|
2294 | + $fieldName.".hour", |
|
2295 | 2295 | $this->_generateOptions($format24Hours ? 'hour24' : 'hour'), |
2296 | 2296 | $attributes |
2297 | 2297 | ); |
@@ -2331,7 +2331,7 @@ discard block |
||
2331 | 2331 | unset($attributes['interval']); |
2332 | 2332 | } |
2333 | 2333 | return $this->select( |
2334 | - $fieldName . ".min", $this->_generateOptions('minute', $minuteOptions), |
|
2334 | + $fieldName.".min", $this->_generateOptions('minute', $minuteOptions), |
|
2335 | 2335 | $attributes |
2336 | 2336 | ); |
2337 | 2337 | } |
@@ -2350,7 +2350,7 @@ discard block |
||
2350 | 2350 | $attributes['value'] = isset($value[$select]) ? $value[$select] : null; |
2351 | 2351 | } else { |
2352 | 2352 | if (empty($value)) { |
2353 | - if (!$attributes['empty']) { |
|
2353 | + if ( ! $attributes['empty']) { |
|
2354 | 2354 | $attributes['value'] = 'now'; |
2355 | 2355 | } |
2356 | 2356 | } else { |
@@ -2384,7 +2384,7 @@ discard block |
||
2384 | 2384 | $attributes['value'] = $meridian; |
2385 | 2385 | } else { |
2386 | 2386 | if (empty($value)) { |
2387 | - if (!$attributes['empty']) { |
|
2387 | + if ( ! $attributes['empty']) { |
|
2388 | 2388 | $attributes['value'] = date('a'); |
2389 | 2389 | } |
2390 | 2390 | } else { |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | $attributes['value'] = null; |
2402 | 2402 | } |
2403 | 2403 | return $this->select( |
2404 | - $fieldName . ".meridian", $this->_generateOptions('meridian'), |
|
2404 | + $fieldName.".meridian", $this->_generateOptions('meridian'), |
|
2405 | 2405 | $attributes |
2406 | 2406 | ); |
2407 | 2407 | } |
@@ -2440,12 +2440,12 @@ discard block |
||
2440 | 2440 | |
2441 | 2441 | if ($attributes['value'] === null && $attributes['empty'] != true) { |
2442 | 2442 | $attributes['value'] = time(); |
2443 | - if (!empty($attributes['maxYear']) && $attributes['maxYear'] < date('Y')) { |
|
2444 | - $attributes['value'] = strtotime(date($attributes['maxYear'] . '-m-d')); |
|
2443 | + if ( ! empty($attributes['maxYear']) && $attributes['maxYear'] < date('Y')) { |
|
2444 | + $attributes['value'] = strtotime(date($attributes['maxYear'].'-m-d')); |
|
2445 | 2445 | } |
2446 | 2446 | } |
2447 | 2447 | |
2448 | - if (!empty($attributes['value'])) { |
|
2448 | + if ( ! empty($attributes['value'])) { |
|
2449 | 2449 | list($year, $month, $day, $hour, $min, $meridian) = $this->_getDateTimeValue( |
2450 | 2450 | $attributes['value'], |
2451 | 2451 | $timeFormat |
@@ -2456,7 +2456,7 @@ discard block |
||
2456 | 2456 | 'minYear' => null, 'maxYear' => null, 'separator' => '-', |
2457 | 2457 | 'interval' => 1, 'monthNames' => true, 'round' => null |
2458 | 2458 | ); |
2459 | - $attributes = array_merge($defaults, (array)$attributes); |
|
2459 | + $attributes = array_merge($defaults, (array) $attributes); |
|
2460 | 2460 | if (isset($attributes['minuteInterval'])) { |
2461 | 2461 | $attributes['interval'] = $attributes['minuteInterval']; |
2462 | 2462 | unset($attributes['minuteInterval']); |
@@ -2469,7 +2469,7 @@ discard block |
||
2469 | 2469 | $round = $attributes['round']; |
2470 | 2470 | $attributes = array_diff_key($attributes, $defaults); |
2471 | 2471 | |
2472 | - if (!empty($interval) && $interval > 1 && !empty($min)) { |
|
2472 | + if ( ! empty($interval) && $interval > 1 && ! empty($min)) { |
|
2473 | 2473 | $current = new DateTime(); |
2474 | 2474 | if ($year !== null) { |
2475 | 2475 | $current->setDate($year, $month, $day); |
@@ -2516,7 +2516,7 @@ discard block |
||
2516 | 2516 | if ($hasId && is_string($attributes['id'])) { |
2517 | 2517 | // build out an array version |
2518 | 2518 | foreach ($keys as $key) { |
2519 | - $attrs[$key]['id'] = $attributes['id'] . $key; |
|
2519 | + $attrs[$key]['id'] = $attributes['id'].$key; |
|
2520 | 2520 | } |
2521 | 2521 | } |
2522 | 2522 | |
@@ -2561,15 +2561,15 @@ discard block |
||
2561 | 2561 | case '24': |
2562 | 2562 | $attrs['Hour']['value'] = $hour; |
2563 | 2563 | $attrs['Minute']['value'] = $min; |
2564 | - $opt .= $this->hour($fieldName, true, $attrs['Hour']) . ':' . |
|
2564 | + $opt .= $this->hour($fieldName, true, $attrs['Hour']).':'. |
|
2565 | 2565 | $this->minute($fieldName, $attrs['Minute']); |
2566 | 2566 | break; |
2567 | 2567 | case '12': |
2568 | 2568 | $attrs['Hour']['value'] = $hour; |
2569 | 2569 | $attrs['Minute']['value'] = $min; |
2570 | 2570 | $attrs['Meridian']['value'] = $meridian; |
2571 | - $opt .= $this->hour($fieldName, false, $attrs['Hour']) . ':' . |
|
2572 | - $this->minute($fieldName, $attrs['Minute']) . ' ' . |
|
2571 | + $opt .= $this->hour($fieldName, false, $attrs['Hour']).':'. |
|
2572 | + $this->minute($fieldName, $attrs['Minute']).' '. |
|
2573 | 2573 | $this->meridian($fieldName, $attrs['Meridian']); |
2574 | 2574 | break; |
2575 | 2575 | } |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | $days[1] = $value; |
2609 | 2609 | } |
2610 | 2610 | |
2611 | - if (!empty($timeFormat)) { |
|
2611 | + if ( ! empty($timeFormat)) { |
|
2612 | 2612 | $time = explode(':', $days[1]); |
2613 | 2613 | |
2614 | 2614 | if ($time[0] >= 12) { |
@@ -2640,7 +2640,7 @@ discard block |
||
2640 | 2640 | $options = 0; |
2641 | 2641 | } |
2642 | 2642 | |
2643 | - if (!empty($field)) { |
|
2643 | + if ( ! empty($field)) { |
|
2644 | 2644 | $this->setEntity($field); |
2645 | 2645 | } |
2646 | 2646 | |
@@ -2653,7 +2653,7 @@ discard block |
||
2653 | 2653 | $name = $model === $entity[0] && isset($entity[1]) ? $entity[1] : $entity[0]; |
2654 | 2654 | $last = $entity[count($entity) - 1]; |
2655 | 2655 | if (in_array($last, $this->_fieldSuffixes)) { |
2656 | - $name .= '[' . $last . ']'; |
|
2656 | + $name .= '['.$last.']'; |
|
2657 | 2657 | } |
2658 | 2658 | |
2659 | 2659 | if (is_array($options)) { |
@@ -2686,8 +2686,8 @@ discard block |
||
2686 | 2686 | $this->_domIdSuffixes = array(); |
2687 | 2687 | foreach ($elements as $name => $title) { |
2688 | 2688 | $htmlOptions = array(); |
2689 | - if (is_array($title) && (!isset($title['name']) || !isset($title['value']))) { |
|
2690 | - if (!empty($name)) { |
|
2689 | + if (is_array($title) && ( ! isset($title['name']) || ! isset($title['value']))) { |
|
2690 | + if ( ! empty($name)) { |
|
2691 | 2691 | if ($attributes['style'] === 'checkbox') { |
2692 | 2692 | $select[] = $this->Html->useTag('fieldsetend'); |
2693 | 2693 | } else { |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | $title, $parents, $showParents, $attributes |
2700 | 2700 | )); |
2701 | 2701 | |
2702 | - if (!empty($name)) { |
|
2702 | + if ( ! empty($name)) { |
|
2703 | 2703 | $name = $attributes['escape'] ? h($name) : $name; |
2704 | 2704 | if ($attributes['style'] === 'checkbox') { |
2705 | 2705 | $select[] = $this->Html->useTag('fieldsetstart', $name); |
@@ -2718,8 +2718,8 @@ discard block |
||
2718 | 2718 | if ($name !== null) { |
2719 | 2719 | $isNumeric = is_numeric($name); |
2720 | 2720 | if ( |
2721 | - (!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) || |
|
2722 | - ($selectedIsArray && in_array((string)$name, $attributes['value'], !$isNumeric)) |
|
2721 | + ( ! $selectedIsArray && ! $selectedIsEmpty && (string) $attributes['value'] == (string) $name) || |
|
2722 | + ($selectedIsArray && in_array((string) $name, $attributes['value'], ! $isNumeric)) |
|
2723 | 2723 | ) { |
2724 | 2724 | if ($attributes['style'] === 'checkbox') { |
2725 | 2725 | $htmlOptions['checked'] = true; |
@@ -2728,10 +2728,10 @@ discard block |
||
2728 | 2728 | } |
2729 | 2729 | } |
2730 | 2730 | |
2731 | - if ($showParents || (!in_array($title, $parents))) { |
|
2731 | + if ($showParents || ( ! in_array($title, $parents))) { |
|
2732 | 2732 | $title = ($attributes['escape']) ? h($title) : $title; |
2733 | 2733 | |
2734 | - $hasDisabled = !empty($attributes['disabled']); |
|
2734 | + $hasDisabled = ! empty($attributes['disabled']); |
|
2735 | 2735 | if ($hasDisabled) { |
2736 | 2736 | $disabledIsArray = is_array($attributes['disabled']); |
2737 | 2737 | if ($disabledIsArray) { |
@@ -2741,18 +2741,18 @@ discard block |
||
2741 | 2741 | if ( |
2742 | 2742 | $hasDisabled && |
2743 | 2743 | $disabledIsArray && |
2744 | - in_array((string)$name, $attributes['disabled'], !$disabledIsNumeric) |
|
2744 | + in_array((string) $name, $attributes['disabled'], ! $disabledIsNumeric) |
|
2745 | 2745 | ) { |
2746 | 2746 | $htmlOptions['disabled'] = 'disabled'; |
2747 | 2747 | } |
2748 | - if ($hasDisabled && !$disabledIsArray && $attributes['style'] === 'checkbox') { |
|
2748 | + if ($hasDisabled && ! $disabledIsArray && $attributes['style'] === 'checkbox') { |
|
2749 | 2749 | $htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled']; |
2750 | 2750 | } |
2751 | 2751 | |
2752 | 2752 | if ($attributes['style'] === 'checkbox') { |
2753 | 2753 | $htmlOptions['value'] = $name; |
2754 | 2754 | |
2755 | - $tagName = $attributes['id'] . $this->domIdSuffix($name); |
|
2755 | + $tagName = $attributes['id'].$this->domIdSuffix($name); |
|
2756 | 2756 | $htmlOptions['id'] = $tagName; |
2757 | 2757 | $label = array('for' => $tagName); |
2758 | 2758 | |
@@ -2765,11 +2765,11 @@ discard block |
||
2765 | 2765 | if (empty($attributes['class'])) { |
2766 | 2766 | $attributes['class'] = 'checkbox'; |
2767 | 2767 | } elseif ($attributes['class'] === 'form-error') { |
2768 | - $attributes['class'] = 'checkbox ' . $attributes['class']; |
|
2768 | + $attributes['class'] = 'checkbox '.$attributes['class']; |
|
2769 | 2769 | } |
2770 | 2770 | $label = $this->label(null, $title, $label); |
2771 | 2771 | $item = $this->Html->useTag('checkboxmultiple', $name, $htmlOptions); |
2772 | - $select[] = $this->Html->div($attributes['class'], $item . $label); |
|
2772 | + $select[] = $this->Html->div($attributes['class'], $item.$label); |
|
2773 | 2773 | } else { |
2774 | 2774 | if ($attributes['escape']) { |
2775 | 2775 | $name = h($name); |
@@ -2791,7 +2791,7 @@ discard block |
||
2791 | 2791 | * @return array |
2792 | 2792 | */ |
2793 | 2793 | protected function _generateOptions($name, $options = array()) { |
2794 | - if (!empty($this->options[$name])) { |
|
2794 | + if ( ! empty($this->options[$name])) { |
|
2795 | 2795 | return $this->options[$name]; |
2796 | 2796 | } |
2797 | 2797 | $data = array(); |
@@ -2862,20 +2862,20 @@ discard block |
||
2862 | 2862 | case 'year': |
2863 | 2863 | $current = intval(date('Y')); |
2864 | 2864 | |
2865 | - $min = !isset($options['min']) ? $current - 20 : (int)$options['min']; |
|
2866 | - $max = !isset($options['max']) ? $current + 20 : (int)$options['max']; |
|
2865 | + $min = ! isset($options['min']) ? $current - 20 : (int) $options['min']; |
|
2866 | + $max = ! isset($options['max']) ? $current + 20 : (int) $options['max']; |
|
2867 | 2867 | |
2868 | 2868 | if ($min > $max) { |
2869 | 2869 | list($min, $max) = array($max, $min); |
2870 | 2870 | } |
2871 | 2871 | if ( |
2872 | - !empty($options['value']) && |
|
2873 | - (int)$options['value'] < $min && |
|
2874 | - (int)$options['value'] > 0 |
|
2872 | + ! empty($options['value']) && |
|
2873 | + (int) $options['value'] < $min && |
|
2874 | + (int) $options['value'] > 0 |
|
2875 | 2875 | ) { |
2876 | - $min = (int)$options['value']; |
|
2877 | - } elseif (!empty($options['value']) && (int)$options['value'] > $max) { |
|
2878 | - $max = (int)$options['value']; |
|
2876 | + $min = (int) $options['value']; |
|
2877 | + } elseif ( ! empty($options['value']) && (int) $options['value'] > $max) { |
|
2878 | + $max = (int) $options['value']; |
|
2879 | 2879 | } |
2880 | 2880 | |
2881 | 2881 | for ($i = $min; $i <= $max; $i++) { |
@@ -2912,7 +2912,7 @@ discard block |
||
2912 | 2912 | $secure = $options['secure']; |
2913 | 2913 | unset($options['secure']); |
2914 | 2914 | } else { |
2915 | - $secure = (isset($this->request['_Token']) && !empty($this->request['_Token'])); |
|
2915 | + $secure = (isset($this->request['_Token']) && ! empty($this->request['_Token'])); |
|
2916 | 2916 | } |
2917 | 2917 | |
2918 | 2918 | $disabledIndex = array_search('disabled', $options, true); |
@@ -2926,11 +2926,11 @@ discard block |
||
2926 | 2926 | $result = $this->addClass($result, 'form-error'); |
2927 | 2927 | } |
2928 | 2928 | |
2929 | - if (!empty($result['disabled'])) { |
|
2929 | + if ( ! empty($result['disabled'])) { |
|
2930 | 2930 | return $result; |
2931 | 2931 | } |
2932 | 2932 | |
2933 | - if (!isset($result['required']) && |
|
2933 | + if ( ! isset($result['required']) && |
|
2934 | 2934 | $this->_introspectModel($this->model(), 'validates', $this->field()) |
2935 | 2935 | ) { |
2936 | 2936 | $result['required'] = true; |
@@ -2973,9 +2973,9 @@ discard block |
||
2973 | 2973 | public function inputDefaults($defaults = null, $merge = false) { |
2974 | 2974 | if ($defaults !== null) { |
2975 | 2975 | if ($merge) { |
2976 | - $this->_inputDefaults = array_merge($this->_inputDefaults, (array)$defaults); |
|
2976 | + $this->_inputDefaults = array_merge($this->_inputDefaults, (array) $defaults); |
|
2977 | 2977 | } else { |
2978 | - $this->_inputDefaults = (array)$defaults; |
|
2978 | + $this->_inputDefaults = (array) $defaults; |
|
2979 | 2979 | } |
2980 | 2980 | } |
2981 | 2981 | return $this->_inputDefaults; |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | * - `plugin` False value will prevent parsing path as a plugin |
511 | 511 | * - `fullBase` If true the url will get a full address for the script file. |
512 | 512 | * |
513 | - * @param string|array $url String or array of javascript files to include |
|
513 | + * @param string $url String or array of javascript files to include |
|
514 | 514 | * @param array|boolean $options Array of options, and html attributes see above. If boolean sets $options['inline'] = value |
515 | - * @return mixed String of `<script />` tags or null if $inline is false or if $once is true and the file has been |
|
515 | + * @return string|null String of `<script />` tags or null if $inline is false or if $once is true and the file has been |
|
516 | 516 | * included before. |
517 | 517 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::script |
518 | 518 | */ |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * @param string $script The script to wrap |
574 | 574 | * @param array $options The options to use. Options not listed above will be |
575 | 575 | * treated as HTML attributes. |
576 | - * @return mixed string or null depending on the value of `$options['block']` |
|
576 | + * @return string|null string or null depending on the value of `$options['block']` |
|
577 | 577 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::scriptBlock |
578 | 578 | */ |
579 | 579 | public function scriptBlock($script, $options = array()) { |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * Generates a script tag inline or in `$scripts_for_layout` depending on the settings |
622 | 622 | * used when the scriptBlock was started |
623 | 623 | * |
624 | - * @return mixed depending on the settings of scriptStart() either a script tag or null |
|
624 | + * @return string|null depending on the settings of scriptStart() either a script tag or null |
|
625 | 625 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::scriptEnd |
626 | 626 | */ |
627 | 627 | public function scriptEnd() { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } else { |
164 | 164 | $this->response = new CakeResponse(); |
165 | 165 | } |
166 | - if (!empty($settings['configFile'])) { |
|
166 | + if ( ! empty($settings['configFile'])) { |
|
167 | 167 | $this->loadConfig($settings['configFile']); |
168 | 168 | } |
169 | 169 | } |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function meta($type, $url = null, $options = array()) { |
240 | 240 | $options += array('inline' => true, 'block' => null); |
241 | - if (!$options['inline'] && empty($options['block'])) { |
|
241 | + if ( ! $options['inline'] && empty($options['block'])) { |
|
242 | 242 | $options['block'] = __FUNCTION__; |
243 | 243 | } |
244 | 244 | unset($options['inline']); |
245 | 245 | |
246 | - if (!is_array($type)) { |
|
246 | + if ( ! is_array($type)) { |
|
247 | 247 | $types = array( |
248 | 248 | 'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $url), |
249 | 249 | 'atom' => array('type' => 'application/atom+xml', 'title' => $type, 'link' => $url), |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | if (isset($types[$type])) { |
260 | 260 | $type = $types[$type]; |
261 | - } elseif (!isset($options['type']) && $url !== null) { |
|
261 | + } elseif ( ! isset($options['type']) && $url !== null) { |
|
262 | 262 | if (is_array($url) && isset($url['ext'])) { |
263 | 263 | $type = $types[$url['ext']]; |
264 | 264 | } else { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | if (empty($charset)) { |
305 | 305 | $charset = strtolower(Configure::read('App.encoding')); |
306 | 306 | } |
307 | - return sprintf($this->_tags['charset'], (!empty($charset) ? $charset : 'utf-8')); |
|
307 | + return sprintf($this->_tags['charset'], ( ! empty($charset) ? $charset : 'utf-8')); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | $title = htmlentities($title, ENT_QUOTES, $escapeTitle); |
354 | 354 | } |
355 | 355 | |
356 | - if (!empty($options['confirm'])) { |
|
356 | + if ( ! empty($options['confirm'])) { |
|
357 | 357 | $confirmMessage = $options['confirm']; |
358 | 358 | unset($options['confirm']); |
359 | 359 | } |
360 | 360 | if ($confirmMessage) { |
361 | 361 | $options['onclick'] = $this->_confirm($confirmMessage, 'return true;', 'return false;', $options); |
362 | - } elseif (isset($options['default']) && !$options['default']) { |
|
362 | + } elseif (isset($options['default']) && ! $options['default']) { |
|
363 | 363 | if (isset($options['onclick'])) { |
364 | 364 | $options['onclick'] .= ' '; |
365 | 365 | } else { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::css |
411 | 411 | */ |
412 | 412 | public function css($path, $options = array()) { |
413 | - if (!is_array($options)) { |
|
413 | + if ( ! is_array($options)) { |
|
414 | 414 | $rel = $options; |
415 | 415 | $options = array(); |
416 | 416 | if ($rel) { |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | $options += array('block' => null, 'inline' => true, 'rel' => 'stylesheet'); |
426 | - if (!$options['inline'] && empty($options['block'])) { |
|
426 | + if ( ! $options['inline'] && empty($options['block'])) { |
|
427 | 427 | $options['block'] = __FUNCTION__; |
428 | 428 | } |
429 | 429 | unset($options['inline']); |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | if (is_array($path)) { |
432 | 432 | $out = ''; |
433 | 433 | foreach ($path as $i) { |
434 | - $out .= "\n\t" . $this->css($i, $options); |
|
434 | + $out .= "\n\t".$this->css($i, $options); |
|
435 | 435 | } |
436 | 436 | if (empty($options['block'])) { |
437 | - return $out . "\n"; |
|
437 | + return $out."\n"; |
|
438 | 438 | } |
439 | 439 | return; |
440 | 440 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | if (Configure::read('Asset.filter.css')) { |
449 | 449 | $pos = strpos($url, Configure::read('App.cssBaseUrl')); |
450 | 450 | if ($pos !== false) { |
451 | - $url = substr($url, 0, $pos) . 'ccss/' . substr($url, $pos + strlen(Configure::read('App.cssBaseUrl'))); |
|
451 | + $url = substr($url, 0, $pos).'ccss/'.substr($url, $pos + strlen(Configure::read('App.cssBaseUrl'))); |
|
452 | 452 | } |
453 | 453 | } |
454 | 454 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $out = sprintf( |
458 | 458 | $this->_tags['style'], |
459 | 459 | $this->_parseAttributes($options, array('rel', 'block'), '', ' '), |
460 | - '@import url(' . $url . ');' |
|
460 | + '@import url('.$url.');' |
|
461 | 461 | ); |
462 | 462 | } else { |
463 | 463 | $out = sprintf( |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | $options['inline'] = $inline; |
523 | 523 | } |
524 | 524 | $options = array_merge(array('block' => null, 'inline' => true, 'once' => true), $options); |
525 | - if (!$options['inline'] && empty($options['block'])) { |
|
525 | + if ( ! $options['inline'] && empty($options['block'])) { |
|
526 | 526 | $options['block'] = __FUNCTION__; |
527 | 527 | } |
528 | 528 | unset($options['inline']); |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | if (is_array($url)) { |
531 | 531 | $out = ''; |
532 | 532 | foreach ($url as $i) { |
533 | - $out .= "\n\t" . $this->script($i, $options); |
|
533 | + $out .= "\n\t".$this->script($i, $options); |
|
534 | 534 | } |
535 | 535 | if (empty($options['block'])) { |
536 | - return $out . "\n"; |
|
536 | + return $out."\n"; |
|
537 | 537 | } |
538 | 538 | return null; |
539 | 539 | } |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | public function scriptBlock($script, $options = array()) { |
580 | 580 | $options += array('type' => 'text/javascript', 'safe' => true, 'inline' => true); |
581 | 581 | if ($options['safe']) { |
582 | - $script = "\n" . '//<![CDATA[' . "\n" . $script . "\n" . '//]]>' . "\n"; |
|
582 | + $script = "\n".'//<![CDATA['."\n".$script."\n".'//]]>'."\n"; |
|
583 | 583 | } |
584 | - if (!$options['inline'] && empty($options['block'])) { |
|
584 | + if ( ! $options['inline'] && empty($options['block'])) { |
|
585 | 585 | $options['block'] = 'script'; |
586 | 586 | } |
587 | 587 | unset($options['inline'], $options['safe']); |
@@ -649,12 +649,12 @@ discard block |
||
649 | 649 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::style |
650 | 650 | */ |
651 | 651 | public function style($data, $oneline = true) { |
652 | - if (!is_array($data)) { |
|
652 | + if ( ! is_array($data)) { |
|
653 | 653 | return $data; |
654 | 654 | } |
655 | 655 | $out = array(); |
656 | 656 | foreach ($data as $key => $value) { |
657 | - $out[] = $key . ':' . $value . ';'; |
|
657 | + $out[] = $key.':'.$value.';'; |
|
658 | 658 | } |
659 | 659 | if ($oneline) { |
660 | 660 | return implode(' ', $out); |
@@ -680,10 +680,10 @@ discard block |
||
680 | 680 | */ |
681 | 681 | public function getCrumbs($separator = '»', $startText = false) { |
682 | 682 | $crumbs = $this->_prepareCrumbs($startText); |
683 | - if (!empty($crumbs)) { |
|
683 | + if ( ! empty($crumbs)) { |
|
684 | 684 | $out = array(); |
685 | 685 | foreach ($crumbs as $crumb) { |
686 | - if (!empty($crumb[1])) { |
|
686 | + if ( ! empty($crumb[1])) { |
|
687 | 687 | $out[] = $this->link($crumb[0], $crumb[1], $crumb[2]); |
688 | 688 | } else { |
689 | 689 | $out[] = $crumb[0]; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function getCrumbList($options = array(), $startText = false) { |
716 | 716 | $defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '', 'escape' => true); |
717 | - $options = array_merge($defaults, (array)$options); |
|
717 | + $options = array_merge($defaults, (array) $options); |
|
718 | 718 | $firstClass = $options['firstClass']; |
719 | 719 | $lastClass = $options['lastClass']; |
720 | 720 | $separator = $options['separator']; |
@@ -736,12 +736,12 @@ discard block |
||
736 | 736 | } else { |
737 | 737 | $elementContent = $this->link($crumb[0], $crumb[1], $crumb[2]); |
738 | 738 | } |
739 | - if (!$which && $firstClass !== false) { |
|
739 | + if ( ! $which && $firstClass !== false) { |
|
740 | 740 | $options['class'] = $firstClass; |
741 | 741 | } elseif ($which == $crumbCount - 1 && $lastClass !== false) { |
742 | 742 | $options['class'] = $lastClass; |
743 | 743 | } |
744 | - if (!empty($separator) && ($crumbCount - $which >= 2)) { |
|
744 | + if ( ! empty($separator) && ($crumbCount - $which >= 2)) { |
|
745 | 745 | $elementContent .= $separator; |
746 | 746 | } |
747 | 747 | $result .= $this->tag('li', $elementContent, $options); |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | protected function _prepareCrumbs($startText, $escape = true) { |
760 | 760 | $crumbs = $this->_crumbs; |
761 | 761 | if ($startText) { |
762 | - if (!is_array($startText)) { |
|
762 | + if ( ! is_array($startText)) { |
|
763 | 763 | $startText = array( |
764 | 764 | 'url' => '/', |
765 | 765 | 'text' => $startText |
@@ -804,12 +804,12 @@ discard block |
||
804 | 804 | $path = $this->assetUrl($path, $options + array('pathPrefix' => Configure::read('App.imageBaseUrl'))); |
805 | 805 | $options = array_diff_key($options, array('fullBase' => null, 'pathPrefix' => null)); |
806 | 806 | |
807 | - if (!isset($options['alt'])) { |
|
807 | + if ( ! isset($options['alt'])) { |
|
808 | 808 | $options['alt'] = ''; |
809 | 809 | } |
810 | 810 | |
811 | 811 | $url = false; |
812 | - if (!empty($options['url'])) { |
|
812 | + if ( ! empty($options['url'])) { |
|
813 | 813 | $url = $options['url']; |
814 | 814 | unset($options['url']); |
815 | 815 | } |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | public function tableHeaders($names, $trOptions = null, $thOptions = null) { |
836 | 836 | $out = array(); |
837 | 837 | foreach ($names as $arg) { |
838 | - if (!is_array($arg)) { |
|
838 | + if ( ! is_array($arg)) { |
|
839 | 839 | $out[] = sprintf($this->_tags['tableheader'], $this->_parseAttributes($thOptions), $arg); |
840 | 840 | } else { |
841 | 841 | $out[] = sprintf($this->_tags['tableheader'], $this->_parseAttributes(current($arg)), key($arg)); |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::tableCells |
858 | 858 | */ |
859 | 859 | public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $useCount = false, $continueOddEven = true) { |
860 | - if (empty($data[0]) || !is_array($data[0])) { |
|
860 | + if (empty($data[0]) || ! is_array($data[0])) { |
|
861 | 861 | $data = array($data); |
862 | 862 | } |
863 | 863 | |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | $cellOptions = $cell[1]; |
889 | 889 | $cell = $cell[0]; |
890 | 890 | } elseif ($useCount) { |
891 | - $cellOptions['class'] = 'column-' . ++$i; |
|
891 | + $cellOptions['class'] = 'column-'.++$i; |
|
892 | 892 | } |
893 | 893 | $cellsOut[] = sprintf($this->_tags['tablecell'], $this->_parseAttributes($cellOptions), $cell); |
894 | 894 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::useTag |
937 | 937 | */ |
938 | 938 | public function useTag($tag) { |
939 | - if (!isset($this->_tags[$tag])) { |
|
939 | + if ( ! isset($this->_tags[$tag])) { |
|
940 | 940 | return ''; |
941 | 941 | } |
942 | 942 | $args = func_get_args(); |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::div |
965 | 965 | */ |
966 | 966 | public function div($class = null, $text = null, $options = array()) { |
967 | - if (!empty($class)) { |
|
967 | + if ( ! empty($class)) { |
|
968 | 968 | $options['class'] = $class; |
969 | 969 | } |
970 | 970 | return $this->tag('div', $text, $options); |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | if (isset($options['escape'])) { |
988 | 988 | $text = h($text); |
989 | 989 | } |
990 | - if ($class && !empty($class)) { |
|
990 | + if ($class && ! empty($class)) { |
|
991 | 991 | $options['class'] = $class; |
992 | 992 | } |
993 | 993 | $tag = 'para'; |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | 'text' => '' |
1057 | 1057 | ); |
1058 | 1058 | |
1059 | - if (!empty($options['tag'])) { |
|
1059 | + if ( ! empty($options['tag'])) { |
|
1060 | 1060 | $tag = $options['tag']; |
1061 | 1061 | } else { |
1062 | 1062 | $tag = null; |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | 'src' => $source, |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | - if (!isset($source['type'])) { |
|
1073 | + if ( ! isset($source['type'])) { |
|
1074 | 1074 | $ext = pathinfo($source['src'], PATHINFO_EXTENSION); |
1075 | 1075 | $source['type'] = $this->response->getMimeType($ext); |
1076 | 1076 | } |
@@ -1078,10 +1078,10 @@ discard block |
||
1078 | 1078 | $sourceTags .= $this->useTag('tagselfclosing', 'source', $source); |
1079 | 1079 | } |
1080 | 1080 | unset($source); |
1081 | - $options['text'] = $sourceTags . $options['text']; |
|
1081 | + $options['text'] = $sourceTags.$options['text']; |
|
1082 | 1082 | unset($options['fullBase']); |
1083 | 1083 | } else { |
1084 | - if (empty($path) && !empty($options['src'])) { |
|
1084 | + if (empty($path) && ! empty($options['src'])) { |
|
1085 | 1085 | $path = $options['src']; |
1086 | 1086 | } |
1087 | 1087 | $options['src'] = $this->assetUrl($path, $options); |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | $index = 1; |
1150 | 1150 | foreach ($items as $key => $item) { |
1151 | 1151 | if (is_array($item)) { |
1152 | - $item = $key . $this->nestedList($item, $options, $itemOptions, $tag); |
|
1152 | + $item = $key.$this->nestedList($item, $options, $itemOptions, $tag); |
|
1153 | 1153 | } |
1154 | 1154 | if (isset($itemOptions['even']) && $index % 2 === 0) { |
1155 | 1155 | $itemOptions['class'] = $itemOptions['even']; |
@@ -1204,13 +1204,13 @@ discard block |
||
1204 | 1204 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#changing-the-tags-output-by-htmlhelper |
1205 | 1205 | */ |
1206 | 1206 | public function loadConfig($configFile, $path = null) { |
1207 | - if (!$path) { |
|
1208 | - $path = APP . 'Config' . DS; |
|
1207 | + if ( ! $path) { |
|
1208 | + $path = APP.'Config'.DS; |
|
1209 | 1209 | } |
1210 | 1210 | $file = null; |
1211 | 1211 | $reader = 'php'; |
1212 | 1212 | |
1213 | - if (!is_array($configFile)) { |
|
1213 | + if ( ! is_array($configFile)) { |
|
1214 | 1214 | $file = $configFile; |
1215 | 1215 | } elseif (isset($configFile[0])) { |
1216 | 1216 | $file = $configFile[0]; |
@@ -1221,9 +1221,9 @@ discard block |
||
1221 | 1221 | throw new ConfigureException(__d('cake_dev', 'Cannot load the configuration file. Wrong "configFile" configuration.')); |
1222 | 1222 | } |
1223 | 1223 | |
1224 | - $readerClass = Inflector::camelize($reader) . 'Reader'; |
|
1224 | + $readerClass = Inflector::camelize($reader).'Reader'; |
|
1225 | 1225 | App::uses($readerClass, 'Configure'); |
1226 | - if (!class_exists($readerClass)) { |
|
1226 | + if ( ! class_exists($readerClass)) { |
|
1227 | 1227 | throw new ConfigureException(__d('cake_dev', 'Cannot load the configuration file. Unknown reader.')); |
1228 | 1228 | } |
1229 | 1229 |