Skip to content

Commit

Permalink
Replaced array() with [] in:
Browse files Browse the repository at this point in the history
lib/Cake/Cache
lib/Cake/Config
lib/Cake/Console
lib/Cake/Console/Command
lib/Cake/Console/Command/Task
lib/Cake/Console/Templates
  • Loading branch information
cameri committed Oct 29, 2013
1 parent 80f2fb6 commit 5e46d41
Show file tree
Hide file tree
Showing 38 changed files with 690 additions and 691 deletions.
12 changes: 6 additions & 6 deletions Cake/Cache/Cache.php
Expand Up @@ -32,10 +32,10 @@
* A sample configuration would be:
*
* {{{
* Cache::config('shared', array(
* Cache::config('shared', [
* 'engine' => 'Cake\Cache\Engine\ApcEngine',
* 'prefix' => 'my_app_'
* ));
* ]);
* }}}
*
* This would configure an APC cache engine to the 'shared' alias. You could then read and write
Expand Down Expand Up @@ -77,7 +77,7 @@
* @see app/Config/core.php for configuration settings
* @param string $name Name of the configuration
* @param array $settings Optional associative array of settings passed to the engine
* @return array array(engine, settings) on success, false on failure
* @return array [engine, settings] on success, false on failure
* @throws Cake\Error\Exception
*/
class Cache {
Expand All @@ -99,14 +99,14 @@ class Cache {
*
* @var array
*/
protected static $_config = array();
protected static $_config = [];

/**
* Group to Config mapping
*
* @var array
*/
protected static $_groups = array();
protected static $_groups = [];

/**
* Whether to reset the settings with the next call to Cache::set();
Expand Down Expand Up @@ -416,7 +416,7 @@ public static function groupConfigs($group = null) {
}

if (isset(self::$_groups[$group])) {
return array($group => self::$_groups[$group]);
return [$group => self::$_groups[$group]];
}

throw new Error\Exception(__d('cake_dev', 'Invalid cache group %s', $group));
Expand Down
12 changes: 6 additions & 6 deletions Cake/Cache/CacheEngine.php
Expand Up @@ -27,7 +27,7 @@ abstract class CacheEngine {
*
* @var array
*/
public $settings = array();
public $settings = [];

/**
* Contains the compiled string with all groups
Expand All @@ -45,13 +45,13 @@ abstract class CacheEngine {
* @param array $settings Associative array of parameters for the engine
* @return boolean True if the engine has been successfully initialized, false if not
*/
public function init($settings = array()) {
$settings += $this->settings + array(
public function init($settings = []) {
$settings += $this->settings + [
'prefix' => 'cake_',
'duration' => 3600,
'probability' => 100,
'groups' => array()
);
'groups' => []
];
$this->settings = $settings;
if (!empty($this->settings['groups'])) {
sort($this->settings['groups']);
Expand Down Expand Up @@ -174,7 +174,7 @@ public function key($key) {
$prefix = vsprintf($this->_groupPrefix, $this->groups());
}

$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DS, '/', '.'), '_', strval($key)))));
$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace([DS, '/', '.'], '_', strval($key)))));
return $prefix . $key;
}

Expand Down
22 changes: 11 additions & 11 deletions Cake/Config/routes.php
Expand Up @@ -51,32 +51,32 @@
$plugins[$key] = Inflector::underscore($value);
}
$pluginPattern = implode('|', $plugins);
$match = array('plugin' => $pluginPattern);
$shortParams = array(
$match = ['plugin' => $pluginPattern];
$shortParams = [
'routeClass' => 'Cake\Routing\Route\PluginShortRoute',
'plugin' => $pluginPattern,
'_name' => '_plugin._controller:index',
);
];

foreach ($prefixes as $prefix) {
$params = array('prefix' => $prefix);
$indexParams = $params + array('action' => 'index');
$params = ['prefix' => $prefix];
$indexParams = $params + ['action' => 'index'];
Router::connect("/{$prefix}/:plugin", $indexParams, $shortParams);
Router::connect("/{$prefix}/:plugin/:controller", $indexParams, $match);
Router::connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match);
}
Router::connect('/:plugin', array('action' => 'index'), $shortParams);
Router::connect('/:plugin/:controller', array('action' => 'index'), $match);
Router::connect('/:plugin/:controller/:action/*', array(), $match);
Router::connect('/:plugin', ['action' => 'index'], $shortParams);
Router::connect('/:plugin/:controller', ['action' => 'index'], $match);
Router::connect('/:plugin/:controller/:action/*', [], $match);
}

foreach ($prefixes as $prefix) {
$params = array('prefix' => $prefix);
$indexParams = $params + array('action' => 'index');
$params = ['prefix' => $prefix];
$indexParams = $params + ['action' => 'index'];
Router::connect("/{$prefix}/:controller", $indexParams);
Router::connect("/{$prefix}/:controller/:action/*", $params);
}
Router::connect('/:controller', array('action' => 'index'));
Router::connect('/:controller', ['action' => 'index']);
Router::connect('/:controller/:action/*');

unset($params, $indexParams, $prefix, $prefixes, $shortParams, $match,
Expand Down
2 changes: 1 addition & 1 deletion Cake/Configure/Engine/IniConfig.php
Expand Up @@ -29,7 +29,7 @@
* to create nested array structures through usage of `.` delimited names. This allows
* you to create nested arrays structures in an ini config file. For example:
*
* `db.password = secret` would turn into `array('db' => array('password' => 'secret'))`
* `db.password = secret` would turn into `['db' => ['password' => 'secret']]`
*
* You can nest properties as deeply as needed using `.`'s. In addition to using `.` you
* can use standard ini section notation to create nested structures:
Expand Down

0 comments on commit 5e46d41

Please sign in to comment.