Skip to content

Commit

Permalink
Merge pull request #9114 from cakephp/return-fix
Browse files Browse the repository at this point in the history
Fix CS error.
  • Loading branch information
markstory committed Jul 14, 2016
2 parents b7f0dd3 + 855c4d1 commit be86aa9
Show file tree
Hide file tree
Showing 336 changed files with 1,951 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Auth/BaseAuthenticate.php
Expand Up @@ -176,6 +176,7 @@ public function passwordHasher()
}

$passwordHasher = $this->_config['passwordHasher'];

return $this->_passwordHasher = PasswordHasherFactory::build($passwordHasher);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Auth/BasicAuthenticate.php
Expand Up @@ -79,6 +79,7 @@ public function getUser(Request $request)
if (!is_string($username) || $username === '' || !is_string($pass) || $pass === '') {
return false;
}

return $this->_findUser($username, $pass);
}

Expand Down Expand Up @@ -106,6 +107,7 @@ public function unauthenticated(Request $request, Response $response)
public function loginHeaders(Request $request)
{
$realm = $this->config('realm') ?: $request->env('SERVER_NAME');

return sprintf('WWW-Authenticate: Basic realm="%s"', $realm);
}
}
1 change: 1 addition & 0 deletions src/Auth/ControllerAuthorize.php
Expand Up @@ -77,6 +77,7 @@ public function controller(Controller $controller = null)
}
$this->_Controller = $controller;
}

return $this->_Controller;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Auth/DigestAuthenticate.php
Expand Up @@ -119,6 +119,7 @@ public function getUser(Request $request)
if ($digest['response'] === $hash) {
return $user;
}

return false;
}

Expand All @@ -140,6 +141,7 @@ protected function _getDigest(Request $request)
if (empty($digest)) {
return false;
}

return $this->parseAuthData($digest);
}

Expand All @@ -166,6 +168,7 @@ public function parseAuthData($digest)
if (empty($req)) {
return $keys;
}

return null;
}

Expand Down Expand Up @@ -220,6 +223,7 @@ public function loginHeaders(Request $request)
foreach ($options as $k => $v) {
$opts[] = sprintf('%s="%s"', $k, $v);
}

return 'WWW-Authenticate: Digest ' . implode(',', $opts);
}
}
1 change: 1 addition & 0 deletions src/Auth/FallbackPasswordHasher.php
Expand Up @@ -89,6 +89,7 @@ public function check($password, $hashedPassword)
return true;
}
}

return false;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Auth/FormAuthenticate.php
Expand Up @@ -53,6 +53,7 @@ protected function _checkFields(Request $request, array $fields)
return false;
}
}

return true;
}

Expand All @@ -71,6 +72,7 @@ public function authenticate(Request $request, Response $response)
if (!$this->_checkFields($request, $fields)) {
return false;
}

return $this->_findUser(
$request->data[$fields['username']],
$request->data[$fields['password']]
Expand Down
1 change: 1 addition & 0 deletions src/Auth/Storage/MemoryStorage.php
Expand Up @@ -69,6 +69,7 @@ public function redirectUrl($url = null)

if ($url === false) {
$this->_redirectUrl = null;

return null;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Auth/Storage/SessionStorage.php
Expand Up @@ -83,6 +83,7 @@ public function read()
}

$this->_user = $this->_session->read($this->_config['key']) ?: false;

return $this->_user;
}

Expand Down Expand Up @@ -128,6 +129,7 @@ public function redirectUrl($url = null)

if ($url === false) {
$this->_session->delete($this->_config['redirect']);

return null;
}

Expand Down
11 changes: 11 additions & 0 deletions src/Cache/Cache.php
Expand Up @@ -188,6 +188,7 @@ public static function engine($config)
}

static::_buildEngine($config);

return $registry->{$config};
}

Expand Down Expand Up @@ -247,6 +248,7 @@ public static function write($key, $value, $config = 'default')
E_USER_WARNING
);
}

return $success;
}

Expand Down Expand Up @@ -286,6 +288,7 @@ public static function writeMany($data, $config = 'default')
));
}
}

return $return;
}

Expand Down Expand Up @@ -313,6 +316,7 @@ public static function writeMany($data, $config = 'default')
public static function read($key, $config = 'default')
{
$engine = static::engine($config);

return $engine->read($key);
}

Expand Down Expand Up @@ -341,6 +345,7 @@ public static function read($key, $config = 'default')
public static function readMany($keys, $config = 'default')
{
$engine = static::engine($config);

return $engine->readMany($keys);
}

Expand Down Expand Up @@ -406,6 +411,7 @@ public static function decrement($key, $offset = 1, $config = 'default')
public static function delete($key, $config = 'default')
{
$engine = static::engine($config);

return $engine->delete($key);
}

Expand Down Expand Up @@ -434,6 +440,7 @@ public static function delete($key, $config = 'default')
public static function deleteMany($keys, $config = 'default')
{
$engine = static::engine($config);

return $engine->deleteMany($keys);
}

Expand All @@ -447,6 +454,7 @@ public static function deleteMany($keys, $config = 'default')
public static function clear($check = false, $config = 'default')
{
$engine = static::engine($config);

return $engine->clear($check);
}

Expand Down Expand Up @@ -477,6 +485,7 @@ public static function clearAll($check = false)
public static function clearGroup($group, $config = 'default')
{
$engine = static::engine($config);

return $engine->clearGroup($group);
}

Expand Down Expand Up @@ -580,6 +589,7 @@ public static function remember($key, $callable, $config = 'default')
}
$results = call_user_func($callable);
self::write($key, $results, $config);

return $results;
}

Expand Down Expand Up @@ -612,6 +622,7 @@ public static function add($key, $value, $config = 'default')
if (is_resource($value)) {
return false;
}

return $engine->add($key, $value);
}
}
5 changes: 5 additions & 0 deletions src/Cache/CacheEngine.php
Expand Up @@ -112,6 +112,7 @@ public function writeMany($data)
foreach ($data as $key => $value) {
$return[$key] = $this->write($key, $value);
}

return $return;
}

Expand All @@ -136,6 +137,7 @@ public function readMany($keys)
foreach ($keys as $key) {
$return[$key] = $this->read($key);
}

return $return;
}

Expand Down Expand Up @@ -187,6 +189,7 @@ public function deleteMany($keys)
foreach ($keys as $key) {
$return[$key] = $this->delete($key);
}

return $return;
}

Expand All @@ -206,6 +209,7 @@ public function add($key, $value)
if ($cachedValue === false) {
return $this->write($key, $value);
}

return false;
}

Expand Down Expand Up @@ -252,6 +256,7 @@ public function key($key)
}

$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace([DIRECTORY_SEPARATOR, '/', '.'], '_', strval($key)))));

return $prefix . $key;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Cache/CacheRegistry.php
Expand Up @@ -40,6 +40,7 @@ protected function _resolveClassName($class)
if (is_object($class)) {
return $class;
}

return App::className($class, 'Cache/Engine', 'Engine');
}

Expand Down Expand Up @@ -96,6 +97,7 @@ protected function _create($class, $alias, $config)
if ($config['probability'] && time() % $config['probability'] === 0) {
$instance->gc();
}

return $instance;
}

Expand Down
8 changes: 8 additions & 0 deletions src/Cache/Engine/ApcEngine.php
Expand Up @@ -47,6 +47,7 @@ public function init(array $config = [])
}

parent::init($config);

return true;
}

Expand All @@ -67,6 +68,7 @@ public function write($key, $value)
$expires = time() + $duration;
}
apcu_store($key . '_expires', $expires, $duration);

return apcu_store($key, $value, $duration);
}

Expand All @@ -86,6 +88,7 @@ public function read($key)
if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->_config['duration']) < $cachetime)) {
return false;
}

return apcu_fetch($key);
}

Expand Down Expand Up @@ -148,6 +151,7 @@ public function clear($check)
APC_ITER_NONE
);
apcu_delete($iterator);

return true;
}
$cache = apcu_cache_info();
Expand All @@ -156,6 +160,7 @@ public function clear($check)
apcu_delete($key['info']);
}
}

return true;
}

Expand All @@ -178,6 +183,7 @@ public function add($key, $value)
$expires = time() + $duration;
}
apcu_add($key . '_expires', $expires, $duration);

return apcu_add($key, $value, $duration);
}

Expand Down Expand Up @@ -212,6 +218,7 @@ public function groups()
foreach ($this->_config['groups'] as $i => $group) {
$result[] = $group . $groups[$i];
}

return $result;
}

Expand All @@ -225,6 +232,7 @@ public function groups()
public function clearGroup($group)
{
apcu_inc($this->_config['prefix'] . $group, 1, $success);

return $success;
}
}
10 changes: 10 additions & 0 deletions src/Cache/Engine/FileEngine.php
Expand Up @@ -102,6 +102,7 @@ public function init(array $config = [])
if (!empty($this->_groupPrefix)) {
$this->_groupPrefix = str_replace('_', DIRECTORY_SEPARATOR, $this->_groupPrefix);
}

return $this->_active();
}

Expand Down Expand Up @@ -199,6 +200,7 @@ public function read($key)
if ($this->_config['lock']) {
$this->_File->flock(LOCK_UN);
}

return false;
}

Expand All @@ -221,6 +223,7 @@ public function read($key)
}
$data = unserialize((string)$data);
}

return $data;
}

Expand Down Expand Up @@ -285,6 +288,7 @@ public function clear($check)
$cleared[] = $path;
}
}

return true;
}

Expand Down Expand Up @@ -393,6 +397,7 @@ protected function _setKey($key, $createKey = false)
$this->_File = $path->openFile('c+');
} catch (Exception $e) {
trigger_error($e->getMessage(), E_USER_WARNING);

return false;
}
unset($path);
Expand All @@ -405,6 +410,7 @@ protected function _setKey($key, $createKey = false)
), E_USER_WARNING);
}
}

return true;
}

Expand All @@ -427,8 +433,10 @@ protected function _active()
'%s is not writable',
$this->_config['path']
), E_USER_WARNING);

return false;
}

return true;
}

Expand All @@ -449,6 +457,7 @@ public function key($key)
'_',
strval($key)
));

return $key;
}

Expand Down Expand Up @@ -480,6 +489,7 @@ public function clearGroup($group)
//@codingStandardsIgnoreEnd
}
}

return true;
}
}

0 comments on commit be86aa9

Please sign in to comment.