Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #818 from shama/patch-unused-vars

Remove unused variables and code
  • Loading branch information...
commit 93004fcf2f48a759195e5bff704c61cb4bf246ed 2 parents c8cb3ae + bc40ac7
@markstory markstory authored
View
2  lib/Cake/Controller/Component/Acl/PhpAcl.php
@@ -318,10 +318,8 @@ public function resolve($aco) {
* @return void
*/
public function build(array $allow, array $deny = array()) {
- $stack = array();
$this->_tree = array();
$tree = array();
- $root = &$tree;
foreach ($allow as $dotPath => $aros) {
if (is_string($aros)) {
View
1  lib/Cake/Controller/Controller.php
@@ -557,7 +557,6 @@ protected function _mergeControllerVars() {
if ($mergeParent || !empty($pluginController)) {
$appVars = get_class_vars($this->_mergeParent);
- $uses = $appVars['uses'];
$merge = array('components', 'helpers');
$this->_mergeVars($merge, $this->_mergeParent, true);
}
View
1  lib/Cake/Core/Configure.php
@@ -185,7 +185,6 @@ public static function read($var = null) {
*/
public static function delete($var = null) {
$keys = explode('.', $var);
- $last = array_pop($keys);
self::$_values = Hash::remove(self::$_values, $var);
}
View
1  lib/Cake/Model/Behavior/TranslateBehavior.php
@@ -603,7 +603,6 @@ public function unbindTranslation(Model $Model, $fields = null) {
if (is_string($fields)) {
$fields = array($fields);
}
- $RuntimeModel = $this->translateModel($Model);
$associations = array();
foreach ($fields as $key => $value) {
View
4 lib/Cake/Model/CakeSchema.php
@@ -271,7 +271,7 @@ public function read($options = array()) {
unset($currentTables[$key]);
}
if (!empty($Object->hasAndBelongsToMany)) {
- foreach ($Object->hasAndBelongsToMany as $Assoc => $assocData) {
+ foreach ($Object->hasAndBelongsToMany as $assocData) {
if (isset($assocData['with'])) {
$class = $assocData['with'];
}
@@ -597,7 +597,7 @@ protected function _columns(&$Obj) {
$db = $Obj->getDataSource();
$fields = $Obj->schema(true);
- $columns = $props = array();
+ $columns = array();
foreach ($fields as $name => $value) {
if ($Obj->primaryKey == $name) {
$value['key'] = 'primary';
View
1  lib/Cake/Model/Datasource/CakeSession.php
@@ -449,7 +449,6 @@ public static function clear() {
*/
protected static function _configureSession() {
$sessionConfig = Configure::read('Session');
- $iniSet = function_exists('ini_set');
if (isset($sessionConfig['defaults'])) {
$defaults = self::_defaultConfig($sessionConfig['defaults']);
View
2  lib/Cake/Model/Datasource/Database/Postgres.php
@@ -438,7 +438,7 @@ public function index($model) {
)
AND c.oid = i.indrelid AND i.indexrelid = c2.oid
ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname", false);
- foreach ($indexes as $i => $info) {
+ foreach ($indexes as $info) {
$key = array_pop($info);
if ($key['indisprimary']) {
$key['relname'] = 'PRIMARY';
View
2  lib/Cake/Model/Datasource/Database/Sqlite.php
@@ -474,7 +474,7 @@ public function index($model) {
if (is_bool($indexes)) {
return array();
}
- foreach ($indexes as $i => $info) {
+ foreach ($indexes as $info) {
$key = array_pop($info);
$keyInfo = $this->query('PRAGMA index_info("' . $key['name'] . '")');
foreach ($keyInfo as $keyCol) {
View
12 lib/Cake/Model/Datasource/DboSource.php
@@ -1294,9 +1294,9 @@ public function queryAssociation(Model $model, &$linkModel, $type, $association,
}
}
if ($type === 'hasAndBelongsToMany') {
- $uniqueIds = $merge = array();
+ $merge = array();
- foreach ($fetch as $j => $data) {
+ foreach ($fetch as $data) {
if (isset($data[$with]) && $data[$with][$foreignKey] === $row[$modelAlias][$modelPK]) {
if ($habtmFieldsCount <= 2) {
unset($data[$with]);
@@ -1445,7 +1445,7 @@ protected function _mergeAssociation(&$data, &$merge, $association, $type, $self
$data[$association] = array();
}
} else {
- foreach ($merge as $i => $row) {
+ foreach ($merge as $row) {
$insert = array();
if (count($row) === 1) {
$insert = $row[$association];
@@ -2413,7 +2413,7 @@ public function conditions($conditions, $quoteValues = true, $where = true, $mod
}
$clauses = '/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i';
- if (preg_match($clauses, $conditions, $match)) {
+ if (preg_match($clauses, $conditions)) {
$clause = '';
}
$conditions = $this->_quoteFields($conditions);
@@ -2908,7 +2908,7 @@ public function insertMulti($table, $fields, $values) {
$columnMap[$key] = $pdoMap[$type];
}
- foreach ($values as $row => $value) {
+ foreach ($values as $value) {
$i = 1;
foreach ($value as $col => $val) {
$statement->bindValue($i, $val, $columnMap[$col]);
@@ -3205,7 +3205,7 @@ public function introspectType($value) {
$isAllFloat = $isAllInt = true;
$containsFloat = $containsInt = $containsString = false;
- foreach ($value as $key => $valElement) {
+ foreach ($value as $valElement) {
$valElement = trim($valElement);
if (!is_float($valElement) && !preg_match('/^[\d]+\.[\d]+$/', $valElement)) {
$isAllFloat = false;
View
6 lib/Cake/Model/Model.php
@@ -2363,7 +2363,7 @@ public function delete($id = null, $cascade = true) {
$updateCounterCache = false;
if (!empty($this->belongsTo)) {
- foreach ($this->belongsTo as $parent => $assoc) {
+ foreach ($this->belongsTo as $assoc) {
if (!empty($assoc['counterCache'])) {
$updateCounterCache = true;
break;
@@ -2449,7 +2449,7 @@ protected function _deleteDependent($id, $cascade) {
* @return void
*/
protected function _deleteLinks($id) {
- foreach ($this->hasAndBelongsToMany as $assoc => $data) {
+ foreach ($this->hasAndBelongsToMany as $data) {
list($plugin, $joinModel) = pluginSplit($data['with']);
$records = $this->{$joinModel}->find('all', array(
'conditions' => array($this->{$joinModel}->escapeField($data['foreignKey']) => $id),
@@ -3042,7 +3042,7 @@ public function invalidate($field, $value = true) {
public function isForeignKey($field) {
$foreignKeys = array();
if (!empty($this->belongsTo)) {
- foreach ($this->belongsTo as $assoc => $data) {
+ foreach ($this->belongsTo as $data) {
$foreignKeys[] = $data['foreignKey'];
}
}
View
2  lib/Cake/Network/CakeRequest.php
@@ -675,7 +675,7 @@ public function subdomains($tldLength = 1) {
public function accepts($type = null) {
$raw = $this->parseAccept();
$accept = array();
- foreach ($raw as $value => $types) {
+ foreach ($raw as $types) {
$accept = array_merge($accept, $types);
}
if ($type === null) {
View
2  lib/Cake/Utility/ClassRegistry.php
@@ -175,7 +175,7 @@ public static function init($class, $strict = false) {
}
if (!isset($instance)) {
- trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %1$s class %2$s ', $class, $type), E_USER_WARNING);
+ trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %s', $class), E_USER_WARNING);
return $false;
}
}
View
1  lib/Cake/Utility/Debugger.php
@@ -213,7 +213,6 @@ public static function showError($code, $description, $file = null, $line = null
if (empty($line)) {
$line = '??';
}
- $path = self::trimPath($file);
$info = compact('code', 'description', 'file', 'line');
if (!in_array($info, $self->errors)) {
View
2  lib/Cake/Utility/Folder.php
@@ -367,7 +367,7 @@ public function chmod($path, $mode = false, $recursive = true, $exceptions = arr
$paths = $this->tree($path);
foreach ($paths as $type) {
- foreach ($type as $key => $fullpath) {
+ foreach ($type as $fullpath) {
$check = explode(DS, $fullpath);
$count = count($check);
View
1  lib/Cake/Utility/Hash.php
@@ -432,7 +432,6 @@ public static function contains(array $data, array $needle) {
}
$stack = array();
- $i = 1;
while (!empty($needle)) {
$key = key($needle);
$val = $needle[$key];
View
3  lib/Cake/View/Helper/FormHelper.php
@@ -194,7 +194,7 @@ protected function _introspectModel($model, $key, $field = null) {
if ($key === 'fields') {
if (!isset($this->fieldset[$model]['fields'])) {
- $fields = $this->fieldset[$model]['fields'] = $object->schema();
+ $this->fieldset[$model]['fields'] = $object->schema();
foreach ($object->hasAndBelongsToMany as $alias => $assocData) {
$this->fieldset[$object->alias]['fields'][$alias] = array('type' => 'multiple');
}
@@ -320,7 +320,6 @@ public function create($model = null, $options = array()) {
$key = null;
if ($model !== false) {
- $object = $this->_getModel($model);
$key = $this->_introspectModel($model, 'key');
$this->setEntity($model, true);
}
View
1  lib/Cake/View/Helper/MootoolsEngineHelper.php
@@ -254,7 +254,6 @@ public function request($url, $options = array()) {
$options['url'] = $url;
$options = $this->_prepareCallbacks('request', $options);
if (!empty($options['dataExpression'])) {
- $callbacks[] = 'data';
unset($options['dataExpression']);
} elseif (!empty($data)) {
$data = $this->object($data);
View
1  lib/Cake/View/Helper/PrototypeEngineHelper.php
@@ -237,7 +237,6 @@ public function request($url, $options = array()) {
$url = '"' . $this->url($url) . '"';
$options = $this->_mapOptions('request', $options);
$type = '.Request';
- $data = null;
if (isset($options['type']) && strtolower($options['type']) == 'json') {
unset($options['type']);
}
View
2  lib/Cake/View/Helper/RssHelper.php
@@ -341,7 +341,7 @@ public function elem($name, $attrib = array(), $content = null, $endTag = true)
$nodes->item(0)->setAttribute($key, $value);
}
}
- foreach ($children as $k => $child) {
+ foreach ($children as $child) {
$child = $elem->createElement($name, $child);
$nodes->item(0)->appendChild($child);
}
View
1  lib/Cake/View/Helper/TimeHelper.php
@@ -358,7 +358,6 @@ public function toRSS($dateString, $timezone = null) {
*/
public function timeAgoInWords($dateTime, $options = array()) {
$element = null;
- $stringDate = '';
if (is_array($options) && !empty($options['element'])) {
$element = array(
View
2  lib/Cake/View/MediaView.php
@@ -101,8 +101,6 @@ public function render($view = null, $layout = null) {
if ($this->_isActive()) {
$extension = strtolower($extension);
- $chunkSize = 8192;
- $buffer = '';
$fileSize = @filesize($path);
$handle = fopen($path, 'rb');
View
7 lib/Cake/View/View.php
@@ -290,11 +290,6 @@ class View extends Object {
protected $_eventManager = null;
/**
- * The view file to be rendered, only used inside _execute()
- */
- private $__viewFileName = null;
-
-/**
* Whether the event manager was already configured for this object
*
* @var boolean
@@ -856,7 +851,7 @@ public function __isset($name) {
*/
public function loadHelpers() {
$helpers = HelperCollection::normalizeObjectArray($this->helpers);
- foreach ($helpers as $name => $properties) {
+ foreach ($helpers as $properties) {
list($plugin, $class) = pluginSplit($properties['class']);
$this->{$class} = $this->Helpers->load($properties['class'], $properties['settings']);
}
Please sign in to comment.
Something went wrong with that request. Please try again.