Commit 83b80027 by Qiang Xue

Merge branch 'master' of git://github.com/yiisoft/yii2

parents a0d19e92 77368538
......@@ -9,6 +9,7 @@ namespace yii\build\controllers;
use Yii;
use yii\console\Controller;
use yii\helpers\Console;
use yii\helpers\VarDumper;
/**
......@@ -33,7 +34,10 @@ class MimeTypeController extends Controller
if ($outFile === null) {
$outFile = Yii::getAlias('@yii/helpers/mimeTypes.php');
}
$this->stdout('downloading mime-type file from apache httpd repository...');
if ($content = file_get_contents('http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co')) {
$this->stdout("done.\n", Console::FG_GREEN);
$this->stdout("generating file $outFile...");
$mimeMap = [];
foreach(explode("\n", $content) as $line) {
$line = trim($line);
......@@ -65,6 +69,7 @@ return $array;
EOD;
file_put_contents($outFile, $content);
$this->stdout("done.\n", Console::FG_GREEN);
} else {
$this->stderr("Failed to download mime.types file from apache SVN.\n");
}
......
......@@ -85,6 +85,7 @@ class PhpDocController extends Controller
$this->fixFileDoc($lines);
$this->fixDocBlockIndentation($lines);
$lines = array_values($this->fixLineSpacing($lines));
$newContent = implode("\n", $lines);
if ($sha !== sha1($newContent)) {
......@@ -163,6 +164,9 @@ class PhpDocController extends Controller
return FileHelper::findFiles($root, $options);
}
/**
* Fix file PHPdoc
*/
protected function fixFileDoc(&$lines)
{
// find namespace
......@@ -170,12 +174,15 @@ class PhpDocController extends Controller
$namespaceLine = '';
$contentAfterNamespace = false;
foreach($lines as $i => $line) {
if (substr_compare(trim($line), 'namespace', 0, 9) === 0) {
$namespace = $i;
$namespaceLine = trim($line);
} elseif ($namespace !== false && trim($line) !== '') {
$contentAfterNamespace = $i;
break;
$line = trim($line);
if (!empty($line)) {
if (strncmp($line, 'namespace', 9) === 0) {
$namespace = $i;
$namespaceLine = $line;
} elseif ($namespace !== false) {
$contentAfterNamespace = $i;
break;
}
}
}
......@@ -254,6 +261,116 @@ class PhpDocController extends Controller
}
}
/**
* Fixes line spacing code style for properties and constants
*/
protected function fixLineSpacing($lines)
{
$propertiesOnly = false;
// remove blank lines between properties
$skip = true;
foreach($lines as $i => $line) {
if (strpos($line, 'class ') !== false) {
$skip = false;
}
if ($skip) {
continue;
}
if (trim($line) === '') {
unset($lines[$i]);
} elseif (ltrim($line)[0] !== '*' && strpos($line, 'function ') !== false) {
break;
} elseif (trim($line) === '}') {
$propertiesOnly = true;
break;
}
}
$lines = array_values($lines);
// add back some
$endofUse = false;
$endofConst = false;
$endofPublic = false;
$endofProtected = false;
$endofPrivate = false;
$skip = true;
$level = 0; // track array properties
$property = '';
foreach($lines as $i => $line) {
if (strpos($line, 'class ') !== false) {
$skip = false;
}
if ($skip) {
continue;
}
// check for multi line array
if ($level > 0) {
${'endof'.$property} = $i;
}
$line = trim($line);
if (strncmp($line, 'public $', 8) === 0 || strncmp($line, 'public static $', 15) === 0) {
$endofPublic = $i;
$property = 'Public';
$level = 0;
} elseif (strncmp($line, 'protected $', 11) === 0 || strncmp($line, 'protected static $', 18) === 0) {
$endofProtected = $i;
$property = 'Protected';
$level = 0;
} elseif (strncmp($line, 'private $', 9) === 0 || strncmp($line, 'private static $', 16) === 0) {
$endofPrivate = $i;
$property = 'Private';
$level = 0;
} elseif (substr($line,0 , 6) === 'const ') {
$endofConst = $i;
$property = false;
} elseif (substr($line,0 , 4) === 'use ') {
$endofUse = $i;
$property = false;
} elseif (!empty($line) && $line[0] === '*') {
$property = false;
} elseif (!empty($line) && $line[0] !== '*' && strpos($line, 'function ') !== false || $line === '}') {
break;
}
// check for multi line array
if ($property !== false && strncmp($line, "'SQLSTATE[", 10) !== 0) {
$level += substr_count($line, '[') - substr_count($line, ']');
}
}
$endofAll = false;
foreach(['Private', 'Protected', 'Public', 'Const', 'Use'] as $var) {
if (${'endof'.$var} !== false) {
$endofAll = ${'endof'.$var};
break;
}
}
// $this->checkPropertyOrder($lineInfo);
$result = [];
foreach($lines as $i => $line) {
$result[] = $line;
if (!($propertiesOnly && $i === $endofAll)) {
if ($i === $endofUse || $i === $endofConst || $i === $endofPublic ||
$i === $endofProtected || $i === $endofPrivate) {
$result[] = '';
}
if ($i === $endofAll) {
$result[] = '';
}
}
}
return $result;
}
protected function checkPropertyOrder($lineInfo)
{
// TODO
}
protected function updateClassPropertyDocs($file, $className, $propertyDoc)
{
$ref = new \ReflectionClass($className);
......@@ -275,13 +392,15 @@ class PhpDocController extends Controller
// TODO move these checks to different action
$lines = explode("\n", $newDoc);
if (trim($lines[1]) == '*' || substr_compare(trim($lines[1]), '* @', 0, 3) === 0) {
$firstLine = trim($lines[1]);
if ($firstLine === '*' || strncmp($firstLine, '* @', 3) === 0) {
$this->stderr("[WARN] Class $className has no short description.\n", Console::FG_YELLOW, Console::BOLD);
}
foreach ($lines as $line) {
if (substr_compare(trim($line), '* @since ', 0, 9) === 0) {
$line = trim($line);
if (strncmp($line, '* @since ', 9) === 0) {
$seenSince = true;
} elseif (substr_compare(trim($line), '* @author ', 0, 10) === 0) {
} elseif (strncmp($line, '* @author ', 10) === 0) {
$seenAuthor = true;
}
}
......@@ -350,13 +469,14 @@ class PhpDocController extends Controller
$propertyPart = false;
$propertyPosition = false;
foreach ($lines as $i => $line) {
if (substr_compare(trim($line), '* @property ', 0, 12) === 0) {
$line = trim($line);
if (strncmp($line, '* @property ', 12) === 0) {
$propertyPart = true;
} elseif ($propertyPart && trim($line) == '*') {
} elseif ($propertyPart && $line == '*') {
$propertyPosition = $i;
$propertyPart = false;
}
if (substr_compare(trim($line), '* @author ', 0, 10) === 0 && $propertyPosition === false) {
if (strncmp($line, '* @author ', 10) === 0 && $propertyPosition === false) {
$propertyPosition = $i - 1;
$propertyPart = false;
}
......
......@@ -20,7 +20,7 @@ All Rights Reserved.
* [Встановлення Yii](start-installation.md)
* [Запуск додатка](start-workflow.md)
* [Говоримо «привіт»](start-hello.md)
* [Говоримо «Привіт»](start-hello.md)
* [Робота з формами](start-forms.md)
* [Робота з базами даних](start-databases.md)
* [Генерація коду за допомогою Gii](start-gii.md)
......
Запуск додатка
====================
Після встановлення Yii, базовий додаток буде доступний або по URL `http://hostname/basic/web/index.php`, або по `http://hostname/index.php`, в залежності від налаштування Web сервера. Даний розділ - загальне введення в організацію коду, вбудований функціонал і опрацювання звернень додатком Yii.
> Інформація: Далі, в даному посібнику передбачається що Yii встановлений в теку `basic/web`, яка, в свою чергу, встановлена як коренева директорія в налаштуваннях Web сервера. В результаті, звернувшись по URL `http://hostname/index.php` ви отримаєте доступ до додатку, розміщенному в `basic/web`. Детальніше з процесом початкового налаштування можна ознайомитись в розділі [Встановлення Yii](start-installation.md).
Функціонал <a name="functionality"></a>
---------------
Вбудований шаблон простого додатку складається з чотирьох сторінок:
* домашня сторінка, відображається при переході по URL `http://hostname/index.php`
* "About" ("Про нас")
* на сторінці "Contact" знаходиться форма зворотнього зв’язку, на якій користувач може звернутися до розробника по e-mail
* на сторінці "Login" відображається форма авторизації. Спробуйте авторизуватись з логіном/паролем "admin/admin". Зверніть увагу на зміну розділу "Login" в головному меню на "Logout".
Ці сторінки використовують суміжний хедер (шапка сайта) і футер (підвал). В "шапці" знаходиться головне меню, за допомогою якого користувач переміщається по сайту. В "підвалі" - копірайт і загальна інформація.
В самій верхній частині вікна ви будете бачити системні повідомлення Yii - журнал, відлагоджувальну інформацію, повідомлення про помилки, запити до бази даних і т.п. Відображенням данної інформацію керує [вбудований відладчик](tool-debugger.md), він записує і відображає інформацію про хід виконання додатку.
Структура додатка Yii <a name="application-structure"></a>
---------------------
Нижще наведений перелік основних директорій і файлів вашого додатку (вважаєм, що додаток встановлений в директорію `basic`):
```
basic/ кореневий каталог додатка
composer.json використовується Composer'ом, містить опис додатку
config/ конфігураційні файли
console.php конфігурація консольного додатка
web.php конфігурація Web додатка
commands/ містить класи консольних команд
controllers/ контролери
models/ моделі
runtime/ файли, які генерує Yii під час виконання додатку (логи, кеш і т.п.)
vendor/ містить пакунки Composer'а і, власне, сам фреймворк Yii
views/ представлення додатку
web/ коренева директорія Web додатку. Містить файли, доступні через Web
assets/ скрипти, які використовуються додатком (js, css)
index.php місце входження в додаток Yii. З нього розпочинається виконання додатку
yii скрипт виконання консольного додатку Yii
```
В цілому, додаток Yii можна розділити на дві категорії файлів: розміщенні в `basic/web` і розміщенні в інших директоріях. Перша категорія доступна через Web (наприклад, браузером), друга недоступна зовні та і не повинна бути так як містить службову інформацію.
В Yii реалізована схема проектування [модель-представлення-контролер (MVC)](http://http://uk.wikipedia.org/wiki/Model-View-Controller),
яка відповідає структурі директорій додатка. В директорії `models` знаходяться [Моделі](structure-models.md),
в `views` розміщені [Представлення](structure-views.md), а в каталозі `controllers` всі [Контролери](structure-controllers.md) додатка.
Діаграма нижче демонструє внутрішню будову додатка.
![внутрішня будова додатка](../guide/images/application-structure.png)
В кожному додатку Yii є місце входження в додаток, `web/index.php` це єдиний PHP-скрипт доступний для виконання через Web. Він отримує вхідний запит і створює екземпляр [додатку](structure-applications.md).
[Додаток](structure-applications.md) опрацьовує вхідні запити з допомогою [компонентів](concept-components.md) і відправляє запит контролеру. [Віджети](structure-widgets.md) використовуються у [Представленнях](structure-views.md) для побудови динамічних інтерфейсів сайта.
Життєвий цикл запиту користувача <a name="request-lifecycle"></a>
-----------------
На діаграмі показано як додаток опрацьовує запит.
![Життєвий цикл запиту](../guide/images/application-lifecycle.png)
1. Користувач звертається до [місця входження](structure-entry-scripts.md) `web/index.php`.
2. Скрипт завантажує конфігурацію [configuration](concept-configurations.md) і створює екземпляр [додатку](structure-applications.md) для наступного опрацювання запиту.
3. Додаток визначає [маршрут](runtime-routing.md) запиту за допомогою компонента додатка [запит](runtime-requests.md).
4. Додаток створює екземпляр [контролера](structure-controllers.md) для виконання запиту.
5. Контролер, в свою чергу, створює [подію](structure-controllers.md) і накладає на неї фільтри.
6. Якщо хоч один фільтр поверне помилку - виконання додатку зупиняється.
7. Якщо всі фільтри пройдені - додаток виконується.
8. Подія завантажує модель даних. Скоріше за все із бази даних.
9. Подія генерує представлення, відображаючи в ньому дані (в т.ч. і отримані із моделі).
10. Згенерований вид додатку передається як компонент [відповідь](runtime-responses.md).
11. Компонент "відповідь" відправляє готовий результат роботи додатку браузеру користувача.
......@@ -151,7 +151,7 @@ For example,
During the bootstrapping process, each component will be instantiated. If the component class
implements [[yii\base\BootstrapInterface]], its [[yii\base\BootstrapInterface::bootstrap()|bootstrap()]] method
will be also be called.
will also be called.
Another practical example is in the application configuration for the [Basic Application Template](start-installation.md),
where the `debug` and `gii` modules are configured as bootstrapping components when the application is running
......@@ -391,11 +391,11 @@ does not specify one. The route may consist of child module ID, controller ID, a
For example, `help`, `post/create`, `admin/post/create`. If action ID is not given, it will take the default
value as specified in [[yii\base\Controller::defaultAction]].
For [yii\web\Application|Web applications], the default value of this property is `'site'`, which means
For [[yii\web\Application|Web applications]], the default value of this property is `'site'`, which means
the `SiteController` controller and its default action should be used. As a result, if you access
the application without specifying a route, it will show the result of `app\controllers\SiteController::actionIndex()`.
For [yii\console\Application|console applications], the default value is `'help'`, which means the core command
For [[yii\console\Application|console applications]], the default value is `'help'`, which means the core command
[[yii\console\controllers\HelpController::actionIndex()]] should be used. As a result, if you run the command `yii`
without providing any arguments, it will display the help information.
......@@ -556,7 +556,7 @@ For example,
```
Note that the same `beforeAction` event is also triggered by [modules](structure-modules.md)
and [controllers)(structure-controllers.md). Application objects are the first ones
and [controllers](structure-controllers.md). Application objects are the first ones
triggering this event, followed by modules (if any), and finally controllers. If an event handler
sets [[yii\base\ActionEvent::isValid]] to be `false`, all the following events will NOT be triggered.
......@@ -582,7 +582,7 @@ For example,
```
Note that the same `afterAction` event is also triggered by [modules](structure-modules.md)
and [controllers)(structure-controllers.md). These objects trigger this event in the reverse order
and [controllers](structure-controllers.md). These objects trigger this event in the reverse order
as for that of `beforeAction`. That is, controllers are the first objects triggering this event,
followed by modules (if any), and finally applications.
......
......@@ -28,8 +28,8 @@ class ApiController extends BaseController
*/
public $guide;
// TODO add force update option
// TODO add force update option
/**
* Renders API documentation files
* @param array $sourceDirs
......
......@@ -28,6 +28,7 @@ class GuideController extends BaseController
*/
public $apiDocs;
/**
* Renders API documentation files
* @param array $sourceDirs
......
......@@ -30,6 +30,7 @@ abstract class BaseController extends Controller
*/
public $exclude;
protected function normalizeTargetDir($target)
{
$target = rtrim(Yii::getAlias($target), '\\/');
......
<?php
/**
*
*
* @author Carsten Brandt <mail@cebe.cc>
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\apidoc\helpers;
use cebe\jssearch\Indexer;
use cebe\jssearch\tokenizer\StandardTokenizer;
use cebe\jssearch\TokenizerInterface;
......
......@@ -31,6 +31,7 @@ class ApiMarkdown extends GithubMarkdown
protected $renderingContext;
/**
* Renders a code block
*/
......
......@@ -29,6 +29,7 @@ class ApiMarkdownLaTeX extends GithubMarkdown
protected $renderingContext;
protected function inlineMarkers()
{
return array_merge(parent::inlineMarkers(), [
......
......@@ -17,6 +17,7 @@ class IndexFileAnalyzer extends Markdown
private $_chapter = 0;
private $_chapters = [];
public function analyze($text)
{
$this->parse($text);
......
......@@ -24,24 +24,21 @@ class BaseDoc extends Object
* @var \phpDocumentor\Reflection\DocBlock\Context
*/
public $phpDocContext;
public $name;
public $sourceFile;
public $startLine;
public $endLine;
public $shortDescription;
public $description;
public $since;
public $deprecatedSince;
public $deprecatedReason;
/**
* @var \phpDocumentor\Reflection\DocBlock\Tag[]
*/
public $tags = [];
public function hasTag($name)
{
foreach ($this->tags as $tag) {
......
......@@ -18,10 +18,8 @@ namespace yii\apidoc\models;
class ClassDoc extends TypeDoc
{
public $parentClass;
public $isAbstract;
public $isFinal;
/**
* @var string[]
*/
......@@ -29,7 +27,6 @@ class ClassDoc extends TypeDoc
public $traits = [];
// will be set by Context::updateReferences()
public $subclasses = [];
/**
* @var EventDoc[]
*/
......@@ -39,6 +36,7 @@ class ClassDoc extends TypeDoc
*/
public $constants = [];
public function findSubject($subjectName)
{
if (($subject = parent::findSubject($subjectName)) !== null) {
......
......@@ -18,6 +18,7 @@ class ConstDoc extends BaseDoc
public $definedBy;
public $value;
/**
* @param \phpDocumentor\Reflection\ClassReflector\ConstantReflector $reflector
* @param Context $context
......
......@@ -33,9 +33,9 @@ class Context extends Component
* @var TraitDoc[]
*/
public $traits = [];
public $errors = [];
public function getType($type)
{
$type = ltrim($type, '\\');
......
......@@ -20,6 +20,7 @@ class EventDoc extends ConstDoc
public $type;
public $types;
/**
* @param \phpDocumentor\Reflection\ClassReflector\ConstantReflector $reflector
* @param Context $context
......
......@@ -30,6 +30,7 @@ class FunctionDoc extends BaseDoc
public $returnTypes;
public $isReturnByReference;
/**
* @param \phpDocumentor\Reflection\FunctionReflector $reflector
* @param Context $context
......
......@@ -16,10 +16,10 @@ namespace yii\apidoc\models;
class InterfaceDoc extends TypeDoc
{
public $parentInterfaces = [];
// will be set by Context::updateReferences()
public $implementedBy = [];
/**
* @param \phpDocumentor\Reflection\InterfaceReflector $reflector
* @param Context $context
......
......@@ -17,14 +17,12 @@ class MethodDoc extends FunctionDoc
{
public $isAbstract;
public $isFinal;
public $isStatic;
public $visibility;
// will be set by creating class
public $definedBy;
/**
* @param \phpDocumentor\Reflection\ClassReflector\MethodReflector $reflector
* @param Context $context
......
......@@ -23,13 +23,13 @@ class ParamDoc extends Object
public $isOptional;
public $defaultValue;
public $isPassedByReference;
// will be set by creating class
public $description;
public $type;
public $types;
public $sourceFile;
/**
* @param \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $reflector
* @param Context $context
......
......@@ -20,18 +20,16 @@ class PropertyDoc extends BaseDoc
{
public $visibility;
public $isStatic;
public $type;
public $types;
public $defaultValue;
// will be set by creating class
public $getter;
public $setter;
// will be set by creating class
public $definedBy;
public function getIsReadOnly()
{
return $this->getter !== null && $this->setter === null;
......
......@@ -18,9 +18,9 @@ class TraitDoc extends TypeDoc
// classes using the trait
// will be set by Context::updateReferences()
public $usedBy = [];
public $traits = [];
/**
* @param \phpDocumentor\Reflection\TraitReflector $reflector
* @param Context $context
......
......@@ -34,9 +34,9 @@ class TypeDoc extends BaseDoc
* @var PropertyDoc[]
*/
public $properties = [];
public $namespace;
public function findSubject($subjectName)
{
if ($subjectName[0] != '$') {
......@@ -46,7 +46,7 @@ class TypeDoc extends BaseDoc
}
}
}
if (substr_compare($subjectName, '()', -2, 2) === 0) {
if (!empty($subjectName) && substr_compare($subjectName, '()', -2, 2) === 0) {
return null;
}
if ($this->properties === null) {
......
......@@ -42,10 +42,10 @@ abstract class BaseRenderer extends Component
* @var Controller the apidoc controller instance. Can be used to control output.
*/
public $controller;
public $guideUrl;
public $guideReferences = [];
public function init()
{
ApiMarkdown::$renderer = $this;
......@@ -72,7 +72,7 @@ abstract class BaseRenderer extends Component
foreach ($types as $type) {
$postfix = '';
if (is_string($type)) {
if (substr_compare($type, '[]', -2, 2) === 0) {
if (!empty($type) && substr_compare($type, '[]', -2, 2) === 0) {
$postfix = '[]';
$type = substr($type, 0, -2);
}
......
......@@ -24,6 +24,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
public $layout = '@yii/apidoc/templates/bootstrap/layouts/api.php';
public $indexView = '@yii/apidoc/templates/bootstrap/views/index.php';
/**
* @inheritdoc
*/
......
......@@ -23,6 +23,7 @@ class GuideRenderer extends \yii\apidoc\templates\html\GuideRenderer
public $layout = '@yii/apidoc/templates/bootstrap/layouts/guide.php';
/**
* @inheritDoc
*/
......
......@@ -78,6 +78,7 @@ class SideNavWidget extends \yii\bootstrap\Widget
*/
public $activeUrl;
/**
* Initializes the widget.
*/
......
......@@ -46,12 +46,14 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
* @var string path or alias of the view file to use for rendering the index page.
*/
public $indexView = '@yii/apidoc/templates/html/views/index.php';
/**
* @var View
*/
private $_view;
private $_targetDir;
public function init()
{
parent::init();
......
......@@ -34,6 +34,7 @@ abstract class GuideRenderer extends BaseGuideRenderer
private $_view;
private $_targetDir;
public function init()
{
parent::init();
......
......@@ -23,10 +23,12 @@ if (empty($see)) {
} else {
echo '<p>See also:</p><ul>';
foreach ($see as $ref) {
if (substr_compare($ref, '>', -1, 1)) {
$ref .= '.';
if (!empty($ref)) {
if (substr_compare($ref, '>', -1, 1)) {
$ref .= '.';
}
echo "<li>$ref</li>";
}
echo "<li>$ref</li>";
}
echo '</ul>';
}
......@@ -20,9 +20,9 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
{
public $layout = false;
public $indexView = '@yii/apidoc/templates/online/views/index.php';
public $pageTitle = 'Yii Framework 2.0 API Documentation';
/**
* @inheritdoc
*/
......
......@@ -93,6 +93,8 @@ class AuthAction extends Action
* @var string the redirect url after unsuccessful authorization (e.g. user canceled).
*/
private $_cancelUrl = '';
/**
* @var string name or alias of the view file, which should be rendered in order to perform redirection.
* If not set default one will be used.
......
......@@ -58,6 +58,7 @@ abstract class BaseClient extends Component implements ClientInterface
*/
private $_viewOptions;
/**
* @param string $id service id.
*/
......
......@@ -39,12 +39,6 @@ abstract class BaseOAuth extends BaseClient implements ClientInterface
*/
public $version = '1.0';
/**
* @var string URL, which user will be redirected after authentication at the OAuth provider web site.
* Note: this should be absolute URL (with http:// or https:// leading).
* By default current URL will be used.
*/
private $_returnUrl;
/**
* @var string API base URL.
*/
public $apiBaseUrl;
......@@ -56,6 +50,13 @@ abstract class BaseOAuth extends BaseClient implements ClientInterface
* @var string auth request scope.
*/
public $scope;
/**
* @var string URL, which user will be redirected after authentication at the OAuth provider web site.
* Note: this should be absolute URL (with http:// or https:// leading).
* By default current URL will be used.
*/
private $_returnUrl;
/**
* @var array cURL request options. Option values from this field will overwrite corresponding
* values from [[defaultCurlOptions()]].
......@@ -70,6 +71,7 @@ abstract class BaseOAuth extends BaseClient implements ClientInterface
*/
private $_signatureMethod = [];
/**
* @param string $returnUrl return URL
*/
......
......@@ -47,6 +47,7 @@ class Collection extends Component
*/
private $_clients = [];
/**
* @param array $clients list of auth clients
*/
......
......@@ -26,6 +26,7 @@ class InvalidResponseException extends Exception
*/
public $responseBody = '';
/**
* Constructor.
* @param array $responseHeaders response headers
......
......@@ -62,6 +62,7 @@ class OAuth1 extends BaseOAuth
*/
public $accessTokenMethod = 'GET';
/**
* Fetches the OAuth request token.
* @param array $params additional request params.
......
......@@ -50,6 +50,7 @@ class OAuth2 extends BaseOAuth
*/
public $tokenUrl;
/**
* Composes user authorization URL.
* @param array $params additional auth GET params.
......
......@@ -43,6 +43,8 @@ class OAuthToken extends Object
* @var array token parameters.
*/
private $_params = [];
/**
* @var integer object creation timestamp.
*/
......
......@@ -68,7 +68,6 @@ class OpenId extends BaseClient implements ClientInterface
* ~~~
*/
public $optionalAttributes = [];
/**
* @var boolean whether to verify the peer's certificate.
*/
......@@ -83,7 +82,6 @@ class OpenId extends BaseClient implements ClientInterface
* This value will take effect only if [[verifyPeer]] is set.
*/
public $cainfo;
/**
* @var string authentication return URL.
*/
......@@ -96,6 +94,8 @@ class OpenId extends BaseClient implements ClientInterface
* @var string client trust root (realm), by default [[\yii\web\Request::hostInfo]] value will be used.
*/
private $_trustRoot;
/**
* @var array data, which should be used to retrieve the OpenID response.
* If not set combination of GET and POST will be used.
......@@ -761,7 +761,7 @@ class OpenId extends BaseClient implements ClientInterface
} else {
// 'ax' prefix is either undefined, or points to another extension, so we search for another prefix
foreach ($this->data as $key => $value) {
if (substr_compare($key, 'openid_ns_', 0, 10) === 0 && $value == 'http://openid.net/srv/ax/1.0') {
if (strncmp($key, 'openid_ns_', 10) === 0 && $value == 'http://openid.net/srv/ax/1.0') {
$alias = substr($key, strlen('openid_ns_'));
break;
}
......@@ -775,7 +775,7 @@ class OpenId extends BaseClient implements ClientInterface
$attributes = [];
foreach ($this->data as $key => $value) {
$keyMatch = 'openid_' . $alias . '_value_';
if (substr_compare($key, $keyMatch, 0, strlen($keyMatch))) {
if (strncmp($key, $keyMatch, strlen($keyMatch))) {
continue;
}
$key = substr($key, strlen($keyMatch));
......@@ -802,7 +802,7 @@ class OpenId extends BaseClient implements ClientInterface
$sregToAx = array_flip($this->axToSregMap);
foreach ($this->data as $key => $value) {
$keyMatch = 'openid_sreg_';
if (substr_compare($key, $keyMatch, 0, strlen($keyMatch))) {
if (strncmp($key, $keyMatch, strlen($keyMatch))) {
continue;
}
$key = substr($key, strlen($keyMatch));
......
......@@ -57,6 +57,7 @@ class Facebook extends OAuth2
*/
public $scope = 'email';
/**
* @inheritdoc
*/
......
......@@ -53,6 +53,7 @@ class GitHub extends OAuth2
*/
public $apiBaseUrl = 'https://api.github.com';
/**
* @inheritdoc
*/
......
......@@ -55,6 +55,7 @@ class GoogleOAuth extends OAuth2
*/
public $apiBaseUrl = 'https://www.googleapis.com/plus/v1';
/**
* @inheritdoc
*/
......
......@@ -48,6 +48,7 @@ class GoogleOpenId extends OpenId
'pref/language',
];
/**
* @inheritdoc
*/
......
......@@ -56,6 +56,7 @@ class LinkedIn extends OAuth2
*/
public $apiBaseUrl = 'https://api.linkedin.com/v1';
/**
* @inheritdoc
*/
......
......@@ -53,6 +53,7 @@ class Live extends OAuth2
*/
public $apiBaseUrl = 'https://apis.live.net/v5.0';
/**
* @inheritdoc
*/
......
......@@ -65,6 +65,7 @@ class Twitter extends OAuth1
*/
public $apiBaseUrl = 'https://api.twitter.com/1.1';
/**
* @inheritdoc
*/
......
......@@ -14,7 +14,6 @@ use yii\authclient\OAuth2;
*
* In order to use VKontakte OAuth you must register your application at <http://vk.com/editapp?act=create>.
*
*
* Example application configuration:
*
* ~~~
......@@ -54,6 +53,7 @@ class VKontakte extends OAuth2
*/
public $apiBaseUrl = 'https://api.vk.com/method';
/**
* @inheritdoc
*/
......
......@@ -53,6 +53,7 @@ class YandexOAuth extends OAuth2
*/
public $apiBaseUrl = 'https://login.yandex.ru';
/**
* @inheritdoc
*/
......
......@@ -46,6 +46,7 @@ class YandexOpenId extends OpenId
'contact/email',
];
/**
* @inheritdoc
*/
......
......@@ -33,6 +33,8 @@ class RsaSha1 extends BaseMethod
* This value can be fetched from file specified by [[publicCertificateFile]].
*/
protected $_publicCertificate;
/**
* @var string path to the file, which holds private key certificate.
*/
......
......@@ -96,6 +96,7 @@ class AuthChoice extends Widget
*/
private $_clients;
/**
* @param ClientInterface[] $clients auth providers
*/
......
......@@ -95,17 +95,14 @@ class ActiveField extends \yii\widgets\ActiveField
* @var bool whether to render [[checkboxList()]] and [[radioList()]] inline.
*/
public $inline = false;
/**
* @var string|null optional template to render the `{input}` placeholder content
*/
public $inputTemplate;
/**
* @var array options for the wrapper tag, used in the `{beginWrapper}` placeholder
*/
public $wrapperOptions = [];
/**
* @var null|array CSS grid classes for horizontal layout. This must be an array with these keys:
* - 'offset' the offset grid class to append to the wrapper if no label is rendered
......@@ -115,47 +112,40 @@ class ActiveField extends \yii\widgets\ActiveField
* - 'hint' the hint grid class
*/
public $horizontalCssClasses;
/**
* @var string the template for checkboxes in default layout
*/
public $checkboxTemplate = "<div class=\"checkbox\">\n{beginLabel}\n{input}\n{labelTitle}\n{endLabel}\n{error}\n{hint}\n</div>";
/**
* @var string the template for radios in default layout
*/
public $radioTemplate = "<div class=\"radio\">\n{beginLabel}\n{input}\n{labelTitle}\n{endLabel}\n{error}\n{hint}\n</div>";
/**
* @var string the template for checkboxes in horizontal layout
*/
public $horizontalCheckboxTemplate = "{beginWrapper}\n<div class=\"checkbox\">\n{beginLabel}\n{input}\n{labelTitle}\n{endLabel}\n</div>\n{error}\n{endWrapper}\n{hint}";
/**
* @var string the template for radio buttons in horizontal layout
*/
public $horizontalRadioTemplate = "{beginWrapper}\n<div class=\"radio\">\n{beginLabel}\n{input}\n{labelTitle}\n{endLabel}\n</div>\n{error}\n{endWrapper}\n{hint}";
/**
* @var string the template for inline checkboxLists
*/
public $inlineCheckboxListTemplate = "{label}\n{beginWrapper}\n{input}\n{error}\n{endWrapper}\n{hint}";
/**
* @var string the template for inline radioLists
*/
public $inlineRadioListTemplate = "{label}\n{beginWrapper}\n{input}\n{error}\n{endWrapper}\n{hint}";
/**
* @var bool whether to render the error. Default is `true` except for layout `inline`.
*/
public $enableError = true;
/**
* @var bool whether to render the label. Default is `true`.
*/
public $enableLabel = true;
/**
* @inheritdoc
*/
......
......@@ -69,7 +69,6 @@ class ActiveForm extends \yii\widgets\ActiveForm
* @var array HTML attributes for the form tag. Default is `['role' => 'form']`.
*/
public $options = ['role' => 'form'];
/**
* @var string the form layout. Either 'default', 'horizontal' or 'inline'.
* By choosing a layout, an appropriate default field configuration is applied. This will
......@@ -79,6 +78,7 @@ class ActiveForm extends \yii\widgets\ActiveForm
*/
public $layout = 'default';
/**
* @inheritdoc
*/
......
......@@ -68,6 +68,7 @@ class Alert extends Widget
*/
public $closeButton = [];
/**
* Initializes the widget.
*/
......
......@@ -39,6 +39,7 @@ class Button extends Widget
*/
public $encodeLabel = true;
/**
* Initializes the widget.
* If you override this method, make sure you call the parent implementation first.
......
......@@ -59,6 +59,7 @@ class ButtonDropdown extends Widget
*/
public $encodeLabel = true;
/**
* Renders the widget.
*/
......
......@@ -52,6 +52,7 @@ class ButtonGroup extends Widget
*/
public $encodeLabels = true;
/**
* Initializes the widget.
* If you override this method, make sure you call the parent implementation first.
......
......@@ -66,6 +66,7 @@ class Carousel extends Widget
*/
public $items = [];
/**
* Initializes the widget.
*/
......
......@@ -59,6 +59,7 @@ class Collapse extends Widget
*/
public $items = [];
/**
* Initializes the widget.
*/
......
......@@ -45,7 +45,8 @@ class Dropdown extends Widget
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
protected $_containerOptions = [];
/**
* Initializes the widget.
* If you override this method, make sure you call the parent implementation first.
......
......@@ -82,6 +82,7 @@ class Modal extends Widget
*/
public $toggleButton;
/**
* Initializes the widget.
*/
......
......@@ -93,6 +93,7 @@ class Nav extends Widget
*/
public $params;
/**
* Initializes the widget.
*/
......
......@@ -85,6 +85,7 @@ class NavBar extends Widget
*/
public $innerContainerOptions = [];
/**
* Initializes the widget.
*/
......
......@@ -89,6 +89,7 @@ class Progress extends Widget
*/
public $bars;
/**
* Initializes the widget.
* If you override this method, make sure you call the parent implementation first.
......
......@@ -102,6 +102,7 @@ class Tabs extends Widget
*/
public $navType = 'nav-tabs';
/**
* Initializes the widget.
*/
......
......@@ -39,6 +39,7 @@ class Widget extends \yii\base\Widget
*/
public $clientEvents = [];
/**
* Initializes the widget.
* This method will register the bootstrap asset bundle. If you override this method,
......
......@@ -27,11 +27,13 @@ abstract class BasePage extends Component
* the route and the rest of the name-value pairs are treated as GET parameters, e.g. `array('site/page', 'name' => 'about')`.
*/
public $route;
/**
* @var \Codeception\AbstractGuy the testing guy object
*/
protected $guy;
/**
* Constructor.
*
......
......@@ -33,6 +33,7 @@ class TestCase extends Test
*/
public $appConfig = '@tests/unit/_config.php';
/**
* Returns the value of an object property.
*
......
......@@ -23,9 +23,9 @@ class Installer extends LibraryInstaller
const EXTRA_WRITABLE = 'writable';
const EXTRA_EXECUTABLE = 'executable';
const EXTRA_CONFIG = 'config';
const EXTENSION_FILE = 'yiisoft/extensions.php';
/**
* @inheritdoc
*/
......
......@@ -25,6 +25,7 @@ class LogTarget extends Target
public $module;
public $tag;
/**
* @param \yii\debug\Module $module
* @param array $config
......
......@@ -194,8 +194,7 @@ class Module extends \yii\base\Module implements BootstrapInterface
return true;
}
}
Yii::warning('Access to debugger is denied due to IP address restriction. The requested IP is ' . $ip, __METHOD__);
Yii::warning('Access to debugger is denied due to IP address restriction. The requesting IP address is ' . $ip, __METHOD__);
return false;
}
......
......@@ -49,6 +49,7 @@ class Panel extends Component
*/
public $actions = [];
/**
* @return string name of the panel
*/
......
......@@ -23,6 +23,7 @@ class Filter extends Component
*/
protected $rules = [];
/**
* Adds data filtering rule.
*
......
......@@ -22,6 +22,7 @@ abstract class Base extends Component implements MatcherInterface
*/
protected $baseValue;
/**
* @inheritdoc
*/
......
......@@ -20,6 +20,7 @@ class SameAs extends Base
*/
public $partial = false;
/**
* @inheritdoc
*/
......
......@@ -33,6 +33,7 @@ class DefaultController extends Controller
*/
public $summary;
/**
* @inheritdoc
*/
......
......@@ -23,12 +23,12 @@ class Db extends Base
* @var string type of the input search value
*/
public $type;
/**
* @var integer query attribute input search value
*/
public $query;
/**
* @inheritdoc
*/
......
......@@ -23,47 +23,40 @@ class Debug extends Base
* @var string tag attribute input search value
*/
public $tag;
/**
* @var string ip attribute input search value
*/
public $ip;
/**
* @var string method attribute input search value
*/
public $method;
/**
* @var integer ajax attribute input search value
*/
public $ajax;
/**
* @var string url attribute input search value
*/
public $url;
/**
* @var string status code attribute input search value
*/
public $statusCode;
/**
* @var integer sql count attribute input search value
*/
public $sqlCount;
/**
* @var integer total mail count attribute input search value
*/
public $mailCount;
/**
* @var array critical codes, used to determine grid row options.
*/
public $criticalCodes = [400, 404, 500];
/**
* @inheritdoc
*/
......
......@@ -23,17 +23,16 @@ class Log extends Base
* @var string ip attribute input search value
*/
public $level;
/**
* @var string method attribute input search value
*/
public $category;
/**
* @var integer message attribute input search value
*/
public $message;
/**
* @inheritdoc
*/
......
......@@ -22,52 +22,44 @@ class Mail extends Base
* @var string from attribute input search value
*/
public $from;
/**
* @var string to attribute input search value
*/
public $to;
/**
* @var string reply attribute input search value
*/
public $reply;
/**
* @var string cc attribute input search value
*/
public $cc;
/**
* @var string bcc attribute input search value
*/
public $bcc;
/**
* @var string subject attribute input search value
*/
public $subject;
/**
* @var string body attribute input search value
*/
public $body;
/**
* @var string charset attribute input search value
*/
public $charset;
/**
* @var string headers attribute input search value
*/
public $headers;
/**
* @var string file attribute input search value
*/
public $file;
public function rules()
{
return [
......
......@@ -23,12 +23,12 @@ class Profile extends Base
* @var string method attribute input search value
*/
public $category;
/**
* @var integer info attribute input search value
*/
public $info;
/**
* @inheritdoc
*/
......
......@@ -28,16 +28,17 @@ class DbPanel extends Panel
* the execution is considered taking critical number of DB queries.
*/
public $criticalQueryThreshold;
/**
* @var array db queries info extracted to array as models, to use with data provider.
*/
private $_models;
/**
* @var array current database request timings
*/
private $_timings;
/**
* @inheritdoc
*/
......
......@@ -25,6 +25,7 @@ class LogPanel extends Panel
*/
private $_models;
/**
* @inheritdoc
*/
......
......@@ -29,11 +29,13 @@ class MailPanel extends Panel
* @var string path where all emails will be saved. should be an alias.
*/
public $mailPath = '@runtime/debug/mail';
/**
* @var array current request sent messages
*/
private $_messages = [];
/**
* @inheritdoc
*/
......
......@@ -25,6 +25,7 @@ class ProfilingPanel extends Panel
*/
private $_models;
/**
* @inheritdoc
*/
......
......@@ -56,6 +56,7 @@ class ActiveRecord extends BaseActiveRecord
private $_version;
private $_highlight;
/**
* Returns the database connection used by this AR class.
* By default, the "elasticsearch" application component is used as the database connection.
......
......@@ -43,9 +43,9 @@ class Command extends Component
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html
*/
public $highlight;
public $options = [];
/**
* @param array $options
* @return mixed
......
......@@ -46,7 +46,6 @@ class Connection extends Component
* @var array the active node. key of [[nodes]]. Will be randomly selected on [[open()]].
*/
public $activeNode;
// TODO http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html#_example_configuring_http_basic_auth
public $auth = [];
/**
......@@ -62,6 +61,7 @@ class Connection extends Component
*/
public $dataTimeout = null;
public function init()
{
foreach ($this->nodes as $node) {
......
......@@ -36,6 +36,7 @@ class DebugAction extends Action
*/
public $controller;
public function run($logId, $tag)
{
$this->controller->loadData($tag);
......
......@@ -24,6 +24,7 @@ class DebugPanel extends Panel
{
public $db = 'elasticsearch';
public function init()
{
$this->actions['elasticsearch-query'] = [
......
......@@ -137,7 +137,6 @@ class Query extends Component implements QueryInterface
* on one or more fields.
*/
public $highlight;
public $facets = [];
......
......@@ -24,6 +24,7 @@ class QueryBuilder extends \yii\base\Object
*/
public $db;
/**
* Constructor.
* @param Connection $connection the database connection.
......
......@@ -164,6 +164,7 @@ class FixtureController extends \yii\console\controllers\FixtureController
* More info in [Faker](https://github.com/fzaninotto/Faker.) library docs.
*/
public $providers = [];
/**
* @var \Faker\Generator Faker generator instance
*/
......
......@@ -54,6 +54,7 @@ class CodeFile extends Object
*/
public $operation;
/**
* Constructor.
* @param string $path the file path that the new code should be saved to.
......
......@@ -58,6 +58,7 @@ abstract class Generator extends Model
*/
public $messageCategory = 'app';
/**
* @return string name of the code generator
*/
......
......@@ -21,6 +21,7 @@ class ActiveField extends \yii\widgets\ActiveField
*/
public $model;
/**
* @inheritdoc
*/
......
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