mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Applied code style fixes
This commit is contained in:
@ -127,7 +127,7 @@ class ExitCode
|
|||||||
*/
|
*/
|
||||||
public static $reasons = [
|
public static $reasons = [
|
||||||
self::OK => 'Success',
|
self::OK => 'Success',
|
||||||
self::UNSPECIFIED_ERROR => "Unspecified error",
|
self::UNSPECIFIED_ERROR => 'Unspecified error',
|
||||||
self::USAGE => 'Incorrect usage, argument or option error',
|
self::USAGE => 'Incorrect usage, argument or option error',
|
||||||
self::DATAERR => 'Error in input data',
|
self::DATAERR => 'Error in input data',
|
||||||
self::NOINPUT => 'Input file not found or unreadable',
|
self::NOINPUT => 'Input file not found or unreadable',
|
||||||
@ -154,6 +154,6 @@ class ExitCode
|
|||||||
*/
|
*/
|
||||||
public static function getReason($exitCode)
|
public static function getReason($exitCode)
|
||||||
{
|
{
|
||||||
return isset($exReasons[$exitCode]) ? $exReasons[$exitCode] : "Unknown exit code";
|
return isset($exReasons[$exitCode]) ? $exReasons[$exitCode] : 'Unknown exit code';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
namespace yii\data;
|
namespace yii\data;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\InvalidConfigException;
|
|
||||||
use yii\base\BaseObject;
|
use yii\base\BaseObject;
|
||||||
|
use yii\base\InvalidConfigException;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\helpers\Inflector;
|
use yii\helpers\Inflector;
|
||||||
use yii\web\Request;
|
use yii\web\Request;
|
||||||
|
@ -195,7 +195,7 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
{
|
{
|
||||||
$pk = [];
|
$pk = [];
|
||||||
// disambiguate column names in case ActiveQuery adds a JOIN
|
// disambiguate column names in case ActiveQuery adds a JOIN
|
||||||
foreach($this->getPrimaryKey(true) as $key => $value) {
|
foreach ($this->getPrimaryKey(true) as $key => $value) {
|
||||||
$pk[static::tableName() . '.' . $key] = $value;
|
$pk[static::tableName() . '.' . $key] = $value;
|
||||||
}
|
}
|
||||||
/* @var $record BaseActiveRecord */
|
/* @var $record BaseActiveRecord */
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
namespace yii\db;
|
namespace yii\db;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\base\BaseObject;
|
||||||
use yii\base\InvalidCallException;
|
use yii\base\InvalidCallException;
|
||||||
use yii\base\InvalidConfigException;
|
use yii\base\InvalidConfigException;
|
||||||
use yii\base\NotSupportedException;
|
use yii\base\NotSupportedException;
|
||||||
use yii\base\BaseObject;
|
|
||||||
use yii\caching\Cache;
|
use yii\caching\Cache;
|
||||||
use yii\caching\CacheInterface;
|
use yii\caching\CacheInterface;
|
||||||
use yii\caching\TagDependency;
|
use yii\caching\TagDependency;
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
namespace yii\db;
|
namespace yii\db;
|
||||||
|
|
||||||
use yii\base\InvalidParamException;
|
|
||||||
use yii\base\BaseObject;
|
use yii\base\BaseObject;
|
||||||
|
use yii\base\InvalidParamException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TableSchema represents the metadata of a database table.
|
* TableSchema represents the metadata of a database table.
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
namespace yii\mail;
|
namespace yii\mail;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\ErrorHandler;
|
|
||||||
use yii\base\BaseObject;
|
use yii\base\BaseObject;
|
||||||
|
use yii\base\ErrorHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseMessage serves as a base class that implements the [[send()]] method required by [[MessageInterface]].
|
* BaseMessage serves as a base class that implements the [[send()]] method required by [[MessageInterface]].
|
||||||
|
@ -56,7 +56,7 @@ class MysqlMutex extends DbMutex
|
|||||||
*/
|
*/
|
||||||
protected function acquireLock($name, $timeout = 0)
|
protected function acquireLock($name, $timeout = 0)
|
||||||
{
|
{
|
||||||
return $this->db->useMaster(function($db) use ($name, $timeout) {
|
return $this->db->useMaster(function ($db) use ($name, $timeout) {
|
||||||
/** @var \yii\db\Connection $db */
|
/** @var \yii\db\Connection $db */
|
||||||
return (bool) $db->createCommand(
|
return (bool) $db->createCommand(
|
||||||
'SELECT GET_LOCK(:name, :timeout)',
|
'SELECT GET_LOCK(:name, :timeout)',
|
||||||
@ -75,7 +75,7 @@ class MysqlMutex extends DbMutex
|
|||||||
{
|
{
|
||||||
return $this->db->useMaster(function ($db) use ($name) {
|
return $this->db->useMaster(function ($db) use ($name) {
|
||||||
/** @var \yii\db\Connection $db */
|
/** @var \yii\db\Connection $db */
|
||||||
return (bool)$db->createCommand(
|
return (bool) $db->createCommand(
|
||||||
'SELECT RELEASE_LOCK(:name)',
|
'SELECT RELEASE_LOCK(:name)',
|
||||||
[':name' => $name]
|
[':name' => $name]
|
||||||
)->queryScalar();
|
)->queryScalar();
|
||||||
|
@ -88,7 +88,7 @@ class OracleMutex extends DbMutex
|
|||||||
$timeout = abs((int) $timeout);
|
$timeout = abs((int) $timeout);
|
||||||
|
|
||||||
// inside pl/sql scopes pdo binding not working correctly :(
|
// inside pl/sql scopes pdo binding not working correctly :(
|
||||||
$this->db->useMaster(function($db) use ($name, $timeout, $releaseOnCommit, &$lockStatus) {
|
$this->db->useMaster(function ($db) use ($name, $timeout, $releaseOnCommit, &$lockStatus) {
|
||||||
/** @var \yii\db\Connection $db */
|
/** @var \yii\db\Connection $db */
|
||||||
$db->createCommand(
|
$db->createCommand(
|
||||||
'DECLARE
|
'DECLARE
|
||||||
@ -115,7 +115,7 @@ END;',
|
|||||||
protected function releaseLock($name)
|
protected function releaseLock($name)
|
||||||
{
|
{
|
||||||
$releaseStatus = null;
|
$releaseStatus = null;
|
||||||
$this->db->useMaster(function($db) use ($name, &$releaseStatus) {
|
$this->db->useMaster(function ($db) use ($name, &$releaseStatus) {
|
||||||
/** @var \yii\db\Connection $db */
|
/** @var \yii\db\Connection $db */
|
||||||
$db->createCommand(
|
$db->createCommand(
|
||||||
'DECLARE
|
'DECLARE
|
||||||
|
@ -71,9 +71,9 @@ class PgsqlMutex extends DbMutex
|
|||||||
throw new InvalidParamException('PgsqlMutex does not support timeout.');
|
throw new InvalidParamException('PgsqlMutex does not support timeout.');
|
||||||
}
|
}
|
||||||
list($key1, $key2) = $this->getKeysFromName($name);
|
list($key1, $key2) = $this->getKeysFromName($name);
|
||||||
return $this->db->useMaster(function($db) use ($key1, $key2) {
|
return $this->db->useMaster(function ($db) use ($key1, $key2) {
|
||||||
/** @var \yii\db\Connection $db */
|
/** @var \yii\db\Connection $db */
|
||||||
return (bool)$db->createCommand(
|
return (bool) $db->createCommand(
|
||||||
'SELECT pg_try_advisory_lock(:key1, :key2)',
|
'SELECT pg_try_advisory_lock(:key1, :key2)',
|
||||||
[':key1' => $key1, ':key2' => $key2]
|
[':key1' => $key1, ':key2' => $key2]
|
||||||
)->queryScalar();
|
)->queryScalar();
|
||||||
@ -89,9 +89,9 @@ class PgsqlMutex extends DbMutex
|
|||||||
protected function releaseLock($name)
|
protected function releaseLock($name)
|
||||||
{
|
{
|
||||||
list($key1, $key2) = $this->getKeysFromName($name);
|
list($key1, $key2) = $this->getKeysFromName($name);
|
||||||
return $this->db->useMaster(function($db) use ($key1, $key2) {
|
return $this->db->useMaster(function ($db) use ($key1, $key2) {
|
||||||
/** @var \yii\db\Connection $db */
|
/** @var \yii\db\Connection $db */
|
||||||
return (bool)$db->createCommand(
|
return (bool) $db->createCommand(
|
||||||
'SELECT pg_advisory_unlock(:key1, :key2)',
|
'SELECT pg_advisory_unlock(:key1, :key2)',
|
||||||
[':key1' => $key1, ':key2' => $key2]
|
[':key1' => $key1, ':key2' => $key2]
|
||||||
)->queryScalar();
|
)->queryScalar();
|
||||||
|
@ -569,7 +569,7 @@ class IpValidator extends Validator
|
|||||||
$unpack = unpack('A16', inet_pton($ip));
|
$unpack = unpack('A16', inet_pton($ip));
|
||||||
$binStr = array_shift($unpack);
|
$binStr = array_shift($unpack);
|
||||||
$bytes = static::IPV6_ADDRESS_LENGTH / 8; // 128 bit / 8 = 16 bytes
|
$bytes = static::IPV6_ADDRESS_LENGTH / 8; // 128 bit / 8 = 16 bytes
|
||||||
$result = '';
|
$result = '';
|
||||||
while ($bytes-- > 0) {
|
while ($bytes-- > 0) {
|
||||||
$result = sprintf('%08b', isset($binStr[$bytes]) ? ord($binStr[$bytes]) : '0') . $result;
|
$result = sprintf('%08b', isset($binStr[$bytes]) ? ord($binStr[$bytes]) : '0') . $result;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ namespace yii\web;
|
|||||||
|
|
||||||
use ArrayIterator;
|
use ArrayIterator;
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\InvalidCallException;
|
|
||||||
use yii\base\BaseObject;
|
use yii\base\BaseObject;
|
||||||
|
use yii\base\InvalidCallException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CookieCollection maintains the cookies available in the current request.
|
* CookieCollection maintains the cookies available in the current request.
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
namespace yii\web;
|
namespace yii\web;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\InvalidConfigException;
|
|
||||||
use yii\base\BaseObject;
|
use yii\base\BaseObject;
|
||||||
|
use yii\base\InvalidConfigException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UrlNormalizer normalizes URLs for [[UrlManager]] and [[UrlRule]].
|
* UrlNormalizer normalizes URLs for [[UrlManager]] and [[UrlRule]].
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
namespace yii\web;
|
namespace yii\web;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\InvalidConfigException;
|
|
||||||
use yii\base\BaseObject;
|
use yii\base\BaseObject;
|
||||||
|
use yii\base\InvalidConfigException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UrlRule represents a rule used by [[UrlManager]] for parsing and generating URLs.
|
* UrlRule represents a rule used by [[UrlManager]] for parsing and generating URLs.
|
||||||
|
Reference in New Issue
Block a user