Commit 6098437e authored by alexpott's avatar alexpott
Browse files

Issue #2572793 by attiks, andypost: Fix 'Drupal.WhiteSpace.OperatorSpacing' coding standard

parent 5c386edc
......@@ -623,7 +623,7 @@ function drupal_valid_test_ua($new_prefix = NULL) {
$user_agent = isset($_COOKIE['SIMPLETEST_USER_AGENT']) ? $_COOKIE['SIMPLETEST_USER_AGENT'] : $http_user_agent;
if (isset($user_agent) && preg_match("/^(simpletest\d+):(.+):(.+):(.+)$/", $user_agent, $matches)) {
list(, $prefix, $time, $salt, $hmac) = $matches;
$check_string = $prefix . ':' . $time . ':' . $salt;
$check_string = $prefix . ':' . $time . ':' . $salt;
// Read the hash salt prepared by drupal_generate_test_ua().
// This function is called before settings.php is read and Drupal's error
// handlers are set up. While Drupal's error handling may be properly
......
......@@ -1797,7 +1797,7 @@ function install_check_translations($langcode, $server_pattern) {
$writable = FALSE;
// @todo: Make this configurable.
$site_path = \Drupal::service('site.path');
$files_directory = $site_path . '/files';
$files_directory = $site_path . '/files';
$translations_directory = $site_path . '/files/translations';
$translations_directory_exists = FALSE;
$online = FALSE;
......
......@@ -515,7 +515,7 @@ function drupal_install_config_directories() {
// they can later be added to git. Since this directory is auto-created, we
// have to write out the README rather than just adding it to the drupal core
// repo.
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
file_put_contents(config_get_config_directory(CONFIG_SYNC_DIRECTORY) . '/README.txt', $text);
}
......
......@@ -1265,7 +1265,7 @@ function template_preprocess_html(&$variables) {
// Add a variable for the root path. This can be used to create a class and
// theme the page depending on the current path (e.g. node, admin, user) as
// well as more specific data like path-frontpage.
$is_front_page = \Drupal::service('path.matcher')->isFrontPage();
$is_front_page = \Drupal::service('path.matcher')->isFrontPage();
if ($is_front_page) {
$variables['root_path'] = FALSE;
......
......@@ -181,7 +181,7 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
}
}
$this->lcs = 0;
$this->seq[0]= $yoff - 1;
$this->seq[0] = $yoff - 1;
$this->in_seq = array();
$ymids[0] = array();
......@@ -190,11 +190,11 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
for ($chunk = 0; $chunk < $nchunks; $chunk++) {
if ($chunk > 0) {
for ($i = 0; $i <= $this->lcs; $i++) {
$ymids[$i][$chunk-1] = $this->seq[$i];
$ymids[$i][$chunk - 1] = $this->seq[$i];
}
}
$x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
for ( ; $x < $x1; $x++) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if (empty($ymatches[$line])) {
......@@ -206,12 +206,12 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
$ymids[$k] = $ymids[$k - 1];
break;
}
}
while (list ($junk, $y) = each($matches)) {
if ($y > $this->seq[$k-1]) {
if ($y > $this->seq[$k - 1]) {
$this::USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
......@@ -222,7 +222,7 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
elseif (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
$ymids[$k] = $ymids[$k - 1];
}
}
}
......
......@@ -50,7 +50,7 @@ public function save($name, $code) {
$path = $this->getFullPath($name);
$directory = dirname($path);
if ($this->ensureDirectory($directory)) {
$htaccess_path = $directory . '/.htaccess';
$htaccess_path = $directory . '/.htaccess';
if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) {
@chmod($htaccess_path, 0444);
}
......@@ -126,7 +126,7 @@ public static function htaccessLines($private = TRUE) {
*/
protected function ensureDirectory($directory, $mode = 0777) {
if ($this->createDirectory($directory, $mode)) {
$htaccess_path = $directory . '/.htaccess';
$htaccess_path = $directory . '/.htaccess';
if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) {
@chmod($htaccess_path, 0444);
}
......
......@@ -139,7 +139,7 @@ public function name($length = 8, $unique = FALSE) {
* @return string
*/
public function word($length) {
mt_srand((double) microtime()*1000000);
mt_srand((double) microtime() * 1000000);
$vowels = array("a", "e", "i", "o", "u");
$cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr",
......
......@@ -83,7 +83,7 @@ public static function allowedIf($condition) {
* will be TRUE.
*/
public static function forbiddenIf($condition) {
return $condition ? static::forbidden(): static::neutral();
return $condition ? static::forbidden() : static::neutral();
}
/**
......
......@@ -70,7 +70,7 @@ public function extract($path, array $files = array()) {
*/
public function listContents() {
$files = array();
for ($i=0; $i < $this->zip->numFiles; $i++) {
for ($i = 0; $i < $this->zip->numFiles; $i++) {
$files[] = $this->zip->getNameIndex($i);
}
return $files;
......
......@@ -68,7 +68,7 @@ public function render(array $js_assets) {
'type' => 'application/json',
'data-drupal-selector' => 'drupal-settings-json',
);
$element['#value'] = Json::encode($js_asset['data']);
$element['#value'] = Json::encode($js_asset['data']);
break;
case 'file':
......
......@@ -272,7 +272,7 @@ public function getCacheKeys() {
// $this->configFactoryOverrides, add cache keys for each.
$keys[] = 'global_overrides';
foreach($this->configFactoryOverrides as $override) {
$keys[] = $override->getCacheSuffix();
$keys[] = $override->getCacheSuffix();
}
return $keys;
}
......
......@@ -165,7 +165,7 @@ public function getDependentEntities($type, $name) {
// If checking content, module, or theme dependencies, discover which
// entities are dependent on the entities that have a direct dependency.
foreach ($dependent_entities as $entity) {
$entities_to_check[] = $entity->getConfigDependencyName();
$entities_to_check[] = $entity->getConfigDependencyName();
}
}
$dependencies = array_merge($this->createGraphConfigEntityDependencies($entities_to_check), $dependent_entities);
......
......@@ -191,7 +191,7 @@ protected function castValue($key, $value) {
// we have to special case the meaning of an empty string for numeric
// types. In PHP this would be casted to a 0 but for the purposes of
// configuration we need to treat this as a NULL.
$empty_value = $value === '' && ($element instanceof IntegerInterface || $element instanceof FloatInterface);
$empty_value = $value === '' && ($element instanceof IntegerInterface || $element instanceof FloatInterface);
if ($value === NULL || $empty_value) {
$value = NULL;
......
......@@ -819,7 +819,7 @@ public function __toString() {
// Don't use the AS keyword for table aliases, as some
// databases don't support it (e.g., Oracle).
$query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);
$query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);
if (!empty($table['condition'])) {
$query .= ' ON ' . $table['condition'];
......
......@@ -234,12 +234,12 @@ public function formatDiff($from, $to, $options = array()) {
switch ($value) {
case 'y':
$interval_output = $this->formatPlural($interval->y, '1 year', '@count years', array(), array('langcode' => $options['langcode']));
$max_age = min($max_age, 365*86400);
$max_age = min($max_age, 365 * 86400);
break;
case 'm':
$interval_output = $this->formatPlural($interval->m, '1 month', '@count months', array(), array('langcode' => $options['langcode']));
$max_age = min($max_age, 30*86400);
$max_age = min($max_age, 30 * 86400);
break;
case 'd':
......@@ -252,7 +252,7 @@ public function formatDiff($from, $to, $options = array()) {
$interval_output .= $this->formatPlural($weeks, '1 week', '@count weeks', array(), array('langcode' => $options['langcode']));
$days -= $weeks * 7;
$granularity--;
$max_age = min($max_age, 7*86400);
$max_age = min($max_age, 7 * 86400);
}
if ((!$output || $weeks > 0) && $granularity > 0 && $days > 0) {
......
......@@ -88,7 +88,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
break;
case 'hour':
$format = in_array('ampm', $element['#date_part_order']) ? 'g': 'G';
$format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
break;
case 'minute':
......@@ -218,7 +218,7 @@ public static function processDatelist(&$element, FormStateInterface $form_state
break;
case 'hour':
$format = in_array('ampm', $element['#date_part_order']) ? 'g': 'G';
$format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
$options = $date_helper->hours($format, $element['#required']);
$title = t('Hour');
break;
......
......@@ -50,7 +50,7 @@ public function process(ContainerBuilder $container) {
$root_namespace_dir = $namespaces[$root_namespace];
}
$message =<<<EOF
$message = <<<EOF
Missing proxy class '$proxy_class' for lazy service '$service_id'.
Use the following command to generate the proxy class:
......
......@@ -305,7 +305,7 @@ protected function initializePager() {
*/
public function tableSort(&$headers) {
// If 'field' is not initialized, the header columns aren't clickable.
foreach ($headers as $key =>$header) {
foreach ($headers as $key => $header) {
if (is_array($header) && isset($header['specifier'])) {
$headers[$key]['field'] = '';
}
......
......@@ -212,7 +212,7 @@ public function addField($field, $type, $langcode) {
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$field_storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
// Add the new entity base table using the table and sql column.
$join_condition= '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column";
$join_condition = '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column";
$base_table = $this->sqlQuery->leftJoin($entity_type->getBaseTable(), NULL, $join_condition);
$propertyDefinitions = array();
$key++;
......
......@@ -201,7 +201,7 @@ public function getFieldColumnName(FieldStorageDefinitionInterface $storage_defi
$field_name = $storage_definition->getName();
if ($this->allowsSharedTableStorage($storage_definition)) {
$column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name;
$column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name;
}
elseif ($this->requiresDedicatedTableStorage($storage_definition)) {
$column_name = !in_array($property_name, $this->getReservedColumns()) ? $field_name . '_' . $property_name : $property_name;
......
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