diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 1bed46a8d..9ca6c3547 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -477,5 +477,6 @@ class Cache { } return array(); } + } diff --git a/lib/Cake/Cache/CacheEngine.php b/lib/Cake/Cache/CacheEngine.php index 0b0e1b625..8930a195e 100644 --- a/lib/Cake/Cache/CacheEngine.php +++ b/lib/Cake/Cache/CacheEngine.php @@ -53,7 +53,8 @@ abstract class CacheEngine { * Permanently remove all expired and deleted data * @return void */ - public function gc() { } + public function gc() { + } /** * Write value for a key into cache @@ -129,4 +130,5 @@ abstract class CacheEngine { $key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key))); return $key; } + } diff --git a/lib/Cake/Cache/Engine/ApcEngine.php b/lib/Cake/Cache/Engine/ApcEngine.php index a6ca486fd..1ce19a473 100644 --- a/lib/Cake/Cache/Engine/ApcEngine.php +++ b/lib/Cake/Cache/Engine/ApcEngine.php @@ -54,7 +54,7 @@ class ApcEngine extends CacheEngine { } else { $expires = time() + $duration; } - apc_store($key.'_expires', $expires, $duration); + apc_store($key . '_expires', $expires, $duration); return apc_store($key, $value, $duration); } @@ -66,7 +66,7 @@ class ApcEngine extends CacheEngine { */ public function read($key) { $time = time(); - $cachetime = intval(apc_fetch($key.'_expires')); + $cachetime = intval(apc_fetch($key . '_expires')); if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { return false; } diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index 4a1993b92..df472caff 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -299,7 +299,7 @@ class FileEngine extends CacheEngine { } unset($path); - if (!$exists && !chmod($this->_File->getPathname(), (int) $this->settings['mask'])) { + if (!$exists && !chmod($this->_File->getPathname(), (int)$this->settings['mask'])) { trigger_error(__d( 'cake_dev', 'Could not apply permission mask "%s" on cache file "%s"', array($this->_File->getPathname(), $this->settings['mask'])), E_USER_WARNING); @@ -322,4 +322,5 @@ class FileEngine extends CacheEngine { } return true; } + } diff --git a/lib/Cake/Cache/Engine/MemcacheEngine.php b/lib/Cake/Cache/Engine/MemcacheEngine.php index 0cbc84902..0738ed468 100644 --- a/lib/Cake/Cache/Engine/MemcacheEngine.php +++ b/lib/Cake/Cache/Engine/MemcacheEngine.php @@ -234,4 +234,5 @@ class MemcacheEngine extends CacheEngine { } return true; } + } diff --git a/lib/Cake/Cache/Engine/XcacheEngine.php b/lib/Cake/Cache/Engine/XcacheEngine.php index 950d47945..561123f5f 100644 --- a/lib/Cake/Cache/Engine/XcacheEngine.php +++ b/lib/Cake/Cache/Engine/XcacheEngine.php @@ -173,4 +173,5 @@ class XcacheEngine extends CacheEngine { } } } + } diff --git a/lib/Cake/Config/routes.php b/lib/Cake/Config/routes.php index ca26400ca..b5e1fc988 100644 --- a/lib/Cake/Config/routes.php +++ b/lib/Cake/Config/routes.php @@ -45,42 +45,42 @@ * * You can disable the connection of default routes by deleting the require inside APP/Config/routes.php. */ - $prefixes = Router::prefixes(); +$prefixes = Router::prefixes(); - if ($plugins = CakePlugin::loaded()) { - App::uses('PluginShortRoute', 'Routing/Route'); - foreach ($plugins as $key => $value) { - $plugins[$key] = Inflector::underscore($value); - } - $pluginPattern = implode('|', $plugins); - $match = array('plugin' => $pluginPattern); - $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern); - - foreach ($prefixes as $prefix) { - $params = array('prefix' => $prefix, $prefix => true); - $indexParams = $params + array('action' => 'index'); - Router::connect("/{$prefix}/:plugin", $indexParams, $shortParams); - Router::connect("/{$prefix}/:plugin/:controller", $indexParams, $match); - Router::connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match); - } - Router::connect('/:plugin', array('action' => 'index'), $shortParams); - Router::connect('/:plugin/:controller', array('action' => 'index'), $match); - Router::connect('/:plugin/:controller/:action/*', array(), $match); +if ($plugins = CakePlugin::loaded()) { + App::uses('PluginShortRoute', 'Routing/Route'); + foreach ($plugins as $key => $value) { + $plugins[$key] = Inflector::underscore($value); } + $pluginPattern = implode('|', $plugins); + $match = array('plugin' => $pluginPattern); + $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern); foreach ($prefixes as $prefix) { $params = array('prefix' => $prefix, $prefix => true); $indexParams = $params + array('action' => 'index'); - Router::connect("/{$prefix}/:controller", $indexParams); - Router::connect("/{$prefix}/:controller/:action/*", $params); + Router::connect("/{$prefix}/:plugin", $indexParams, $shortParams); + Router::connect("/{$prefix}/:plugin/:controller", $indexParams, $match); + Router::connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match); } - Router::connect('/:controller', array('action' => 'index')); - Router::connect('/:controller/:action/*'); + Router::connect('/:plugin', array('action' => 'index'), $shortParams); + Router::connect('/:plugin/:controller', array('action' => 'index'), $match); + Router::connect('/:plugin/:controller/:action/*', array(), $match); +} - $namedConfig = Router::namedConfig(); - if ($namedConfig['rules'] === false) { - Router::connectNamed(true); - } +foreach ($prefixes as $prefix) { + $params = array('prefix' => $prefix, $prefix => true); + $indexParams = $params + array('action' => 'index'); + Router::connect("/{$prefix}/:controller", $indexParams); + Router::connect("/{$prefix}/:controller/:action/*", $params); +} +Router::connect('/:controller', array('action' => 'index')); +Router::connect('/:controller/:action/*'); - unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match, - $pluginPattern, $plugins, $key, $value); +$namedConfig = Router::namedConfig(); +if ($namedConfig['rules'] === false) { + Router::connectNamed(true); +} + +unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match, + $pluginPattern, $plugins, $key, $value); diff --git a/lib/Cake/Configure/ConfigReaderInterface.php b/lib/Cake/Configure/ConfigReaderInterface.php index 806cac654..498b81dcd 100644 --- a/lib/Cake/Configure/ConfigReaderInterface.php +++ b/lib/Cake/Configure/ConfigReaderInterface.php @@ -19,6 +19,7 @@ * @package Cake.Core */ interface ConfigReaderInterface { + /** * Read method is used for reading configuration information from sources. * These sources can either be static resources like files, or dynamic ones like @@ -28,4 +29,5 @@ interface ConfigReaderInterface { * @return array An array of data to merge into the runtime configuration */ public function read($key); + } diff --git a/lib/Cake/Configure/IniReader.php b/lib/Cake/Configure/IniReader.php index 4efb03744..4664df031 100644 --- a/lib/Cake/Configure/IniReader.php +++ b/lib/Cake/Configure/IniReader.php @@ -134,4 +134,5 @@ class IniReader implements ConfigReaderInterface { } return $values; } + } diff --git a/lib/Cake/Configure/PhpReader.php b/lib/Cake/Configure/PhpReader.php index b6682d910..982826769 100644 --- a/lib/Cake/Configure/PhpReader.php +++ b/lib/Cake/Configure/PhpReader.php @@ -27,6 +27,7 @@ * @package Cake.Configure */ class PhpReader implements ConfigReaderInterface { + /** * The path this reader finds files on. * @@ -86,4 +87,5 @@ class PhpReader implements ConfigReaderInterface { } return $config; } + } diff --git a/lib/Cake/Utility/CakeNumber.php b/lib/Cake/Utility/CakeNumber.php index e78f2485a..91cc4b355 100644 --- a/lib/Cake/Utility/CakeNumber.php +++ b/lib/Cake/Utility/CakeNumber.php @@ -206,15 +206,15 @@ class CakeNumber { } } - $position = $options[$symbolKey.'Position'] != 'after' ? 'before' : 'after'; - $options[$position] = $options[$symbolKey.'Symbol']; + $position = $options[$symbolKey . 'Position'] != 'after' ? 'before' : 'after'; + $options[$position] = $options[$symbolKey . 'Symbol']; $abs = abs($number); $result = self::format($abs, $options); if ($number < 0 ) { if ($options['negative'] == '()') { - $result = '(' . $result .')'; + $result = '(' . $result . ')'; } else { $result = $options['negative'] . $result; } diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index 653dd24d8..911f76a98 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -52,11 +52,11 @@ class CakeTime { */ public function __set($name, $value) { switch ($name) { - case 'niceFormat': - self::${$name} = $value; - break; - default: - break; + case 'niceFormat': + self::${$name} = $value; + break; + default: + break; } } @@ -67,12 +67,12 @@ class CakeTime { */ public function __get($name) { switch ($name) { - case 'niceFormat': - return self::${$name}; - break; - default: - return null; - break; + case 'niceFormat': + return self::${$name}; + break; + default: + return null; + break; } } @@ -140,13 +140,13 @@ class CakeTime { case 'h': $months = __dc('cake', 'abmon', 5); if (is_array($months)) { - return $months[date('n', self::$_time) -1]; + return $months[date('n', self::$_time) - 1]; } return '%b'; case 'B': $months = __dc('cake', 'mon', 5); if (is_array($months)) { - return $months[date('n', self::$_time) -1]; + return $months[date('n', self::$_time) - 1]; } break; case 'n': @@ -202,7 +202,7 @@ class CakeTime { public static function convert($serverTime, $userOffset) { $serverOffset = self::serverOffset(); $gmtTime = $serverTime - $serverOffset; - $userTime = $gmtTime + $userOffset * (60*60); + $userTime = $gmtTime + $userOffset * (60 * 60); return $userTime; } @@ -378,7 +378,7 @@ class CakeTime { */ public static function isThisYear($dateString, $userOffset = null) { $date = self::fromString($dateString, $userOffset); - return date('Y', $date) == date('Y', time()); + return date('Y', $date) == date('Y', time()); } /** @@ -429,16 +429,16 @@ class CakeTime { switch ($date) { case 1: - $date = array($year.'-01-01', $year.'-03-31'); + $date = array($year . '-01-01', $year . '-03-31'); break; case 2: - $date = array($year.'-04-01', $year.'-06-30'); + $date = array($year . '-04-01', $year . '-06-30'); break; case 3: - $date = array($year.'-07-01', $year.'-09-30'); + $date = array($year . '-07-01', $year . '-09-30'); break; case 4: - $date = array($year.'-10-01', $year.'-12-31'); + $date = array($year . '-10-01', $year . '-12-31'); break; } } @@ -485,8 +485,8 @@ class CakeTime { if ($userOffset == 0) { $timezone = '+0000'; } else { - $hours = (int) floor(abs($userOffset)); - $minutes = (int) (fmod(abs($userOffset), $hours) * 60); + $hours = (int)floor(abs($userOffset)); + $minutes = (int)(fmod(abs($userOffset), $hours) * 60); $timezone = ($userOffset < 0 ? '-' : '+') . str_pad($hours, 2, '0', STR_PAD_LEFT) . str_pad($minutes, 2, '0', STR_PAD_LEFT); } return date('D, d M Y H:i:s', $date) . ' ' . $timezone; @@ -795,4 +795,5 @@ class CakeTime { } return $format; } + } diff --git a/lib/Cake/Utility/ClassRegistry.php b/lib/Cake/Utility/ClassRegistry.php index 77abb316e..621cc218c 100644 --- a/lib/Cake/Utility/ClassRegistry.php +++ b/lib/Cake/Utility/ClassRegistry.php @@ -1,11 +1,5 @@ _objects = array(); $_this->_map = array(); } + } diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index a32a8e748..b106b08c7 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -203,7 +203,7 @@ class Debugger { * @deprecated This function is superseded by Debugger::outputError() */ public static function showError($code, $description, $file = null, $line = null, $context = null) { - $_this = Debugger::getInstance(); + $self = Debugger::getInstance(); if (empty($file)) { $file = '[internal]'; @@ -214,8 +214,8 @@ class Debugger { $path = self::trimPath($file); $info = compact('code', 'description', 'file', 'line'); - if (!in_array($info, $_this->errors)) { - $_this->errors[] = $info; + if (!in_array($info, $self->errors)) { + $self->errors[] = $info; } else { return; } @@ -254,7 +254,7 @@ class Debugger { $data = compact( 'level', 'error', 'code', 'description', 'file', 'path', 'line', 'context' ); - echo $_this->outputError($data); + echo $self->outputError($data); if ($error == 'Fatal Error') { exit(); @@ -279,10 +279,10 @@ class Debugger { * @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::trace */ public static function trace($options = array()) { - $_this = Debugger::getInstance(); + $self = Debugger::getInstance(); $defaults = array( 'depth' => 999, - 'format' => $_this->_outputFormat, + 'format' => $self->_outputFormat, 'args' => false, 'start' => 0, 'scope' => null, @@ -330,10 +330,10 @@ class Debugger { } elseif ($options['format'] == 'array') { $back[] = $trace; } else { - if (isset($_this->_templates[$options['format']]['traceLine'])) { - $tpl = $_this->_templates[$options['format']]['traceLine']; + if (isset($self->_templates[$options['format']]['traceLine'])) { + $tpl = $self->_templates[$options['format']]['traceLine']; } else { - $tpl = $_this->_templates['base']['traceLine']; + $tpl = $self->_templates['base']['traceLine']; } $trace['path'] = self::trimPath($trace['file']); $trace['reference'] = $reference; @@ -665,7 +665,7 @@ class Debugger { * in 3.0 */ public function output($format = null, $strings = array()) { - $_this = Debugger::getInstance(); + $self = Debugger::getInstance(); $data = null; if (is_null($format)) { @@ -676,9 +676,9 @@ class Debugger { return Debugger::addFormat($format, $strings); } - if ($format === true && !empty($_this->_data)) { - $data = $_this->_data; - $_this->_data = array(); + if ($format === true && !empty($self->_data)) { + $data = $self->_data; + $self->_data = array(); $format = false; } Debugger::outputAs($format); @@ -810,4 +810,5 @@ class Debugger { trigger_error(__d('cake_dev', 'Please change the value of \'Security.cipherSeed\' in app/Config/core.php to a numeric (digits only) seed value specific to your application'), E_USER_NOTICE); } } + } diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index 7b1b3a500..a9a2f3e7e 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -528,7 +528,7 @@ class File { * @return Folder Current folder * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::Folder */ - public function &Folder() { + public function &folder() { return $this->Folder; } @@ -566,5 +566,5 @@ class File { } return false; } - + } diff --git a/lib/Cake/Utility/Folder.php b/lib/Cake/Utility/Folder.php index d523ea7d3..1690ca450 100644 --- a/lib/Cake/Utility/Folder.php +++ b/lib/Cake/Utility/Folder.php @@ -1,9 +1,5 @@ read($sort); - return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files)); ; + return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files)); } /** @@ -750,7 +746,7 @@ class Folder { $newpath = DS; } - while (($part = array_shift($parts)) !== NULL) { + while (($part = array_shift($parts)) !== null) { if ($part === '.' || $part === '') { continue; } @@ -780,4 +776,5 @@ class Folder { $lastChar = $path[strlen($path) - 1]; return $lastChar === '/' || $lastChar === '\\'; } + } diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 01e9801c7..efbd61f60 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -1,11 +1,5 @@ $val) { + foreach ((array)$arg as $key => $val) { if (!empty($r[$key]) && is_array($r[$key]) && is_array($val)) { $r[$key] = Set::merge($r[$key], $val); } elseif (is_int($key)) { @@ -1214,4 +1214,5 @@ class Set { } return $return; } + } diff --git a/lib/Cake/Utility/String.php b/lib/Cake/Utility/String.php index 47ff74be1..194a95cfa 100644 --- a/lib/Cake/Utility/String.php +++ b/lib/Cake/Utility/String.php @@ -40,13 +40,13 @@ class String { '::', str_repeat(':0000', 8 - substr_count($node, ':')) . ':', $node ); } - $node = explode(':', $node) ; - $ipv6 = '' ; + $node = explode(':', $node); + $ipv6 = ''; foreach ($node as $id) { $ipv6 .= str_pad(base_convert($id, 16, 2), 16, 0, STR_PAD_LEFT); } - $node = base_convert($ipv6, 2, 10); + $node = base_convert($ipv6, 2, 10); if (strlen($node) < 38) { $node = null; @@ -551,7 +551,7 @@ class String { * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::excerpt */ public static function excerpt($text, $phrase, $radius = 100, $ending = '...') { - if (empty($text) or empty($phrase)) { + if (empty($text) || empty($phrase)) { return self::truncate($text, $radius * 2, array('ending' => $ending)); } diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index 24a5052ae..91290b049 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -580,7 +580,8 @@ class Validation { case 'us': case 'all': case 'can': - // includes all NANPA members. see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories + // includes all NANPA members. + // see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories $regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/'; break; } @@ -880,4 +881,5 @@ class Validation { protected static function _reset() { self::$errors = array(); } + }