Skip to content

Commit

Permalink
Changing unnecessary double-quotes to single-quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Theaxiom committed Apr 17, 2017
1 parent 534fb76 commit 00c2549
Show file tree
Hide file tree
Showing 37 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Controller.php
Expand Up @@ -428,7 +428,7 @@ public function invokeAction()
}
if (!$this->isAction($request->getParam('action'))) {
throw new MissingActionException([
'controller' => $this->name . "Controller",
'controller' => $this->name . 'Controller',
'action' => $request->getParam('action'),
'prefix' => $request->getParam('prefix') ?: '',
'plugin' => $request->getParam('plugin'),
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Configure/Engine/JsonConfig.php
Expand Up @@ -67,7 +67,7 @@ public function read($key)
$values = json_decode(file_get_contents($file), true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new Exception(sprintf(
"Error parsing JSON string fetched from config file \"%s.json\": %s",
'Error parsing JSON string fetched from config file "%s.json": %s',
$key,
json_last_error_msg()
));
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/Mysql.php
Expand Up @@ -78,7 +78,7 @@ public function connect()
$config['init'][] = sprintf("SET time_zone = '%s'", $config['timezone']);
}
if (!empty($config['encoding'])) {
$config['init'][] = sprintf("SET NAMES %s", $config['encoding']);
$config['init'][] = sprintf('SET NAMES %s', $config['encoding']);
}

$config['flags'] += [
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/Postgres.php
Expand Up @@ -76,7 +76,7 @@ public function connect()
}

if (!empty($config['timezone'])) {
$config['init'][] = sprintf("SET timezone = %s", $connection->quote($config['timezone']));
$config['init'][] = sprintf('SET timezone = %s', $connection->quote($config['timezone']));
}

foreach ($config['init'] as $command) {
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Expression/OrderClauseExpression.php
Expand Up @@ -53,7 +53,7 @@ public function sql(ValueBinder $generator)
$field = $field->sql($generator);
}

return sprintf("%s %s", $field, $this->_direction);
return sprintf('%s %s', $field, $this->_direction);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Database/Schema/PostgresSchema.php
Expand Up @@ -198,7 +198,7 @@ protected function _defaultValue($default)
// Remove quotes and postgres casts
return preg_replace(
"/^'(.*)'(?:::.*)$/",
"$1",
'$1',
$default
);
}
Expand All @@ -208,7 +208,7 @@ protected function _defaultValue($default)
*/
public function describeIndexSql($tableName, $config)
{
$sql = "SELECT
$sql = 'SELECT
c2.relname,
a.attname,
i.indisprimary,
Expand All @@ -221,7 +221,7 @@ public function describeIndexSql($tableName, $config)
WHERE n.nspname = ?
AND a.attnum = ANY(i.indkey)
AND c.relname = ?
ORDER BY i.indisprimary DESC, i.indisunique DESC, c.relname, a.attnum";
ORDER BY i.indisprimary DESC, i.indisunique DESC, c.relname, a.attnum';

$schema = 'public';
if (!empty($config['schema'])) {
Expand Down Expand Up @@ -287,7 +287,7 @@ protected function _convertConstraint($schema, $name, $type, $row)
*/
public function describeForeignKeySql($tableName, $config)
{
$sql = "SELECT
$sql = 'SELECT
c.conname AS name,
c.contype AS type,
a.attname AS column_name,
Expand All @@ -303,7 +303,7 @@ public function describeForeignKeySql($tableName, $config)
INNER JOIN pg_catalog.pg_attribute ab ON (a.attrelid = cl.oid AND c.confrelid = ab.attrelid AND ab.attnum = ANY(c.confkey))
WHERE n.nspname = ?
AND cl.relname = ?
ORDER BY name, a.attnum, ab.attnum DESC";
ORDER BY name, a.attnum, ab.attnum DESC';

$schema = empty($config['schema']) ? 'public' : $config['schema'];

Expand Down
8 changes: 4 additions & 4 deletions src/Database/Schema/SqlserverSchema.php
Expand Up @@ -42,7 +42,7 @@ public function listTablesSql($config)
*/
public function describeColumnSql($tableName, $config)
{
$sql = "SELECT DISTINCT
$sql = 'SELECT DISTINCT
AC.column_id AS [column_id],
AC.name AS [name],
TY.name AS [type],
Expand All @@ -58,7 +58,7 @@ public function describeColumnSql($tableName, $config)
INNER JOIN sys.[all_columns] AC ON T.[object_id] = AC.[object_id]
INNER JOIN sys.[types] TY ON TY.[user_type_id] = AC.[user_type_id]
WHERE T.[name] = ? AND S.[name] = ?
ORDER BY column_id";
ORDER BY column_id';

$schema = empty($config['schema']) ? static::DEFAULT_SCHEMA_NAME : $config['schema'];

Expand Down Expand Up @@ -261,7 +261,7 @@ public function convertIndexDescription(TableSchema $schema, $row)
*/
public function describeForeignKeySql($tableName, $config)
{
$sql = "SELECT FK.[name] AS [foreign_key_name], FK.[delete_referential_action_desc] AS [delete_type],
$sql = 'SELECT FK.[name] AS [foreign_key_name], FK.[delete_referential_action_desc] AS [delete_type],
FK.[update_referential_action_desc] AS [update_type], C.name AS [column], RT.name AS [reference_table],
RC.name AS [reference_column]
FROM sys.foreign_keys FK
Expand All @@ -271,7 +271,7 @@ public function describeForeignKeySql($tableName, $config)
INNER JOIN sys.schemas S ON S.schema_id = T.schema_id AND S.schema_id = RT.schema_id
INNER JOIN sys.columns C ON C.column_id = FKC.parent_column_id AND C.object_id = FKC.parent_object_id
INNER JOIN sys.columns RC ON RC.column_id = FKC.referenced_column_id AND RC.object_id = FKC.referenced_object_id
WHERE FK.is_ms_shipped = 0 AND T.name = ? AND S.name = ?";
WHERE FK.is_ms_shipped = 0 AND T.name = ? AND S.name = ?';

$schema = empty($config['schema']) ? static::DEFAULT_SCHEMA_NAME : $config['schema'];

Expand Down
2 changes: 1 addition & 1 deletion src/Error/BaseErrorHandler.php
Expand Up @@ -354,7 +354,7 @@ protected function _getMessage(Exception $exception)
$exception;
$config = $this->_options;
$message = sprintf(
"[%s] %s in %s on line %s",
'[%s] %s in %s on line %s',
get_class($exception),
$exception->getMessage(),
$exception->getFile(),
Expand Down
6 changes: 3 additions & 3 deletions src/Error/Debugger.php
Expand Up @@ -67,7 +67,7 @@ class Debugger
protected $_templates = [
'log' => [
'trace' => '{:reference} - {:path}, line {:line}',
'error' => "{:error} ({:code}): {:description} in [{:file}, line {:line}]"
'error' => '{:error} ({:code}): {:description} in [{:file}, line {:line}]'
],
'js' => [
'error' => '',
Expand Down Expand Up @@ -429,7 +429,7 @@ public static function excerpt($file, $line, $context = 2)
if (!isset($data[$i])) {
continue;
}
$string = str_replace(["\r\n", "\n"], "", static::_highlight($data[$i]));
$string = str_replace(["\r\n", "\n"], '', static::_highlight($data[$i]));
if ($i == $line) {
$lines[] = '<span class="code-highlight">' . $string . '</span>';
} else {
Expand Down Expand Up @@ -551,7 +551,7 @@ protected static function _export($var, $depth, $indent)
*/
protected static function _array(array $var, $depth, $indent)
{
$out = "[";
$out = '[';
$break = $end = null;
if (!empty($var)) {
$break = "\n" . str_repeat("\t", $indent);
Expand Down
2 changes: 1 addition & 1 deletion src/Error/Middleware/ErrorHandlerMiddleware.php
Expand Up @@ -187,7 +187,7 @@ protected function logException($request, $exception)
protected function getMessage($request, $exception)
{
$message = sprintf(
"[%s] %s",
'[%s] %s',
get_class($exception),
$exception->getMessage()
);
Expand Down
4 changes: 2 additions & 2 deletions src/Error/PHP7ErrorException.php
Expand Up @@ -45,8 +45,8 @@ public function __construct($error)
'(%s) - %s in %s on %s',
get_class($error),
$this->message,
$this->file ?: "null",
$this->line ?: "null"
$this->file ?: 'null',
$this->line ?: 'null'
);
parent::__construct($msg, $this->code);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Event/EventManager.php
Expand Up @@ -470,7 +470,7 @@ public function prioritisedListeners($eventKey)
*/
public function matchingListeners($eventKeyPattern)
{
$matchPattern = '/' . preg_quote($eventKeyPattern, "/") . '/';
$matchPattern = '/' . preg_quote($eventKeyPattern, '/') . '/';
$matches = array_intersect_key(
$this->_listeners,
array_flip(
Expand Down
2 changes: 1 addition & 1 deletion src/Filesystem/File.php
Expand Up @@ -371,7 +371,7 @@ public function safe($name = null, $ext = null)
$ext = $this->ext();
}

return preg_replace("/(?:[^\w\.-]+)/", "_", basename($name, $ext));
return preg_replace("/(?:[^\w\.-]+)/", '_', basename($name, $ext));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Client/Adapter/Stream.php
Expand Up @@ -147,7 +147,7 @@ protected function _buildHeaders(Request $request, $options)
{
$headers = [];
foreach ($request->getHeaders() as $name => $values) {
$headers[] = sprintf('%s: %s', $name, implode(", ", $values));
$headers[] = sprintf('%s: %s', $name, implode(', ', $values));
}

$cookies = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Client/Response.php
Expand Up @@ -228,9 +228,9 @@ protected function _parseCookie($value)
$value = rtrim($value, ';');
$nestedSemi = '";"';
if (strpos($value, $nestedSemi) !== false) {
$value = str_replace($nestedSemi, "{__cookie_replace__}", $value);
$value = str_replace($nestedSemi, '{__cookie_replace__}', $value);
$parts = explode(';', $value);
$parts = str_replace("{__cookie_replace__}", $nestedSemi, $parts);
$parts = str_replace('{__cookie_replace__}', $nestedSemi, $parts);
} else {
$parts = preg_split('/\;[ \t]*/', $value);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Http/Response.php
Expand Up @@ -1189,7 +1189,7 @@ public function withCharset($charset)
public function disableCache()
{
$this->_setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
$this->_setHeader('Last-Modified', gmdate("D, d M Y H:i:s") . " GMT");
$this->_setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
$this->_setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
}

Expand All @@ -1201,7 +1201,7 @@ public function disableCache()
public function withDisabledCache()
{
return $this->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
->withHeader('Last-Modified', gmdate("D, d M Y H:i:s") . " GMT")
->withHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT')
->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
}

Expand All @@ -1219,7 +1219,7 @@ public function cache($since, $time = '+1 day')
$time = strtotime($time);
}

$this->_setHeader('Date', gmdate("D, j M Y G:i:s ", time()) . 'GMT');
$this->_setHeader('Date', gmdate('D, j M Y G:i:s ', time()) . 'GMT');

$this->modified($since);
$this->expires($time);
Expand All @@ -1240,7 +1240,7 @@ public function withCache($since, $time = '+1 day')
$time = strtotime($time);
}

return $this->withHeader('Date', gmdate("D, j M Y G:i:s ", time()) . 'GMT')
return $this->withHeader('Date', gmdate('D, j M Y G:i:s ', time()) . 'GMT')
->withModified($since)
->withExpires($time)
->withSharable(true)
Expand Down Expand Up @@ -1749,8 +1749,8 @@ protected function _getUTCDate($time = null)
*/
public function compress()
{
$compressionEnabled = ini_get("zlib.output_compression") !== '1' &&
extension_loaded("zlib") &&
$compressionEnabled = ini_get('zlib.output_compression') !== '1' &&
extension_loaded('zlib') &&
(strpos(env('HTTP_ACCEPT_ENCODING'), 'gzip') !== false);

return $compressionEnabled && ob_start('ob_gzhandler');
Expand All @@ -1764,7 +1764,7 @@ public function compress()
public function outputCompressed()
{
return strpos(env('HTTP_ACCEPT_ENCODING'), 'gzip') !== false
&& (ini_get("zlib.output_compression") === '1' || in_array('ob_gzhandler', ob_list_handlers()));
&& (ini_get('zlib.output_compression') === '1' || in_array('ob_gzhandler', ob_list_handlers()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Http/ResponseEmitter.php
Expand Up @@ -209,8 +209,8 @@ protected function emitCookies(array $cookies)
}

if (strpos($cookie, '";"') !== false) {
$cookie = str_replace('";"', "{__cookie_replace__}", $cookie);
$parts = str_replace("{__cookie_replace__}", '";"', explode(';', $cookie));
$cookie = str_replace('";"', '{__cookie_replace__}', $cookie);
$parts = str_replace('{__cookie_replace__}', '";"', explode(';', $cookie));
} else {
$parts = preg_split('/\;[ \t]*/', $cookie);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Http/ResponseTransformer.php
Expand Up @@ -93,9 +93,9 @@ protected static function parseCookies(array $cookieHeader)
$cookies = [];
foreach ($cookieHeader as $cookie) {
if (strpos($cookie, '";"') !== false) {
$cookie = str_replace('";"', "{__cookie_replace__}", $cookie);
$cookie = str_replace('";"', '{__cookie_replace__}', $cookie);
$parts = preg_split('/\;[ \t]*/', $cookie);
$parts = str_replace("{__cookie_replace__}", '";"', $parts);
$parts = str_replace('{__cookie_replace__}', '";"', $parts);
} else {
$parts = preg_split('/\;[ \t]*/', $cookie);
}
Expand Down
14 changes: 7 additions & 7 deletions src/I18n/Date.php
Expand Up @@ -77,13 +77,13 @@ class Date extends MutableDate implements JsonSerializable
* @see \Cake\I18n\Date::timeAgoInWords()
*/
public static $wordAccuracy = [
'year' => "day",
'month' => "day",
'week' => "day",
'day' => "day",
'hour' => "day",
'minute' => "day",
'second' => "day",
'year' => 'day',
'month' => 'day',
'week' => 'day',
'day' => 'day',
'hour' => 'day',
'minute' => 'day',
'second' => 'day',
];

/**
Expand Down
14 changes: 7 additions & 7 deletions src/I18n/FrozenDate.php
Expand Up @@ -79,13 +79,13 @@ class FrozenDate extends ChronosDate implements JsonSerializable
* @see \Cake\I18n\Date::timeAgoInWords()
*/
public static $wordAccuracy = [
'year' => "day",
'month' => "day",
'week' => "day",
'day' => "day",
'hour' => "day",
'minute' => "day",
'second' => "day",
'year' => 'day',
'month' => 'day',
'week' => 'day',
'day' => 'day',
'hour' => 'day',
'minute' => 'day',
'second' => 'day',
];

/**
Expand Down
14 changes: 7 additions & 7 deletions src/I18n/FrozenTime.php
Expand Up @@ -80,13 +80,13 @@ class FrozenTime extends Chronos implements JsonSerializable
* @see \Cake\I18n\FrozenTime::timeAgoInWords()
*/
public static $wordAccuracy = [
'year' => "day",
'month' => "day",
'week' => "day",
'day' => "hour",
'hour' => "minute",
'minute' => "minute",
'second' => "second",
'year' => 'day',
'month' => 'day',
'week' => 'day',
'day' => 'hour',
'hour' => 'minute',
'minute' => 'minute',
'second' => 'second',
];

/**
Expand Down
4 changes: 2 additions & 2 deletions src/I18n/Parser/MoFileParser.php
Expand Up @@ -64,7 +64,7 @@ public function parse($resource)
$stat = fstat($stream);

if ($stat['size'] < self::MO_HEADER_SIZE) {
throw new RuntimeException("Invalid format for MO translations file");
throw new RuntimeException('Invalid format for MO translations file');
}
$magic = unpack('V1', fread($stream, 4));
$magic = hexdec(substr(dechex(current($magic)), -8));
Expand All @@ -74,7 +74,7 @@ public function parse($resource)
} elseif ($magic == self::MO_BIG_ENDIAN_MAGIC) {
$isBigEndian = true;
} else {
throw new RuntimeException("Invalid format for MO translations file");
throw new RuntimeException('Invalid format for MO translations file');
}

// offset formatRevision
Expand Down

0 comments on commit 00c2549

Please sign in to comment.