Commit 7295540c by Alexander Makarov

Code style and phpdoc fixes

parent 76d8e2b5
......@@ -45,7 +45,10 @@ class FixtureHelper extends Module
$this->unloadFixtures();
}
protected function fixtures()
/**
* @inheritdoc
*/
public function fixtures()
{
return [
'user' => [
......
......@@ -34,7 +34,8 @@ abstract class BasePage extends Component
/**
* Constructor.
* @param \Codeception\AbstractGuy the testing guy object
*
* @param \Codeception\AbstractGuy $I the testing guy object
*/
public function __construct($I)
{
......
......@@ -173,11 +173,26 @@ class Connection extends Component
return $command;
}
/**
* Creates new query builder instance
* @return QueryBuilder
*/
public function getQueryBuilder()
{
return new QueryBuilder($this);
}
/**
* Performs GET HTTP request
*
* @param string $url URL
* @param array $options URL options
* @param string $body request body
* @param boolean $raw if response body contains JSON and should be decoded
* @return mixed response
* @throws Exception
* @throws \yii\base\InvalidConfigException
*/
public function get($url, $options = [], $body = null, $raw = false)
{
$this->open();
......@@ -185,6 +200,16 @@ class Connection extends Component
return $this->httpRequest('GET', $this->createUrl($url, $options), $body, $raw);
}
/**
* Performs HEAD HTTP request
*
* @param string $url URL
* @param array $options URL options
* @param string $body request body
* @return mixed response
* @throws Exception
* @throws \yii\base\InvalidConfigException
*/
public function head($url, $options = [], $body = null)
{
$this->open();
......@@ -192,6 +217,17 @@ class Connection extends Component
return $this->httpRequest('HEAD', $this->createUrl($url, $options), $body);
}
/**
* Performs POST HTTP request
*
* @param string $url URL
* @param array $options URL options
* @param string $body request body
* @param boolean $raw if response body contains JSON and should be decoded
* @return mixed response
* @throws Exception
* @throws \yii\base\InvalidConfigException
*/
public function post($url, $options = [], $body = null, $raw = false)
{
$this->open();
......@@ -199,6 +235,17 @@ class Connection extends Component
return $this->httpRequest('POST', $this->createUrl($url, $options), $body, $raw);
}
/**
* Performs PUT HTTP request
*
* @param string $url URL
* @param array $options URL options
* @param string $body request body
* @param boolean $raw if response body contains JSON and should be decoded
* @return mixed response
* @throws Exception
* @throws \yii\base\InvalidConfigException
*/
public function put($url, $options = [], $body = null, $raw = false)
{
$this->open();
......@@ -206,6 +253,17 @@ class Connection extends Component
return $this->httpRequest('PUT', $this->createUrl($url, $options), $body, $raw);
}
/**
* Performs DELETE HTTP request
*
* @param string $url URL
* @param array $options URL options
* @param string $body request body
* @param boolean $raw if response body contains JSON and should be decoded
* @return mixed response
* @throws Exception
* @throws \yii\base\InvalidConfigException
*/
public function delete($url, $options = [], $body = null, $raw = false)
{
$this->open();
......@@ -213,6 +271,13 @@ class Connection extends Component
return $this->httpRequest('DELETE', $this->createUrl($url, $options), $body, $raw);
}
/**
* Creates URL
*
* @param mixed $path path
* @param array $options URL options
* @return array
*/
private function createUrl($path, $options = [])
{
if (!is_string($path)) {
......@@ -232,6 +297,17 @@ class Connection extends Component
return [$this->nodes[$this->activeNode]['http_address'], $url];
}
/**
* Performs HTTP request
*
* @param string $method method name
* @param string $url URL
* @param string $requestBody request body
* @param boolean $raw if response body contains JSON and should be decoded
* @throws Exception if request failed
* @throws \yii\base\InvalidParamException
* @return mixed response
*/
protected function httpRequest($method, $url, $requestBody = null, $raw = false)
{
$method = strtoupper($method);
......
......@@ -133,11 +133,11 @@ class QueryBuilder extends \yii\base\Object
/**
* Parses the condition specification and generates the corresponding SQL expression.
* @param string|array $condition the condition specification. Please refer to [[Query::where()]]
* on how to specify a condition.
* @param array $params the binding parameters to be populated
*
* @param string|array $condition the condition specification. Please refer to [[Query::where()]] on how to specify a condition.
* @throws \yii\base\InvalidParamException if unknown operator is used in query
* @throws \yii\base\NotSupportedException if string conditions are used in where
* @return string the generated SQL expression
* @throws \yii\db\Exception if the condition is in bad format
*/
public function buildCondition($condition)
{
......
......@@ -194,9 +194,12 @@ class FixtureController extends \yii\console\controllers\FixtureController
/**
* Generates fixtures and fill them with Faker data.
* @param string $file filename for the table template. You can generate all fixtures for all tables
* by specifying keyword "all" as filename.
*
* @param array|string $file filename for the table template.
* You can generate all fixtures for all tables by specifying keyword "all" as filename.
* @param integer $times how much fixtures do you want per table
* @throws \yii\base\InvalidParamException
* @throws \yii\console\Exception
*/
public function actionGenerate(array $file, $times = 2)
{
......
......@@ -485,8 +485,10 @@ abstract class Generator extends Model
/**
* Generates a string depending on enableI18N property
*
* @param string $string the text be generated
* @param array $placeholders the placeholders to use by `Yii::t()`
* @return string
*/
public function generateString($string = '', $placeholders = [])
{
......
......@@ -355,7 +355,7 @@ class FileHelperTest extends TestCase
// without "fileinfo" it falls back to getMimeTypeByExtension() and returns application/json
$file = $this->testFilePath . DIRECTORY_SEPARATOR . 'mime_type_test.json';
file_put_contents($file, '{"a": "b"}');
$this->assertTrue(in_array(FileHelper::getMimeType($file), array('application/json', 'text/plain')));
$this->assertTrue(in_array(FileHelper::getMimeType($file), ['application/json', 'text/plain']));
}
public function testNormalizePath()
......
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