Commit ea68bd3a by resurtm

CS fixes.

parent b314d963
......@@ -111,8 +111,8 @@ class DictionaryTest extends \yiiunit\TestCase
public function testMergeWith()
{
$a = array('a' => 'v1', 'v2', array('2'), 'c' => array('3','c' => 'a'));
$b = array('v22', 'a' => 'v11', array('2'), 'c' => array('c' => '3','a'));
$a = array('a' => 'v1', 'v2', array('2'), 'c' => array('3', 'c' => 'a'));
$b = array('v22', 'a' => 'v11', array('2'), 'c' => array('c' => '3', 'a'));
$c = array('a' => 'v11', 'v2', array('2'), 'c' => array('3', 'c' => '3', 'a'), 'v22', array('2'));
$dictionary = new Dictionary($a);
$dictionary2 = new Dictionary($b);
......
......@@ -20,7 +20,7 @@ class QueryTest extends \yiiunit\DatabaseTestCase
$query = new Query;
$query->select('id, name', 'something')->distinct(true);
$this->assertEquals(array('id','name'), $query->select);
$this->assertEquals(array('id', 'name'), $query->select);
$this->assertTrue($query->distinct);
$this->assertEquals('something', $query->selectOption);
}
......
......@@ -164,8 +164,8 @@ abstract class ManagerTestBase extends TestCase
public function testExecuteBizRule()
{
$this->assertTrue($this->auth->executeBizRule(null, array(), null));
$this->assertTrue($this->auth->executeBizRule('return 1==true;', array(), null));
$this->assertTrue($this->auth->executeBizRule('return $params[0]==$params[1];', array(1, '1'), null));
$this->assertTrue($this->auth->executeBizRule('return 1 == true;', array(), null));
$this->assertTrue($this->auth->executeBizRule('return $params[0] == $params[1];', array(1, '1'), null));
$this->assertFalse($this->auth->executeBizRule('invalid', array(), null));
}
......@@ -220,7 +220,7 @@ abstract class ManagerTestBase extends TestCase
$this->auth->createOperation('updatePost', 'update a post');
$this->auth->createOperation('deletePost', 'delete a post');
$task = $this->auth->createTask('updateOwnPost', 'update a post by author himself', 'return $params["authorID"]==$params["userID"];');
$task = $this->auth->createTask('updateOwnPost', 'update a post by author himself', 'return $params["authorID"] == $params["userID"];');
$task->addChild('updatePost');
$role = $this->auth->createRole('reader');
......
......@@ -8,7 +8,6 @@
namespace yii\console\controllers;
use yii\console\Controller;
use yii\helpers\FileHelper;
use yii\base\Exception;
/**
......@@ -140,10 +139,10 @@ class AppController extends Controller
*/
protected function getConfig()
{
if ($this->_config===null) {
$this->_config = require $this->getDefaultTemplatesPath().'/config.php';
if ($this->_config === null) {
$this->_config = require $this->getDefaultTemplatesPath() . '/config.php';
if ($this->templatesPath && file_exists($this->templatesPath)) {
$this->_config = array_merge($this->_config, require $this->templatesPath.'/config.php');
$this->_config = array_merge($this->_config, require $this->templatesPath . '/config.php');
}
}
if (isset($this->_config[$this->type])) {
......@@ -188,18 +187,18 @@ class AppController extends Controller
}
}
if ($i===0) {
return "'".$path1."'";
if ($i === 0) {
return "'" . $path1 . "'";
}
$up='';
for($j=$i;$j<$n2-1;++$j) {
$up.='/..';
$up = '';
for ($j = $i; $j < $n2 - 1; ++$j) {
$up .= '/..';
}
for(; $i<$n1-1; ++$i) {
$up.='/'.$segs1[$i];
for(; $i < $n1 - 1; ++$i) {
$up .= '/' . $segs1[$i];
}
return '__DIR__.\''.$up.'/'.basename($path1).'\'';
return '__DIR__.\'' . $up . '/' . basename($path1) . '\'';
}
......@@ -214,7 +213,7 @@ class AppController extends Controller
* <li>callback: optional, the callback to be invoked when copying a file. The callback function
* should be declared as follows:
* <pre>
* function foo($source,$params)
* function foo($source, $params)
* </pre>
* where $source parameter is the source file path, and the content returned
* by the function will be saved into the target file.</li>
......
......@@ -36,7 +36,7 @@ class MessageController extends Controller
* - sourcePath: string, root directory of all source files.
* - messagePath: string, root directory containing message translations.
* - languages: array, list of language codes that the extracted messages
* should be translated to. For example, array('zh_cn','en_au').
* should be translated to. For example, array('zh_cn', 'en_au').
* - fileTypes: array, a list of file extensions (e.g. 'php', 'xml').
* Only the files whose extension name can be found in this list
* will be processed. If empty, all files will be processed.
......@@ -135,7 +135,7 @@ class MessageController extends Controller
return $messages;
}
protected function generateMessageFile($messages,$fileName,$overwrite,$removeOld,$sort)
protected function generateMessageFile($messages, $fileName, $overwrite, $removeOld, $sort)
{
echo "Saving messages to $fileName...";
if (is_file($fileName)) {
......
......@@ -234,7 +234,7 @@ class Query extends \yii\base\Component
*
* - `in`: operand 1 should be a column or DB expression, and operand 2 be an array representing
* the range of the values that the column or DB expression should be in. For example,
* `array('in', 'id', array(1,2,3))` will generate `id IN (1,2,3)`.
* `array('in', 'id', array(1, 2, 3))` will generate `id IN (1, 2, 3)`.
* The method will properly quote the column name and escape values in the range.
*
* - `not in`: similar to the `in` operator except that `IN` is replaced with `NOT IN` in the generated condition.
......
......@@ -39,7 +39,7 @@ class Markdown
public static function process($content, $config = array())
{
if (static::$markdown===null) {
if (static::$markdown === null) {
static::$markdown = new MarkdownExtra();
}
foreach ($config as $name => $value) {
......
......@@ -109,7 +109,7 @@ class GettextMoFile extends GettextFile
if (($context && $separatorPosition !== false && substr($id, 0, $separatorPosition) === $context) ||
(!$context && $separatorPosition === false)) {
if ($separatorPosition !== false) {
$id = substr($id,$separatorPosition+1);
$id = substr($id, $separatorPosition+1);
}
$message = $this->readString($fileHandle, $targetLengths[$i], $targetOffsets[$i]);
......
......@@ -87,7 +87,7 @@ class I18N extends Component
$language = Yii::$app->language;
}
// allow chars for category: word chars, ".", "-", "/","\"
// allow chars for category: word chars, ".", "-", "/", "\"
if (strpos($message, '|') !== false && preg_match('/^([\w\-\\/\.\\\\]+)\|(.*)/', $message, $matches)) {
$category = $matches[1];
$message = $matches[2];
......
......@@ -166,7 +166,7 @@ class CProfileLogRoute extends CWebLogRoute
}
$entries = array_values($results);
$func = create_function('$a,$b', 'return $a[4]<$b[4]?1:0;');
$func = create_function('$a,$b', 'return $a[4] < $b[4] ? 1 : 0;');
usort($entries, $func);
$this->render('profile-summary', $entries);
......
......@@ -10,9 +10,9 @@
namespace yii\test;
require_once('PHPUnit/Runner/Version.php');
spl_autoload_unregister(array('Yii','autoload'));
spl_autoload_unregister(array('Yii', 'autoload'));
require_once('PHPUnit/Autoload.php');
spl_autoload_register(array('Yii','autoload')); // put yii's autoloader at the end
spl_autoload_register(array('Yii', 'autoload')); // put yii's autoloader at the end
/**
* TestCase is the base class for all test case classes.
......
......@@ -73,7 +73,7 @@ class ListPager extends Widget
$selection = $this->pagination->createUrl($currentPage);
if (!isset($this->options['onchange'])) {
$this->options['onchange'] = "if(this.value!='') {window.location=this.value;};";
$this->options['onchange'] = "if (this.value != '') { window.location = this.value; };";
}
echo Html::dropDownList(null, $selection, $pages, $this->options);
......
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