Skip to content

Commit

Permalink
Fix up return void setConfig()
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jan 31, 2017
1 parent 7671cff commit 5df496b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/Datasource/ConnectionManager.php
Expand Up @@ -67,7 +67,7 @@ class ConnectionManager
*
* @param string|array $key The name of the connection config, or an array of multiple configs.
* @param array|null $config An array of name => config data for adapter.
* @return array|null Null when adding configuration and an array of configuration data when reading.
* @return void
* @throws \Cake\Core\Exception\Exception When trying to modify an existing config.
* @see \Cake\Core\StaticConfigTrait::config()
*/
Expand All @@ -77,7 +77,7 @@ public static function setConfig($key, $config = null)
$config['name'] = $key;
}

return static::_setConfig($key, $config);
static::_setConfig($key, $config);
}

/**
Expand Down
45 changes: 18 additions & 27 deletions src/Log/Log.php
Expand Up @@ -29,7 +29,7 @@
* A sample configuration would look like:
*
* ```
* Log::config('my_log', ['className' => 'FileLog']);
* Log::setConfig('my_log', ['className' => 'FileLog']);
* ```
*
* You can define the className as any fully namespaced classname or use a short hand
Expand All @@ -48,7 +48,7 @@
* This allows you to disable debug messages in production for example:
*
* ```
* Log::config('default', [
* Log::setConfig('default', [
* 'className' => 'File',
* 'path' => LOGS,
* 'levels' => ['error', 'critical', 'alert', 'emergency']
Expand All @@ -66,7 +66,7 @@
* all scopes that match the handled levels.
*
* ```
* Log::config('payments', [
* Log::setConfig('payments', [
* 'className' => 'File',
* 'scopes' => ['payment', 'order']
* ]);
Expand Down Expand Up @@ -241,47 +241,38 @@ public static function levels()
*
* ### Usage
*
* Reading config data back:
*
* ```
* Log::config('default');
* ```
*
* Setting a cache engine up.
*
* ```
* Log::config('default', $settings);
* Log::setConfig('default', $settings);
* ```
*
* Injecting a constructed adapter in:
*
* ```
* Log::config('default', $instance);
* Log::setConfig('default', $instance);
* ```
*
* Using a factory function to get an adapter:
*
* ```
* Log::config('default', function () { return new FileLog(); });
* Log::setConfig('default', function () { return new FileLog(); });
* ```
*
* Configure multiple adapters at once:
*
* ```
* Log::config($arrayOfConfig);
* Log::setConfig($arrayOfConfig);
* ```
*
* @param string|array $key The name of the logger config, or an array of multiple configs.
* @param array|null $config An array of name => config data for adapter.
* @return array|null Null when adding configuration and an array of configuration data when reading.
* @return void
* @throws \BadMethodCallException When trying to modify an existing config.
*/
public static function setConfig($key, $config = null)
{
$return = static::_setConfig($key, $config);
if ($return !== null) {
return $return;
}
static::_setConfig($key, $config);
static::$_dirtyConfig = true;
}

Expand Down Expand Up @@ -351,7 +342,7 @@ public static function engine($name)
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
* @throws \InvalidArgumentException If invalid level is passed.
*/
Expand Down Expand Up @@ -406,7 +397,7 @@ public static function write($level, $message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function emergency($message, $context = [])
Expand All @@ -422,7 +413,7 @@ public static function emergency($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function alert($message, $context = [])
Expand All @@ -438,7 +429,7 @@ public static function alert($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function critical($message, $context = [])
Expand All @@ -454,7 +445,7 @@ public static function critical($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function error($message, $context = [])
Expand All @@ -470,7 +461,7 @@ public static function error($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function warning($message, $context = [])
Expand All @@ -486,7 +477,7 @@ public static function warning($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function notice($message, $context = [])
Expand All @@ -502,7 +493,7 @@ public static function notice($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function debug($message, $context = [])
Expand All @@ -518,7 +509,7 @@ public static function debug($message, $context = [])
* The special `scope` key can be passed to be used for further filtering of the
* log engines to be used. If a string or a numerically index array is passed, it
* will be treated as the `scope` key.
* See Cake\Log\Log::config() for more information on logging scopes.
* See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success
*/
public static function info($message, $context = [])
Expand Down

0 comments on commit 5df496b

Please sign in to comment.