diff --git a/lib/Cake/Console/Command/ServerShell.php b/lib/Cake/Console/Command/ServerShell.php index 715cd3de5..ae46f6ef8 100644 --- a/lib/Cake/Console/Command/ServerShell.php +++ b/lib/Cake/Console/Command/ServerShell.php @@ -26,11 +26,15 @@ class ServerShell extends AppShell { /** * Default ServerHost + * + * @var string */ const DEFAULT_HOST = 'localhost'; /** * Default ListenPort + * + * @var integer */ const DEFAULT_PORT = 80; diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php index 22e41d9a5..5a4553466 100644 --- a/lib/Cake/Console/Command/Task/ControllerTask.php +++ b/lib/Cake/Console/Command/Task/ControllerTask.php @@ -184,6 +184,10 @@ class ControllerTask extends BakeTask { $wannaUseSession = $this->in( __d('cake_console', "Would you like to use Session flash messages?"), array('y', 'n'), 'y' ); + + if (strtolower($wannaUseSession) === 'y') { + array_push($components, 'Session'); + } } } else { list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods(); diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index e43305fc8..d60bc0e5c 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -504,6 +504,7 @@ class ExtractTask extends AppShell { * @param array $rules the set of validation rules for the field * @param string $file the file name where this validation rule was found * @param string $domain default domain to bind the validations to + * @param string $category the translation category * @return void */ protected function _processValidationRules($field, $rules, $file, $domain, $category = 'LC_MESSAGES') { diff --git a/lib/Cake/Console/ConsoleOutput.php b/lib/Cake/Console/ConsoleOutput.php index ca4037e3c..fa021b565 100644 --- a/lib/Cake/Console/ConsoleOutput.php +++ b/lib/Cake/Console/ConsoleOutput.php @@ -46,21 +46,29 @@ class ConsoleOutput { /** * Raw output constant - no modification of output text. + * + * @var integer */ const RAW = 0; /** * Plain output - tags will be stripped. + * + * @var integer */ const PLAIN = 1; /** * Color output - Convert known tags in to ANSI color escape codes. + * + * @var integer */ const COLOR = 2; /** * Constant for a newline. + * + * @var string */ const LF = PHP_EOL; diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index e595ea2c8..b6a6cbcf2 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -33,16 +33,22 @@ class Shell extends Object { /** * Output constant making verbose shells. + * + * @var integer */ const VERBOSE = 2; /** * Output constant for making normal shells. + * + * @var integer */ const NORMAL = 1; /** * Output constants for making quiet shells. + * + * @var integer */ const QUIET = 0; diff --git a/lib/Cake/Controller/Component/Acl/PhpAcl.php b/lib/Cake/Controller/Component/Acl/PhpAcl.php index d9120a9b9..d8f757333 100644 --- a/lib/Cake/Controller/Component/Acl/PhpAcl.php +++ b/lib/Cake/Controller/Component/Acl/PhpAcl.php @@ -26,11 +26,15 @@ class PhpAcl extends Object implements AclInterface { /** * Constant for deny + * + * @var boolean */ const DENY = false; /** * Constant for allow + * + * @var boolean */ const ALLOW = true; @@ -364,6 +368,8 @@ class PhpAro { /** * role to resolve to when a provided ARO is not listed in * the internal tree + * + * @var string */ const DEFAULT_ROLE = 'Role/default'; diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 136707be0..93c5100ee 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -39,6 +39,8 @@ class AuthComponent extends Component { /** * Constant for 'all' + * + * @var string */ const ALL = 'all'; diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 558de586d..c5674b3ec 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -66,28 +66,28 @@ class App { /** * Append paths * - * @constant APPEND + * @var string */ const APPEND = 'append'; /** * Prepend paths * - * @constant PREPEND + * @var string */ const PREPEND = 'prepend'; /** * Register package * - * @constant REGISTER + * @var string */ const REGISTER = 'register'; /** * Reset paths instead of merging * - * @constant RESET + * @var boolean */ const RESET = true; diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index 1e35c6ba1..3e3cf9a2e 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -152,6 +152,8 @@ class Object { * * @param string $msg Log message * @param integer $type Error type constant. Defined in app/Config/core.php. + * @param null|string|array $scope The scope(s) a log message is being created in. + * See CakeLog::config() for more information on logging scopes. * @return boolean Success of log write */ public function log($msg, $type = LOG_ERR, $scope = null) { diff --git a/lib/Cake/Error/ErrorHandler.php b/lib/Cake/Error/ErrorHandler.php index c2672c6b9..3e6eca2a7 100644 --- a/lib/Cake/Error/ErrorHandler.php +++ b/lib/Cake/Error/ErrorHandler.php @@ -1,6 +1,6 @@ Aro->node($aro); $acoPath = $this->Aco->node($aco); - if (!$aroPath || !$acoPath) { + if (!$aroPath) { $this->log(__d('cake_dev', - "%s - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", + "%s - Failed ARO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", 'DbAcl::check()', print_r($aro, true), print_r($aco, true)), diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index fd3630d2a..b618701eb 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -35,35 +35,35 @@ class CakeEmail { /** * Default X-Mailer * - * @constant EMAIL_CLIENT + * @var string */ const EMAIL_CLIENT = 'CakePHP Email'; /** * Line length - no should more - RFC 2822 - 2.1.1 * - * @constant LINE_LENGTH_SHOULD + * @var integer */ const LINE_LENGTH_SHOULD = 78; /** * Line length - no must more - RFC 2822 - 2.1.1 * - * @constant LINE_LENGTH_MUST + * @var integer */ const LINE_LENGTH_MUST = 998; /** * Type of message - HTML * - * @constant MESSAGE_HTML + * @var string */ const MESSAGE_HTML = 'html'; /** * Type of message - TEXT * - * @constant MESSAGE_TEXT + * @var string */ const MESSAGE_TEXT = 'text'; @@ -1315,6 +1315,7 @@ class CakeEmail { * Wrap the message to follow the RFC 2822 - 2.1.1 * * @param string $message Message to wrap + * @param integer $wrapLength The line length * @return array Wrapped message */ protected function _wrap($message, $wrapLength = CakeEmail::LINE_LENGTH_MUST) { diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index bab5c23a5..cc9b0ff73 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -490,7 +490,7 @@ class CakeRoute { $prefixed = $params['prefix'] . '_'; } if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) { - $params['action'] = substr($params['action'], strlen($prefixed) * -1); + $params['action'] = substr($params['action'], strlen($prefixed)); unset($params['prefix']); } diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index 2d3c4a622..6cbd12241 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -85,14 +85,45 @@ class Router { protected static $_validExtensions = array(); /** - * 'Constant' regular expression definitions for named route elements + * Regular expression for action names * + * @var string */ const ACTION = 'index|show|add|create|edit|update|remove|del|delete|view|item'; + +/** + * Regular expression for years + * + * @var string + */ const YEAR = '[12][0-9]{3}'; + +/** + * Regular expression for months + * + * @var string + */ const MONTH = '0[1-9]|1[012]'; + +/** + * Regular expression for days + * + * @var string + */ const DAY = '0[1-9]|[12][0-9]|3[01]'; + +/** + * Regular expression for auto increment IDs + * + * @var string + */ const ID = '[0-9]+'; + +/** + * Regular expression for UUIDs + * + * @var string + */ const UUID = '[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}'; /** @@ -245,19 +276,19 @@ class Router { * Connects a new Route in the router. * * Routes are a way of connecting request URLs to objects in your application. At their core routes - * are a set or regular expressions that are used to match requests to destinations. + * are a set of regular expressions that are used to match requests to destinations. * * Examples: * * `Router::connect('/:controller/:action/*');` * - * The first parameter will be used as a controller name while the second is used as the action name. + * The first token ':controller' will be used as a controller name while the second is used as the action name. * the '/*' syntax makes this route greedy in that it will match requests like `/posts/index` as well as requests * like `/posts/edit/1/foo/bar`. * * `Router::connect('/home-page', array('controller' => 'pages', 'action' => 'display', 'home'));` * - * The above shows the use of route parameter defaults. And providing routing parameters for a static route. + * The above shows the use of route parameter defaults, and providing routing parameters for a static route. * * {{{ * Router::connect( @@ -270,6 +301,9 @@ class Router { * Shows connecting a route with custom route parameters as well as providing patterns for those parameters. * Patterns for routing parameters do not need capturing groups, as one will be added for each route params. * + * $defaults is merged with the results of parsing the request URL to form the final routing destination and its + * parameters. This destination is expressed as an associative array by Router. See the output of {@link parse()}. + * * $options offers four 'special' keys. `pass`, `named`, `persist` and `routeClass` * have special meaning in the $options array. * @@ -304,6 +338,7 @@ class Router { * shifted into the passed arguments, supplying patterns for routing parameters and supplying the name of a * custom routing class. * @see routes + * @see parse(). * @return array Array of routes * @throws RouterException */ diff --git a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php index 32dbed19d..1f0e283ca 100644 --- a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php +++ b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php @@ -308,6 +308,11 @@ class CakeRouteTest extends CakeTestCase { $result = $route->match($url); $expected = '/admin/subscriptions/edit_admin_e/1'; $this->assertEquals($expected, $result); + + $url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'admin_edit', 1); + $result = $route->match($url); + $expected = '/admin/subscriptions/edit/1'; + $this->assertEquals($expected, $result); } /** diff --git a/lib/Cake/Test/Case/View/MediaViewTest.php b/lib/Cake/Test/Case/View/MediaViewTest.php index 514a6f434..d3b8dc70d 100644 --- a/lib/Cake/Test/Case/View/MediaViewTest.php +++ b/lib/Cake/Test/Case/View/MediaViewTest.php @@ -80,8 +80,7 @@ class MediaViewTest extends CakeTestCase { $this->MediaView->response->expects($this->once()) ->method('send'); - $result = $this->MediaView->render(); - $this->assertTrue($result); + $this->MediaView->render(); } /** @@ -119,8 +118,7 @@ class MediaViewTest extends CakeTestCase { $this->MediaView->response->expects($this->once()) ->method('send'); - $result = $this->MediaView->render(); - $this->assertTrue($result); + $this->MediaView->render(); } /** diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index 432de7882..21fd87636 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -1024,7 +1024,7 @@ class ViewTest extends CakeTestCase { $this->assertRegExp("/
yo what up<\/a><\/p>/", $result); - $this->assertTrue($View->render(false, 'flash')); + $this->assertNull($View->render(false, 'flash')); $this->PostsController->helpers = array('Session', 'Cache', 'Html'); $this->PostsController->constructClasses(); diff --git a/lib/Cake/Utility/Folder.php b/lib/Cake/Utility/Folder.php index 7cff4b548..a851bc9bf 100644 --- a/lib/Cake/Utility/Folder.php +++ b/lib/Cake/Utility/Folder.php @@ -26,7 +26,7 @@ class Folder { * Default scheme for Folder::copy * Recursively merges subfolders with the same name * - * @constant MERGE + * @var string */ const MERGE = 'merge'; @@ -34,7 +34,7 @@ class Folder { * Overwrite scheme for Folder::copy * subfolders with the same name will be replaced * - * @constant OVERWRITE + * @var string */ const OVERWRITE = 'overwrite'; @@ -42,7 +42,7 @@ class Folder { * Skip scheme for Folder::copy * if a subfolder with the same name exists it will be skipped * - * @constant SKIP + * @var string */ const SKIP = 'skip'; diff --git a/lib/Cake/View/Helper/NumberHelper.php b/lib/Cake/View/Helper/NumberHelper.php index b8303f6bc..795d0cc21 100644 --- a/lib/Cake/View/Helper/NumberHelper.php +++ b/lib/Cake/View/Helper/NumberHelper.php @@ -73,6 +73,8 @@ class NumberHelper extends AppHelper { } /** + * Formats a number with a level of precision. + * * @see CakeNumber::precision() * * @param float $number A floating point number. @@ -85,6 +87,8 @@ class NumberHelper extends AppHelper { } /** + * Returns a formatted-for-humans file size. + * * @see CakeNumber::toReadableSize() * * @param integer $size Size in bytes @@ -96,6 +100,8 @@ class NumberHelper extends AppHelper { } /** + * - `multiply`: Multiply the input value by 100 for decimal percentages. + * * @see CakeNumber::toPercentage() * * @param float $number A floating point number @@ -109,6 +115,8 @@ class NumberHelper extends AppHelper { } /** + * Formats a number into a currency format. + * * @see CakeNumber::format() * * @param float $number A floating point number @@ -122,6 +130,8 @@ class NumberHelper extends AppHelper { } /** + * Formats a number into a currency format. + * * @see CakeNumber::currency() * * @param float $number @@ -137,6 +147,18 @@ class NumberHelper extends AppHelper { } /** + * Add a currency format to the Number helper. Makes reusing + * currency formats easier. + * + * {{{ $this->Number->addFormat('NOK', array('before' => 'Kr. ')); }}} + * + * You can now use `NOK` as a shortform when formatting currency amounts. + * + * {{{ $this->Number->currency($value, 'NOK'); }}} + * + * Added formats are merged with the defaults defined in Cake\Utility\Number::$_currencyDefaults + * See Cake\Utility\Number::currency() for more information on the various options and their function. + * * @see CakeNumber::addFormat() * * @param string $formatName The format name to be used in the future. @@ -150,6 +172,8 @@ class NumberHelper extends AppHelper { } /** + * Getter/setter for default currency + * * @see CakeNumber::defaultCurrency() * * @param string $currency The currency to be used in the future. diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index a3f07856c..451aa17b6 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -215,6 +215,9 @@ class TextHelper extends AppHelper { } /** + * Highlights a given phrase in a text. You can specify any expression in highlighter that + * may include the \1 expression to include the $phrase found. + * * @see String::highlight() * * @param string $text Text to search the phrase in @@ -251,6 +254,8 @@ class TextHelper extends AppHelper { } /** + * Strips given text of all links (Time->format('2012-02-15', '%m-%d-%Y'); // returns 02-15-2012 + * $this->Time->format('2012-02-15 23:01:01', '%c'); // returns preferred date and time based on configured locale + * $this->Time->format('0000-00-00', '%d-%m-%Y', 'N/A'); // return N/A becuase an invalid date was passed + * $this->Time->format('2012-02-15 23:01:01', '%c', 'N/A', 'America/New_York'); // converts passed date to timezone + * }}} + * * @see CakeTime::format() * * @param integer|string|DateTime $format date format string (or a UNIX timestamp, strtotime() valid string or DateTime object) @@ -442,6 +503,9 @@ class TimeHelper extends AppHelper { } /** + * Returns a formatted date string, given either a UNIX timestamp or a valid strtotime() date string. + * It takes into account the default date format for the current language if a LC_TIME file is used. + * * @see CakeTime::i18nFormat() * * @param integer|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object diff --git a/lib/Cake/View/MediaView.php b/lib/Cake/View/MediaView.php index 7a407dd96..4a7985086 100644 --- a/lib/Cake/View/MediaView.php +++ b/lib/Cake/View/MediaView.php @@ -62,7 +62,7 @@ class MediaView extends View { * * @param string $view Not used * @param string $layout Not used - * @return boolean + * @return void */ public function render($view = null, $layout = null) { $name = $download = $id = $modified = $path = $cache = $mimeType = $compress = null; @@ -94,7 +94,6 @@ class MediaView extends View { $this->response->compress(); } $this->response->send(); - return true; } } diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 44483f2e2..6ccefbe72 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -299,16 +299,22 @@ class View extends Object { /** * Constant for view file type 'view' + * + * @var string */ const TYPE_VIEW = 'view'; /** * Constant for view file type 'element' + * + * @var string */ const TYPE_ELEMENT = 'element'; /** * Constant for view file type 'layout' + * + * @var string */ const TYPE_LAYOUT = 'layout'; @@ -445,12 +451,12 @@ class View extends Object { * * @param string $view Name of view file to use * @param string $layout Layout to use. - * @return string Rendered Element + * @return string|null Rendered content or null if content already rendered and returned earlier. * @throws CakeException If there is an error in the view. */ public function render($view = null, $layout = null) { if ($this->hasRendered) { - return true; + return; } if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { diff --git a/lib/Cake/View/ViewBlock.php b/lib/Cake/View/ViewBlock.php index f0c74c5ca..28667c8c3 100644 --- a/lib/Cake/View/ViewBlock.php +++ b/lib/Cake/View/ViewBlock.php @@ -28,14 +28,14 @@ class ViewBlock { /** * Append content * - * @constant APPEND + * @var string */ const APPEND = 'append'; /** * Prepend content * - * @constant PREPEND + * @var string */ const PREPEND = 'prepend';