Commit a34cb251 authored by alexpott's avatar alexpott

Issue #2002650 by mrsinguyen, chertzog, legolasbo, Erik Erskine, rhm50,...

Issue #2002650 by mrsinguyen, chertzog, legolasbo, Erik Erskine, rhm50, sandergo90, grisendo, targoo, janstoeckler, maximpodorov, beowulf1416: Improve maintainability by removing unused local variables.
parent 00f461ae
......@@ -2542,8 +2542,6 @@ function install_configure_form_validate($form, &$form_state) {
* @see install_configure_form_validate()
*/
function install_configure_form_submit($form, &$form_state) {
global $user;
\Drupal::config('system.site')
->set('name', $form_state['values']['site_name'])
->set('mail', $form_state['values']['site_mail'])
......
......@@ -161,7 +161,6 @@ function pager_get_query_parameters() {
* - quantity: The number of pages in the list.
*/
function template_preprocess_pager(&$variables) {
$tags = $variables['tags'];
$element = $variables['element'];
$parameters = $variables['parameters'];
$quantity = $variables['quantity'];
......
......@@ -68,7 +68,7 @@ function color_css_alter(&$css) {
if (!empty($color_paths) && !empty($themes[$theme_key]->stylesheets['all'])) {
foreach ($themes[$theme_key]->stylesheets['all'] as $base_filename => $old_path) {
foreach ($themes[$theme_key]->stylesheets['all'] as $old_path) {
// Loop over the path array with recolored CSS files to find matching
// paths which could replace the non-recolored paths.
foreach ($color_paths as $color_path) {
......@@ -408,7 +408,6 @@ function color_scheme_form_submit($form, &$form_state) {
* Rewrites the stylesheet to match the colors in the palette.
*/
function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
$themes = list_themes();
// Prepare color conversion table.
$conversion = $palette;
foreach ($conversion as $k => $v) {
......
......@@ -114,7 +114,7 @@ function _testColor($theme, $test_values) {
$this->drupalGet('<front>');
$stylesheets = \Drupal::state()->get('drupal_css_cache_files') ?: array();
$stylesheet_content = '';
foreach ($stylesheets as $key => $uri) {
foreach ($stylesheets as $uri) {
$stylesheet_content .= join("\n", file(drupal_realpath($uri)));
}
$this->assertTrue(strpos($stylesheet_content, 'public://') === FALSE, 'Make sure the color paths have been translated to local paths. (' . $theme . ')');
......
......@@ -420,7 +420,7 @@ protected function sortItems(FieldItemListInterface $items) {
});
$items->setValue($itemValues);
// Remove the '_weight' entries.
foreach ($items as $delta => $item) {
foreach ($items as $item) {
unset($item->_weight);
}
}
......
......@@ -211,7 +211,6 @@ function testFieldViewValue() {
),
);
$setting = $display['settings']['test_formatter_setting_multiple'];
$array = array();
foreach ($this->values as $delta => $value) {
$item = $this->entity->{$this->field_name}[$delta]->getValue();
$output = field_view_value($this->entity, $this->field_name, $item, $display);
......@@ -227,7 +226,6 @@ function testFieldViewValue() {
),
);
$setting = $display['settings']['test_formatter_setting_additional'];
$array = array();
foreach ($this->values as $delta => $value) {
$item = $this->entity->{$this->field_name}[$delta]->getValue();
$output = field_view_value($this->entity, $this->field_name, $item, $display);
......
......@@ -127,7 +127,7 @@ function testFieldAvailableLanguages() {
\Drupal::state()->set('field_test.field_available_languages_alter', TRUE);
$langcodes = field_content_languages();
$available_langcodes = field_available_languages($this->entity_type, $this->field);
foreach ($available_langcodes as $delta => $langcode) {
foreach ($available_langcodes as $langcode) {
if ($langcode != 'xx' && $langcode != 'en') {
$this->assertTrue(in_array($langcode, $langcodes), format_string('%language is an enabled language.', array('%language' => $langcode)));
}
......
......@@ -375,7 +375,7 @@ function forum_node_update(EntityInterface $node) {
function forum_node_insert(EntityInterface $node) {
if (\Drupal::service('forum_manager')->checkNodeType($node)) {
if (!empty($node->forum_tid)) {
$nid = db_insert('forum')
db_insert('forum')
->fields(array(
'tid' => $node->forum_tid,
'vid' => $node->getRevisionId(),
......
......@@ -556,7 +556,7 @@ function locale_translate_batch_refresh(array &$context) {
if (isset($context['results']['stats'])) {
// Get list of unique string identifiers and language codes updated.
$langcodes = array_unique(array_values($context['results']['languages']));
foreach ($context['results']['stats'] as $filepath => $report) {
foreach ($context['results']['stats'] as $report) {
$strings = array_merge($strings, $report['strings']);
}
}
......
......@@ -1252,7 +1252,7 @@ function _locale_parse_js_file($filepath) {
}
// Loop through all matches and process them.
foreach ($matches as $key => $match) {
foreach ($matches as $match) {
// Remove the quotes and string concatenations from the string and context.
$string = implode('', preg_split('~(?<!\\\\)[\'"]\s*\+\s*[\'"]~s', substr($match['string'], 1, -1)));
......
......@@ -60,7 +60,7 @@ function locale_translation_status_form($form, &$form_state) {
// Prepare information about projects which have available translation
// updates.
if ($languages && $status) {
foreach ($status as $project_id => $project) {
foreach ($status as $project) {
foreach ($project as $langcode => $project_info) {
// No translation file found for this project-language combination.
if (empty($project_info->type)) {
......
......@@ -25,7 +25,7 @@ function node_views_analyze(ViewExecutable $view) {
$ret = array();
// Check for something other than the default display:
if ($view->storage->get('base_table') == 'node') {
foreach ($view->displayHandlers as $id => $display) {
foreach ($view->displayHandlers as $display) {
if (!$display->isDefaulted('access') || !$display->isDefaulted('filters')) {
// check for no access control
$access = $display->getOption('access');
......
......@@ -63,7 +63,6 @@ public function setUp() {
'sourceType' => Breakpoint::SOURCE_TYPE_USER_DEFINED,
));
$breakpoints = array();
$breakpoint_names = array('small', 'medium', 'large');
for ($i = 0; $i < 3; $i++) {
$width = ($i + 1) * 200;
......
......@@ -244,7 +244,6 @@ function testManipulations() {
// value for whether each group of values fail.
$correct_dimensions_real = TRUE;
$correct_dimensions_object = TRUE;
$correct_colors = TRUE;
// Check the real dimensions of the image first.
if (imagesy($image->getResource()) != $values['height'] || imagesx($image->getResource()) != $values['width']) {
......
......@@ -30,7 +30,7 @@ function testMenuRebuildByVariable() {
$this->assertEqual($admin_exists, 'admin', "The path 'admin/' exists prior to deleting.");
// Delete the path item 'admin', and test that the path doesn't exist in the database.
$delete = db_delete('menu_router')
db_delete('menu_router')
->condition('path', 'admin')
->execute();
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
......
......@@ -31,7 +31,7 @@
*/
function update_authorize_run_update($filetransfer, $projects) {
$operations = array();
foreach ($projects as $project => $project_info) {
foreach ($projects as $project_info) {
$operations[] = array(
'update_authorize_batch_copy_project',
array(
......@@ -186,7 +186,7 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url
* An associative array of results from the batch operation.
*/
function update_authorize_update_batch_finished($success, $results) {
foreach ($results['log'] as $project => $messages) {
foreach ($results['log'] as $messages) {
if (!empty($messages['#abort'])) {
$success = FALSE;
}
......@@ -253,7 +253,7 @@ function update_authorize_update_batch_finished($success, $results) {
* An associative array of results from the batch operation.
*/
function update_authorize_install_batch_finished($success, $results) {
foreach ($results['log'] as $project => $messages) {
foreach ($results['log'] as $messages) {
if (!empty($messages['#abort'])) {
$success = FALSE;
}
......
......@@ -166,7 +166,6 @@ public function testExposedFilter() {
// Pass in just valid usernames.
$users = $this->names;
$options['query']['uid'] = implode(', ', $users);
$users = array_map('strtolower', $users);
$this->drupalGet($path, $options);
$this->assertNoRaw('Unable to find user');
......
......@@ -111,11 +111,6 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
$options['field'] = $this->actualField;
}
$plural = $this->definition['plugin_type'];
if (isset($types[$plural]['plural'])) {
$plural = $types[$plural]['plural'];
}
$this->unpackOptions($this->options, $options);
// This exist on most handlers, but not all. So they are still optional.
......
......@@ -218,8 +218,6 @@ protected function leftQuery($options) {
$temp_view->args[] = '**CORRELATED**';
// Add the base table ID field.
$views_data = Views::viewsData()->get($this->definition['base']);
$base_field = $views_data['table']['base']['field'];
$temp_view->addItem('default', 'field', $this->definition['base'], $this->definition['field']);
$relationship_id = NULL;
......
......@@ -59,7 +59,6 @@ public function testGlossaryView() {
$view->executeDisplay('attachment_1');
// Check that the amount of nodes per char.
$result_nodes_per_char = array();
foreach ($view->result as $item) {
$this->assertEqual($nodes_per_char[$item->title_truncated], $item->num_records);
}
......
......@@ -42,7 +42,6 @@ public function testAreaText() {
$view->setDisplay();
// Add a null argument.
$string = $this->randomString();
$view->displayHandlers->get('default')->overrideOption('arguments', array(
'null' => array(
'id' => 'null',
......@@ -68,7 +67,6 @@ public function testAreaText() {
$view->setDisplay();
// Add a argument, which has null as handler.
$string = $this->randomString();
$view->displayHandlers->get('default')->overrideOption('arguments', array(
'id' => array(
'id' => 'id',
......
......@@ -125,7 +125,7 @@ public function testRelationshipQuery() {
$expected_result = $this->dataSet();
// Alter the expected result to contain the right uids.
foreach ($expected_result as $key => &$row) {
foreach ($expected_result as &$row) {
// Only John has an existing author.
if ($row['name'] == 'John') {
$row['uid'] = 1;
......
......@@ -57,7 +57,6 @@ public function testStorePagerSettings() {
$this->assertText('20 items');
// Change type and check whether the type is new type is stored.
$edit = array();
$edit = array(
'pager[type]' => 'mini',
);
......@@ -72,7 +71,6 @@ public function testStorePagerSettings() {
$this->drupalGet('admin/structure/views/view/test_store_pager_settings/edit');
$edit = array();
$edit = array(
'pager[type]' => 'full',
);
......
......@@ -32,7 +32,6 @@ public static function getInfo() {
*/
public function testRedirect() {
$view_name = 'test_view';
$view = views_get_view($view_name);
$random_destination = $this->randomName();
$edit_path = "admin/structure/views/view/$view_name/edit";
......@@ -44,8 +43,6 @@ public function testRedirect() {
// but have the old url in the destination the user should be redirected to
// the new path.
$view_name = 'test_redirect_view';
$view = views_get_view($view_name);
$random_destination = $this->randomName();
$new_path = $this->randomName();
$edit_path = "admin/structure/views/view/$view_name/edit";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment