diff --git a/extensions/apidoc/apidoc b/extensions/apidoc/apidoc index 40da46b124..0f1b69dd89 100755 --- a/extensions/apidoc/apidoc +++ b/extensions/apidoc/apidoc @@ -15,7 +15,7 @@ $composerAutoload = [ __DIR__ . '/../../autoload.php', // script is installed as a composer binary ]; $vendorPath = null; -foreach($composerAutoload as $autoload) { +foreach ($composerAutoload as $autoload) { if (file_exists($autoload)) { require($autoload); $vendorPath = dirname($autoload); @@ -27,7 +27,7 @@ $yiiDirs = [ __DIR__ . '/vendor/yiisoft/yii2', // standalone with "composer install" run __DIR__ . '/../../yiisoft/yii2', // script is installed as a composer binary ]; -foreach($yiiDirs as $dir) { +foreach ($yiiDirs as $dir) { if (file_exists($dir . '/Yii.php')) { require($dir . '/Yii.php'); break; diff --git a/extensions/apidoc/commands/RenderController.php b/extensions/apidoc/commands/RenderController.php index 6cf6a8cbcc..5ed8f6409a 100644 --- a/extensions/apidoc/commands/RenderController.php +++ b/extensions/apidoc/commands/RenderController.php @@ -58,8 +58,8 @@ class RenderController extends Controller $this->stdout('Searching files to process... '); $files = []; - foreach($sourceDirs as $source) { - foreach($this->findFiles($source) as $fileName) { + foreach ($sourceDirs as $source) { + foreach ($this->findFiles($source) as $fileName) { $files[$fileName] = $fileName; } } @@ -80,7 +80,7 @@ class RenderController extends Controller $this->stdout('done.' . PHP_EOL, Console::FG_GREEN); $this->stdout('Checking for updated files... '); - foreach($context->files as $file => $sha) { + foreach ($context->files as $file => $sha) { if (sha1_file($file) === $sha) { unset($files[$file]); } @@ -92,7 +92,7 @@ class RenderController extends Controller $this->stdout($fileCount . ' file' . ($fileCount == 1 ? '' : 's') . ' to update.' . PHP_EOL); Console::startProgress(0, $fileCount, 'Processing files... ', false); $done = 0; - foreach($files as $file) { + foreach ($files as $file) { $context->addFile($file); Console::updateProgress(++$done, $fileCount); } diff --git a/extensions/apidoc/helpers/ApiMarkdown.php b/extensions/apidoc/helpers/ApiMarkdown.php index 1ccf76d20b..103b5b9d5a 100644 --- a/extensions/apidoc/helpers/ApiMarkdown.php +++ b/extensions/apidoc/helpers/ApiMarkdown.php @@ -70,7 +70,7 @@ class ApiMarkdown extends GithubMarkdown if (!empty($language)) { $block['language'] = $language; } - for($i = $current + 1, $count = count($lines); $i < $count; $i++) { + for ($i = $current + 1, $count = count($lines); $i < $count; $i++) { if (rtrim($line = $lines[$i]) !== $fence) { $block['content'][] = $line; } else { diff --git a/extensions/apidoc/helpers/PrettyPrinter.php b/extensions/apidoc/helpers/PrettyPrinter.php index 288178dd99..9085cf04d1 100644 --- a/extensions/apidoc/helpers/PrettyPrinter.php +++ b/extensions/apidoc/helpers/PrettyPrinter.php @@ -38,4 +38,4 @@ class PrettyPrinter extends \phpDocumentor\Reflection\PrettyPrinter $printer = new static(); return $printer->prettyPrintExpr($value); } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/BaseDoc.php b/extensions/apidoc/models/BaseDoc.php index 5a6e46de69..ee61033e0d 100644 --- a/extensions/apidoc/models/BaseDoc.php +++ b/extensions/apidoc/models/BaseDoc.php @@ -76,7 +76,7 @@ class BaseDoc extends Object $this->phpDocContext = $docblock->getContext(); $this->tags = $docblock->getTags(); - foreach($this->tags as $i => $tag) { + foreach ($this->tags as $i => $tag) { if ($tag instanceof SinceTag) { $this->since = $tag->getVersion(); unset($this->tags[$i]); @@ -104,12 +104,13 @@ class BaseDoc extends Object $this->endLine = $reflection->getEndLine(); } - public function getSourceUrl($baseUrl, $line=null) + public function getSourceUrl($baseUrl, $line = null) { - if($line === null) + if ($line === null) { return $baseUrl . $this->sourcePath; - else + } else { return $baseUrl . $this->sourcePath . '#' . $line; + } } public function getSourceCode() diff --git a/extensions/apidoc/models/ClassDoc.php b/extensions/apidoc/models/ClassDoc.php index c317881f71..53cd58fe26 100644 --- a/extensions/apidoc/models/ClassDoc.php +++ b/extensions/apidoc/models/ClassDoc.php @@ -45,12 +45,12 @@ class ClassDoc extends TypeDoc if (($subject = parent::findSubject($subjectName)) !== null) { return $subject; } - foreach($this->events as $name => $event) { + foreach ($this->events as $name => $event) { if ($subjectName == $name) { return $event; } } - foreach($this->constants as $name => $constant) { + foreach ($this->constants as $name => $constant) { if ($subjectName == $name) { return $constant; } @@ -64,7 +64,7 @@ class ClassDoc extends TypeDoc public function getNativeEvents() { $events = []; - foreach($this->events as $name => $event) { + foreach ($this->events as $name => $event) { if ($event->definedBy != $this->name) { continue; } @@ -93,13 +93,13 @@ class ClassDoc extends TypeDoc $this->isAbstract = $reflector->isAbstract(); $this->isFinal = $reflector->isFinal(); - foreach($reflector->getInterfaces() as $interface) { + foreach ($reflector->getInterfaces() as $interface) { $this->interfaces[] = ltrim($interface, '\\'); } - foreach($reflector->getTraits() as $trait) { + foreach ($reflector->getTraits() as $trait) { $this->traits[] = ltrim($trait, '\\'); } - foreach($reflector->getConstants() as $constantReflector) { + foreach ($reflector->getConstants() as $constantReflector) { $docblock = $constantReflector->getDocBlock(); if ($docblock !== null && count($docblock->getTagsByName('event')) > 0) { $event = new EventDoc($constantReflector); @@ -112,4 +112,4 @@ class ClassDoc extends TypeDoc } } } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/ConstDoc.php b/extensions/apidoc/models/ConstDoc.php index 94a87bf1c8..abca13f560 100644 --- a/extensions/apidoc/models/ConstDoc.php +++ b/extensions/apidoc/models/ConstDoc.php @@ -33,4 +33,4 @@ class ConstDoc extends BaseDoc $this->value = $reflector->getValue(); } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/Context.php b/extensions/apidoc/models/Context.php index c71f40d30f..5101947ff4 100644 --- a/extensions/apidoc/models/Context.php +++ b/extensions/apidoc/models/Context.php @@ -57,15 +57,15 @@ class Context extends Component $reflection = new FileReflector($fileName, true); $reflection->process(); - foreach($reflection->getClasses() as $class) { + foreach ($reflection->getClasses() as $class) { $class = new ClassDoc($class, $this, ['sourceFile' => $fileName]); $this->classes[$class->name] = $class; } - foreach($reflection->getInterfaces() as $interface) { + foreach ($reflection->getInterfaces() as $interface) { $interface = new InterfaceDoc($interface, $this, ['sourceFile' => $fileName]); $this->interfaces[$interface->name] = $interface; } - foreach($reflection->getTraits() as $trait) { + foreach ($reflection->getTraits() as $trait) { $trait = new TraitDoc($trait, $this, ['sourceFile' => $fileName]); $this->traits[$trait->name] = $trait; } @@ -74,7 +74,7 @@ class Context extends Component public function updateReferences() { // update all subclass references - foreach($this->classes as $class) { + foreach ($this->classes as $class) { $className = $class->name; while (isset($this->classes[$class->parentClass])) { $class = $this->classes[$class->parentClass]; @@ -82,12 +82,12 @@ class Context extends Component } } // update interfaces of subclasses - foreach($this->classes as $class) { + foreach ($this->classes as $class) { $this->updateSubclassInferfacesTraits($class); } // update implementedBy and usedBy for interfaces and traits - foreach($this->classes as $class) { - foreach($class->traits as $trait) { + foreach ($this->classes as $class) { + foreach ($class->traits as $trait) { if (isset($this->traits[$trait])) { $trait = $this->traits[$trait]; $trait->usedBy[] = $class->name; @@ -95,12 +95,12 @@ class Context extends Component $class->methods = array_merge($trait->methods, $class->methods); } } - foreach($class->interfaces as $interface) { + foreach ($class->interfaces as $interface) { if (isset($this->interfaces[$interface])) { $this->interfaces[$interface]->implementedBy[] = $class->name; if ($class->isAbstract) { // add not implemented interface methods - foreach($this->interfaces[$interface]->methods as $method) { + foreach ($this->interfaces[$interface]->methods as $method) { if (!isset($class->methods[$method->name])) { $class->methods[$method->name] = $method; } @@ -110,11 +110,11 @@ class Context extends Component } } // inherit properties, methods, contants and events to subclasses - foreach($this->classes as $class) { + foreach ($this->classes as $class) { $this->updateSubclassInheritance($class); } // add properties from getters and setters - foreach($this->classes as $class) { + foreach ($this->classes as $class) { $this->handlePropertyFeature($class); } @@ -127,7 +127,7 @@ class Context extends Component */ protected function updateSubclassInferfacesTraits($class) { - foreach($class->subclasses as $subclass) { + foreach ($class->subclasses as $subclass) { $subclass = $this->classes[$subclass]; $subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces)); $subclass->traits = array_unique(array_merge($subclass->traits, $class->traits)); @@ -141,7 +141,7 @@ class Context extends Component */ protected function updateSubclassInheritance($class) { - foreach($class->subclasses as $subclass) { + foreach ($class->subclasses as $subclass) { $subclass = $this->classes[$subclass]; $subclass->events = array_merge($class->events, $subclass->events); $subclass->constants = array_merge($class->constants, $subclass->constants); @@ -160,7 +160,7 @@ class Context extends Component if (!$this->isSubclassOf($class, 'yii\base\Object')) { return; } - foreach($class->getPublicMethods() as $name => $method) { + foreach ($class->getPublicMethods() as $name => $method) { if ($method->isStatic) { continue; } @@ -232,7 +232,7 @@ class Context extends Component */ private function paramsOptional($method, $number = 0) { - foreach($method->params as $param) { + foreach ($method->params as $param) { if (!$param->isOptional && $number-- <= 0) { return false; } @@ -246,7 +246,7 @@ class Context extends Component */ private function getFirstNotOptionalParameter($method) { - foreach($method->params as $param) { + foreach ($method->params as $param) { if (!$param->isOptional) { return $param; } @@ -266,7 +266,7 @@ class Context extends Component if ($classA->name == $classB) { return true; } - while($classA->parentClass !== null && isset($this->classes[$classA->parentClass])) { + while ($classA->parentClass !== null && isset($this->classes[$classA->parentClass])) { $classA = $this->classes[$classA->parentClass]; if ($classA->name == $classB) { return true; @@ -274,4 +274,4 @@ class Context extends Component } return false; } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/EventDoc.php b/extensions/apidoc/models/EventDoc.php index 17515f067c..12edc98410 100644 --- a/extensions/apidoc/models/EventDoc.php +++ b/extensions/apidoc/models/EventDoc.php @@ -34,7 +34,7 @@ class EventDoc extends ConstDoc return; } - foreach($this->tags as $i => $tag) { + foreach ($this->tags as $i => $tag) { if ($tag->getName() == 'event') { $eventTag = new ReturnTag('event', $tag->getContent(), $tag->getDocBlock(), $tag->getLocation()); $this->type = $eventTag->getType(); @@ -49,4 +49,4 @@ class EventDoc extends ConstDoc } } } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/FunctionDoc.php b/extensions/apidoc/models/FunctionDoc.php index 2a482f1d89..2befe0a198 100644 --- a/extensions/apidoc/models/FunctionDoc.php +++ b/extensions/apidoc/models/FunctionDoc.php @@ -45,17 +45,17 @@ class FunctionDoc extends BaseDoc $this->isReturnByReference = $reflector->isByRef(); - foreach($reflector->getArguments() as $arg) { + foreach ($reflector->getArguments() as $arg) { $arg = new ParamDoc($arg, $context, ['sourceFile' => $this->sourceFile]); $this->params[$arg->name] = $arg; } - foreach($this->tags as $i => $tag) { + foreach ($this->tags as $i => $tag) { if ($tag instanceof ThrowsTag) { $this->exceptions[$tag->getType()] = $tag->getDescription(); unset($this->tags[$i]); } elseif ($tag instanceof PropertyTag) { - // ignore property tag + // ignore property tag } elseif ($tag instanceof ParamTag) { $paramName = $tag->getVariableName(); if (!isset($this->params[$paramName]) && $context !== null) { diff --git a/extensions/apidoc/models/InterfaceDoc.php b/extensions/apidoc/models/InterfaceDoc.php index 2b9699f524..32cbd8384f 100644 --- a/extensions/apidoc/models/InterfaceDoc.php +++ b/extensions/apidoc/models/InterfaceDoc.php @@ -33,15 +33,15 @@ class InterfaceDoc extends TypeDoc return; } - foreach($reflector->getParentInterfaces() as $interface) { + foreach ($reflector->getParentInterfaces() as $interface) { $this->parentInterfaces[] = ltrim($interface, '\\'); } - foreach($this->methods as $method) { + foreach ($this->methods as $method) { $method->isAbstract = true; } // interface can not have properties $this->properties = null; } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/ParamDoc.php b/extensions/apidoc/models/ParamDoc.php index b1e10075a9..69af05ea60 100644 --- a/extensions/apidoc/models/ParamDoc.php +++ b/extensions/apidoc/models/ParamDoc.php @@ -53,4 +53,4 @@ class ParamDoc extends Object } $this->isPassedByReference = $reflector->isByRef(); } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/PropertyDoc.php b/extensions/apidoc/models/PropertyDoc.php index fc7d99dd32..0fbb6ca25b 100644 --- a/extensions/apidoc/models/PropertyDoc.php +++ b/extensions/apidoc/models/PropertyDoc.php @@ -63,7 +63,7 @@ class PropertyDoc extends BaseDoc $this->defaultValue = PrettyPrinter::getRepresentationOfValue($reflector->getNode()->default); } - foreach($this->tags as $tag) { + foreach ($this->tags as $tag) { if ($tag instanceof VarTag) { $this->type = $tag->getType(); $this->types = $tag->getTypes(); @@ -83,4 +83,4 @@ class PropertyDoc extends BaseDoc ]; } } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/TraitDoc.php b/extensions/apidoc/models/TraitDoc.php index 216a53502d..3742bfa11e 100644 --- a/extensions/apidoc/models/TraitDoc.php +++ b/extensions/apidoc/models/TraitDoc.php @@ -34,8 +34,8 @@ class TraitDoc extends TypeDoc return; } - foreach($reflector->getTraits() as $trait) { + foreach ($reflector->getTraits() as $trait) { $this->traits[] = ltrim($trait, '\\'); } } -} \ No newline at end of file +} diff --git a/extensions/apidoc/models/TypeDoc.php b/extensions/apidoc/models/TypeDoc.php index aad261de11..2f43491cc3 100644 --- a/extensions/apidoc/models/TypeDoc.php +++ b/extensions/apidoc/models/TypeDoc.php @@ -41,7 +41,7 @@ class TypeDoc extends BaseDoc public function findSubject($subjectName) { if ($subjectName[0] != '$') { - foreach($this->methods as $name => $method) { + foreach ($this->methods as $name => $method) { if (rtrim($subjectName, '()') == $name) { return $method; } @@ -53,7 +53,7 @@ class TypeDoc extends BaseDoc if ($this->properties === null) { return null; } - foreach($this->properties as $name => $property) { + foreach ($this->properties as $name => $property) { if (ltrim($subjectName, '$') == ltrim($name, '$')) { return $property; } @@ -93,7 +93,7 @@ class TypeDoc extends BaseDoc private function getFilteredMethods($visibility = null, $definedBy = null) { $methods = []; - foreach($this->methods as $name => $method) { + foreach ($this->methods as $name => $method) { if ($visibility !== null && $method->visibility != $visibility) { continue; } @@ -140,7 +140,7 @@ class TypeDoc extends BaseDoc return []; } $properties = []; - foreach($this->properties as $name => $property) { + foreach ($this->properties as $name => $property) { if ($visibility !== null && $property->visibility != $visibility) { continue; } @@ -167,14 +167,14 @@ class TypeDoc extends BaseDoc return; } - foreach($this->tags as $i => $tag) { + foreach ($this->tags as $i => $tag) { if ($tag instanceof AuthorTag) { $this->authors[$tag->getAuthorName()] = $tag->getAuthorEmail(); unset($this->tags[$i]); } } - foreach($reflector->getProperties() as $propertyReflector) { + foreach ($reflector->getProperties() as $propertyReflector) { if ($propertyReflector->getVisibility() != 'private') { $property = new PropertyDoc($propertyReflector, $context, ['sourceFile' => $this->sourceFile]); $property->definedBy = $this->name; @@ -182,7 +182,7 @@ class TypeDoc extends BaseDoc } } - foreach($reflector->getMethods() as $methodReflector) { + foreach ($reflector->getMethods() as $methodReflector) { if ($methodReflector->getVisibility() != 'private') { $method = new MethodDoc($methodReflector, $context, ['sourceFile' => $this->sourceFile]); $method->definedBy = $this->name; @@ -190,4 +190,4 @@ class TypeDoc extends BaseDoc } } } -} \ No newline at end of file +} diff --git a/extensions/apidoc/templates/BaseRenderer.php b/extensions/apidoc/templates/BaseRenderer.php index a8baab8986..8683ed5552 100644 --- a/extensions/apidoc/templates/BaseRenderer.php +++ b/extensions/apidoc/templates/BaseRenderer.php @@ -68,4 +68,4 @@ abstract class BaseRenderer extends Component * @return string */ public abstract function subjectLink($subject, $title = null); -} \ No newline at end of file +} diff --git a/extensions/apidoc/templates/bootstrap/Renderer.php b/extensions/apidoc/templates/bootstrap/Renderer.php index 488ae3a123..40386f186c 100644 --- a/extensions/apidoc/templates/bootstrap/Renderer.php +++ b/extensions/apidoc/templates/bootstrap/Renderer.php @@ -6,6 +6,7 @@ */ namespace yii\apidoc\templates\bootstrap; + use yii\apidoc\helpers\ApiMarkdown; use yii\apidoc\models\Context; use yii\console\Controller; @@ -60,7 +61,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer $types = array_merge($context->classes, $context->interfaces, $context->traits); $controller->stdout('generating extension index files...'); - foreach($this->extensions as $ext) { + foreach ($this->extensions as $ext) { $readme = @file_get_contents("https://raw.github.com/yiisoft/yii2-$ext/master/README.md"); $indexFileContent = $this->renderWithLayout($this->indexView, [ 'docContext' => $context, @@ -109,13 +110,13 @@ class Renderer extends \yii\apidoc\templates\html\Renderer switch ($navClasses) { case 'app': - $types = array_filter($types, function($val) { + $types = array_filter($types, function ($val) { return strncmp($val->name, 'yii\\', 4) !== 0; }); break; case 'yii': $self = $this; - $types = array_filter($types, function($val) use ($self) { + $types = array_filter($types, function ($val) use ($self) { if (strlen($val->name) < 5) { return false; } @@ -124,7 +125,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer }); break; default: - $types = array_filter($types, function($val) use ($navClasses) { + $types = array_filter($types, function ($val) use ($navClasses) { return strncmp($val->name, "yii\\$navClasses\\", strlen("yii\\$navClasses\\")) === 0; }); } @@ -151,7 +152,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer $done = 0; $fileData = []; $headlines = []; - foreach($files as $file) { + foreach ($files as $file) { $fileData[$file] = file_get_contents($file); if (basename($file) == 'index.md') { continue; // to not add index file to nav @@ -163,7 +164,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer } } - foreach($fileData as $file => $content) { + foreach ($fileData as $file => $content) { $output = ApiMarkdown::process($content); // TODO generate links to yiiframework.com by default $output = $this->fixMarkdownLinks($output); if ($this->guideLayout !== false) { @@ -191,7 +192,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer public function getGuideReferences() { $refs = []; - foreach($this->markDownFiles as $file) { + foreach ($this->markDownFiles as $file) { $refName = 'guide-' . basename($file, '.md'); $refs[$refName] = ['url' => $this->generateGuideFileName($file)]; } @@ -203,4 +204,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer $content = preg_replace('/href\s*=\s*"([^"\/]+)\.md(#.*)?"/i', 'href="guide_\1.html\2"', $content); return $content; } -} \ No newline at end of file +} diff --git a/extensions/apidoc/templates/bootstrap/SideNavWidget.php b/extensions/apidoc/templates/bootstrap/SideNavWidget.php index 2e346a2729..277e14c99e 100644 --- a/extensions/apidoc/templates/bootstrap/SideNavWidget.php +++ b/extensions/apidoc/templates/bootstrap/SideNavWidget.php @@ -151,7 +151,7 @@ class SideNavWidget extends \yii\bootstrap\Widget $label .= ' ' . Html::tag('b', '', ['class' => 'caret']); if (is_array($items)) { if ($active === false) { - foreach($items as $subItem) { + foreach ($items as $subItem) { if (isset($subItem['active']) && $subItem['active']) { $active = true; } diff --git a/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php b/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php index 1ae8021acc..0a377074b5 100644 --- a/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php +++ b/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php @@ -6,6 +6,7 @@ */ namespace yii\apidoc\templates\bootstrap\assets; + use yii\web\View; /** diff --git a/extensions/apidoc/templates/bootstrap/layouts/api.php b/extensions/apidoc/templates/bootstrap/layouts/api.php index 935705d590..a1a61c06e4 100644 --- a/extensions/apidoc/templates/bootstrap/layouts/api.php +++ b/extensions/apidoc/templates/bootstrap/layouts/api.php @@ -14,7 +14,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?> $types = $this->context->getNavTypes(isset($type) ? $type : null, $types); ksort($types); $nav = []; - foreach($types as $i=>$class) { + foreach ($types as $i => $class) { $namespace = $class->namespace; if (empty($namespace)) { $namespace = 'Not namespaced classes'; diff --git a/extensions/apidoc/templates/bootstrap/layouts/guide.php b/extensions/apidoc/templates/bootstrap/layouts/guide.php index 6673a974bb..cecfa44775 100644 --- a/extensions/apidoc/templates/bootstrap/layouts/guide.php +++ b/extensions/apidoc/templates/bootstrap/layouts/guide.php @@ -17,7 +17,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?> 'url' => './guide_index.html', 'active' => isset($currentFile) && (basename($currentFile) == 'index.md'), ]; - foreach($headlines as $file => $headline) { + foreach ($headlines as $file => $headline) { // if (!isset($nav[$namespace])) { // $nav[$namespace] = [ // 'label' => $namespace, diff --git a/extensions/apidoc/templates/bootstrap/layouts/main.php b/extensions/apidoc/templates/bootstrap/layouts/main.php index c47bcc42ee..cef0a71303 100644 --- a/extensions/apidoc/templates/bootstrap/layouts/main.php +++ b/extensions/apidoc/templates/bootstrap/layouts/main.php @@ -46,7 +46,7 @@ $this->beginPage(); 'view' => $this, ]); $extItems = []; - foreach($this->context->extensions as $ext) { + foreach ($this->context->extensions as $ext) { $extItems[] = [ 'label' => $ext, 'url' => "./ext_{$ext}_index.html", diff --git a/extensions/apidoc/templates/bootstrap/views/index.php b/extensions/apidoc/templates/bootstrap/views/index.php index c7339abe10..17c668b796 100644 --- a/extensions/apidoc/templates/bootstrap/views/index.php +++ b/extensions/apidoc/templates/bootstrap/views/index.php @@ -3,6 +3,7 @@ use yii\apidoc\models\ClassDoc; use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\TraitDoc; + /** * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types * @var yii\web\View $this @@ -26,7 +27,7 @@ if (isset($readme)) { $class): +foreach($types as $i => $class): ?>
Total processing time: = $time ?>; Peak memory: = $memory ?>.
@@ -50,4 +51,3 @@ echo GridView::widget([ ], ], ]); -?> diff --git a/extensions/elasticsearch/ActiveQuery.php b/extensions/elasticsearch/ActiveQuery.php index c7d23ad3ba..0ed64aa25a 100644 --- a/extensions/elasticsearch/ActiveQuery.php +++ b/extensions/elasticsearch/ActiveQuery.php @@ -156,7 +156,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } $models = $this->createModels($result['hits']['hits']); if ($this->asArray && !$this->indexBy) { - foreach($models as $key => $model) { + foreach ($models as $key => $model) { if ($pk === '_id') { $model['_source']['_id'] = $model['_id']; } @@ -168,7 +168,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $this->findWith($this->with, $models); } if (!$this->asArray) { - foreach($models as $model) { + foreach ($models as $model) { $model->afterFind(); } } @@ -226,7 +226,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface /** @var ActiveRecord $modelClass */ $modelClass = $this->modelClass; $pk = $modelClass::primaryKey()[0]; - foreach($models as $key => $model) { + foreach ($models as $key => $model) { if ($pk === '_id') { $model['_source']['_id'] = $model['_id']; } @@ -238,7 +238,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $this->findWith($this->with, $models); } if (!$this->asArray) { - foreach($models as $model) { + foreach ($models as $model) { $model->afterFind(); } } diff --git a/extensions/elasticsearch/ActiveRecord.php b/extensions/elasticsearch/ActiveRecord.php index 4fdff54160..06d5d23130 100644 --- a/extensions/elasticsearch/ActiveRecord.php +++ b/extensions/elasticsearch/ActiveRecord.php @@ -122,7 +122,7 @@ class ActiveRecord extends BaseActiveRecord $command = static::getDb()->createCommand(); $result = $command->mget(static::index(), static::type(), $primaryKeys, $options); $models = []; - foreach($result['docs'] as $doc) { + foreach ($result['docs'] as $doc) { if ($doc['exists']) { $model = static::instantiate($doc); static::populateRecord($model, $doc); @@ -422,7 +422,7 @@ class ActiveRecord extends BaseActiveRecord return 0; } $bulk = ''; - foreach($primaryKeys as $pk) { + foreach ($primaryKeys as $pk) { $action = Json::encode([ "update" => [ "_id" => $pk, @@ -441,7 +441,7 @@ class ActiveRecord extends BaseActiveRecord $response = static::getDb()->post($url, [], $bulk); $n=0; $errors = []; - foreach($response['items'] as $item) { + foreach ($response['items'] as $item) { if (isset($item['update']['error'])) { $errors[] = $item['update']; } elseif ($item['update']['ok']) { @@ -480,7 +480,7 @@ class ActiveRecord extends BaseActiveRecord return 0; } $bulk = ''; - foreach($primaryKeys as $pk) { + foreach ($primaryKeys as $pk) { $action = Json::encode([ "update" => [ "_id" => $pk, @@ -489,12 +489,12 @@ class ActiveRecord extends BaseActiveRecord ], ]); $script = ''; - foreach($counters as $counter => $value) { + foreach ($counters as $counter => $value) { $script .= "ctx._source.$counter += $counter;\n"; } $data = Json::encode([ "script" => $script, - "params" => $counters + "params" => $counters ]); $bulk .= $action . "\n" . $data . "\n"; } @@ -504,7 +504,7 @@ class ActiveRecord extends BaseActiveRecord $response = static::getDb()->post($url, [], $bulk); $n=0; $errors = []; - foreach($response['items'] as $item) { + foreach ($response['items'] as $item) { if (isset($item['update']['error'])) { $errors[] = $item['update']; } elseif ($item['update']['ok']) { @@ -543,7 +543,7 @@ class ActiveRecord extends BaseActiveRecord return 0; } $bulk = ''; - foreach($primaryKeys as $pk) { + foreach ($primaryKeys as $pk) { $bulk .= Json::encode([ "delete" => [ "_id" => $pk, @@ -558,7 +558,7 @@ class ActiveRecord extends BaseActiveRecord $response = static::getDb()->post($url, [], $bulk); $n=0; $errors = []; - foreach($response['items'] as $item) { + foreach ($response['items'] as $item) { if (isset($item['delete']['error'])) { $errors[] = $item['delete']; } elseif ($item['delete']['found'] && $item['delete']['ok']) { diff --git a/extensions/elasticsearch/Command.php b/extensions/elasticsearch/Command.php index 9ea4a6019f..b6a98b63d0 100644 --- a/extensions/elasticsearch/Command.php +++ b/extensions/elasticsearch/Command.php @@ -400,4 +400,4 @@ class Command extends Component { return $this->db->get(['_template', $name]); } -} \ No newline at end of file +} diff --git a/extensions/elasticsearch/Connection.php b/extensions/elasticsearch/Connection.php index 75de7a3bf1..857f0f6883 100644 --- a/extensions/elasticsearch/Connection.php +++ b/extensions/elasticsearch/Connection.php @@ -63,7 +63,7 @@ class Connection extends Component public function init() { - foreach($this->nodes as $node) { + foreach ($this->nodes as $node) { if (!isset($node['http_address'])) { throw new InvalidConfigException('Elasticsearch node needs at least a http_address configured.'); } @@ -210,7 +210,7 @@ class Connection extends Component private function createUrl($path, $options = []) { if (!is_string($path)) { - $url = implode('/', array_map(function($a) { + $url = implode('/', array_map(function ($a) { return urlencode(is_array($a) ? implode(',', $a) : $a); }, $path)); if (!empty($options)) { @@ -240,12 +240,12 @@ class Connection extends Component // http://www.php.net/manual/en/function.curl-setopt.php#82418 CURLOPT_HTTPHEADER => ['Expect:'], - CURLOPT_WRITEFUNCTION => function($curl, $data) use (&$body) { + CURLOPT_WRITEFUNCTION => function ($curl, $data) use (&$body) { $body .= $data; return mb_strlen($data, '8bit'); }, - CURLOPT_HEADERFUNCTION => function($curl, $data) use (&$headers) { - foreach(explode("\r\n", $data) as $row) { + CURLOPT_HEADERFUNCTION => function ($curl, $data) use (&$headers) { + foreach (explode("\r\n", $data) as $row) { if (($pos = strpos($row, ':')) !== false) { $headers[strtolower(substr($row, 0, $pos))] = trim(substr($row, $pos + 1)); } @@ -355,4 +355,4 @@ class Connection extends Component { return $this->get(['_cluster', 'state']); } -} \ No newline at end of file +} diff --git a/extensions/elasticsearch/Exception.php b/extensions/elasticsearch/Exception.php index 1736deccb4..2510072abc 100644 --- a/extensions/elasticsearch/Exception.php +++ b/extensions/elasticsearch/Exception.php @@ -22,4 +22,4 @@ class Exception extends \yii\db\Exception { return 'Elasticsearch Database Exception'; } -} \ No newline at end of file +} diff --git a/extensions/elasticsearch/Query.php b/extensions/elasticsearch/Query.php index 139b2d6df0..f392d161f6 100644 --- a/extensions/elasticsearch/Query.php +++ b/extensions/elasticsearch/Query.php @@ -501,4 +501,4 @@ class Query extends Component implements QueryInterface $this->timeout = $timeout; return $this; } -} \ No newline at end of file +} diff --git a/extensions/elasticsearch/QueryBuilder.php b/extensions/elasticsearch/QueryBuilder.php index e9511ea933..0b6a38b06e 100644 --- a/extensions/elasticsearch/QueryBuilder.php +++ b/extensions/elasticsearch/QueryBuilder.php @@ -177,7 +177,7 @@ class QueryBuilder extends \yii\base\Object private function buildHashCondition($condition) { $parts = []; - foreach($condition as $attribute => $value) { + foreach ($condition as $attribute => $value) { if ($attribute == '_id') { if ($value == null) { // there is no null pk $parts[] = ['script' => ['script' => '0==1']]; diff --git a/extensions/gii/Generator.php b/extensions/gii/Generator.php index d82bdc1099..9dc3c6b5f4 100644 --- a/extensions/gii/Generator.php +++ b/extensions/gii/Generator.php @@ -13,7 +13,6 @@ use yii\base\InvalidConfigException; use yii\base\Model; use yii\web\View; - /** * This is the base class for all generator classes. * diff --git a/extensions/gii/components/DiffRendererHtmlInline.php b/extensions/gii/components/DiffRendererHtmlInline.php index 757addbac2..908630af95 100644 --- a/extensions/gii/components/DiffRendererHtmlInline.php +++ b/extensions/gii/components/DiffRendererHtmlInline.php @@ -73,7 +73,7 @@ HTML; } } // Added lines only on the right side - else if ($change['tag'] === 'insert') { + elseif ($change['tag'] === 'insert') { foreach ($change['changed']['lines'] as $no => $line) { $toLine = $change['changed']['offset'] + $no + 1; $html .= << $line) { $fromLine = $change['base']['offset'] + $no + 1; $html .= << $line) { $fromLine = $change['base']['offset'] + $no + 1; $html .= <<attributes(); } } - } diff --git a/extensions/jui/AutoCompleteAsset.php b/extensions/jui/AutoCompleteAsset.php index f48e064a5c..8e2b3f463a 100644 --- a/extensions/jui/AutoCompleteAsset.php +++ b/extensions/jui/AutoCompleteAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/ButtonAsset.php b/extensions/jui/ButtonAsset.php index 6616b346d0..b00354e4ba 100644 --- a/extensions/jui/ButtonAsset.php +++ b/extensions/jui/ButtonAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/CoreAsset.php b/extensions/jui/CoreAsset.php index d77a25fc07..f221f53ecc 100644 --- a/extensions/jui/CoreAsset.php +++ b/extensions/jui/CoreAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/DatePickerAsset.php b/extensions/jui/DatePickerAsset.php index fddd8dffd9..68fb486a43 100644 --- a/extensions/jui/DatePickerAsset.php +++ b/extensions/jui/DatePickerAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/DatePickerRegionalAsset.php b/extensions/jui/DatePickerRegionalAsset.php index 249373ae5f..fcb931b37f 100644 --- a/extensions/jui/DatePickerRegionalAsset.php +++ b/extensions/jui/DatePickerRegionalAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/DialogAsset.php b/extensions/jui/DialogAsset.php index 109243e58a..da6a32cfe6 100644 --- a/extensions/jui/DialogAsset.php +++ b/extensions/jui/DialogAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/DraggableAsset.php b/extensions/jui/DraggableAsset.php index f3286a592e..152ea6e14d 100644 --- a/extensions/jui/DraggableAsset.php +++ b/extensions/jui/DraggableAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/DroppableAsset.php b/extensions/jui/DroppableAsset.php index 84b64b8cc6..ae7afa865d 100644 --- a/extensions/jui/DroppableAsset.php +++ b/extensions/jui/DroppableAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/EffectAsset.php b/extensions/jui/EffectAsset.php index 79c5aaa5f1..d28347c909 100644 --- a/extensions/jui/EffectAsset.php +++ b/extensions/jui/EffectAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/MenuAsset.php b/extensions/jui/MenuAsset.php index 8b840a8cf5..c4c66ec049 100644 --- a/extensions/jui/MenuAsset.php +++ b/extensions/jui/MenuAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/ProgressBarAsset.php b/extensions/jui/ProgressBarAsset.php index d485fbddc2..b7a5df2942 100644 --- a/extensions/jui/ProgressBarAsset.php +++ b/extensions/jui/ProgressBarAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/ResizableAsset.php b/extensions/jui/ResizableAsset.php index acf4c7341a..9097a8f63d 100644 --- a/extensions/jui/ResizableAsset.php +++ b/extensions/jui/ResizableAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/SelectableAsset.php b/extensions/jui/SelectableAsset.php index 61f405fe5a..b794756357 100644 --- a/extensions/jui/SelectableAsset.php +++ b/extensions/jui/SelectableAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/SliderAsset.php b/extensions/jui/SliderAsset.php index 56c245142f..fcba7766d6 100644 --- a/extensions/jui/SliderAsset.php +++ b/extensions/jui/SliderAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/SortableAsset.php b/extensions/jui/SortableAsset.php index 69c9ba371c..5f31f73447 100644 --- a/extensions/jui/SortableAsset.php +++ b/extensions/jui/SortableAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/SpinnerAsset.php b/extensions/jui/SpinnerAsset.php index 89a8c59ea6..04bc698bea 100644 --- a/extensions/jui/SpinnerAsset.php +++ b/extensions/jui/SpinnerAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/TabsAsset.php b/extensions/jui/TabsAsset.php index 5bef4c0d46..49b3bad10f 100644 --- a/extensions/jui/TabsAsset.php +++ b/extensions/jui/TabsAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/ThemeAsset.php b/extensions/jui/ThemeAsset.php index dedcb000ea..8c7e78e038 100644 --- a/extensions/jui/ThemeAsset.php +++ b/extensions/jui/ThemeAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/jui/TooltipAsset.php b/extensions/jui/TooltipAsset.php index 1fa4490c65..f0139a1c0c 100644 --- a/extensions/jui/TooltipAsset.php +++ b/extensions/jui/TooltipAsset.php @@ -6,6 +6,7 @@ */ namespace yii\jui; + use yii\web\AssetBundle; /** diff --git a/extensions/mongodb/ActiveQuery.php b/extensions/mongodb/ActiveQuery.php index 351f942c29..fabea5f742 100644 --- a/extensions/mongodb/ActiveQuery.php +++ b/extensions/mongodb/ActiveQuery.php @@ -111,7 +111,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $this->findWith($this->with, $models); } if (!$this->asArray) { - foreach($models as $model) { + foreach ($models as $model) { $model->afterFind(); } } @@ -172,4 +172,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface } return $db->getCollection($this->from); } -} \ No newline at end of file +} diff --git a/extensions/mongodb/ActiveRecord.php b/extensions/mongodb/ActiveRecord.php index fd48d0e59b..fdf73011e4 100644 --- a/extensions/mongodb/ActiveRecord.php +++ b/extensions/mongodb/ActiveRecord.php @@ -348,4 +348,4 @@ abstract class ActiveRecord extends BaseActiveRecord } return $this->collectionName() === $record->collectionName() && (string)$this->getPrimaryKey() === (string)$record->getPrimaryKey(); } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Cache.php b/extensions/mongodb/Cache.php index 3f4eaf7ca8..af016a51c2 100644 --- a/extensions/mongodb/Cache.php +++ b/extensions/mongodb/Cache.php @@ -199,4 +199,4 @@ class Cache extends \yii\caching\Cache ]); } } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Collection.php b/extensions/mongodb/Collection.php index 6f595f801c..43a3672f24 100644 --- a/extensions/mongodb/Collection.php +++ b/extensions/mongodb/Collection.php @@ -626,7 +626,8 @@ class Collection extends Object * @return array the highest scoring documents, in descending order by score. * @throws Exception on failure. */ - public function fullTextSearch($search, $condition = [], $fields = [], $options = []) { + public function fullTextSearch($search, $condition = [], $fields = [], $options = []) + { $command = [ 'search' => $search ]; @@ -931,4 +932,4 @@ class Collection extends Object } return [$column => $value]; } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Connection.php b/extensions/mongodb/Connection.php index e79bfcb949..11a0c1a4db 100644 --- a/extensions/mongodb/Connection.php +++ b/extensions/mongodb/Connection.php @@ -269,4 +269,4 @@ class Connection extends Component { $this->trigger(self::EVENT_AFTER_OPEN); } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Database.php b/extensions/mongodb/Database.php index 5c53e504c4..2ded6b376a 100644 --- a/extensions/mongodb/Database.php +++ b/extensions/mongodb/Database.php @@ -170,4 +170,4 @@ class Database extends Object throw new Exception('Unknown error, use "w=1" option to enable error tracking'); } } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Exception.php b/extensions/mongodb/Exception.php index 9e3a1480b5..a9385612b4 100644 --- a/extensions/mongodb/Exception.php +++ b/extensions/mongodb/Exception.php @@ -22,4 +22,4 @@ class Exception extends \yii\base\Exception { return 'MongoDB Exception'; } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Query.php b/extensions/mongodb/Query.php index 1ecea3999e..6594a5702b 100644 --- a/extensions/mongodb/Query.php +++ b/extensions/mongodb/Query.php @@ -343,4 +343,4 @@ class Query extends Component implements QueryInterface return $result; } } -} \ No newline at end of file +} diff --git a/extensions/mongodb/Session.php b/extensions/mongodb/Session.php index 9b630ccc65..efa78b6e49 100644 --- a/extensions/mongodb/Session.php +++ b/extensions/mongodb/Session.php @@ -187,4 +187,4 @@ class Session extends \yii\web\Session ->remove(['expire' => ['$lt' => time()]]); return true; } -} \ No newline at end of file +} diff --git a/extensions/mongodb/file/ActiveQuery.php b/extensions/mongodb/file/ActiveQuery.php index 79bcd2f831..d19043f8bb 100644 --- a/extensions/mongodb/file/ActiveQuery.php +++ b/extensions/mongodb/file/ActiveQuery.php @@ -56,7 +56,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $this->findWith($this->with, $models); } if (!$this->asArray) { - foreach($models as $model) { + foreach ($models as $model) { $model->afterFind(); } } @@ -117,4 +117,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface } return $db->getFileCollection($this->from); } -} \ No newline at end of file +} diff --git a/extensions/mongodb/file/Collection.php b/extensions/mongodb/file/Collection.php index 2efdef1408..c4083648eb 100644 --- a/extensions/mongodb/file/Collection.php +++ b/extensions/mongodb/file/Collection.php @@ -182,4 +182,4 @@ class Collection extends \yii\mongodb\Collection throw new Exception($e->getMessage(), (int)$e->getCode(), $e); } } -} \ No newline at end of file +} diff --git a/extensions/mongodb/file/Query.php b/extensions/mongodb/file/Query.php index 435dcc74f2..341113e2b2 100644 --- a/extensions/mongodb/file/Query.php +++ b/extensions/mongodb/file/Query.php @@ -72,4 +72,4 @@ class Query extends \yii\mongodb\Query } return $result; } -} \ No newline at end of file +} diff --git a/extensions/redis/ActiveQuery.php b/extensions/redis/ActiveQuery.php index df69be101b..54aec1f1bd 100644 --- a/extensions/redis/ActiveQuery.php +++ b/extensions/redis/ActiveQuery.php @@ -87,10 +87,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface // TODO add support for orderBy $data = $this->executeScript($db, 'All'); $rows = []; - foreach($data as $dataRow) { + foreach ($data as $dataRow) { $row = []; $c = count($dataRow); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { $row[$dataRow[$i++]] = $dataRow[$i++]; } $rows[] = $row; @@ -101,7 +101,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface $this->findWith($this->with, $models); } if (!$this->asArray) { - foreach($models as $model) { + foreach ($models as $model) { $model->afterFind(); } } @@ -128,7 +128,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface } $row = []; $c = count($data); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { $row[$data[$i++]] = $data[$i++]; } if ($this->asArray) { @@ -336,7 +336,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface if (count($this->where) == 1) { $pks = (array) reset($this->where); } else { - foreach($this->where as $values) { + foreach ($this->where as $values) { if (is_array($values)) { // TODO support composite IN for composite PK throw new NotSupportedException('Find by composite PK is not supported by redis ActiveRecord.'); @@ -357,7 +357,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface } $i = 0; $data = []; - foreach($pks as $pk) { + foreach ($pks as $pk) { if (++$i > $start && ($limit === null || $i <= $start + $limit)) { $key = $modelClass::keyPrefix() . ':a:' . $modelClass::buildKey($pk); $result = $db->executeCommand('HGETALL', [$key]); @@ -380,10 +380,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface return count($data); case 'Column': $column = []; - foreach($data as $dataRow) { + foreach ($data as $dataRow) { $row = []; $c = count($dataRow); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { $row[$dataRow[$i++]] = $dataRow[$i++]; } $column[] = $row[$columnName]; @@ -391,9 +391,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface return $column; case 'Sum': $sum = 0; - foreach($data as $dataRow) { + foreach ($data as $dataRow) { $c = count($dataRow); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { if ($dataRow[$i++] == $columnName) { $sum += $dataRow[$i]; break; @@ -404,10 +404,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface case 'Average': $sum = 0; $count = 0; - foreach($data as $dataRow) { + foreach ($data as $dataRow) { $count++; $c = count($dataRow); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { if ($dataRow[$i++] == $columnName) { $sum += $dataRow[$i]; break; @@ -417,9 +417,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface return $sum / $count; case 'Min': $min = null; - foreach($data as $dataRow) { + foreach ($data as $dataRow) { $c = count($dataRow); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { if ($dataRow[$i++] == $columnName && ($min == null || $dataRow[$i] < $min)) { $min = $dataRow[$i]; break; @@ -429,9 +429,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface return $min; case 'Max': $max = null; - foreach($data as $dataRow) { + foreach ($data as $dataRow) { $c = count($dataRow); - for($i = 0; $i < $c; ) { + for ($i = 0; $i < $c;) { if ($dataRow[$i++] == $columnName && ($max == null || $dataRow[$i] > $max)) { $max = $dataRow[$i]; break; diff --git a/extensions/redis/ActiveRecord.php b/extensions/redis/ActiveRecord.php index 34c9c05a9e..91af01f49e 100644 --- a/extensions/redis/ActiveRecord.php +++ b/extensions/redis/ActiveRecord.php @@ -139,7 +139,7 @@ class ActiveRecord extends BaseActiveRecord $key = static::keyPrefix() . ':a:' . static::buildKey($pk); // save attributes $args = [$key]; - foreach($values as $attribute => $value) { + foreach ($values as $attribute => $value) { $args[] = $attribute; $args[] = $value; } @@ -172,13 +172,13 @@ class ActiveRecord extends BaseActiveRecord } $db = static::getDb(); $n=0; - foreach(static::fetchPks($condition) as $pk) { + foreach (static::fetchPks($condition) as $pk) { $newPk = $pk; $pk = static::buildKey($pk); $key = static::keyPrefix() . ':a:' . $pk; // save attributes $args = [$key]; - foreach($attributes as $attribute => $value) { + foreach ($attributes as $attribute => $value) { if (isset($newPk[$attribute])) { $newPk[$attribute] = $value; } @@ -224,9 +224,9 @@ class ActiveRecord extends BaseActiveRecord } $db = static::getDb(); $n=0; - foreach(static::fetchPks($condition) as $pk) { + foreach (static::fetchPks($condition) as $pk) { $key = static::keyPrefix() . ':a:' . static::buildKey($pk); - foreach($counters as $attribute => $value) { + foreach ($counters as $attribute => $value) { $db->executeCommand('HINCRBY', [$key, $attribute, $value]); } $n++; @@ -254,7 +254,7 @@ class ActiveRecord extends BaseActiveRecord $attributeKeys = []; $pks = static::fetchPks($condition); $db->executeCommand('MULTI'); - foreach($pks as $pk) { + foreach ($pks as $pk) { $pk = static::buildKey($pk); $db->executeCommand('LREM', [static::keyPrefix(), 0, $pk]); $attributeKeys[] = static::keyPrefix() . ':a:' . $pk; @@ -276,9 +276,9 @@ class ActiveRecord extends BaseActiveRecord $primaryKey = static::primaryKey(); $pks = []; - foreach($records as $record) { + foreach ($records as $record) { $pk = []; - foreach($primaryKey as $key) { + foreach ($primaryKey as $key) { $pk[$key] = $record[$key]; } $pks[] = $pk; @@ -304,7 +304,7 @@ class ActiveRecord extends BaseActiveRecord } ksort($key); // ensure order is always the same $isNumeric = true; - foreach($key as $value) { + foreach ($key as $value) { if (!is_numeric($value)) { $isNumeric = false; } diff --git a/extensions/redis/Cache.php b/extensions/redis/Cache.php index 0722b9de70..18ac8d7aa6 100644 --- a/extensions/redis/Cache.php +++ b/extensions/redis/Cache.php @@ -78,7 +78,7 @@ class Cache extends \yii\caching\Cache parent::init(); if (is_string($this->redis)) { $this->redis = Yii::$app->getComponent($this->redis); - } else if (is_array($this->redis)) { + } elseif (is_array($this->redis)) { if (!isset($this->redis['class'])) { $this->redis['class'] = Connection::className(); } @@ -145,7 +145,7 @@ class Cache extends \yii\caching\Cache protected function setValues($data, $expire) { $args = []; - foreach($data as $key => $value) { + foreach ($data as $key => $value) { $args[] = $key; $args[] = $value; } @@ -164,7 +164,7 @@ class Cache extends \yii\caching\Cache } $result = $this->redis->executeCommand('EXEC'); array_shift($result); - foreach($result as $i => $r) { + foreach ($result as $i => $r) { if ($r != 1) { $failedKeys[] = $index[$i]; } diff --git a/extensions/redis/Connection.php b/extensions/redis/Connection.php index b8bbde2149..202f5382e1 100644 --- a/extensions/redis/Connection.php +++ b/extensions/redis/Connection.php @@ -254,7 +254,7 @@ class Connection extends Component ); if ($this->_socket) { if ($this->dataTimeout !== null) { - stream_set_timeout($this->_socket, $timeout=(int)$this->dataTimeout, (int) (($this->dataTimeout - $timeout) * 1000000)); + stream_set_timeout($this->_socket, $timeout = (int)$this->dataTimeout, (int) (($this->dataTimeout - $timeout) * 1000000)); } if ($this->password !== null) { $this->executeCommand('AUTH', [$this->password]); @@ -345,13 +345,13 @@ class Connection extends Component * for details on the mentioned reply types. * @trows Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply). */ - public function executeCommand($name, $params=[]) + public function executeCommand($name, $params = []) { $this->open(); array_unshift($params, $name); $command = '*' . count($params) . "\r\n"; - foreach($params as $arg) { + foreach ($params as $arg) { $command .= '$' . mb_strlen($arg, '8bit') . "\r\n" . $arg . "\r\n"; } diff --git a/extensions/redis/LuaScriptBuilder.php b/extensions/redis/LuaScriptBuilder.php index 80a67d87ae..9fd483ef0f 100644 --- a/extensions/redis/LuaScriptBuilder.php +++ b/extensions/redis/LuaScriptBuilder.php @@ -156,7 +156,7 @@ class LuaScriptBuilder extends \yii\base\Object $modelClass = $query->modelClass; $key = $this->quoteValue($modelClass::keyPrefix()); $loadColumnValues = ''; - foreach($columns as $column => $alias) { + foreach ($columns as $column => $alias) { $loadColumnValues .= "local $alias=redis.call('HGET',$key .. ':a:' .. pk, '$column')\n"; } diff --git a/extensions/redis/Session.php b/extensions/redis/Session.php index 04e9074f4b..a9c3bdd29c 100644 --- a/extensions/redis/Session.php +++ b/extensions/redis/Session.php @@ -81,7 +81,7 @@ class Session extends \yii\web\Session { if (is_string($this->redis)) { $this->redis = Yii::$app->getComponent($this->redis); - } else if (is_array($this->redis)) { + } elseif (is_array($this->redis)) { if (!isset($this->redis['class'])) { $this->redis['class'] = Connection::className(); } diff --git a/extensions/sphinx/ActiveQuery.php b/extensions/sphinx/ActiveQuery.php index db5609084b..42391f97ae 100644 --- a/extensions/sphinx/ActiveQuery.php +++ b/extensions/sphinx/ActiveQuery.php @@ -135,7 +135,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } $models = $this->fillUpSnippets($models); if (!$this->asArray) { - foreach($models as $model) { + foreach ($models as $model) { $model->afterFind(); } } diff --git a/extensions/sphinx/ColumnSchema.php b/extensions/sphinx/ColumnSchema.php index 5edca8504a..a7736f772f 100644 --- a/extensions/sphinx/ColumnSchema.php +++ b/extensions/sphinx/ColumnSchema.php @@ -78,4 +78,4 @@ class ColumnSchema extends Object } return $value; } -} \ No newline at end of file +} diff --git a/extensions/sphinx/Connection.php b/extensions/sphinx/Connection.php index b732d97daf..c9c67ab664 100644 --- a/extensions/sphinx/Connection.php +++ b/extensions/sphinx/Connection.php @@ -6,6 +6,7 @@ */ namespace yii\sphinx; + use yii\base\NotSupportedException; /** diff --git a/extensions/sphinx/IndexSchema.php b/extensions/sphinx/IndexSchema.php index b93a8f0c7b..4e61219578 100644 --- a/extensions/sphinx/IndexSchema.php +++ b/extensions/sphinx/IndexSchema.php @@ -59,4 +59,4 @@ class IndexSchema extends Object { return array_keys($this->columns); } -} \ No newline at end of file +} diff --git a/extensions/sphinx/QueryBuilder.php b/extensions/sphinx/QueryBuilder.php index 8e1d5c4e57..6f99bc8d2a 100644 --- a/extensions/sphinx/QueryBuilder.php +++ b/extensions/sphinx/QueryBuilder.php @@ -422,7 +422,7 @@ class QueryBuilder extends Object if (strpos($column, '(') === false) { $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) { if (preg_match('/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/', $column, $matches)) { $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 * @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) { return 'NULL'; } elseif ($value instanceof Expression) { diff --git a/extensions/sphinx/Schema.php b/extensions/sphinx/Schema.php index c583d2f539..81a7a57e38 100644 --- a/extensions/sphinx/Schema.php +++ b/extensions/sphinx/Schema.php @@ -486,4 +486,4 @@ class Schema extends Object return $column; } -} \ No newline at end of file +} diff --git a/extensions/twig/TwigSimpleFileLoader.php b/extensions/twig/TwigSimpleFileLoader.php index 281d465b0e..4449f0aa9c 100644 --- a/extensions/twig/TwigSimpleFileLoader.php +++ b/extensions/twig/TwigSimpleFileLoader.php @@ -68,7 +68,8 @@ class TwigSimpleFileLoader implements \Twig_LoaderInterface * @param string $name file name * @return string absolute path of file */ - protected function getFilePath($name){ + protected function getFilePath($name) + { return $this->_dir . '/' . $name; } -} \ No newline at end of file +} diff --git a/extensions/twig/ViewRenderer.php b/extensions/twig/ViewRenderer.php index 5792806b61..5420a24b84 100644 --- a/extensions/twig/ViewRenderer.php +++ b/extensions/twig/ViewRenderer.php @@ -33,33 +33,33 @@ class ViewRenderer extends BaseViewRenderer * @see http://twig.sensiolabs.org/doc/api.html#environment-options */ public $options = []; - /** + /** * @var array Objects or static classes. * Keys of the array are names to call in template, values are objects or names of static classes. * Example: `['html' => '\yii\helpers\Html']`. * In the template you can use it like this: `{{ html.a('Login', 'site/login') | raw }}`. */ - public $globals = []; - /** + public $globals = []; + /** * @var array Custom functions. * Keys of the array are names to call in template, values are names of functions or static methods of some class. * Example: `['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a']`. * In the template you can use it like this: `{{ rot13('test') }}` or `{{ a('Login', 'site/login') | raw }}`. */ - public $functions = []; - /** + public $functions = []; + /** * @var array Custom filters. * Keys of the array are names to call in template, values are names of functions or static methods of some class. * Example: `['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']`. * In the template you can use it like this: `{{ 'test'|rot13 }}` or `{{ model|jsonEncode }}`. */ - public $filters = []; - /** + public $filters = []; + /** * @var array Custom extensions. * Example: `['Twig_Extension_Sandbox', 'Twig_Extension_Text']` */ - public $extensions = []; - /** + public $extensions = []; + /** * @var array Twig lexer options. * Example: Smarty-like syntax: * ```php @@ -71,8 +71,8 @@ class ViewRenderer extends BaseViewRenderer * ``` * @see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax */ - public $lexerOptions = []; - /** + public $lexerOptions = []; + /** * @var \Twig_Environment twig environment object that do all rendering twig templates */ public $twig; @@ -118,7 +118,7 @@ class ViewRenderer extends BaseViewRenderer } // Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}}) - $this->twig->addFunction('void', new \Twig_Function_Function(function($argument){ + $this->twig->addFunction('void', new \Twig_Function_Function(function ($argument) { })); $this->twig->addFunction('path', new \Twig_Function_Function(function ($path, $args = []) { diff --git a/extensions/twig/ViewRendererStaticClassProxy.php b/extensions/twig/ViewRendererStaticClassProxy.php index 3823ce0a07..25216e0424 100644 --- a/extensions/twig/ViewRendererStaticClassProxy.php +++ b/extensions/twig/ViewRendererStaticClassProxy.php @@ -19,7 +19,8 @@ class ViewRendererStaticClassProxy { private $_staticClassName; - public function __construct($staticClassName) { + public function __construct($staticClassName) + { $this->_staticClassName = $staticClassName; } @@ -40,4 +41,4 @@ class ViewRendererStaticClassProxy { return call_user_func_array(array($this->_staticClassName, $method), $arguments); } -} \ No newline at end of file +}