Browse files

Another quality pass.

  • Loading branch information...
1 parent fadf37b commit 0593c79e9c6e329781d90d44a3ce98c3433b3708 @jails jails committed Mar 29, 2013
Showing with 834 additions and 915 deletions.
  1. +3 −2 action/Controller.php
  2. +9 −8 action/Request.php
  3. +3 −3 action/Response.php
  4. +1 −1 analysis/Debugger.php
  5. +4 −4 analysis/Inspector.php
  6. +4 −4 analysis/Parser.php
  7. +4 −3 console/Command.php
  8. +2 −2 console/Dispatcher.php
  9. +2 −2 console/Request.php
  10. +0 −3 console/Response.php
  11. +1 −3 console/command/Create.php
  12. +18 −19 console/command/Library.php
  13. +3 −3 core/Adaptable.php
  14. +0 −1 core/Libraries.php
  15. +11 −14 data/Collection.php
  16. +11 −13 data/Entity.php
  17. +21 −26 data/Model.php
  18. +3 −3 data/collection/MultiKeyRecordSet.php
  19. +7 −13 data/model/Query.php
  20. +20 −22 data/source/Database.php
  21. +2 −2 data/source/MongoDb.php
  22. +1 −0 data/source/Result.php
  23. +2 −2 data/source/database/adapter/MySql.php
  24. +2 −2 data/source/database/adapter/PostgreSql.php
  25. +2 −3 data/source/database/adapter/Sqlite3.php
  26. +1 −0 data/source/http/adapter/CouchDb.php
  27. +2 −2 data/source/mongo_db/Exporter.php
  28. +0 −1 g11n/Catalog.php
  29. +1 −1 g11n/Locale.php
  30. +0 −1 g11n/Multibyte.php
  31. +2 −3 g11n/catalog/adapter/Code.php
  32. +7 −7 net/Message.php
  33. +9 −9 net/http/Message.php
  34. +16 −16 net/http/Request.php
  35. +12 −12 net/http/Response.php
  36. +7 −7 net/http/Route.php
  37. +1 −0 net/http/Service.php
  38. +1 −0 security/validation/RequestToken.php
  39. +0 −1 storage/Cache.php
  40. +1 −3 storage/Session.php
  41. +2 −1 storage/cache/adapter/File.php
  42. +0 −1 storage/cache/adapter/Redis.php
  43. +0 −1 storage/cache/adapter/XCache.php
  44. +1 −1 storage/session/adapter/Cookie.php
  45. +2 −2 storage/session/strategy/Encrypt.php
  46. +2 −2 storage/session/strategy/Hmac.php
  47. +73 −72 template/helper/Form.php
  48. +1 −0 template/view/Renderer.php
  49. +0 −1 test/Mocker.php
  50. +3 −5 test/Unit.php
  51. +0 −21 tests/cases/action/ControllerTest.php
  52. +5 −4 tests/cases/analysis/DocblockTest.php
  53. +2 −9 tests/cases/analysis/InspectorTest.php
  54. +0 −1 tests/cases/console/ResponseTest.php
  55. +2 −3 tests/cases/console/command/LibraryTest.php
  56. +13 −13 tests/cases/console/command/RouteTest.php
  57. +5 −5 tests/cases/console/command/TestTest.php
  58. +7 −7 tests/cases/console/command/create/TestTest.php
  59. +0 −1 tests/cases/core/AdaptableTest.php
  60. +3 −9 tests/cases/data/EntityTest.php
  61. +10 −9 tests/cases/data/ModelTest.php
  62. +8 −9 tests/cases/data/collection/DocumentSetTest.php
  63. +50 −30 tests/cases/data/collection/MultiKeyRecordSetTest.php
  64. +0 −3 tests/cases/data/collection/RecordSetTest.php
  65. +1 −4 tests/cases/data/entity/DocumentTest.php
  66. +4 −2 tests/cases/data/entity/RecordTest.php
  67. +2 −2 tests/cases/data/model/QueryTest.php
  68. +10 −5 tests/cases/data/source/DatabaseTest.php
  69. +0 −1 tests/cases/data/source/MongoDbTest.php
  70. +79 −62 tests/cases/data/source/mongo_db/ExporterTest.php
  71. +0 −1 tests/cases/g11n/MultibyteTest.php
  72. +24 −12 tests/cases/g11n/catalog/AdapterTest.php
  73. +8 −4 tests/cases/g11n/catalog/adapter/PhpTest.php
  74. +0 −1 tests/cases/net/http/AuthTest.php
  75. +3 −3 tests/cases/net/http/RequestTest.php
  76. +0 −1 tests/cases/net/http/RouterTest.php
  77. +0 −1 tests/cases/net/socket/ContextTest.php
  78. +0 −1 tests/cases/net/socket/StreamTest.php
  79. +3 −3 tests/cases/security/auth/adapter/FormTest.php
  80. +0 −7 tests/cases/storage/SessionTest.php
  81. +0 −1 tests/cases/storage/session/adapter/CookieTest.php
  82. +0 −2 tests/cases/storage/session/adapter/PhpTest.php
  83. +0 −1 tests/cases/storage/session/strategy/HmacTest.php
  84. +20 −23 tests/cases/template/ViewTest.php
  85. +35 −37 tests/cases/template/helper/FormTest.php
  86. +0 −1 tests/cases/test/GroupTest.php
  87. +12 −6 tests/cases/test/MockerChainTest.php
  88. +27 −13 tests/cases/util/SetTest.php
  89. +0 −1 tests/cases/util/StringTest.php
  90. +25 −76 tests/cases/util/ValidatorTest.php
  91. +1 −1 tests/fixture/model/gallery/ImagesFixture.php
  92. +1 −1 tests/fixture/model/gallery/ImagesTagsFixture.php
  93. +1 −1 tests/fixture/model/gallery/Tags.php
  94. +3 −2 tests/integration/data/Base.php
  95. +0 −1 tests/integration/data/CrudTest.php
  96. +3 −4 tests/integration/data/DatabaseTest.php
  97. +0 −1 tests/integration/data/DocumentTest.php
  98. +2 −6 tests/integration/data/FieldsTest.php
  99. +0 −1 tests/integration/data/SourceTest.php
  100. +14 −12 tests/integration/data/source/database/adapter/MySqlSchemaTest.php
  101. +4 −5 tests/integration/data/source/database/adapter/MySqlTest.php
  102. +9 −9 tests/integration/data/source/database/adapter/PostgreSqlSchemaTest.php
  103. +4 −5 tests/integration/data/source/database/adapter/PostgreSqlTest.php
  104. +9 −9 tests/integration/data/source/database/adapter/Sqlite3SchemaTest.php
  105. +15 −15 tests/integration/data/source/database/adapter/Sqlite3Test.php
  106. +2 −3 tests/integration/data/source/database/adapter/pdo/ResultTest.php
  107. +2 −1 tests/integration/g11n/ResourcesValidatorTest.php
  108. +0 −1 tests/integration/test/FilterTest.php
  109. +0 −2 tests/mocks/data/MockAntiqueForSchemas.php
  110. +0 −1 tests/mocks/data/model/MockDocumentMultipleKey.php
  111. +1 −1 tests/mocks/data/model/MockDocumentSource.php
  112. +2 −1 tests/mocks/data/model/MockImageTag.php
  113. +0 −1 tests/mocks/data/source/mongo_db/MockResult.php
  114. +1 −0 tests/mocks/storage/cache/strategy/MockConfigurizer.php
  115. +2 −2 tests/mocks/template/view/adapters/TestRenderer.php
  116. +1 −1 tests/mocks/test/MockFilterClass.php
  117. +27 −30 util/Collection.php
  118. +15 −15 util/Inflector.php
  119. +21 −21 util/Set.php
  120. +53 −56 util/Validator.php
  121. +3 −4 util/collection/Filters.php
View
5 action/Controller.php
@@ -225,8 +225,9 @@ public function set($data = array()) {
* the template path would be `views/posts/view.html.php`. Defaults to the name of the
* action being rendered.
*
- * The options specified here are merged with the values in the `Controller::$_render`
- * property. You may refer to it for other options accepted by this method.
+ * The options specified here are merged with the values in the `Controller::$_render`
+ * property. You may refer to it for other options accepted by this method.
+ *
* @return object Returns the `Response` object associated with this `Controller` instance.
*/
public function render(array $options = array()) {
View
17 action/Request.php
@@ -244,7 +244,7 @@ public function env($key) {
$val = array_key_exists($key, $this->_env) ? $this->_env[$key] : getenv($key);
$this->_env[$key] = $val;
- if ($key == 'REMOTE_ADDR') {
+ if ($key === 'REMOTE_ADDR') {
$https = array('HTTP_X_FORWARDED_FOR', 'HTTP_PC_REMOTE_ADDR', 'HTTP_X_REAL_IP');
foreach ($https as $altKey) {
if ($addr = $this->env($altKey)) {
@@ -273,7 +273,7 @@ public function env($key) {
}
return $this->_env['SERVER_ADDR'];
case 'SCRIPT_FILENAME':
- if ($this->_env['PLATFORM'] == 'IIS') {
+ if ($this->_env['PLATFORM'] === 'IIS') {
return str_replace('\\\\', '\\', $this->env('PATH_TRANSLATED'));
}
return $this->env('DOCUMENT_ROOT') . $this->env('PHP_SELF');
@@ -364,12 +364,13 @@ protected function _parseAccept() {
* ability to act conditionally on different aspects of the request. See `Media::type()` (the
* section on content negotiation) and the routing system for more information.
*
- * _Note_: All keys should be _lower-cased_, even when getting HTTP headers.
+ * _Note_: All keys should be _lower-cased_, even when getting HTTP headers.
+ *
* @see lithium\action\Request::env()
* @see lithium\net\http\Media::type()
* @see lithium\net\http\Router
* @param string $key A prefixed key indicating what part of the request data the requested
- * value should come from, and the name of the value to retrieve, in lower case.
+ * value should come from, and the name of the value to retrieve, in lower case.
* @return string Returns the value of a GET, POST, routing or environment variable, or an
* HTTP header or method name.
*/
@@ -431,7 +432,7 @@ public function is($flag) {
if (!in_array($flag, $media::types())) {
return false;
}
- return $this->type() == $flag;
+ return $this->type() === $flag;
}
$detector = $this->_detectors[$flag];
@@ -449,7 +450,7 @@ public function is($flag) {
if (Validator::isRegex($check)) {
return (boolean) preg_match($check, $this->env($key));
}
- return ($this->env($key) == $check);
+ return ($this->env($key) === $check);
}
/**
@@ -515,7 +516,7 @@ public function referer($default = null, $local = false) {
return $ref;
}
$url = parse_url($ref) + array('path' => '');
- if (empty($url['host']) || $url['host'] == $this->env('HTTP_HOST')) {
+ if (empty($url['host']) || $url['host'] === $this->env('HTTP_HOST')) {
$ref = $url['path'];
if (!empty($url['query'])) {
$ref .= '?' . $url['query'];
@@ -526,7 +527,7 @@ public function referer($default = null, $local = false) {
return $ref;
}
}
- return ($default != null) ? $default : '/';
+ return ($default !== null) ? $default : '/';
}
/**
View
6 action/Response.php
@@ -120,9 +120,9 @@ public function render() {
foreach ($this->headers as $name => $value) {
$key = strtolower($name);
- if ($key == 'location') {
+ if ($key === 'location') {
$this->_writeHeader("Location: {$value}", $this->status['code']);
- } elseif ($key == 'download') {
+ } elseif ($key === 'download') {
$this->_writeHeader('Content-Disposition: attachment; filename="' . $value . '"');
} elseif (is_array($value)) {
$this->_writeHeader(
@@ -132,7 +132,7 @@ public function render() {
$this->_writeHeader("{$name}: {$value}");
}
}
- if ($this->status['code'] == 302 || $this->status['code'] == 204) {
+ if ($this->status['code'] === 302 || $this->status['code'] === 204) {
return;
}
$chunked = $this->body(null, $this->_config);
View
2 analysis/Debugger.php
@@ -89,7 +89,7 @@ public static function trace(array $options = array()) {
if ($options['format'] === 'points' && $trace['file'] !== '[internal]') {
$back[] = array('file' => $trace['file'], 'line' => $trace['line']);
- } elseif (is_string($options['format']) && $options['format'] != 'array') {
+ } elseif (is_string($options['format']) && $options['format'] !== 'array') {
$back[] = String::insert($options['format'], array_map(
function($data) { return is_object($data) ? get_class($data) : $data; },
$trace
View
8 analysis/Inspector.php
@@ -137,8 +137,8 @@ public static function info($identifier, $info = array()) {
if (method_exists($inspector, static::$_methodMap[$key])) {
$setAccess = (
($type === 'method' || $type === 'property') &&
- array_intersect($result['modifiers'], array('private', 'protected')) != array()
- && method_exists($inspector, 'setAccessible')
+ array_intersect($result['modifiers'], array('private', 'protected')) !== array() &&
+ method_exists($inspector, 'setAccessible')
);
if ($setAccess) {
@@ -283,7 +283,7 @@ public static function methods($class, $format = null, array $options = array())
case null:
return $methods;
case 'extents':
- if ($methods->getName() == array()) {
+ if ($methods->getName() === array()) {
return array();
}
@@ -339,7 +339,7 @@ public static function properties($class, array $options = array()) {
$class = __CLASS__;
$modifiers = array_values($class::invokeMethod('_modifiers', array($item)));
$setAccess = (
- array_intersect($modifiers, array('private', 'protected')) != array()
+ array_intersect($modifiers, array('private', 'protected')) !== array()
);
if ($setAccess) {
$item->setAccessible(true);
View
8 analysis/Parser.php
@@ -130,7 +130,7 @@ public static function find($code, $pattern, array $options = array()) {
if (empty($patternMatch) && $options['startOfLine']) {
return ($token['line'] > $prev['line']);
}
- return ($token['line'] == $prev['line']);
+ return ($token['line'] === $prev['line']);
};
$capture = function($token) use (&$matches, &$patternMatch, $tokens, $breaks, $options) {
@@ -142,7 +142,7 @@ public static function find($code, $pattern, array $options = array()) {
if (empty($patternMatch)) {
$prev = $tokens->prev();
$tokens->next();
- if ($options['startOfLine'] && $token['line'] == $prev['line']) {
+ if ($options['startOfLine'] && $token['line'] === $prev['line']) {
$patternMatch = $matches = array();
return false;
}
@@ -259,7 +259,7 @@ public static function match($code, $parameters, array $options = array()) {
* @return boolean Match result.
*/
public static function matchToken($pattern, $token) {
- if ($pattern['name'] != $token['name']) {
+ if ($pattern['name'] !== $token['name']) {
return false;
}
@@ -276,7 +276,7 @@ public static function matchToken($pattern, $token) {
}
switch (true) {
- case ($match === '_' || $match == $content):
+ case ($match === '_' || $match === $content):
return true;
}
return false;
View
7 console/Command.php
@@ -222,9 +222,10 @@ public function in($prompt = null, array $options = array()) {
$this->out("{$prompt} {$choices} \n {$default}> ", false);
$result = trim($this->request->input());
} while (
- !empty($options['choices']) && !in_array($result, $options['choices'], true)
- && (empty($options['quit']) || $result !== $options['quit'])
- && (!$options['default'] || $result !== '')
+ !empty($options['choices']) &&
+ !in_array($result, $options['choices'], true) &&
+ (empty($options['quit']) || $result !== $options['quit']) &&
+ (!$options['default'] || $result !== '')
);
if ($result == $options['quit']) {
View
4 console/Dispatcher.php
@@ -186,8 +186,8 @@ protected static function _call($callable, $request, $params) {
$params['action'] = 'run';
}
$isHelp = (
- !empty($params['help']) || !empty($params['h'])
- || !method_exists($callable, $params['action'])
+ !empty($params['help']) || !empty($params['h']) ||
+ !method_exists($callable, $params['action'])
);
if ($isHelp) {
$params['action'] = '_help';
View
4 console/Request.php
@@ -133,8 +133,8 @@ public function args($key = 0) {
*
* @param string $key
* @return mixed Returns the environment key related to the `$key` argument. If `$key` is equal
- * to null the result will be the entire environment array. If `$key` is set but not
- * available, `null` will be returned.
+ * to null the result will be the entire environment array. If `$key` is set but not
+ * available, `null` will be returned.
*/
public function env($key = null) {
if (!empty($this->_env[$key])) {
View
3 console/Response.php
@@ -90,9 +90,6 @@ public function error($error) {
/**
* Destructor to close streams
- *
- * @return void
- *
*/
public function __destruct() {
if ($this->output) {
View
4 console/command/Create.php
@@ -19,7 +19,6 @@
*
* `li3 create --template=controller Posts`
* `li3 create --template=model Posts`
- *
*/
class Create extends \lithium\console\Command {
@@ -215,13 +214,12 @@ protected function _instance($name, array $config = array()) {
return parent::_instance($name, $config);
}
-
/**
* Save a template with the current params. Writes file to `Create::$path`.
*
* @param array $params
* @return string A result string on success of writing the file. If any errors occur along
- * the way such as missing information boolean false is returned.
+ * the way such as missing information boolean false is returned.
*/
protected function _save(array $params = array()) {
$defaults = array('namespace' => null, 'class' => null);
View
37 console/command/Library.php
@@ -202,7 +202,7 @@ public function config($key = null, $value = null, $options = true) {
* location
*
* @param string $name if only param, command/create/template/app.phar.gz extracted to $name
- * otherwise, the template name or full path to extract `from` phar.gz.
+ * otherwise, the template name or full path to extract `from` phar.gz.
* @param string $result if exists $name is extracted to $result
* @return boolean
*/
@@ -262,9 +262,9 @@ public function extract($name = 'new', $result = null) {
*
* @param string $base File path to the extracted library
* @return array A multi-dimensional array. Keys on the top level
- * are filenames or glob-style paths. Those hold an array
- * with keys being the search param and values being the
- * replacement values
+ * are filenames or glob-style paths. Those hold an array
+ * with keys being the search param and values being the
+ * replacement values
*/
protected function _findReplacements($base = null) {
$replacements = null;
@@ -288,17 +288,17 @@ protected function _findReplacements($base = null) {
*
* @param string $extracted contains the path to the extracted archive.
* @param array $options Valid options are:
- * - `'replacements'`: an array of string replacements indexed by filename.
- * It's also possible to use glob-style wildcards in the filename such
- * as `*` or `*.php` or `resources/g11n/*`. If the filename starts
- * with `*`, then that filename pattern will be recursively found
- * in every sub-directory. Additionally, each replacement can
- * use `String::insert()` style strings that will be replaced
- * with the data in the `data` option.
- * - `'data'`: an array with data that will be used to replace
- * `String::insert`-style placeholders in the `replacements` option.
- * By default, this includes 'namespace' and 'library' which are
- * both set to the extracted library's namespace.
+ * - `'replacements'`: an array of string replacements indexed by filename.
+ * It's also possible to use glob-style wildcards in the filename such
+ * as `*` or `*.php` or `resources/g11n/*`. If the filename starts
+ * with `*`, then that filename pattern will be recursively found
+ * in every sub-directory. Additionally, each replacement can
+ * use `String::insert()` style strings that will be replaced
+ * with the data in the `data` option.
+ * - `'data'`: an array with data that will be used to replace
+ * `String::insert`-style placeholders in the `replacements` option.
+ * By default, this includes 'namespace' and 'library' which are
+ * both set to the extracted library's namespace.
* @return boolean
*/
protected function _replaceAfterExtract($extracted, $options = array()) {
@@ -413,7 +413,7 @@ protected function _wildcardPaths($path, $base = '') {
* - `li3 library archive myapp my_archive` : archives 'myapp' to 'my_archive.phar.gz'
*
* @param string $name if only param, the archive name for the current working directory
- * otherwise, The library name or path to the directory to compress.
+ * otherwise, The library name or path to the directory to compress.
* @param string $result if exists, The name of the resulting archive
* @return boolean
*/
@@ -465,7 +465,6 @@ public function archive($name = null, $result = null) {
return false;
}
-
/**
* List all the plugins and extensions available on the server.
*
@@ -644,8 +643,8 @@ public function push($name = null) {
}
$formula = json_decode(file_get_contents("phar://{$file}/config/{$name}.json"));
$isValid = (
- !empty($formula->name) && !empty($formula->version)
- && !empty($formula->summary) && !empty($formula->sources)
+ !empty($formula->name) && !empty($formula->version) &&
+ !empty($formula->summary) && !empty($formula->sources)
);
if (!$isValid) {
$this->error(array(
View
6 core/Adaptable.php
@@ -37,9 +37,9 @@ class Adaptable extends \lithium\core\StaticObject {
* Example:
* {{{
* array(
- * 'production' => array(),
- * 'development' => array(),
- * 'test' => array()
+ * 'production' => array(),
+ * 'development' => array(),
+ * 'test' => array()
* )
* }}}
*
View
1 core/Libraries.php
@@ -419,7 +419,6 @@ public static function remove($name) {
* @param mixed $library The name of a library added to the application with `Libraries::add()`,
* or `true` to search all libraries.
* @param array $options The options this method accepts:
- *
* - `'path'` _string_: A physical filesystem path relative to the directory of the
* library being searched. If provided, only the classes or namespaces within
* this path will be returned.
View
25 data/Collection.php
@@ -79,6 +79,7 @@
/**
* Setted to `true` when the collection has begun iterating.
+ *
* @var integer
*/
protected $_started = false;
@@ -207,7 +208,7 @@ public function set($values) {
* current `Collection`.
*
* @param string $offset String or integer indicating the offset or
- * index of an entity in the set.
+ * index of an entity in the set.
* @return boolean Result.
*/
public function offsetExists($offset) {
@@ -346,11 +347,11 @@ public function valid() {
* objects contained in this collection.
*
* @param mixed $filter Callback to use for filtering, or array of key/value pairs which entity
- * properties will be matched against.
+ * properties will be matched against.
* @param array $options Options to modify the behavior of this method. See the documentation
- * for the `$options` parameter of `lithium\util\Collection::find()`.
+ * for the `$options` parameter of `lithium\util\Collection::find()`.
* @return mixed The filtered items. Will be an array unless `'collect'` is defined in the
- * `$options` argument, then an instance of this class will be returned.
+ * `$options` argument, then an instance of this class will be returned.
*/
public function find($filter, array $options = array()) {
$this->offsetGet(null);
@@ -420,8 +421,8 @@ public function each($filter) {
*
* @param callback $filter The filter to apply.
* @param array $options The available options are:
- * - `'collect'`: If `true`, the results will be returned wrapped
- * in a new `Collection` object or subclass.
+ * - `'collect'`: If `true`, the results will be returned wrapped
+ * in a new `Collection` object or subclass.
* @return object The filtered data.
*/
public function map($filter, array $options = array()) {
@@ -462,9 +463,9 @@ public function reduce($filter, $initial = false) {
* Overriden to load any data that has not yet been loaded.
*
* @param mixed $field The field to sort the data on, can also be a callback
- * to a custom sort function.
+ * to a custom sort function.
* @param array $options The available options are:
- * - No options yet implemented
+ * - No options yet implemented
* @return $this, useful for chaining this with other methods.
*/
public function sort($field = 'id', array $options = array()) {
@@ -516,7 +517,7 @@ public function data() {
* @see lithium\util\Collection::formats()
* @see lithium\util\Collection::$_formats
* @param string $format By default the only supported value is `'array'`. However, additional
- * format handlers can be registered using the `formats()` method.
+ * format handlers can be registered using the `formats()` method.
* @param array $options Options for converting this collection:
* - `'internal'` _boolean_: Indicates whether the current internal representation of the
* collection should be exported. Defaults to `false`, which uses the standard iterator
@@ -556,7 +557,7 @@ public function result() {
*
* @param string $name Stat name.
* @return mixed Single stat if `$name` supplied, else all stats for this
- * `Collection`.
+ * `Collection`.
*/
public function stats($name = null) {
if ($name) {
@@ -568,8 +569,6 @@ public function stats($name = null) {
/**
* Executes when the associated result resource pointer reaches the end of its data set. The
* resource is freed by the connection, and the reference to the connection is unlinked.
- *
- * @return void
*/
public function close() {
if (!empty($this->_result)) {
@@ -591,8 +590,6 @@ public function closed() {
/**
* Ensures that the data set's connection is closed when the object is destroyed.
- *
- * @return void
*/
public function __destruct() {
$this->close();
View
24 data/Entity.php
@@ -277,10 +277,10 @@ public function schema($field = null) {
* Access the errors of the record.
*
* @see lithium\data\Entity::$_errors
- * @param array|string $field If an array, overwrites `$this->_errors` if it is empty, if not,
- * merges the errors with the current values. If a string, and `$value` is not `null`,
- * sets the corresponding key in `$this->_errors` to `$value`. Setting `$field` to
- * `false` will reset the current state.
+ * @param array|string $field If an array, overwrites `$this->_errors` if it is empty,
+ * if not, merges the errors with the current values. If a string, and `$value`
+ * is not `null`, sets the corresponding key in `$this->_errors` to `$value`.
+ * Setting `$field` to `false` will reset the current state.
* @param string $value Value to set.
* @return mixed Either the `$this->_errors` array, or single value from it.
*/
@@ -327,11 +327,10 @@ public function exists() {
* @param mixed $id The ID to assign, where applicable.
* @param array $data Any additional generated data assigned to the object by the database.
* @param array $options Method options:
- * - `'materialize'` _boolean_: Determines whether or not the flag should be set
- * that indicates that this entity exists in the data store. Defaults to `true`.
- * - `'dematerialize'` _boolean_: If set to `true`, indicates that this entity has
- * been deleted from the data store and no longer exists. Defaults to `false`.
- * @return void
+ * - `'materialize'` _boolean_: Determines whether or not the flag should be set
+ * that indicates that this entity exists in the data store. Defaults to `true`.
+ * - `'dematerialize'` _boolean_: If set to `true`, indicates that this entity has
+ * been deleted from the data store and no longer exists. Defaults to `false`.
*/
public function sync($id = null, array $data = array(), array $options = array()) {
$defaults = array('materialize' => true, 'dematerialize' => false);
@@ -359,7 +358,7 @@ public function sync($id = null, array $data = array(), array $options = array()
*
* @param string $field The name of the field to be incremented.
* @param string $value The value to increment the field by. Defaults to `1` if this parameter
- * is not specified.
+ * is not specified.
* @return integer Returns the current value of `$field`, based on the value retrieved from the
* data source when the entity was loaded, plus any increments applied. Note that it may
* not reflect the most current value in the persistent backend data source.
@@ -395,8 +394,8 @@ public function decrement($field, $value = 1) {
*
* @param string The field name to check its state.
* @return mixed Returns `true` if a field is given and was updated, `false` otherwise and
- * `null` if the field was not set at all. If no field is given returns an arra
- * where the keys are entity field names, and the values are `true` for changed
+ * `null` if the field was not set at all. If no field is given returns an arra
+ * where the keys are entity field names, and the values are `true` for changed
* fields.
*/
public function modified($field = null) {
@@ -455,7 +454,6 @@ public function export(array $options = array()) {
*
* @param object $parent
* @param array $config
- * @return void
*/
public function assignTo($parent, array $config = array()) {
foreach ($config as $key => $val) {
View
47 data/Model.php
@@ -242,13 +242,13 @@ class Model extends \lithium\core\StaticObject {
* {{{
* // config/bootstrap/connections.php:
* Connections::add('default', array(
- * 'type' => 'MongoDb',
- * 'host' => 'localhost',
- * 'database' => 'app_name',
- * 'schema' => function($db, $collection, $meta) {
- * $result = $db->connection->schemas->findOne(compact('collection'));
- * return $result ? $result['data'] : array();
- * }
+ * 'type' => 'MongoDb',
+ * 'host' => 'localhost',
+ * 'database' => 'app_name',
+ * 'schema' => function($db, $collection, $meta) {
+ * $result = $db->connection->schemas->findOne(compact('collection'));
+ * return $result ? $result['data'] : array();
+ * }
* ));
* }}}
*
@@ -261,14 +261,14 @@ class Model extends \lithium\core\StaticObject {
* types as follows:
*
* {{{
- * id => MongoId
- * date => MongoDate
- * regex => MongoRegex
- * integer => integer
- * float => float
- * boolean => boolean
- * code => MongoCode
- * binary => MongoBinData
+ * id => MongoId
+ * date => MongoDate
+ * regex => MongoRegex
+ * integer => integer
+ * float => float
+ * boolean => boolean
+ * code => MongoCode
+ * binary => MongoBinData
* }}}
*
* @see lithium\data\source\MongoDb::$_schema
@@ -420,7 +420,7 @@ protected static function _initialize($class) {
}
}
- foreach($inheritedAttrs as $key => $value) {
+ foreach ($inheritedAttrs as $key => $value) {
$self->{$key} += $value;
}
@@ -490,7 +490,6 @@ protected static function _instance($name, array $options = array()) {
* @see lithium\data\Model::find()
* @see lithium\data\Model::$_meta
* @link http://php.net/manual/en/language.oop5.overloading.php PHP Manual: Overloading
- *
* @throws BadMethodCallException On unhandled call, will throw an exception.
* @param string $method Method name caught by `__callStatic()`.
* @param array $params Arguments given to the above `$method` call.
@@ -651,7 +650,6 @@ public static function finder($name, $finder = null) {
* - `'limit'`: The maximum number of records to return.
* - `'page'`: For pagination of data.
* - `'with'`: An array of relationship names to be included in the query.
- *
* @return mixed Returns the query definition if querying, or `null` if setting.
*/
public static function query($query = null) {
@@ -786,7 +784,6 @@ protected static function _key($key, $values, $entity) {
*
* @param string $type A type of model relation.
* @return mixed An array of relation instances or an instance of relation.
- *
*/
public static function relations($type = null) {
$self = static::_object();
@@ -846,7 +843,6 @@ protected static function _relations($type = null, $name = null) {
});
}
-
/**
* Creates a relationship binding between this model and another.
*
@@ -1022,7 +1018,7 @@ public static function instanceMethods(array $methods = null) {
*
* {{{
* if (!$post->save($someData)) {
- * return array('errors' => $post->errors());
+ * return array('errors' => $post->errors());
* }
* }}}
*
@@ -1038,10 +1034,10 @@ public static function instanceMethods(array $methods = null) {
* @see lithium\data\Model::validates()
* @see lithium\data\Entity::errors()
* @param object $entity The record or document object to be saved in the database. This
- * parameter is implicit and should not be passed under normal circumstances.
- * In the above example, the call to `save()` on the `$post` object is
- * transparently proxied through to the `Posts` model class, and `$post` is passed
- * in as the `$entity` parameter.
+ * parameter is implicit and should not be passed under normal circumstances.
+ * In the above example, the call to `save()` on the `$post` object is
+ * transparently proxied through to the `Posts` model class, and `$post` is passed
+ * in as the `$entity` parameter.
* @param array $data Any data that should be assigned to the record before it is saved.
* @param array $options Options:
* - `'callbacks'` _boolean_: If `false`, all callbacks will be disabled before
@@ -1056,7 +1052,6 @@ public static function instanceMethods(array $methods = null) {
* method if `'validate'` is not `false`.
* - `'whitelist'` _array_: An array of fields that are allowed to be saved to this
* record.
- *
* @return boolean Returns `true` on a successful save operation, `false` on failure.
* @filter
*/
View
6 data/collection/MultiKeyRecordSet.php
@@ -187,10 +187,10 @@ public function each($filter) {
*
* @param callback $filter Callback to use for filtering.
* @param array $options The available options are:
- * - `'collect'`: If `true`, the results will be returned wrapped
- * in a new `Collection` object or subclass.
+ * - `'collect'`: If `true`, the results will be returned wrapped
+ * in a new `Collection` object or subclass.
* @return mixed The filtered items. Will be an array unless `'collect'` is defined in the
- * `$options` argument, then an instance of this class will be returned.
+ * `$options` argument, then an instance of this class will be returned.
*/
public function find($filter, array $options = array()) {
$this->offsetGet(null);
View
20 data/model/Query.php
@@ -83,7 +83,6 @@ class Query extends \lithium\core\Object {
* The query's fields
*
* @see lithium\data\model\Query::fields()
- *
* @var array
*/
protected $_fields = array(0 => array(), 1 => array());
@@ -93,7 +92,6 @@ class Query extends \lithium\core\Object {
* unique aliases
*
* @see lithium\data\model\Query::alias()
- *
* @var array
*/
protected $_alias = array();
@@ -102,7 +100,6 @@ class Query extends \lithium\core\Object {
* Map beetween generated aliases and corresponding relation paths
*
* @see lithium\data\model\Query::alias()
- *
* @var array
*/
protected $_paths = array();
@@ -111,7 +108,6 @@ class Query extends \lithium\core\Object {
* Map beetween generated aliases and corresponding models.
*
* @see lithium\data\model\Query::alias()
- *
* @var array
*/
protected $_models = array();
@@ -128,7 +124,6 @@ class Query extends \lithium\core\Object {
*
* @var array
*/
-
protected $_initializers = array(
'model', 'entity', 'conditions', 'having', 'group', 'order',
'limit', 'offset', 'page', 'data', 'calculate', 'schema', 'comment'
@@ -334,17 +329,17 @@ public function having($having = null) {
*
* Usage:
* {{{
- * // to add a field
- * $query->fields('created');
+ * // to add a field
+ * $query->fields('created');
* }}}
* {{{
- * // to add several fields
- * $query->fields(array('title','body','modified'));
+ * // to add several fields
+ * $query->fields(array('title','body','modified'));
* }}}
* {{{
- * // to reset fields to none
- * $query->fields(false);
- * // should be followed by a 2nd call to fields with required fields
+ * // to reset fields to none
+ * $query->fields(false);
+ * // should be followed by a 2nd call to fields with required fields
* }}}
*
* @param mixed $fields string, array or `false`
@@ -807,7 +802,6 @@ protected function _entityConditions() {
* during the export according the export's `mode` option and the query `with` option.
*
* @see lithium\data\model\Query::export()
- *
* @param string $relpath a dotted relation path
* @param string $query a query instance
* @return mixed
View
42 data/source/Database.php
@@ -19,6 +19,7 @@
use lithium\data\model\Query;
use InvalidArgumentException;
use UnexpectedValueException;
+
/**
* The `Database` class provides the base-level abstraction for SQL-oriented relational databases.
* It handles all aspects of abstraction, including formatting for basic query types and SQL
@@ -276,12 +277,14 @@ public function connect() {
preg_match('/SQLSTATE\[(.+?)\]/', $e->getMessage(), $code);
$code = $code[1] ?: 0;
switch (true) {
- case $code === 'HY000' || substr($code, 0, 2) === '08':
- $msg = "Unable to connect to host `{$config['host']}`.";
- throw new NetworkException($msg, null, $e);
- case in_array($code, array('28000', '42000')):
- $msg = "Host connected, but could not access database `{$config['database']}`.";
- throw new ConfigException($msg, null, $e);
+ case $code === 'HY000' || substr($code, 0, 2) === '08':
+ $msg = "Unable to connect to host `{$config['host']}`.";
+ throw new NetworkException($msg, null, $e);
+ break;
+ case in_array($code, array('28000', '42000')):
+ $msg = "Host connected, but could not access database `{$config['database']}`.";
+ throw new ConfigException($msg, null, $e);
+ break;
}
throw new ConfigException("An unknown configuration error has occured.", null, $e);
}
@@ -1063,7 +1066,7 @@ public function joins(array $joins, $context) {
return $result;
}
- /**
+ /**
* Returns a string of formatted constraints to be inserted into the query statement. If the
* query constraints are defined as an array, key pairs are converted to SQL strings.
*
@@ -1129,7 +1132,7 @@ public function group($group, $context) {
/**
* Helper method
- *
+ *
* @see lithium\data\source\Database::order()
* @see lithium\data\source\Database::group()
* @param mixed $field The field
@@ -1195,9 +1198,7 @@ public function alias($alias, $context) {
*
* @param string $type Name of the column type
* @param string $value Value to cast
- *
* @return mixed Casted value
- *
*/
protected function _cast($type, $value) {
if (is_object($value) || $value === null) {
@@ -1451,7 +1452,6 @@ protected function _aliasing($name, $alias, $map = array()) {
* @param array $constraints Array of additionnal $constraints.
* @return array A constraints array.
*/
-
public function on($rel, $aliasFrom = null, $aliasTo = null, $constraints = array()) {
$model = $rel->from();
@@ -1531,20 +1531,20 @@ protected function _constraint($name, $value, $schema = null) {
}
$data = array();
- foreach($value as $name => $value) {
- switch($name){
+ foreach ($value as $name => $value) {
+ switch ($name) {
case 'key':
case 'index':
if (isset($meta[$name])) {
$data['index'] = $meta[$name];
}
- break;
+ break;
case 'to':
$data[$name] = $this->name($value);
- break;
+ break;
case 'on':
$data[$name] = "ON {$value}";
- break;
+ break;
case 'expr':
if (is_array($value)) {
$result = array();
@@ -1559,11 +1559,11 @@ protected function _constraint($name, $value, $schema = null) {
} else {
$data[$name] = $value;
}
- break;
+ break;
case 'toColumn':
- case 'column';
+ case 'column':
$data[$name] = join(', ', array_map(array($this, 'name'), (array) $value));
- break;
+ break;
}
}
@@ -1611,7 +1611,6 @@ public function createSchema($source, $schema) {
*
* @see DatabaseSchema::createSchema()
* @see DatabaseSchema::_column()
- *
* @param array $metas The array of column metas.
* @param array $names If `$names` is not `null` only build meta present in `$names`
* @param type $joiner The join character
@@ -1633,15 +1632,14 @@ protected function _buildMetas($type, array $metas, $names = null, $joiner = ' '
* Helper for building columns constraints
*
* @see DatabaseSchema::createSchema()
- *
* @param array $constraints The array of constraints
* @param type $schema The schema of the table
* @param type $joiner The join character
* @return string The SQL constraints
*/
protected function _buildconstraints(array $constraints, $schema = null, $joiner = ' ', $primary = false) {
$result = '';
- foreach($constraints as $constraint) {
+ foreach ($constraints as $constraint) {
if (isset($constraint['type'])) {
$name = $constraint['type'];
if ($meta = $this->_constraint($name, $constraint, $schema)) {
View
4 data/source/MongoDb.php
@@ -144,8 +144,8 @@ class MongoDb extends \lithium\data\Source {
* array(Mongo::RP_SECONDARY_PREFERRED, array('dc' => 'east) See the documentation for
* `Mongo::setReadPreference()`. Defaults to null.
*
- * Typically, these parameters are set in `Connections::add()`, when adding the adapter to the
- * list of active connections.
+ * Typically, these parameters are set in `Connections::add()`, when adding the
+ * adapter to the list of active connections.
*/
public function __construct(array $config = array()) {
$host = 'localhost:27017';
View
1 data/source/Result.php
@@ -27,6 +27,7 @@
/**
* Setted to `true` when the collection has begun iterating.
+ *
* @var integer
*/
protected $_started = false;
View
4 data/source/database/adapter/MySql.php
@@ -105,8 +105,8 @@ class MySql extends \lithium\data\source\Database {
* - `'persistent'`: If a persistent connection (if available) should be made.
* Defaults to true.
*
- * Typically, these parameters are set in `Connections::add()`, when adding the adapter to the
- * list of active connections.
+ * Typically, these parameters are set in `Connections::add()`, when adding the
+ * adapter to the list of active connections.
*/
public function __construct(array $config = array()) {
$defaults = array('host' => 'localhost:3306', 'encoding' => null);
View
4 data/source/database/adapter/PostgreSql.php
@@ -101,8 +101,8 @@ class PostgreSql extends \lithium\data\source\Database {
* Defaults to true.
* - `'schema'`: The name of the database schema to use. Defaults to 'public'
*
- * Typically, these parameters are set in `Connections::add()`, when adding the adapter to the
- * list of active connections.
+ * Typically, these parameters are set in `Connections::add()`, when adding the
+ * adapter to the list of active connections.
*/
public function __construct(array $config = array()) {
$defaults = array(
View
5 data/source/database/adapter/Sqlite3.php
@@ -4,7 +4,6 @@
*
* @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
- *
*/
namespace lithium\data\source\database\adapter;
@@ -100,8 +99,8 @@ class Sqlite3 extends \lithium\data\source\Database {
* - `'key'` _string_: An optional encryption key used when encrypting and decrypting
* an SQLite database.
*
- * Typically, these parameters are set in `Connections::add()`, when adding the adapter to the
- * list of active connections.
+ * Typically, these parameters are set in `Connections::add()`, when adding the
+ * adapter to the list of active connections.
*/
public function __construct(array $config = array()) {
$defaults = array('database' => ':memory:', 'encoding' => null);
View
1 data/source/http/adapter/CouchDb.php
@@ -51,6 +51,7 @@ class CouchDb extends \lithium\data\source\Http {
/**
* Constructor.
+ *
* @param array $config
*/
public function __construct(array $config = array()) {
View
4 data/source/mongo_db/Exporter.php
@@ -123,8 +123,8 @@ protected static function _update($export) {
$newValue = $value->to('array', $options);
$originalValue = null;
$shouldConvert = (isset($original[$key]) && (
- $original[$key] instanceof static::$_classes['set'] ||
- $original[$key] instanceof static::$_classes['entity']
+ $original[$key] instanceof static::$_classes['set'] ||
+ $original[$key] instanceof static::$_classes['entity']
));
if ($shouldConvert) {
$originalValue = $original[$key]->to('array', $options);
View
1 g11n/Catalog.php
@@ -8,7 +8,6 @@
namespace lithium\g11n;
-use lithium\core\Libraries;
/**
* Globalization data is not just translated messages, it is validation rules, formats and a lot
View
2 g11n/Locale.php
@@ -304,7 +304,7 @@ protected static function _preferredConsole($request) {
if ($value = $request->env('LANGUAGE')) {
return explode(':', $value);
}
- foreach (array('LC_ALL', 'LANG') as $variable) {
+ foreach (array('LC_ALL', 'LANG') as $variable) {
$value = $request->env($variable);
if (!$value || $value === 'C' || $value === 'POSIX') {
View
1 g11n/Multibyte.php
@@ -6,7 +6,6 @@
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
namespace lithium\g11n;
-use lithium\core\Libraries;
/**
* The `Multibyte` class helps operating with UTF-8 encoded strings. Here
View
5 g11n/catalog/adapter/Code.php
@@ -41,8 +41,7 @@ public function __construct(array $config = array()) {
/**
* Initializer. Checks if the configured path exists.
*
- * @return void
- * @throws \Exception
+ * @throws lithium\core\ConfigException
*/
protected function _init() {
parent::_init();
@@ -59,7 +58,7 @@ protected function _init() {
* @param string $locale A locale identifier.
* @param string $scope The scope for the current operation.
* @return array Returns the message template. If the scope is not equal to the current scope
- * or `$category` is not `'messageTemplate'` null is returned.
+ * or `$category` is not `'messageTemplate'` null is returned.
*/
public function read($category, $locale, $scope) {
if ($scope !== $this->_config['scope']) {
View
14 net/Message.php
@@ -72,13 +72,13 @@ class Message extends \lithium\core\Object {
* Adds config values to the public properties when a new object is created.
*
* @param array $config Configuration options : default value
- * - `scheme`: tcp
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `body`: null
+ * - `scheme`: tcp
+ * - `host`: localhost
+ * - `port`: null
+ * - `username`: null
+ * - `password`: null
+ * - `path`: null
+ * - `body`: null
*/
public function __construct(array $config = array()) {
$defaults = array(
View
18 net/http/Message.php
@@ -56,15 +56,15 @@ class Message extends \lithium\net\Message {
* Adds config values to the public properties when a new object is created.
*
* @param array $config Configuration options : default value
- * - `scheme`: http
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `version`: 1.1
- * - `headers`: array
- * - `body`: null
+ * - `scheme`: http
+ * - `host`: localhost
+ * - `port`: null
+ * - `username`: null
+ * - `password`: null
+ * - `path`: null
+ * - `version`: 1.1
+ * - `headers`: array
+ * - `body`: null
*/
public function __construct(array $config = array()) {
$defaults = array(
View
32 net/http/Request.php
@@ -49,20 +49,20 @@ class Request extends \lithium\net\http\Message {
* Adds config values to the public properties when a new object is created.
*
* @param array $config Configuration options : default value
- * - `scheme`: http
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `query`: array - after the question mark ?
- * - `fragment`: null - after the hashmark #
- * - `auth` - the Authorization method (Basic|Digest)
- * - `method` - GET
- * - `type`: null
- * - `version`: 1.1
- * - `headers`: array
- * - `body`: null
+ * - `scheme`: http
+ * - `host`: localhost
+ * - `port`: null
+ * - `username`: null
+ * - `password`: null
+ * - `path`: null
+ * - `query`: array - after the question mark ?
+ * - `fragment`: null - after the hashmark #
+ * - `auth` - the Authorization method (Basic|Digest)
+ * - `method` - GET
+ * - `type`: null
+ * - `version`: 1.1
+ * - `headers`: array
+ * - `body`: null
*/
public function __construct(array $config = array()) {
$defaults = array(
@@ -131,7 +131,7 @@ public function queryString($params = array(), $format = null) {
$query = array_merge($query, $querySet);
}
$query = array_filter($query);
-
+
if ($format) {
$q = null;
foreach ($query as $key => $value) {
@@ -153,7 +153,7 @@ public function queryString($params = array(), $format = null) {
} else {
$result[] = http_build_query($query);
}
-
+
$result = array_filter($result);
return $result ? "?" . join("&", $result) : null;
}
View
24 net/http/Response.php
@@ -212,14 +212,14 @@ protected function _parseMessage($body) {
}
/**
- * Decodes content bodies transferred with HTTP chunked encoding.
- *
- * @link http://en.wikipedia.org/wiki/Chunked_transfer_encoding Wikipedia: Chunked encoding
- * @param string $body A chunked HTTP message body.
- * @return string Returns the value of `$body` with chunks decoded, but only if the value of the
- * `Transfer-Encoding` header is set to `'chunked'`. Otherwise, returns `$body`
- * unmodified.
- */
+ * Decodes content bodies transferred with HTTP chunked encoding.
+ *
+ * @link http://en.wikipedia.org/wiki/Chunked_transfer_encoding Wikipedia: Chunked encoding
+ * @param string $body A chunked HTTP message body.
+ * @return string Returns the value of `$body` with chunks decoded, but only if the value of the
+ * `Transfer-Encoding` header is set to `'chunked'`. Otherwise, returns `$body`
+ * unmodified.
+ */
protected function _httpChunkedDecode($body) {
if (stripos($this->headers['Transfer-Encoding'], 'chunked') === false) {
return $body;
@@ -230,10 +230,10 @@ protected function _httpChunkedDecode($body) {
}
/**
- * Return the response as a string.
- *
- * @return string
- */
+ * Return the response as a string.
+ *
+ * @return string
+ */
public function __toString() {
$first = "{$this->protocol} {$this->status['code']} {$this->status['message']}";
if ($type = $this->headers('Content-Type')) {
View
14 net/http/Route.php
@@ -30,13 +30,13 @@
* incoming URLs than it generates.
*
* {{{$route = new Route(array(
- * 'template' => '/users/{:user}',
- * 'pattern' => '@^/u(?:sers)?(?:/(?P<user>[^\/]+))$@',
- * 'params' => array('controller' => 'users', 'action' => 'index'),
- * 'match' => array('controller' => 'users', 'action' => 'index'),
- * 'defaults' => array('controller' => 'users'),
- * 'keys' => array('user' => 'user'),
- * 'options' => array('compile' => false, 'wrap' => false)
+ * 'template' => '/users/{:user}',
+ * 'pattern' => '@^/u(?:sers)?(?:/(?P<user>[^\/]+))$@',
+ * 'params' => array('controller' => 'users', 'action' => 'index'),
+ * 'match' => array('controller' => 'users', 'action' => 'index'),
+ * 'defaults' => array('controller' => 'users'),
+ * 'keys' => array('user' => 'user'),
+ * 'options' => array('compile' => false, 'wrap' => false)
* ));
* Router::connect($route); // this will match '/users/<username>' or '/u/<username>'.
* }}}
View
1 net/http/Service.php
@@ -67,6 +67,7 @@ class Service extends \lithium\core\Object {
/**
* Initializes a new `Service` instance with the default HTTP request settings and
* transport- and format-handling classes.
+ *
* @param array $config
*/
public function __construct(array $config = array()) {
View
1 security/validation/RequestToken.php
@@ -45,6 +45,7 @@
* // Handle a normal request...
* }
* }}}
+ *
* @link http://shiflett.org/articles/cross-site-request-forgeries Cross-Site Request Forgeries
* @see lithium\template\helper\Security::requestToken()
*/
View
1 storage/Cache.php
@@ -123,7 +123,6 @@ public static function write($name, $key, $data, $expiry = null, array $options
return static::_filter(__FUNCTION__, $params, $method, $settings[$name]['filters']);
}
-
/**
* Reads from the specified cache configuration
*
View
4 storage/Session.php
@@ -8,8 +8,6 @@
namespace lithium\storage;
-use lithium\core\Libraries;
-
/**
* The `Session` static class provides a consistent interface to configure and utilize the
* different persistent storage adapters included with Lithium, as well as your own adapters.
@@ -58,7 +56,7 @@ class Session extends \lithium\core\Adaptable {
* Returns (and Sets) the key used to identify the session.
*
* @param mixed $name Optional named session configuration.
- * @param mixed $session_id Optional session id to use for this session.
+ * @param mixed $session_id Optional session id to use for this session.
* @return string Returns the value of the session identifier key, or `null` if no named
* configuration exists, no session id has been set or no session has been started.
*/
View
3 storage/cache/adapter/File.php
@@ -47,7 +47,8 @@ class File extends \lithium\core\Object {
* @param array $config Configuration parameters for this cache adapter. These settings are
* indexed by name and queryable through `Cache::config('name')`.
* The defaults are:
- * - 'path' : Path where cached entries live `Libraries::get(true, 'resources') . '/tmp/cache'`.
+ * - 'path' : Path where cached entries live, for example
+ * `Libraries::get(true, 'resources') . '/tmp/cache'`.
* - 'expiry' : Default expiry time used if none is explicitly set when calling
* `Cache::write()`.
*/
View
1 storage/cache/adapter/Redis.php
@@ -45,7 +45,6 @@
* @see lithium\storage\Cache::key()
* @see lithium\storage\Cache::adapter()
* @link https://github.com/nicolasff/phpredis GitHub: PhpRedis Extension
- *
*/
class Redis extends \lithium\core\Object {
View
1 storage/cache/adapter/XCache.php
@@ -132,7 +132,6 @@ public function increment($key, $offset = 1) {
};
}
-
/**
* Clears user-space cache.
*
View
2 storage/session/adapter/Cookie.php
@@ -28,7 +28,7 @@ class Cookie extends \lithium\core\Object {
*
* @var array Keys are in direct correspondence with the parameters in the PHP-native
* `setcookie()` method. The only difference is that the `expire` value is a
- * strtotime-compatible string instead of an epochal timestamp.
+ * strtotime-compatible string instead of an epochal timestamp.
*/
protected $_defaults = array(
'expire' => '+2 days', 'path' => '/',
View
4 storage/session/strategy/Encrypt.php
@@ -21,8 +21,8 @@
*
* {{{
* Session::config(array('default' => array(
- * 'adapter' => 'Cookie',
- * 'strategies' => array('Encrypt' => array('secret' => 'f00bar$l1thium'))
+ * 'adapter' => 'Cookie',
+ * 'strategies' => array('Encrypt' => array('secret' => 'f00bar$l1thium'))
* )));
* }}}
*
View
4 storage/session/strategy/Hmac.php
@@ -21,8 +21,8 @@
*
* {{{
* Session::config(array('default' => array(
- * 'adapter' => 'Cookie',
- * 'strategies' => array('Hmac' => array('secret' => 'foobar'))
+ * 'adapter' => 'Cookie',
+ * 'strategies' => array('Hmac' => array('secret' => 'foobar'))
* )));
* }}}
*
View
145 template/helper/Form.php
@@ -113,7 +113,7 @@ class Form extends \lithium\template\Helper {
* @see lithium\data\Collection
* @see lithium\template\helper\Form::create()
* @var mixed A single data object, a `Collection` of multiple data objects, or an array of data
- * objects/`Collection`s.
+ * objects/`Collection`s.
*/
protected $_binding = null;
@@ -218,9 +218,9 @@ protected function _init() {
*
* @see lithium\template\helper\Form::$_templateMap
* @param array $config An associative array where the keys are `Form` method names (or
- * `'templates'`, to include a template-overriding sub-array), and the
- * values are arrays of configuration options to be included in the `$options`
- * parameter of each method specified.
+ * `'templates'`, to include a template-overriding sub-array), and the
+ * values are arrays of configuration options to be included in the `$options`
+ * parameter of each method specified.
* @return array Returns an array containing the currently set per-method configurations, and
* an array of the currently set template overrides (in the `'templates'` array key).
*/
@@ -249,21 +249,21 @@ public function config(array $config = array()) {
*
* @see lithium\template\helper\Form::$_binding
* @see lithium\data\Entity
- * @param mixed $bindings List of objects, or the object to bind the form to. This is usually an
- * instance of `Record` or `Document`, or some other class that extends
- * `lithium\data\Entity`.
+ * @param mixed $bindings List of objects, or the object to bind the form to. This is usually
+ * an instance of `Record` or `Document`, or some other class that extends
+ * `lithium\data\Entity`.
* @param array $options Other parameters for creating the form. Available options are:
- * - `'url'` _mixed_: A string URL or URL array parameters defining where in the
- * application the form should be submitted to.
- * - `'action'` _string_: This is a shortcut to be used if you wish to only
- * specify the name of the action to submit to, and use the default URL
- * parameters (i.e. the current controller, etc.) for generating the remainder
- * of the URL. Ignored if the `'url'` key is set.
- * - `'type'` _string_: Currently the only valid option is `'file'`. Set this if
- * the form will be used for file uploads.
- * - `'method'` _string_: Represents the HTTP method with which the form will be
- * submitted (`'get'`, `'post'`, `'put'` or `'delete'`). If `'put'` or
- * `'delete'`, the request method is simulated using a hidden input field.
+ * - `'url'` _mixed_: A string URL or URL array parameters defining where in the
+ * application the form should be submitted to.
+ * - `'action'` _string_: This is a shortcut to be used if you wish to only
+ * specify the name of the action to submit to, and use the default URL
+ * parameters (i.e. the current controller, etc.) for generating the remainder
+ * of the URL. Ignored if the `'url'` key is set.
+ * - `'type'` _string_: Currently the only valid option is `'file'`. Set this if
+ * the form will be used for file uploads.
+ * - `'method'` _string_: Represents the HTTP method with which the form will be
+ * submitted (`'get'`, `'post'`, `'put'` or `'delete'`). If `'put'` or
+ * `'delete'`, the request method is simulated using a hidden input field.
* @return string Returns a `<form />` open tag with the `action` attribute defined by either
* the `'action'` or `'url'` options (defaulting to the current page if none is
* specified), the HTTP method is defined by the `'method'` option, and any HTML
@@ -383,10 +383,10 @@ public function binding($name = null) {
* {{{ embed:lithium\tests\cases\template\helper\FormTest::testCustomInputTypes(1-2) }}}
*
* @param string $type The method called, which represents the `type` attribute of the
- * `<input />` tag.
+ * `<input />` tag.
* @param array $params An array of method parameters passed to the method call. The first
- * element should be the name of the input field, and the second should be an array
- * of element attributes.
+ * element should be the name of the input field, and the second should be an array
+ * of element attributes.
* @return string Returns an `<input />` tag of the type specified in `$type`.
*/
public function __call($type, array $params = array()) {
@@ -418,29 +418,30 @@ public function respondsTo($method, $internal = false) {
* echo $this->form->field(array('email' => 'Enter a valid email'));
* echo $this->form->field(array('name','email','phone'), array('div' => false));
* }}}
+ *
* @param mixed $name The name of the field to render. If the form was bound to an object
- * passed in `create()`, `$name` should be the name of a field in that object.
- * Otherwise, can be any arbitrary field name, as it will appear in POST data.
- * Alternatively supply an array of fields that will use the same options
- * array($field1 => $label1, $field2, $field3 => $label3)
+ * passed in `create()`, `$name` should be the name of a field in that object.
+ * Otherwise, can be any arbitrary field name, as it will appear in POST data.
+ * Alternatively supply an array of fields that will use the same options
+ * array($field1 => $label1, $field2, $field3 => $label3)
* @param array $options Rendering options for the form field. The available options are as
- * follows:
- * - `'label'` _mixed_: A string or array defining the label text and / or
- * parameters. By default, the label text is a human-friendly version of `$name`.
- * However, you can specify the label manually as a string, or both the label
- * text and options as an array, i.e.:
- * `array('Your Label Title' => array('class' => 'foo', 'other' => 'options'))`.
- * - `'type'` _string_: The type of form field to render. Available default options
- * are: `'text'`, `'textarea'`, `'select'`, `'checkbox'`, `'password'` or
- * `'hidden'`, as well as any arbitrary type (i.e. HTML5 form fields).
- * - `'template'` _string_: Defaults to `'template'`, but can be set to any named
- * template string, or an arbitrary HTML fragment. For example, to change the
- * default wrapper tag from `<div />` to `<li />`, you can pass the following:
- * `'<li{:wrap}>{:label}{:input}{:error}</li>'`.
- * - `'wrap'` _array_: An array of HTML attributes which will be embedded in the
- * wrapper tag.
- * - `list` _array_: If `'type'` is set to `'select'`, `'list'` is an array of
- * key/value pairs representing the `$list` parameter of the `select()` method.
+ * follows:
+ * - `'label'` _mixed_: A string or array defining the label text and / or
+ * parameters. By default, the label text is a human-friendly version of `$name`.
+ * However, you can specify the label manually as a string, or both the label
+ * text and options as an array, i.e.:
+ * `array('Your Label Title' => array('class' => 'foo', 'other' => 'options'))`.
+ * - `'type'` _string_: The type of form field to render. Available default options
+ * are: `'text'`, `'textarea'`, `'select'`, `'checkbox'`, `'password'` or
+ * `'hidden'`, as well as any arbitrary type (i.e. HTML5 form fields).
+ * - `'template'` _string_: Defaults to `'template'`, but can be set to any named
+ * template string, or an arbitrary HTML fragment. For example, to change the
+ * default wrapper tag from `<div />` to `<li />`, you can pass the following:
+ * `'<li{:wrap}>{:label}{:input}{:error}</li>'`.
+ * - `'wrap'` _array_: An array of HTML attributes which will be embedded in the
+ * wrapper tag.
+ * - `list` _array_: If `'type'` is set to `'select'`, `'list'` is an array of
+ * key/value pairs representing the `$list` parameter of the `select()` method.
* @return string Returns a form input (the input type is based on the `'type'` option), with
* label and error message, wrapped in a `<div />` element.
*/
@@ -487,7 +488,7 @@ public function field($name, array $options = array()) {
* @see lithium\template\helper\Form::field()
* @param array $fields An array of fields to render.
* @param array $options The array of options to apply to all fields in the `$fields` array. See
- * the `$options` parameter of the `field` method for more information.
+ * the `$options` parameter of the `field` method for more information.
* @return string Returns the fields rendered by `field()`, each separated by a newline.
*/
protected function _fields(array $fields, array $options = array()) {
@@ -508,7 +509,7 @@ protected function _fields(array $fields, array $options = array()) {
*
* @param string $title The title of the button.
* @param array $options Any options passed are converted to HTML attributes within the
- * `<button></button>` tag.
+ * `<button></button>` tag.
* @return string Returns a `<button></button>` tag with the given title and HTML attributes.
*/
public function button($title = null, array $options = array()) {
@@ -525,7 +526,7 @@ public function button($title = null, array $options = array()) {
*
* @param string $title The title of the submit button.
* @param array $options Any options passed are converted to HTML attributes within the
- * `<input />` tag.
+ * `<input />` tag.
* @return string Returns a submit `<input />` tag with the given title and HTML attributes.
*/
public function submit($title = null, array $options = array()) {
@@ -538,9 +539,9 @@ public function submit($title = null, array $options = array()) {
*
* @param string $name The name of the field.
* @param array $options The options to be used when generating the `<textarea />` tag pair,
- * which are as follows:
- * - `'value'` _string_: The content value of the field.
- * - Any other options specified are rendered as HTML attributes of the element.
+ * which are as follows:
+ * - `'value'` _string_: The content value of the field.
+ * - Any other options specified are rendered as HTML attributes of the element.
* @return string Returns a `<textarea>` tag with the given name and HTML attributes.
*/
public function textarea($name, array $options = array()) {
@@ -576,10 +577,10 @@ public function text($name, array $options = array()) {
*
* @param string $name Th