Browse files

insert space after type casting parenthesis

  • Loading branch information...
1 parent 330287a commit 9decac0cf7b8f3c0abcf61bfee5de83999e3088d @alkemann alkemann committed Dec 13, 2009
Showing with 161 additions and 161 deletions.
  1. +2 −2 libraries/lithium/action/Controller.php
  2. +3 −3 libraries/lithium/action/Request.php
  3. +2 −2 libraries/lithium/action/Response.php
  4. +3 −3 libraries/lithium/console/Command.php
  5. +1 −1 libraries/lithium/console/Dispatcher.php
  6. +3 −3 libraries/lithium/console/Request.php
  7. +2 −2 libraries/lithium/console/command/g11n/Extract.php
  8. +9 −9 libraries/lithium/core/Libraries.php
  9. +2 −2 libraries/lithium/core/Object.php
  10. +1 −1 libraries/lithium/core/StaticObject.php
  11. +1 −1 libraries/lithium/data/Connections.php
  12. +3 −3 libraries/lithium/data/Model.php
  13. +1 −1 libraries/lithium/data/Source.php
  14. +4 −4 libraries/lithium/data/model/Document.php
  15. +1 −1 libraries/lithium/data/model/Query.php
  16. +1 −1 libraries/lithium/data/model/Record.php
  17. +1 −1 libraries/lithium/data/source/Database.php
  18. +1 −1 libraries/lithium/data/source/Http.php
  19. +1 −1 libraries/lithium/data/source/MongoDb.php
  20. +2 −2 libraries/lithium/data/source/database/adapter/MySQLi.php
  21. +2 −2 libraries/lithium/data/source/database/adapter/MySql.php
  22. +1 −1 libraries/lithium/data/source/database/adapter/Sqlite3.php
  23. +6 −6 libraries/lithium/data/source/http/adapter/CouchDb.php
  24. +3 −3 libraries/lithium/g11n/Catalog.php
  25. +1 −1 libraries/lithium/g11n/Locale.php
  26. +1 −1 libraries/lithium/g11n/catalog/adapter/Base.php
  27. +3 −3 libraries/lithium/g11n/catalog/adapter/Cldr.php
  28. +1 −1 libraries/lithium/g11n/catalog/adapter/Gettext.php
  29. +2 −2 libraries/lithium/http/Base.php
  30. +6 −6 libraries/lithium/http/Media.php
  31. +1 −1 libraries/lithium/http/Response.php
  32. +1 −1 libraries/lithium/http/Route.php
  33. +2 −2 libraries/lithium/http/Service.php
  34. +1 −1 libraries/lithium/storage/cache/adapter/Memory.php
  35. +1 −1 libraries/lithium/storage/session/adapter/Cookie.php
  36. +1 −1 libraries/lithium/storage/session/adapter/Memory.php
  37. +2 −2 libraries/lithium/storage/session/adapter/Php.php
  38. +1 −1 libraries/lithium/template/Helper.php
  39. +2 −2 libraries/lithium/template/View.php
  40. +2 −2 libraries/lithium/template/helper/Form.php
  41. +1 −1 libraries/lithium/template/view/Renderer.php
  42. +1 −1 libraries/lithium/template/view/adapter/File.php
  43. +1 −1 libraries/lithium/template/view/adapter/Simple.php
  44. +1 −1 libraries/lithium/test/Dispatcher.php
  45. +2 −2 libraries/lithium/test/Group.php
  46. +4 −4 libraries/lithium/test/Report.php
  47. +2 −2 libraries/lithium/test/Reporter.php
  48. +5 −5 libraries/lithium/test/Unit.php
  49. +1 −1 libraries/lithium/test/filter/Complexity.php
  50. +1 −1 libraries/lithium/test/filter/Coverage.php
  51. +2 −2 libraries/lithium/test/filter/Profiler.php
  52. +1 −1 libraries/lithium/test/reporter/Html.php
  53. +1 −1 libraries/lithium/test/reporter/Text.php
  54. +1 −1 libraries/lithium/tests/cases/console/DispatcherTest.php
  55. +3 −3 libraries/lithium/tests/cases/data/model/DocumentTest.php
  56. +1 −1 libraries/lithium/tests/cases/data/model/QueryTest.php
  57. +1 −1 libraries/lithium/tests/cases/data/source/HttpTest.php
  58. +5 −5 libraries/lithium/tests/cases/data/source/http/adapter/CouchDbTest.php
  59. +3 −3 libraries/lithium/tests/cases/http/RequestTest.php
  60. +4 −4 libraries/lithium/tests/cases/http/ResponseTest.php
  61. +4 −4 libraries/lithium/tests/cases/http/ServiceTest.php
  62. +2 −2 libraries/lithium/tests/cases/storage/CacheTest.php
  63. +2 −2 libraries/lithium/tests/cases/storage/session/adapter/PhpTest.php
  64. +1 −1 libraries/lithium/tests/cases/test/GroupTest.php
  65. +1 −1 libraries/lithium/tests/mocks/core/MockObjectConfiguration.php
  66. +1 −1 libraries/lithium/tests/mocks/data/source/http/adapter/MockService.php
  67. +1 −1 libraries/lithium/tests/mocks/http/MockService.php
  68. +2 −2 libraries/lithium/util/Inflector.php
  69. +7 −7 libraries/lithium/util/Set.php
  70. +1 −1 libraries/lithium/util/Socket.php
  71. +2 −2 libraries/lithium/util/String.php
  72. +4 −4 libraries/lithium/util/Validator.php
  73. +1 −1 libraries/lithium/util/collection/Filters.php
  74. +2 −2 libraries/lithium/util/reflection/Docblock.php
  75. +2 −2 libraries/lithium/util/reflection/Inspector.php
  76. +3 −3 libraries/lithium/util/reflection/Parser.php
View
4 libraries/lithium/action/Controller.php
@@ -106,7 +106,7 @@ public function __construct($config = array()) {
foreach (array('render', 'classes') as $key) {
if (!empty($config[$key])) {
- $this->{'_' . $key} = (array)$config[$key] + $this->{'_' . $key};
+ $this->{'_' . $key} = (array) $config[$key] + $this->{'_' . $key};
}
}
parent::__construct($config);
@@ -171,7 +171,7 @@ public function __invoke($request, $dispatchParams, $options = array()) {
* @return void
*/
public function set($data = array()) {
- $this->_render['data'] += (array)$data;
+ $this->_render['data'] += (array) $data;
}
/**
View
6 libraries/lithium/action/Request.php
@@ -126,7 +126,7 @@ protected function _init() {
$mobile = array_merge($mobile, (array) $this->_config['detectors']['mobile'][1]);
}
$this->_detectors['mobile'][1] = $mobile;
- $this->_env += (array)$_SERVER + (array)$_ENV;
+ $this->_env += (array) $_SERVER + (array) $_ENV;
$envs = array('isapi' => 'IIS', 'cgi' => 'CGI', 'cgi-fcgi' => 'CGI');
$this->_env['PLATFORM'] = isset($envs[PHP_SAPI]) ? $envs[PHP_SAPI] : null;
$this->_base = $this->_base ?: $this->_base();
@@ -311,14 +311,14 @@ public function is($flag) {
$check = '/' .join('|', $check) . '/i';
}
if (Validator::isRegex($check)) {
- return (boolean)preg_match($check, $this->env($key));
+ return (boolean) preg_match($check, $this->env($key));
}
return ($this->env($key) == $check);
}
if (is_callable($detector)) {
return $detector($this);
}
- return (boolean)$this->env($detector);
+ return (boolean) $this->env($detector);
}
return false;
}
View
4 libraries/lithium/action/Response.php
@@ -28,7 +28,7 @@ public function __construct($config = array()) {
if (!empty($config['request']) && is_object($config['request'])) {
$this->type = $config['request']->type();
}
- $this->_config = (array)$config + $defaults;
+ $this->_config = (array) $config + $defaults;
parent::__construct($this->_config);
}
@@ -96,7 +96,7 @@ public function render() {
$this->_writeHeader("{$name}: {$value}");
}
}
- $chunked = str_split(join("\r\n", (array)$this->body), $this->_config['buffer']);
+ $chunked = str_split(join("\r\n", (array) $this->body), $this->_config['buffer']);
foreach ($chunked as $chunk) {
echo $chunk;
View
6 libraries/lithium/console/Command.php
@@ -78,7 +78,7 @@ protected function _init() {
$this->response = new $this->_classes['response']($this->_config['response']);
if ($this->request) {
- foreach ((array)$this->request->params['named'] as $key => $param) {
+ foreach ((array) $this->request->params['named'] as $key => $param) {
$this->{$key} = $param;
}
}
@@ -222,7 +222,7 @@ public function header($text, $line = 80) {
*/
public function columns($rows, $separator = "\t") {
$lengths = array_reduce($rows, function($columns, $row) {
- foreach ((array)$row as $key => $val) {
+ foreach ((array) $row as $key => $val) {
if (!isset($columns[$key]) || strlen($val) > $columns[$key]) {
$columns[$key] = strlen($val);
}
@@ -231,7 +231,7 @@ public function columns($rows, $separator = "\t") {
});
$rows = array_reduce($rows, function($rows, $row) use ($lengths, $separator) {
$text = '';
- foreach ((array)$row as $key => $val) {
+ foreach ((array) $row as $key => $val) {
$text = $text . str_pad($val, $lengths[$key]) . $separator;
}
$rows[] = $text;
View
2 libraries/lithium/console/Dispatcher.php
@@ -94,7 +94,7 @@ public static function run($request = null, $options = array()) {
$callable = $self::invokeMethod('_callable', array($request, $params, $options));
return $self::invokeMethod('_call', array($callable, $request, $params));
} catch (\UnexpectedValueException $e) {
- return (object)array('status' => $e->getMessage() . "\n");
+ return (object) array('status' => $e->getMessage() . "\n");
}
});
}
View
6 libraries/lithium/console/Request.php
@@ -69,11 +69,11 @@ public function __construct($config = array()) {
* @return void
*/
protected function _init() {
- $this->_env += (array)$_SERVER + (array)$_ENV;
+ $this->_env += (array) $_SERVER + (array) $_ENV;
$this->_env['working'] = getcwd() ?: null;
- $argv = (array)$this->env('argv');
+ $argv = (array) $this->env('argv');
$this->_env['script'] = array_shift($argv);
- $this->args += $argv + (array)$this->_config['args'];
+ $this->args += $argv + (array) $this->_config['args'];
$this->input = $this->_config['input'];
if (!is_resource($this->_config['input'])) {
View
4 libraries/lithium/console/command/g11n/Extract.php
@@ -72,7 +72,7 @@ protected function _extract() {
$this->out($message);
$this->nl();
- $configs = (array)Catalog::config()->to('array');
+ $configs = (array) Catalog::config()->to('array');
$this->out('Available `Catalog` Configurations:');
foreach ($configs as $name => $config) {
@@ -139,7 +139,7 @@ protected function _writeTemplate($data, $meta) {
$this->out($message);
$this->nl();
- $configs = (array)Catalog::config()->to('array');
+ $configs = (array) Catalog::config()->to('array');
$this->out('Available `Catalog` Configurations:');
foreach ($configs as $name => $config) {
View
18 libraries/lithium/core/Libraries.php
@@ -158,11 +158,11 @@ public static function add($name, $config = array()) {
$defaults['defer'] = true;
break;
case 'plugin':
- return static::_addPlugins((array)$config);
+ return static::_addPlugins((array) $config);
break;
}
- $config = (array)$config + $defaults;
+ $config = (array) $config + $defaults;
$config['path'] = str_replace('\\', '/', $config['path']);
static::$_configurations[$name] = $config;
@@ -206,7 +206,7 @@ public static function get($name = null) {
* @return void
*/
public static function remove($name) {
- foreach ((array)$name as $library) {
+ foreach ((array) $name as $library) {
if (isset(static::$_configurations[$library])) {
if (static::$_configurations[$library]['loader']) {
spl_autoload_unregister(static::$_configurations[$library]['loader']);
@@ -411,7 +411,7 @@ public static function locate($type, $name = null, $options = array()) {
*/
protected static function _locateDeferred($defer, $paths, $params, $options = array()) {
if (isset($options['library'])) {
- $libraries = (array)$options['library'];
+ $libraries = (array) $options['library'];
$libraries = array_intersect_key(
static::$_configurations,
array_combine($libraries, array_fill(0, count($libraries), null))
@@ -432,7 +432,7 @@ protected static function _locateDeferred($defer, $paths, $params, $options = ar
}
$opts = $options + $pathOptions;
- if (isset($opts['libraries']) && !in_array($library, (array)$opts['libraries'])) {
+ if (isset($opts['libraries']) && !in_array($library, (array) $opts['libraries'])) {
unset($opts['libraries']);
continue;
}
@@ -479,7 +479,7 @@ protected static function _locateAll($params, $options = array()) {
}
$opts = $options + $tplOpts;
- if (isset($opts['libraries']) && !in_array($library, (array)$opts['libraries'])) {
+ if (isset($opts['libraries']) && !in_array($library, (array) $opts['libraries'])) {
unset($opts['libraries']);
continue;
}
@@ -506,14 +506,14 @@ protected static function _search($config, $options) {
$path = rtrim($config['path'] . $options['path'], '/');
$filter = '/^.+\/[A-Za-z0-9_]+$|^.*' . preg_quote($config['suffix'], '/') . '/';
$search = function($path) use ($config, $filter, $options) {
- return preg_grep($filter, (array)glob(
+ return preg_grep($filter, (array) glob(
$path . '/*' . ($options['namespaces'] ? '' : $config['suffix'])
));
};
$libs = $search($path, $config);
if ($options['recursive']) {
- $dirs = $queue = array_diff((array)glob($path . '/*', GLOB_ONLYDIR), $libs);
+ $dirs = $queue = array_diff((array) glob($path . '/*', GLOB_ONLYDIR), $libs);
while ($queue) {
$dir = array_pop($queue);
@@ -522,7 +522,7 @@ protected static function _search($config, $options) {
}
$libs = array_merge($libs, $search($dir, $config));
$queue = array_merge(
- $queue, array_diff((array)glob($dir . '/*', GLOB_ONLYDIR), $libs)
+ $queue, array_diff((array) glob($dir . '/*', GLOB_ONLYDIR), $libs)
);
}
}
View
4 libraries/lithium/core/Object.php
@@ -49,7 +49,7 @@ class Object {
*/
public function __construct($config = array()) {
$defaults = array('init' => true);
- $this->_config = (array)$config + $defaults;
+ $this->_config = (array) $config + $defaults;
if ($this->_config['init']) {
$this->_init();
@@ -103,7 +103,7 @@ protected function _init() {
* @see lithium\util\collection\Filters
*/
public function applyFilter($method, $closure = null) {
- foreach ((array)$method as $m) {
+ foreach ((array) $method as $m) {
if (!isset($this->_methodFilters[$m])) {
$this->_methodFilters[$m] = array();
}
View
2 libraries/lithium/core/StaticObject.php
@@ -42,7 +42,7 @@ public static function __init() {}
*/
public static function applyFilter($method, $closure = null) {
$class = get_called_class();
- foreach ((array)$method as $m) {
+ foreach ((array) $method as $m) {
if (!isset(static::$_methodFilters[$class][$m])) {
static::$_methodFilters[$class][$m] = array();
}
View
2 libraries/lithium/data/Connections.php
@@ -110,7 +110,7 @@ public static function add($name, $type = null, $config = array()) {
'login' => '',
'password' => ''
);
- return static::$_configurations[$name] = (array)$config + $defaults;
+ return static::$_configurations[$name] = (array) $config + $defaults;
}
/**
View
6 libraries/lithium/data/Model.php
@@ -195,7 +195,7 @@ public static function find($type, $options = array()) {
$type = 'first';
}
- $options += ((array)$self->_query + (array)$defaults + compact('classes'));
+ $options += ((array) $self->_query + (array) $defaults + compact('classes'));
$meta = array('meta' => $self->_meta, 'name' => get_called_class());
$params = compact('type', 'options');
@@ -492,7 +492,7 @@ protected static function &_connection() {
* @param mixed $closure
*/
public static function applyFilter($method, $closure = null) {
- foreach ((array)$method as $m) {
+ foreach ((array) $method as $m) {
if (!isset(static::_instance()->_instanceFilters[$m])) {
static::_instance()->_instanceFilters[$m] = array();
}
@@ -547,7 +547,7 @@ protected static function _relations() {
'fields' => true,
'key' => $key . '_id'
);
- $relations[$name] = (array)$options + $defaults;
+ $relations[$name] = (array) $options + $defaults;
}
}
return $relations;
View
2 libraries/lithium/data/Source.php
@@ -49,7 +49,7 @@
*/
public function __construct($config = array()) {
$defaults = array('autoConnect' => true);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
View
8 libraries/lithium/data/model/Document.php
@@ -131,7 +131,7 @@ public function __construct($config = array()) {
unset($config['data']);
}
parent::__construct($config);
- $this->_items = (array)$this->_items;
+ $this->_items = (array) $this->_items;
}
/**
@@ -321,7 +321,7 @@ protected function _isComplexType($data) {
if (is_scalar($data) || !$data) {
return false;
}
- if (is_object($data) && (array)$data === array()) {
+ if (is_object($data) && (array) $data === array()) {
return false;
}
if (is_array($data)) {
@@ -344,9 +344,9 @@ protected function _isComplexType($data) {
*/
protected function _update($id = null) {
if ($id) {
- $id = (array)$id;
+ $id = (array) $id;
$model = $this->_model;
- foreach ((array)$model::meta('key') as $i => $key) {
+ foreach ((array) $model::meta('key') as $i => $key) {
$this->__set($key, $id[$i]);
}
}
View
2 libraries/lithium/data/model/Query.php
@@ -89,7 +89,7 @@ public function conditions($conditions = null) {
if (empty($conditions)) {
return $this->_conditions ?: $this->_recordConditions();
}
- $this->_conditions = array_merge($this->_conditions, (array)$conditions);
+ $this->_conditions = array_merge($this->_conditions, (array) $conditions);
}
/**
View
2 libraries/lithium/data/model/Record.php
@@ -64,7 +64,7 @@ class Record extends \lithium\core\Object {
*/
public function __construct($config = array()) {
$defaults = array('model' => null, 'data' => array());
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
public function __get($name) {
View
2 libraries/lithium/data/source/Database.php
@@ -66,7 +66,7 @@ public function __construct($config = array()) {
'password' => '',
'database' => 'lithium',
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
public function name($name) {
View
2 libraries/lithium/data/source/Http.php
@@ -61,7 +61,7 @@ public function __construct($config = array()) {
'timeout' => 1,
'encoding' => 'UTF-8'
);
- $config = (array)$config + $defaults;
+ $config = (array) $config + $defaults;
$config['auth'] = array(
'method' => $config['auth'],
View
2 libraries/lithium/data/source/MongoDb.php
@@ -59,7 +59,7 @@ public function __construct($config = array()) {
'database' => 'lithium',
'port' => '27017',
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
View
4 libraries/lithium/data/source/database/adapter/MySQLi.php
@@ -80,7 +80,7 @@ class MySQLi extends \lithium\data\source\Database {
*/
public function __construct($config = array()) {
$defaults = array('port' => '3306');
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
@@ -131,7 +131,7 @@ public function connect() {
$this->_encoding($config['encoding']);
}
- $this->_useAlias = (boolean)version_compare(
+ $this->_useAlias = (boolean) version_compare(
$this->_connection->server_info, "4.1", ">="
);
}
View
4 libraries/lithium/data/source/database/adapter/MySql.php
@@ -63,7 +63,7 @@ class MySql extends \lithium\data\source\Database {
*/
public function __construct($config = array()) {
$defaults = array('port' => '3306');
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
@@ -90,7 +90,7 @@ public function connect() {
$this->encoding($config['encoding']);
}
- $this->_useAlias = (boolean)version_compare(
+ $this->_useAlias = (boolean) version_compare(
mysql_get_server_info($this->_connection), "4.1", ">="
);
return $this->_isConnected;
View
2 libraries/lithium/data/source/database/adapter/Sqlite3.php
@@ -62,7 +62,7 @@ public function __construct($config = array()) {
'flags' => NULL,
'key' => NULL
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
View
12 libraries/lithium/data/source/http/adapter/CouchDb.php
@@ -38,7 +38,7 @@ class CouchDb extends \lithium\data\source\Http {
*/
public function __construct($config = array()) {
$defaults = array('port' => 5984);
- $config = (array)$config + $defaults;
+ $config = (array) $config + $defaults;
parent::__construct($config);
}
@@ -168,7 +168,7 @@ public function create($query, $options = array()) {
$result = (object) $self->result('next', $result, $query);
if ($success = (isset($result->id) || (isset($result->ok) && $result->ok === true))) {
- $query->data($data + (array)$result);
+ $query->data($data + (array) $result);
$query->record()->invokeMethod('_update', array($result->id));
}
return $success;
@@ -282,9 +282,9 @@ public function result($type, $resource, $context) {
switch ($type) {
case 'next':
if (!isset($resource->rows)) {
- $result = (array)$resource;
+ $result = (array) $resource;
} elseif (isset($resource->rows[$this->_iterator])) {
- $result = (array)$resource->rows[$this->_iterator]->value;
+ $result = (array) $resource->rows[$this->_iterator]->value;
$result['id'] = $resource->rows[$this->_iterator]->id;
if (isset($resource->rows[$this->_iterator]->key)) {
$result['key'] = $resource->rows[$this->_iterator]->key;
@@ -336,7 +336,7 @@ public function conditions($conditions, $context) {
$path = "/{$conditions['_id']}";
unset($conditions['_id']);
}
- $conditions = array_filter((array)$conditions);
+ $conditions = array_filter((array) $conditions);
return compact('path', 'conditions');
}
@@ -370,7 +370,7 @@ public function limit($limit, $context) {
* @return array
*/
function order($order, $context) {
- return (array)$order ?: array();
+ return (array) $order ?: array();
}
}
View
6 libraries/lithium/g11n/Catalog.php
@@ -68,10 +68,10 @@ public static function read($category, $locales, $options = array()) {
$defaults = array('name' => null, 'scope' => null);
$options += $defaults;
- $names = (array)$options['name'] ?: static::$_configurations->keys();
+ $names = (array) $options['name'] ?: static::$_configurations->keys();
$results = null;
- foreach ((array)$locales as $locale) {
+ foreach ((array) $locales as $locale) {
foreach (Locale::cascade($locale) as $cascaded) {
foreach ($names as $name) {
$adapter = static::_adapter($name);
@@ -123,7 +123,7 @@ public static function write($category, $data, $options = array()) {
$defaults = array('name' => null, 'scope' => null);
$options += $defaults;
- $names = (array)$options['name'] ?: static::$_configurations->keys();
+ $names = (array) $options['name'] ?: static::$_configurations->keys();
foreach ($names as $name) {
$adapter = static::_adapter($name);
View
2 libraries/lithium/g11n/Locale.php
@@ -124,7 +124,7 @@ public static function canonicalize($locale) {
$tags = static::decompose($locale);
foreach ($tags as $name => &$tag) {
- foreach ((array)static::$_tags[$name]['formatter'] as $formatter) {
+ foreach ((array) static::$_tags[$name]['formatter'] as $formatter) {
$tag = $formatter($tag);
}
}
View
2 libraries/lithium/g11n/catalog/adapter/Base.php
@@ -107,7 +107,7 @@ public function isSupported($category, $operation) {
*/
protected function _formatMessageItem($key, $value) {
if (!is_array($value) || !isset($value['translated'])) {
- return array('singularId' => $key, 'translated' => (array)$value);
+ return array('singularId' => $key, 'translated' => (array) $value);
}
return $value;
}
View
6 libraries/lithium/g11n/catalog/adapter/Cldr.php
@@ -86,7 +86,7 @@ public function read($category, $locale, $scope) {
$query .= "/postCodeRegex[@territoryId=\"{$territory}\"]";
$yield = function($nodes) {
- return (string)current($nodes);
+ return (string) current($nodes);
};
$post = function($data) {
return "/^{$data}$/";
@@ -105,7 +105,7 @@ public function read($category, $locale, $scope) {
$data = null;
foreach ($nodes as $node) {
- $data[(string)$node['type']] = (string)$node;
+ $data[(string) $node['type']] = (string) $node;
}
return $data;
};
@@ -119,7 +119,7 @@ public function read($category, $locale, $scope) {
foreach ($nodes as $node) {
$displayNames = $node->xpath('displayName');
- $data[(string)$node['type']] = (string)current($displayNames);
+ $data[(string) $node['type']] = (string) current($displayNames);
}
return $data;
};
View
2 libraries/lithium/g11n/catalog/adapter/Gettext.php
@@ -300,7 +300,7 @@ protected function _parseMo($stream) {
protected function _readLong($stream, $isBigEndian) {
$result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4));
$result = current($result);
- return (integer)substr($result, -8);
+ return (integer) substr($result, -8);
}
/**
View
4 libraries/lithium/http/Base.php
@@ -63,7 +63,7 @@ public function headers($key = null, $value = null) {
if (!empty($value)) {
$this->headers = array_merge($this->headers, array($key => $value));
} else {
- foreach ((array)$key as $header => $value) {
+ foreach ((array) $key as $header => $value) {
if (!is_string($header)) {
if (preg_match('/(.*?):(.+)/i', $value, $match)) {
$this->headers[$match[1]] = trim($match[2]);
@@ -88,7 +88,7 @@ public function headers($key = null, $value = null) {
* @return array
*/
public function body($data = null) {
- $this->body = array_merge((array)$this->body, (array)$data);
+ $this->body = array_merge((array) $this->body, (array) $data);
return trim(join("\r\n", $this->body));
}
}
View
12 libraries/lithium/http/Media.php
@@ -198,7 +198,7 @@ public static function type($type, $content = null, $options = array()) {
static::$_types[$type] = $content;
}
if (!empty($options)) {
- static::$_handlers[$type] = ((array)$options + $defaults);
+ static::$_handlers[$type] = ((array) $options + $defaults);
}
}
@@ -233,10 +233,10 @@ public static function assets($type = null, $options = array()) {
if (empty($options)) {
return isset(static::$_assets[$type]) ? static::$_assets[$type] : null;
}
- $options = (array)$options + $defaults;
+ $options = (array) $options + $defaults;
if (isset(static::$_assets[$type])) {
- static::$_assets[$type] = array_filter((array)$options) + static::$_assets[$type];
+ static::$_assets[$type] = array_filter((array) $options) + static::$_assets[$type];
} else {
static::$_assets[$type] = $options;
}
@@ -359,14 +359,14 @@ public static function render(&$response, $data = null, $options = array()) {
}
if (isset(static::$_handlers[$type])) {
- $h = (array)static::$_handlers[$type] + (array)static::$_handlers['default'];
+ $h = (array)static::$_handlers[$type] + (array) static::$_handlers['default'];
} else {
$h = $options + $defaults;
$filter = function($v) { return $v !== null; };
$h = array_filter($h, $filter) + static::$_handlers['default'] + $defaults;
}
$response->body(static::_handle($h, $data, $options));
- $response->headers('Content-type', current((array)static::$_types[$type]));
+ $response->headers('Content-type', current((array) static::$_types[$type]));
}
/**
@@ -401,7 +401,7 @@ protected static function _handle($handler, $data, $options) {
$result = '';
if (isset($options['request'])) {
- $options += (array)$options['request']->params;
+ $options += (array) $options['request']->params;
$handler['request'] = $options['request'];
}
View
2 libraries/lithium/http/Response.php
@@ -139,7 +139,7 @@ public function __construct($config = array()) {
unset($config['message']);
}
- foreach ((array)$config as $key => $value) {
+ foreach ((array) $config as $key => $value) {
if (isset($this->{$key})) {
$this->{$key} = $value;
}
View
2 libraries/lithium/http/Route.php
@@ -99,7 +99,7 @@ public function __construct($config = array()) {
'keys' => array(),
'options' => array()
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
protected function _init() {
View
4 libraries/lithium/http/Service.php
@@ -77,7 +77,7 @@ public function __construct($config = array()) {
'timeout' => 1,
'encoding' => 'UTF-8',
);
- $config = (array)$config + $defaults;
+ $config = (array) $config + $defaults;
$config['auth'] = array(
'method' => $config['auth'],
@@ -214,7 +214,7 @@ protected function _request($method, $path, $data, $options) {
if (in_array($options['type'], $media::types()) && $data && !is_string($data)) {
$type = $media::type($options['type']);
- $contentType = (array)$type['content'];
+ $contentType = (array) $type['content'];
$request->headers(array('Content-Type' => current($contentType)));
$data = Media::encode($options['type'], $data, $options);
}
View
2 libraries/lithium/storage/cache/adapter/Memory.php
@@ -67,7 +67,7 @@ public function write($key, $data, $conditions = null) {
return function($self, $params, $chain) use (&$cache) {
extract($params);
- return (boolean)($cache[$key] = $data);
+ return (boolean) ($cache[$key] = $data);
};
}
View
2 libraries/lithium/storage/session/adapter/Cookie.php
@@ -42,7 +42,7 @@ class Cookie extends \lithium\core\Object {
* @return void
*/
public function __construct($config = array()) {
- parent::__construct((array)$config + $this->_defaults);
+ parent::__construct((array) $config + $this->_defaults);
}
/**
View
2 libraries/lithium/storage/session/adapter/Memory.php
@@ -43,7 +43,7 @@ public function write($key, $value, $options = array()) {
return function($self, $params, $chain) use (&$session) {
extract($params);
- return (boolean)($session[$key] = $value);
+ return (boolean) ($session[$key] = $value);
};
}
View
4 libraries/lithium/storage/session/adapter/Php.php
@@ -38,7 +38,7 @@ class Php extends \lithium\core\Object {
* @return void
*/
public function __construct($config = array()) {
- parent::__construct((array)$config + $this->_defaults);
+ parent::__construct((array) $config + $this->_defaults);
}
/**
@@ -139,7 +139,7 @@ public static function delete($key, $options = array()) {
* return boolean True if enabled, false otherwise
*/
public function enabled() {
- return (boolean)session_id();
+ return (boolean) session_id();
}
}
View
2 libraries/lithium/template/Helper.php
@@ -114,7 +114,7 @@ protected function _formatAttr($key, $value, $options = array()) {
$options += $defaults;
$format = '%s="%s"';
- $value = (string)$value;
+ $value = (string) $value;
if (in_array($key, $this->_minimized)) {
$isMini = ($value == 1 || $value === true || $value === 'true' || $value == $key);
View
4 libraries/lithium/template/View.php
@@ -57,7 +57,7 @@ protected function _init() {
}
$h = function($data) use (&$h) {
- return is_array($data) ? array_map($h, $data) : htmlspecialchars((string)$data);
+ return is_array($data) ? array_map($h, $data) : htmlspecialchars((string) $data);
};
$t = function($message, $options = array()) {
return Message::translate($message, $options + array(
@@ -88,7 +88,7 @@ public function render($type, $data = array(), $options = array()) {
case 'template':
case 'layout':
$template = $this->_loader->template($type, $options);
- $data = (array)$data + $this->outputFilters;
+ $data = (array) $data + $this->outputFilters;
return $this->_renderer->render($template, $data, $options);
}
}
View
4 libraries/lithium/template/helper/Form.php
@@ -122,7 +122,7 @@ public function __construct($config = array()) {
'base' => array(), 'text' => array(), 'textarea' => array(),
'select' => array('multiple' => false)
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
@@ -180,7 +180,7 @@ public function create($binding = null, $options = array()) {
'method' => $binding ? ($binding->exists() ? 'put' : 'post') : 'post'
);
list(, $options, $template) = $this->_defaults(__FUNCTION__, null, $options);
- $options = (array)$options + $defaults;
+ $options = (array) $options + $defaults;
$_binding =& $this->_binding;
$method = __METHOD__;
View
2 libraries/lithium/template/view/Renderer.php
@@ -83,7 +83,7 @@ public function __construct($config = array()) {
'content' => '', 'title' => '', 'scripts' => array(), 'styles' => array()
)
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
View
2 libraries/lithium/template/view/adapter/File.php
@@ -81,7 +81,7 @@ public function template($type, $options) {
$library = Libraries::get($options['library']);
$options['library'] = $library['path'];
- foreach ((array)$this->_config[$type] as $path) {
+ foreach ((array) $this->_config[$type] as $path) {
if (file_exists($path = String::insert($path, $options))) {
return $path;
}
View
2 libraries/lithium/template/view/adapter/Simple.php
@@ -34,7 +34,7 @@ public function render($template, $data = array(), $context = array(), $options
switch (true) {
case is_object($val):
try {
- $data[$key] = (string)$val;
+ $data[$key] = (string) $val;
} catch (Exception $e) {
$data[$key] = '';
}
View
2 libraries/lithium/test/Dispatcher.php
@@ -53,7 +53,7 @@ public static function run($group = null, $options = array()) {
);
$options += $defaults;
- $items = (array)$group;
+ $items = (array) $group;
$isCase = preg_match('/Test$/', $group);
if ($isCase) {
View
4 libraries/lithium/test/Group.php
@@ -78,9 +78,9 @@ public function add($test = null, $options = array()) {
'path' => '/' . join('/', $parts),
'filter' => '/cases|intergration|functional/'
));
- return (array)$test;
+ return (array) $test;
}
- return (array)$test;
+ return (array) $test;
};
if (is_array($test)) {
View
8 libraries/lithium/test/Report.php
@@ -77,7 +77,7 @@ public function __construct($config = array()) {
'filters' => array(),
'reporter' => 'text'
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
@@ -124,9 +124,9 @@ public function run() {
* @return void
*/
public function stats() {
- $results = (array)$this->results['group'];
+ $results = (array) $this->results['group'];
return $this->reporter->stats(array_reduce($results, function($stats, $result) {
- $stats = (array)$stats + array(
+ $stats = (array) $stats + array(
'asserts' => 0,
'passes' => array(),
'fails' => array(),
@@ -163,7 +163,7 @@ public function stats() {
* @return void
*/
public function filters() {
- return $this->reporter->filters((array)$this->results['filters']);
+ return $this->reporter->filters((array) $this->results['filters']);
}
}
View
4 libraries/lithium/test/Reporter.php
@@ -30,7 +30,7 @@ public function stats($stats) {
'asserts' => null, 'passes' => array(), 'fails' => array(),
'errors' => array(), 'exceptions' => array(),
);
- $stats = (array)$stats + $defaults;
+ $stats = (array) $stats + $defaults;
$asserts = $stats['asserts'];
$passes = count($stats['passes']);
@@ -41,7 +41,7 @@ public function stats($stats) {
$aggregate = compact('asserts', 'passes', 'fails', 'errors', 'exceptions', 'success');
$result = array($this->_result($aggregate));
- foreach ((array)$stats['errors'] as $error) {
+ foreach ((array) $stats['errors'] as $error) {
switch ($error['result']) {
case 'fail':
$error += array('class' => 'unknown', 'method' => 'unknown');
View
10 libraries/lithium/test/Unit.php
@@ -354,7 +354,7 @@ function assertTags($string, $expected, $fullDebug = false) {
$regex = array();
$normalized = array();
- foreach ((array)$expected as $key => $val) {
+ foreach ((array) $expected as $key => $val) {
if (!is_numeric($key)) {
$normalized[] = array($key => $val);
} else {
@@ -451,7 +451,7 @@ function assertTags($string, $expected, $fullDebug = false) {
list($description, $expressions, $itemNum) = $assertation;
$matches = false;
- foreach ((array)$expressions as $expression) {
+ foreach ((array) $expressions as $expression) {
if (preg_match(sprintf('/^%s/s', $expression), $string, $match)) {
$matches = true;
$string = substr($string, strlen($match[0]));
@@ -647,8 +647,8 @@ protected function _compare($type, $expected, $result = null, $trace = null) {
if (is_object($expected)) {
$isObject = true;
- $expected = (array)$expected;
- $result = (array)$result;
+ $expected = (array) $expected;
+ $result = (array) $result;
}
if (is_array($expected)) {
@@ -716,7 +716,7 @@ protected function _message($data = array()) {
}
$defaults = array('trace' => null, 'expected' => null, 'result' => null);
- $data = (array)$data + $defaults;
+ $data = (array) $data + $defaults;
return sprintf("trace: %s\nexpected: %s\nresult: %s\n",
$data['trace'],
var_export($data['expected'], true),
View
2 libraries/lithium/test/filter/Complexity.php
@@ -46,7 +46,7 @@ public static function apply($object, $options = array()) {
foreach (Inspector::methods($class, 'ranges') as $method => $lines) {
$lines = Inspector::lines($class, $lines);
- $branches = Parser::tokenize(join("\n", (array)$lines), array(
+ $branches = Parser::tokenize(join("\n", (array) $lines), array(
'include' => static::$_include
));
static::$_results[$class][$method] = count($branches) + 1;
View
2 libraries/lithium/test/filter/Coverage.php
@@ -93,7 +93,7 @@ public static function analyze($results, $classes = array()) {
$classes = $classes ?: array_filter(get_declared_classes(), function($class) {
return (!is_subclass_of($class, 'lithium\test\Unit'));
});
- $classes = array_values(array_intersect((array)$classes, array_keys(static::$_results)));
+ $classes = array_values(array_intersect((array) $classes, array_keys(static::$_results)));
$densities = $result = array();
foreach ($classes as $class) {
View
4 libraries/lithium/test/filter/Profiler.php
@@ -61,7 +61,7 @@ class Profiler extends \lithium\core\StaticObject {
*/
public static function __init() {
foreach (static::$_metrics as $name => $check) {
- $function = current((array)$check['function']);
+ $function = current((array) $check['function']);
if (is_string($check['function']) && !function_exists($check['function'])) {
unset(static::$_metrics[$name]);
@@ -150,7 +150,7 @@ public static function analyze($results, $classes = array()) {
$metrics = array();
foreach ($results as $testCase) {
- foreach ((array)$testCase as $assertion) {
+ foreach ((array) $testCase as $assertion) {
if ($assertion['result'] != 'pass' && $assertion['result'] != 'fail') {
continue;
}
View
2 libraries/lithium/test/reporter/Html.php
@@ -81,7 +81,7 @@ protected function _exception($error) {
*/
public function filters($filters) {
$result = array();
- foreach ((array)$filters as $class => $data) {
+ foreach ((array) $filters as $class => $data) {
$result[] = $class::output('html', $data);
}
return join("\n", $result);
View
2 libraries/lithium/test/reporter/Text.php
@@ -69,7 +69,7 @@ protected function _exception($error) {
*/
public function filters($filters) {
$result = array();
- foreach ((array)$filters as $class => $data) {
+ foreach ((array) $filters as $class => $data) {
$result[] = $class::output('text', $data);
}
return join("\n", $result);
View
2 libraries/lithium/tests/cases/console/DispatcherTest.php
@@ -82,7 +82,7 @@ public function testRunWithAction() {
}
public function testInvalidCommand() {
- $expected = (object)array('status' => "Command `\\this\\command\\is\\fake` not found\n");
+ $expected = (object) array('status' => "Command `\\this\\command\\is\\fake` not found\n");
$result = Dispatcher::run(new Request(array(
'args' => array(
'\this\command\is\fake',
View
6 libraries/lithium/tests/cases/data/model/DocumentTest.php
@@ -412,8 +412,8 @@ public function testEmptyValues() {
*/
public function testObjectIteration() {
$doc = new Document(array('data' => array(
- (object)array('foo' => 'bar'),
- (object)array('bar' => 'foo')
+ (object) array('foo' => 'bar'),
+ (object) array('bar' => 'foo')
)));
$result = $doc->first()->foo;
$expected = 'bar';
@@ -423,7 +423,7 @@ public function testObjectIteration() {
$expected = 'foo';
$this->assertEqual($expected, $result);
- $doc = new Document(array('data' => (object)array(
+ $doc = new Document(array('data' => (object) array(
'first' => array('foo' => 'bar'),
'second' => array('bar' => 'foo')
)));
View
2 libraries/lithium/tests/cases/data/model/QueryTest.php
@@ -134,7 +134,7 @@ public function testRecord() {
$result = $q->record();
$this->assertNull($result);
- $record = (object)array('id' => 12);
+ $record = (object) array('id' => 12);
$record->title = 'Lorem Ipsum';
$q->record($record);
View
2 libraries/lithium/tests/cases/data/source/HttpTest.php
@@ -124,7 +124,7 @@ public function testPost() {
'Content-Length: 11',
'', 'status=cool'
));
- $result = (string)$http->last->request;
+ $result = (string) $http->last->request;
$this->assertEqual($expected, $result);
}
View
10 libraries/lithium/tests/cases/data/source/http/adapter/CouchDbTest.php
@@ -158,7 +158,7 @@ public function testReadWithViewConditions() {
public function testFlatResult() {
$couchdb = new CouchDb($this->_testConfig);
- $rows = (object)array(
+ $rows = (object) array(
'_id' => 'a1', '_rev' => '1-2', 'author' => 'author 1', 'body' => 'body 1'
);
$expected = array(
@@ -172,16 +172,16 @@ public function testFlatResult() {
public function testRowsResult() {
$couchdb = new CouchDb($this->_testConfig);
- $rows = (object)array('total_rows' => 11, 'offset' => 0, 'rows' => array(
- (object)array('id' => 'a1', 'key' => null, 'value' => array(
+ $rows = (object) array('total_rows' => 11, 'offset' => 0, 'rows' => array(
+ (object) array('id' => 'a1', 'key' => null, 'value' => array(
'author' => 'author 1',
'body' => 'body 1'
)),
- (object)array('id' => 'a2', 'key' => null, 'value' => array(
+ (object) array('id' => 'a2', 'key' => null, 'value' => array(
'author' => 'author 2',
'body' => 'body 2'
)),
- (object)array('id' => 'a3', 'key' => null, 'value' => array(
+ (object) array('id' => 'a3', 'key' => null, 'value' => array(
'author' => 'author 3',
'body' => 'body 3'
))
View
6 libraries/lithium/tests/cases/http/RequestTest.php
@@ -109,7 +109,7 @@ public function testToString() {
'User-Agent: Mozilla/5.0 (Lithium)',
'', ''
));
- $result = (string)$this->request;
+ $result = (string) $this->request;
$this->assertEqual($expected, $result);
}
@@ -126,7 +126,7 @@ public function testToStringWithAuth() {
'Authorization: Basic ' . base64_encode('root:something'),
'', ''
));
- $result = (string)$request;
+ $result = (string) $request;
$this->assertEqual($expected, $result);
}
@@ -140,7 +140,7 @@ public function testToStringWithBody() {
'', 'status=cool'
));
$this->request->body(array('status=cool'));
- $result = (string)$this->request;
+ $result = (string) $this->request;
$this->assertEqual($expected, $result);
}
}
View
8 libraries/lithium/tests/cases/http/ResponseTest.php
@@ -59,20 +59,20 @@ public function testParseMessage() {
));
$response = new Response(compact('message'));
- $this->assertEqual($message, (string)$response);
+ $this->assertEqual($message, (string) $response);
$message = 'Invalid Message';
$expected = join("\r\n", array(
'HTTP/1.1 200 OK',
'', '', ''
));
$response = new Response(compact('message'));
- $this->assertEqual($expected, (string)$response);
+ $this->assertEqual($expected, (string) $response);
}
public function testEmptyResponse() {
$response = new Response(array('message' => "\n"));
- $result = trim((string)$response);
+ $result = trim((string) $response);
$expected = 'HTTP/1.1 200 OK';
$this->assertEqual($expected, $result);
}
@@ -100,7 +100,7 @@ function testToString() {
'body' => 'Test!'
);
$response = new Response($config);
- $this->assertEqual($expected, (string)$response);
+ $this->assertEqual($expected, (string) $response);
}
function testTransferEncodingChunkedDecode() {
View
8 libraries/lithium/tests/cases/http/ServiceTest.php
@@ -116,7 +116,7 @@ public function testPost() {
'Content-Length: 11',
'', 'status=cool'
));
- $result = (string)$http->last->request;
+ $result = (string) $http->last->request;
$this->assertEqual($expected, $result);
}
@@ -132,7 +132,7 @@ public function testPut() {
'Content-Length: 11',
'', 'status=cool'
));
- $result = (string)$http->last->request;
+ $result = (string) $http->last->request;
$this->assertEqual($expected, $result);
}
@@ -146,7 +146,7 @@ public function testDelete() {
'User-Agent: Mozilla/5.0 (Lithium)',
'', ''
));
- $result = (string)$http->last->request;
+ $result = (string) $http->last->request;
$this->assertEqual($expected, $result);
}
@@ -162,7 +162,7 @@ public function testJsonPost() {
'Content-Length: 17',
'', '{"status":"cool"}'
));
- $result = (string)$http->last->request;
+ $result = (string) $http->last->request;
$this->assertEqual($expected, $result);
}
}
View
4 libraries/lithium/tests/cases/storage/CacheTest.php
@@ -196,12 +196,12 @@ public function testCacheReadAndWrite() {
$this->assertEqual($expected, $result);
$result = Cache::write(
- 'default', 'another', (object)array('data' => 'take two'), '+1 minute'
+ 'default', 'another', (object) array('data' => 'take two'), '+1 minute'
);
$this->assertTrue($result);
$result = Cache::read('default', 'another');
- $expected = (object)array('data' => 'take two');
+ $expected = (object) array('data' => 'take two');
$this->assertEqual($expected, $result);
}
View
4 libraries/lithium/tests/cases/storage/session/adapter/PhpTest.php
@@ -52,7 +52,7 @@ public function testDefaultConfiguration() {
$this->assertEqual('', $result);
$result = ini_get('session.cookie_lifetime');
- $this->assertEqual(strtotime('+1 day') - time(), (integer)$result);
+ $this->assertEqual(strtotime('+1 day') - time(), (integer) $result);
$result = ini_get('session.cookie_domain');
$this->assertEqual('', $result);
@@ -75,7 +75,7 @@ public function testCustomConfiguration() {
$this->assertEqual($config['name'], $result);
$result = ini_get('session.cookie_lifetime');
- $this->assertEqual($config['cookie_lifetime'], (integer)$result);
+ $this->assertEqual($config['cookie_lifetime'], (integer) $result);
$result = ini_get('session.cookie_domain');
$this->assertEqual($config['cookie_domain'], $result);
View
2 libraries/lithium/tests/cases/test/GroupTest.php
@@ -22,7 +22,7 @@ public function testAdd() {
}
public function testAddCaseThroughConstructor() {
- $items = (array)"\lithium\\tests\mocks\\test";
+ $items = (array) "\lithium\\tests\mocks\\test";
$group = new Group(compact('items'));
$expected = new Collection(array(
View
2 libraries/lithium/tests/mocks/core/MockObjectConfiguration.php
@@ -14,7 +14,7 @@ class MockObjectConfiguration extends \lithium\core\Object {
public function __construct($config = array()) {
if (isset($config['autoConfig'])) {
- $this->_autoConfig = (array)$config['autoConfig'];
+ $this->_autoConfig = (array) $config['autoConfig'];
unset($config['autoConfig']);
}
parent::__construct($config);
View
2 libraries/lithium/tests/mocks/data/source/http/adapter/MockService.php
@@ -24,7 +24,7 @@ public function send($method, $path = null, $data = array(), $options = array())
'rev' => '1-2',
'body' => 'something'
));
- $this->last = (object)compact('request', 'response');
+ $this->last = (object) compact('request', 'response');
return ($options['return'] == 'body') ? $response->body() : $response;
}
}
View
2 libraries/lithium/tests/mocks/http/MockService.php
@@ -26,7 +26,7 @@ public function get($path = null, $data = array(), $options = array()) {
'Test!'
));
$response = new $this->_classes['response'](compact('message'));
- $this->last = (object)compact('request', 'response');
+ $this->last = (object) compact('request', 'response');
return ($options['return'] == 'body') ? $response->body() : $response;
}
View
4 libraries/lithium/util/Inflector.php
@@ -248,11 +248,11 @@ public static function rules($type, $config = array()) {
);
break;
case 'uninflected':
- static::$_uninflected = array_merge(static::$_uninflected, (array)$config);
+ static::$_uninflected = array_merge(static::$_uninflected, (array) $config);
static::$_plural['regexUninflected'] = null;
static::$_singular['regexUninflected'] = null;
- foreach ((array)$config as $word) {
+ foreach ((array) $config as $word) {
unset(static::$_singularized[$word], static::$_pluralized[$word]);
}
break;
View
14 libraries/lithium/util/Set.php
@@ -105,7 +105,7 @@ public static function flatten($data, $options = array()) {
foreach ($data as $key => $val) {
if (is_array($val)) {
- $result += (array)static::flatten($val, array(
+ $result += (array) static::flatten($val, array(
'separator' => $options['separator'],
'path' => $options['path'] . $key
));
@@ -365,11 +365,11 @@ public static function merge($arr1, $arr2 = null) {
$args = func_get_args();
if (!isset($r)) {
- $r = (array)current($args);
+ $r = (array) current($args);
}
while (($arg = next($args)) !== false) {
- foreach ((array)$arg as $key => $val) {
+ foreach ((array) $arg as $key => $val) {
if (is_array($val) && isset($r[$key]) && is_array($r[$key])) {
$r[$key] = static::merge($r[$key], $val);
} elseif (is_int($key)) {
@@ -482,7 +482,7 @@ public static function extract($data, $path = null, $options = array()) {
$match = false;
if ($token === '@*' && is_array($context['item'])) {
$matches[] = array(
- 'trace' => array_merge($context['trace'], (array)$key),
+ 'trace' => array_merge($context['trace'], (array) $key),
'key' => $key,
'item' => array_keys($context['item']),
);
@@ -635,9 +635,9 @@ public static function remove($list, $path = null) {
*/
public static function diff($val1, $val2 = null) {
if (empty($val1)) {
- return (array)$val2;
+ return (array) $val2;
} elseif (empty($val2)) {
- return (array)$val1;
+ return (array) $val1;
}
$out = array();
@@ -846,7 +846,7 @@ public static function reverse($object) {
public static function sort($data, $path, $dir = 'asc') {
$flatten = function($flatten, $results, $key = null) {
$stack = array();
- foreach ((array)$results as $k => $r) {
+ foreach ((array) $results as $k => $r) {
$id = $k;
if (!is_null($key)) {
$id = $key;
View
2 libraries/lithium/util/Socket.php
@@ -40,7 +40,7 @@ public function __construct($config) {
'port' => 80,
'timeout' => 30
);
- parent::__construct((array)$config + $defaults);
+ parent::__construct((array) $config + $defaults);
}
/**
View
4 libraries/lithium/util/String.php
@@ -75,7 +75,7 @@ public static function uuid($context) {
return sprintf(
"%08x-%04x-%04x-%02x%02x-%04x%08x",
- (integer)$timeLow, (integer)substr($timeMid, 2) & 0xffff, mt_rand(0, 0xfff) | 0x4000,
+ (integer) $timeLow, (integer) substr($timeMid, 2) & 0xffff, mt_rand(0, 0xfff) | 0x4000,
mt_rand(0, 0x3f) | 0x80, mt_rand(0, 0xff), $pid, $node
);
}
@@ -140,7 +140,7 @@ public static function insert($str, $data, $options = array()) {
);
$options += $defaults;
$format = $options['format'];
- $data = (array)$data;
+ $data = (array) $data;
if ($format == 'regex' || (empty($format) && !empty($options['escape']))) {
$format = sprintf(
View
8 libraries/lithium/util/Validator.php
@@ -165,7 +165,7 @@ public static function __init() {
$precision = '+(?:[eE][-+]?[0-9]+)?';
$precision = $options['precision'] ? '{' . $options['precision'] . '}' : $precision;
- return (boolean)preg_match("/^[-+]?[0-9]*\\.{1}[0-9]{$precision}$/", (string)$value);
+ return (boolean) preg_match("/^[-+]?[0-9]*\\.{1}[0-9]{$precision}$/", (string) $value);
},
'inList' => function($value, $format, $options) {
$options += array('list' => array());
@@ -435,11 +435,11 @@ public static function rule($rule, $value, $format = 'any', $options = array())
$formats = array_keys($ruleCheck);
$all = ($format == 'all');
} else {
- $formats = (array)$format;
+ $formats = (array) $format;
$all = true;
}
if (static::_checkFormats($ruleCheck, $formats, $value, $all, $options)) {
- return (boolean)static::_filters('after', $rule, compact('value', 'format', 'options'));
+ return (boolean) static::_filters('after', $rule, compact('value', 'format', 'options'));
}
return false;
}
@@ -758,7 +758,7 @@ public static function isMoney($value, $format = 'left') {
public static function multiple($value, $options = array()) {
$defaults = array('in' => null, 'max' => null, 'min' => null);