Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup of minor issues found with phpmd.

  • Loading branch information...
commit e4a7c8f3d79a44238b90dcb75ac038156d4d8b73 1 parent be262f3
@markstory markstory authored
View
4 lib/Cake/Controller/Controller.php
@@ -491,7 +491,7 @@ protected function _isPrivateAction(ReflectionMethod $method, CakeRequest $reque
if (!$privateAction && !empty($prefixes)) {
if (empty($request->params['prefix']) && strpos($request->params['action'], '_') > 0) {
- list($prefix, $action) = explode('_', $request->params['action']);
+ list($prefix) = explode('_', $request->params['action']);
$privateAction = in_array($prefix, $prefixes);
}
}
@@ -877,7 +877,7 @@ public function render($view = null, $layout = null) {
$currentObject = ClassRegistry::getObject($currentModel);
if (is_a($currentObject, 'Model')) {
$className = get_class($currentObject);
- list($plugin, $package) = pluginSplit(App::location($className));
+ list($plugin) = pluginSplit(App::location($className));
$this->request->params['models'][$currentObject->alias] = compact('plugin', 'className');
$View->validationErrors[$currentObject->alias] =& $currentObject->validationErrors;
}
View
2  lib/Cake/Core/Configure.php
@@ -320,7 +320,7 @@ public static function load($key, $config = 'default', $merge = true) {
*/
public static function version() {
if (!isset(self::$_values['Cake']['version'])) {
- require(CAKE . 'Config' . DS . 'config.php');
+ require CAKE . 'Config' . DS . 'config.php';
self::write($config);
}
return self::$_values['Cake']['version'];
View
2  lib/Cake/Log/CakeLog.php
@@ -190,7 +190,7 @@ public static function write($type, $message) {
if (empty(self::$_streams)) {
self::_autoConfig();
}
- foreach (self::$_streams as $key => $logger) {
+ foreach (self::$_streams as $logger) {
$logger->write($type, $message);
}
return true;
View
2  lib/Cake/Network/CakeRequest.php
@@ -613,7 +613,7 @@ public function accepts($type = null) {
$acceptTypes = explode(',', $this->header('accept'));
foreach ($acceptTypes as $i => $accepted) {
if (strpos($accepted, ';') !== false) {
- list($accepted, $prefValue) = explode(';', $accepted);
+ list($accepted) = explode(';', $accepted);
$acceptTypes[$i] = $accepted;
}
}
View
1  lib/Cake/Network/CakeResponse.php
@@ -572,7 +572,6 @@ public function mapType($ctype) {
if (is_array($ctype)) {
return array_map(array($this, 'mapType'), $ctype);
}
- $keys = array_keys($this->_mimeTypes);
foreach ($this->_mimeTypes as $alias => $types) {
if (is_array($types) && in_array($ctype, $types)) {
View
9 lib/Cake/Routing/Route/CakeRoute.php
@@ -156,7 +156,7 @@ protected function _writeRoute() {
}
$names[] = $name;
}
- if (preg_match('#\/\*$#', $route, $m)) {
+ if (preg_match('#\/\*$#', $route)) {
$parsed = preg_replace('#/\\\\\*$#', '(?:/(?P<_args_>.*))?', $parsed);
$this->_greedy = true;
}
@@ -281,7 +281,7 @@ protected function _parseArgs($args, $context) {
if ((!isset($this->options['named']) || !empty($this->options['named'])) && $separatorIsPresent) {
list($key, $val) = explode($namedConfig['separator'], $param, 2);
$hasRule = isset($rules[$key]);
- $passIt = (!$hasRule && !$greedy) || ($hasRule && !$this->_matchNamed($key, $val, $rules[$key], $context));
+ $passIt = (!$hasRule && !$greedy) || ($hasRule && !$this->_matchNamed($val, $rules[$key], $context));
if ($passIt) {
$pass[] = $param;
} else {
@@ -314,13 +314,12 @@ protected function _parseArgs($args, $context) {
* Return true if a given named $param's $val matches a given $rule depending on $context. Currently implemented
* rule types are controller, action and match that can be combined with each other.
*
- * @param string $param The name of the named parameter
* @param string $val The value of the named parameter
* @param array $rule The rule(s) to apply, can also be a match string
* @param string $context An array with additional context information (controller / action)
* @return boolean
*/
- protected function _matchNamed($param, $val, $rule, $context) {
+ protected function _matchNamed($val, $rule, $context) {
if ($rule === true || $rule === false) {
return $rule;
}
@@ -512,4 +511,4 @@ protected function _writeUrl($params) {
return $out;
}
-}
+}
View
21 lib/Cake/Utility/Set.php
@@ -131,27 +131,6 @@ public static function map($class = 'stdClass', $tmp = 'stdClass') {
}
/**
- * Get the array value of $array. If $array is null, it will return
- * the current array Set holds. If it is an object of type Set, it
- * will return its value. If it is another object, its object variables.
- * If it is anything else but an array, it will return an array whose first
- * element is $array.
- *
- * @param mixed $array Data from where to get the array.
- * @return array Array from $array.
- */
- private function __array($array) {
- if (empty($array)) {
- $array = array();
- } elseif (is_object($array)) {
- $array = get_object_vars($array);
- } elseif (!is_array($array)) {
- $array = array($array);
- }
- return $array;
- }
-
-/**
* Maps the given value as an object. If $value is an object,
* it returns $value. Otherwise it maps $value as an object of
* type $class, and if primary assign _name_ $key on first array.
Please sign in to comment.
Something went wrong with that request. Please try again.