Merge pull request #2622 branch 'ext-codestyle-fix' of https://github.com/AlexGx/yii2 into code-style

* 'ext-codestyle-fix' of https://github.com/AlexGx/yii2:
  fix php5.4 array syntax
  many phpcs fixes
  fix phpDoc LuaScriptBuilder build @throws

Conflicts:
	extensions/apidoc/commands/RenderController.php
	extensions/apidoc/models/BaseDoc.php
	extensions/apidoc/templates/BaseRenderer.php
	extensions/apidoc/templates/bootstrap/Renderer.php
	extensions/apidoc/templates/bootstrap/layouts/guide.php
	extensions/apidoc/templates/bootstrap/layouts/main.php
	extensions/apidoc/templates/html/Renderer.php
	extensions/apidoc/templates/offline/Renderer.php
	extensions/apidoc/templates/offline/assets/AssetBundle.php
	extensions/apidoc/templates/offline/views/index.php
This commit is contained in:
Carsten Brandt
2014-03-07 21:34:23 +01:00
110 changed files with 280 additions and 243 deletions

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\apidoc\templates\bootstrap\assets; namespace yii\apidoc\templates\bootstrap\assets;
use yii\web\View; use yii\web\View;
/** /**

View File

@@ -3,6 +3,7 @@
use yii\apidoc\models\ClassDoc; use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\InterfaceDoc;
use yii\apidoc\models\TraitDoc; use yii\apidoc\models\TraitDoc;
/** /**
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var yii\web\View $this * @var yii\web\View $this

View File

@@ -4,6 +4,7 @@ use yii\apidoc\helpers\ApiMarkdown;
use yii\apidoc\models\ClassDoc; use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\InterfaceDoc;
use yii\apidoc\models\TraitDoc; use yii\apidoc\models\TraitDoc;
/** /**
* @var ClassDoc|InterfaceDoc|TraitDoc $type * @var ClassDoc|InterfaceDoc|TraitDoc $type
* @var yii\web\View $this * @var yii\web\View $this

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\apidoc\templates\online; namespace yii\apidoc\templates\online;
use yii\apidoc\models\Context; use yii\apidoc\models\Context;
use yii\apidoc\models\TypeDoc; use yii\apidoc\models\TypeDoc;
use yii\console\Controller; use yii\console\Controller;

View File

@@ -3,6 +3,7 @@
use yii\apidoc\models\ClassDoc; use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\InterfaceDoc;
use yii\apidoc\models\TraitDoc; use yii\apidoc\models\TraitDoc;
/** /**
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var yii\web\View $this * @var yii\web\View $this

View File

@@ -58,14 +58,16 @@ class OAuthToken extends Object
/** /**
* @param string $expireDurationParamKey expire duration param key. * @param string $expireDurationParamKey expire duration param key.
*/ */
public function setExpireDurationParamKey($expireDurationParamKey) { public function setExpireDurationParamKey($expireDurationParamKey)
{
$this->_expireDurationParamKey = $expireDurationParamKey; $this->_expireDurationParamKey = $expireDurationParamKey;
} }
/** /**
* @return string expire duration param key. * @return string expire duration param key.
*/ */
public function getExpireDurationParamKey() { public function getExpireDurationParamKey()
{
if ($this->_expireDurationParamKey === null) { if ($this->_expireDurationParamKey === null) {
$this->_expireDurationParamKey = $this->defaultExpireDurationParamKey(); $this->_expireDurationParamKey = $this->defaultExpireDurationParamKey();
} }
@@ -75,14 +77,16 @@ class OAuthToken extends Object
/** /**
* @return array * @return array
*/ */
public function getParams() { public function getParams()
{
return $this->_params; return $this->_params;
} }
/** /**
* @param array $params * @param array $params
*/ */
public function setParams(array $params) { public function setParams(array $params)
{
$this->_params = $params; $this->_params = $params;
} }
@@ -91,7 +95,8 @@ class OAuthToken extends Object
* @param string $name param name. * @param string $name param name.
* @param mixed $value param value, * @param mixed $value param value,
*/ */
public function setParam($name, $value) { public function setParam($name, $value)
{
$this->_params[$name] = $value; $this->_params[$name] = $value;
} }
@@ -100,7 +105,8 @@ class OAuthToken extends Object
* @param string $name param name. * @param string $name param name.
* @return mixed param value. * @return mixed param value.
*/ */
public function getParam($name) { public function getParam($name)
{
return isset($this->_params[$name]) ? $this->_params[$name] : null; return isset($this->_params[$name]) ? $this->_params[$name] : null;
} }
@@ -109,7 +115,8 @@ class OAuthToken extends Object
* @param string $token token value. * @param string $token token value.
* @return static self reference. * @return static self reference.
*/ */
public function setToken($token) { public function setToken($token)
{
$this->setParam($this->tokenParamKey, $token); $this->setParam($this->tokenParamKey, $token);
} }
@@ -117,7 +124,8 @@ class OAuthToken extends Object
* Returns token value. * Returns token value.
* @return string token value. * @return string token value.
*/ */
public function getToken() { public function getToken()
{
return $this->getParam($this->tokenParamKey); return $this->getParam($this->tokenParamKey);
} }
@@ -125,7 +133,8 @@ class OAuthToken extends Object
* Sets the token secret value. * Sets the token secret value.
* @param string $tokenSecret token secret. * @param string $tokenSecret token secret.
*/ */
public function setTokenSecret($tokenSecret) { public function setTokenSecret($tokenSecret)
{
$this->setParam($this->tokenSecretParamKey, $tokenSecret); $this->setParam($this->tokenSecretParamKey, $tokenSecret);
} }
@@ -133,7 +142,8 @@ class OAuthToken extends Object
* Returns the token secret value. * Returns the token secret value.
* @return string token secret value. * @return string token secret value.
*/ */
public function getTokenSecret() { public function getTokenSecret()
{
return $this->getParam($this->tokenSecretParamKey); return $this->getParam($this->tokenSecretParamKey);
} }
@@ -141,7 +151,8 @@ class OAuthToken extends Object
* Sets token expire duration. * Sets token expire duration.
* @param string $expireDuration token expiration duration. * @param string $expireDuration token expiration duration.
*/ */
public function setExpireDuration($expireDuration) { public function setExpireDuration($expireDuration)
{
$this->setParam($this->getExpireDurationParamKey(), $expireDuration); $this->setParam($this->getExpireDurationParamKey(), $expireDuration);
} }
@@ -149,7 +160,8 @@ class OAuthToken extends Object
* Returns the token expiration duration. * Returns the token expiration duration.
* @return integer token expiration duration. * @return integer token expiration duration.
*/ */
public function getExpireDuration() { public function getExpireDuration()
{
return $this->getParam($this->getExpireDurationParamKey()); return $this->getParam($this->getExpireDurationParamKey());
} }
@@ -157,7 +169,8 @@ class OAuthToken extends Object
* Fetches default expire duration param key. * Fetches default expire duration param key.
* @return string expire duration param key. * @return string expire duration param key.
*/ */
protected function defaultExpireDurationParamKey() { protected function defaultExpireDurationParamKey()
{
$expireDurationParamKey = 'expires_in'; $expireDurationParamKey = 'expires_in';
foreach ($this->getParams() as $name => $value) { foreach ($this->getParams() as $name => $value) {
if (strpos($name, 'expir') !== false) { if (strpos($name, 'expir') !== false) {
@@ -172,7 +185,8 @@ class OAuthToken extends Object
* Checks if token has expired. * Checks if token has expired.
* @return boolean is token expired. * @return boolean is token expired.
*/ */
public function getIsExpired() { public function getIsExpired()
{
$expirationDuration = $this->getExpireDuration(); $expirationDuration = $this->getExpireDuration();
if (empty($expirationDuration)) { if (empty($expirationDuration)) {
return false; return false;
@@ -184,7 +198,8 @@ class OAuthToken extends Object
* Checks if token is valid. * Checks if token is valid.
* @return boolean is token valid. * @return boolean is token valid.
*/ */
public function getIsValid() { public function getIsValid()
{
$token = $this->getToken(); $token = $this->getToken();
return (!empty($token) && !$this->getIsExpired()); return (!empty($token) && !$this->getIsExpired());
} }

View File

@@ -147,7 +147,8 @@ class LinkedIn extends OAuth2
* Generates the auth state value. * Generates the auth state value.
* @return string auth state value. * @return string auth state value.
*/ */
protected function generateAuthState() { protected function generateAuthState()
{
return sha1(uniqid(get_class($this), true)); return sha1(uniqid(get_class($this), true));
} }

View File

@@ -168,5 +168,4 @@ class LogTarget extends Target
# / 2 because messages are in couple (begin/end) # / 2 because messages are in couple (begin/end)
return count($profileLogs) / 2; return count($profileLogs) / 2;
} }
} }

View File

@@ -37,5 +37,4 @@ abstract class Base extends Component implements MatcherInterface
{ {
return !empty($this->baseValue) || ($this->baseValue === '0'); return !empty($this->baseValue) || ($this->baseValue === '0');
} }
} }

View File

@@ -175,5 +175,4 @@ class DbPanel extends Panel
{ {
return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold)); return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
} }
} }

View File

@@ -102,5 +102,4 @@ class MailPanel extends Panel
} }
return $attr; return $attr;
} }
} }

View File

@@ -35,4 +35,3 @@ echo $this->render('panels/config/table', [
]); ]);
echo $panel->getPhpInfo(); echo $panel->getPhpInfo();
?>

View File

@@ -67,4 +67,3 @@ echo GridView::widget([
] ]
], ],
]); ]);
?>

View File

@@ -70,4 +70,3 @@ echo GridView::widget([
], ],
], ],
]); ]);
?>

View File

@@ -1,6 +1,7 @@
<?php <?php
use yii\grid\GridView; use yii\grid\GridView;
use yii\helpers\Html; use yii\helpers\Html;
?> ?>
<h1>Performance Profiling</h1> <h1>Performance Profiling</h1>
<p>Total processing time: <b><?= $time ?></b>; Peak memory: <b><?= $memory ?></b>.</p> <p>Total processing time: <b><?= $time ?></b>; Peak memory: <b><?= $memory ?></b>.</p>
@@ -50,4 +51,3 @@ echo GridView::widget([
], ],
], ],
]); ]);
?>

View File

@@ -13,7 +13,6 @@ use yii\base\InvalidConfigException;
use yii\base\Model; use yii\base\Model;
use yii\web\View; use yii\web\View;
/** /**
* This is the base class for all generator classes. * This is the base class for all generator classes.
* *

View File

@@ -499,5 +499,4 @@ class Generator extends \yii\gii\Generator
return $model->attributes(); return $model->attributes();
} }
} }
} }

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\jui; namespace yii\jui;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -626,7 +626,8 @@ class Collection extends Object
* @return array the highest scoring documents, in descending order by score. * @return array the highest scoring documents, in descending order by score.
* @throws Exception on failure. * @throws Exception on failure.
*/ */
public function fullTextSearch($search, $condition = [], $fields = [], $options = []) { public function fullTextSearch($search, $condition = [], $fields = [], $options = [])
{
$command = [ $command = [
'search' => $search 'search' => $search
]; ];

View File

@@ -133,6 +133,7 @@ class LuaScriptBuilder extends \yii\base\Object
* @param ActiveQuery $query the query used to build the script * @param ActiveQuery $query the query used to build the script
* @param string $buildResult the lua script for building the result * @param string $buildResult the lua script for building the result
* @param string $return the lua variable that should be returned * @param string $return the lua variable that should be returned
* @throws yii\base\NotSupportedException when query contains unsupported order by condition
* @return string * @return string
*/ */
private function build($query, $buildResult, $return) private function build($query, $buildResult, $return)

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\sphinx; namespace yii\sphinx;
use yii\base\NotSupportedException; use yii\base\NotSupportedException;
/** /**

View File

@@ -422,7 +422,7 @@ class QueryBuilder extends Object
if (strpos($column, '(') === false) { if (strpos($column, '(') === false) {
$column = $this->db->quoteColumnName($column); $column = $this->db->quoteColumnName($column);
} }
$columns[$i] = "$column AS " . $this->db->quoteColumnName($i);; $columns[$i] = "$column AS " . $this->db->quoteColumnName($i);
} elseif (strpos($column, '(') === false) { } elseif (strpos($column, '(') === false) {
if (preg_match('/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/', $column, $matches)) { if (preg_match('/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/', $column, $matches)) {
$columns[$i] = $this->db->quoteColumnName($matches[1]) . ' AS ' . $this->db->quoteColumnName($matches[2]); $columns[$i] = $this->db->quoteColumnName($matches[1]) . ' AS ' . $this->db->quoteColumnName($matches[2]);
@@ -907,7 +907,8 @@ class QueryBuilder extends Object
* @param array $params the binding parameters to be populated * @param array $params the binding parameters to be populated
* @return string SQL expression, which represents column value * @return string SQL expression, which represents column value
*/ */
protected function composeColumnValue($indexes, $columnName, $value, &$params) { protected function composeColumnValue($indexes, $columnName, $value, &$params)
{
if ($value === null) { if ($value === null) {
return 'NULL'; return 'NULL';
} elseif ($value instanceof Expression) { } elseif ($value instanceof Expression) {

View File

@@ -68,7 +68,8 @@ class TwigSimpleFileLoader implements \Twig_LoaderInterface
* @param string $name file name * @param string $name file name
* @return string absolute path of file * @return string absolute path of file
*/ */
protected function getFilePath($name){ protected function getFilePath($name)
{
return $this->_dir . '/' . $name; return $this->_dir . '/' . $name;
} }
} }

View File

@@ -19,7 +19,8 @@ class ViewRendererStaticClassProxy
{ {
private $_staticClassName; private $_staticClassName;
public function __construct($staticClassName) { public function __construct($staticClassName)
{
$this->_staticClassName = $staticClassName; $this->_staticClassName = $staticClassName;
} }