Commit b2f1b00b by Alexander Mohorev

code style. operator IF

parent c7e8d8b9
...@@ -120,7 +120,7 @@ needs to be divisible by 10. In the rules you would define: `['attributeName', ' ...@@ -120,7 +120,7 @@ needs to be divisible by 10. In the rules you would define: `['attributeName', '
Then, your own method could look like this: Then, your own method could look like this:
```php ```php
public function myValidationMethod($attribute) { public function myValidationMethod($attribute) {
if(($this->$attribute % 10) != 0) { if (($this->$attribute % 10) != 0) {
$this->addError($attribute, 'cannot divide value by 10'); $this->addError($attribute, 'cannot divide value by 10');
} }
} }
......
...@@ -252,7 +252,7 @@ if ($event === null) { ...@@ -252,7 +252,7 @@ if ($event === null) {
} }
// the following is NOT allowed: // the following is NOT allowed:
if(!$model && null === $event) if (!$model && null === $event)
throw new Exception('test'); throw new Exception('test');
``` ```
......
...@@ -106,11 +106,12 @@ class BaseDoc extends Object ...@@ -106,11 +106,12 @@ class BaseDoc extends Object
public function getSourceUrl($baseUrl, $line=null) public function getSourceUrl($baseUrl, $line=null)
{ {
if($line === null) if ($line === null) {
return $baseUrl . $this->sourcePath; return $baseUrl . $this->sourcePath;
else } else {
return $baseUrl . $this->sourcePath . '#' . $line; return $baseUrl . $this->sourcePath . '#' . $line;
} }
}
public function getSourceCode() public function getSourceCode()
{ {
......
...@@ -235,7 +235,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface ...@@ -235,7 +235,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$parents = []; $parents = [];
$parents[] = $this->typeLink($class); $parents[] = $this->typeLink($class);
while ($class->parentClass !== null) { while ($class->parentClass !== null) {
if(isset($this->context->classes[$class->parentClass])) { if (isset($this->context->classes[$class->parentClass])) {
$class = $this->context->classes[$class->parentClass]; $class = $this->context->classes[$class->parentClass];
$parents[] = $this->typeLink($class); $parents[] = $this->typeLink($class);
} else { } else {
...@@ -255,7 +255,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface ...@@ -255,7 +255,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$interfaces = []; $interfaces = [];
sort($names, SORT_STRING); sort($names, SORT_STRING);
foreach($names as $interface) { foreach($names as $interface) {
if(isset($this->context->interfaces[$interface])) { if (isset($this->context->interfaces[$interface])) {
$interfaces[] = $this->typeLink($this->context->interfaces[$interface]); $interfaces[] = $this->typeLink($this->context->interfaces[$interface]);
} else { } else {
$interfaces[] = $interface; // TODO link to php.net $interfaces[] = $interface; // TODO link to php.net
...@@ -273,7 +273,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface ...@@ -273,7 +273,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$traits = []; $traits = [];
sort($names, SORT_STRING); sort($names, SORT_STRING);
foreach($names as $trait) { foreach($names as $trait) {
if(isset($this->context->traits[$trait])) { if (isset($this->context->traits[$trait])) {
$traits[] = $this->typeLink($this->context->traits[$trait]); $traits[] = $this->typeLink($this->context->traits[$trait]);
} else { } else {
$traits[] = $trait; // TODO link to php.net $traits[] = $trait; // TODO link to php.net
...@@ -291,7 +291,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface ...@@ -291,7 +291,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$classes = []; $classes = [];
sort($names, SORT_STRING); sort($names, SORT_STRING);
foreach($names as $class) { foreach($names as $class) {
if(isset($this->context->classes[$class])) { if (isset($this->context->classes[$class])) {
$classes[] = $this->typeLink($this->context->classes[$class]); $classes[] = $this->typeLink($this->context->classes[$class]);
} else { } else {
$classes[] = $class; // TODO link to php.net $classes[] = $class; // TODO link to php.net
......
...@@ -21,7 +21,7 @@ ArrayHelper::multisort($events, 'name'); ...@@ -21,7 +21,7 @@ ArrayHelper::multisort($events, 'name');
<?= $event->name ?> <?= $event->name ?>
<span class="detailHeaderTag small"> <span class="detailHeaderTag small">
event event
<?php if(!empty($event->since)): ?> <?php if (!empty($event->since)): ?>
(available since version <?= $event->since ?>) (available since version <?= $event->since ?>)
<?php endif; ?> <?php endif; ?>
</span> </span>
......
...@@ -35,7 +35,7 @@ ArrayHelper::multisort($events, 'name'); ...@@ -35,7 +35,7 @@ ArrayHelper::multisort($events, 'name');
<td><?= $this->context->typeLink($event->types) ?></td> <td><?= $this->context->typeLink($event->types) ?></td>
<td> <td>
<?= ApiMarkdown::process($event->shortDescription, $event->definedBy, true) ?> <?= ApiMarkdown::process($event->shortDescription, $event->definedBy, true) ?>
<?php if(!empty($event->since)): ?> <?php if (!empty($event->since)): ?>
(available since version <?= $event->since ?>) (available since version <?= $event->since ?>)
<?php endif; ?> <?php endif; ?>
</td> </td>
......
...@@ -35,7 +35,7 @@ ArrayHelper::multisort($methods, 'name'); ...@@ -35,7 +35,7 @@ ArrayHelper::multisort($methods, 'name');
<tr><td colspan="3"> <tr><td colspan="3">
<div class="signature2"><?= $this->context->renderMethodSignature($method) ?></div> <div class="signature2"><?= $this->context->renderMethodSignature($method) ?></div>
</td></tr> </td></tr>
<?php if(!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?> <?php if (!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
<?php foreach($method->params as $param): ?> <?php foreach($method->params as $param): ?>
<tr> <tr>
<td class="paramNameCol"><?= $param->name ?></td> <td class="paramNameCol"><?= $param->name ?></td>
...@@ -43,7 +43,7 @@ ArrayHelper::multisort($methods, 'name'); ...@@ -43,7 +43,7 @@ ArrayHelper::multisort($methods, 'name');
<td class="paramDescCol"><?= ApiMarkdown::process($param->description, $type) ?></td> <td class="paramDescCol"><?= ApiMarkdown::process($param->description, $type) ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php if(!empty($method->return)): ?> <?php if (!empty($method->return)): ?>
<tr> <tr>
<td class="paramNameCol"><?= 'return'; ?></td> <td class="paramNameCol"><?= 'return'; ?></td>
<td class="paramTypeCol"><?= $this->context->typeLink($method->returnTypes); ?></td> <td class="paramTypeCol"><?= $this->context->typeLink($method->returnTypes); ?></td>
......
...@@ -34,7 +34,7 @@ if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && cou ...@@ -34,7 +34,7 @@ if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && cou
$methods = $type->methods; $methods = $type->methods;
ArrayHelper::multisort($methods, 'name'); ArrayHelper::multisort($methods, 'name');
foreach($methods as $method): ?> foreach($methods as $method): ?>
<?php if($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?> <?php if ($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
<tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()"> <tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()">
<td><?= $this->context->subjectLink($method, $method->name.'()') ?></td> <td><?= $this->context->subjectLink($method, $method->name.'()') ?></td>
<td><?= ApiMarkdown::process($method->shortDescription, $method->definedBy, true) ?></td> <td><?= ApiMarkdown::process($method->shortDescription, $method->definedBy, true) ?></td>
......
...@@ -24,10 +24,10 @@ ArrayHelper::multisort($properties, 'name'); ...@@ -24,10 +24,10 @@ ArrayHelper::multisort($properties, 'name');
<?= $property->name ?> <?= $property->name ?>
<span class="detailHeaderTag small"> <span class="detailHeaderTag small">
<?= $property->visibility ?> <?= $property->visibility ?>
<?php if($property->getIsReadOnly()) echo ' <em>read-only</em> '; ?> <?php if ($property->getIsReadOnly()) echo ' <em>read-only</em> '; ?>
<?php if($property->getIsWriteOnly()) echo ' <em>write-only</em> '; ?> <?php if ($property->getIsWriteOnly()) echo ' <em>write-only</em> '; ?>
property property
<?php if(!empty($property->since)): ?> <?php if (!empty($property->since)): ?>
(available since version <?= $property->since ?>) (available since version <?= $property->since ?>)
<?php endif; ?> <?php endif; ?>
</span> </span>
......
...@@ -34,7 +34,7 @@ if ($protected && count($type->getProtectedProperties()) == 0 || !$protected && ...@@ -34,7 +34,7 @@ if ($protected && count($type->getProtectedProperties()) == 0 || !$protected &&
$properties = $type->properties; $properties = $type->properties;
ArrayHelper::multisort($properties, 'name'); ArrayHelper::multisort($properties, 'name');
foreach($properties as $property): ?> foreach($properties as $property): ?>
<?php if($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?> <?php if ($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?>
<tr<?= $property->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>"> <tr<?= $property->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>">
<td><?= $this->context->subjectLink($property) ?></td> <td><?= $this->context->subjectLink($property) ?></td>
<td><?= $this->context->typeLink($property->types) ?></td> <td><?= $this->context->typeLink($property->types) ?></td>
......
...@@ -30,16 +30,16 @@ $renderer = $this->context; ...@@ -30,16 +30,16 @@ $renderer = $this->context;
?></h1> ?></h1>
<div id="nav"> <div id="nav">
<a href="index.html">All Classes</a> <a href="index.html">All Classes</a>
<?php if(!($type instanceof InterfaceDoc) && !empty($type->properties)): ?> <?php if (!($type instanceof InterfaceDoc) && !empty($type->properties)): ?>
| <a href="#properties">Properties</a> | <a href="#properties">Properties</a>
<?php endif; ?> <?php endif; ?>
<?php if(!empty($type->methods)): ?> <?php if (!empty($type->methods)): ?>
| <a href="#methods">Methods</a> | <a href="#methods">Methods</a>
<?php endif; ?> <?php endif; ?>
<?php if($type instanceof ClassDoc && !empty($type->events)): ?> <?php if ($type instanceof ClassDoc && !empty($type->events)): ?>
| <a href="#events">Events</a> | <a href="#events">Events</a>
<?php endif; ?> <?php endif; ?>
<?php if($type instanceof ClassDoc && !empty($type->constants)): ?> <?php if ($type instanceof ClassDoc && !empty($type->constants)): ?>
| <a href="#constants">Constants</a> | <a href="#constants">Constants</a>
<?php endif; ?> <?php endif; ?>
</div> </div>
...@@ -55,10 +55,10 @@ $renderer = $this->context; ...@@ -55,10 +55,10 @@ $renderer = $this->context;
<?php if ($type instanceof ClassDoc && !empty($type->interfaces)): ?> <?php if ($type instanceof ClassDoc && !empty($type->interfaces)): ?>
<tr><th>Implements</th><td><?= $renderer->renderInterfaces($type->interfaces) ?></td></tr> <tr><th>Implements</th><td><?= $renderer->renderInterfaces($type->interfaces) ?></td></tr>
<?php endif; ?> <?php endif; ?>
<?php if(!($type instanceof InterfaceDoc) && !empty($type->traits)): ?> <?php if (!($type instanceof InterfaceDoc) && !empty($type->traits)): ?>
<tr><th>Uses Traits</th><td><?= $renderer->renderTraits($type->traits) ?></td></tr> <tr><th>Uses Traits</th><td><?= $renderer->renderTraits($type->traits) ?></td></tr>
<?php endif; ?> <?php endif; ?>
<?php if($type instanceof ClassDoc && !empty($type->subclasses)): ?> <?php if ($type instanceof ClassDoc && !empty($type->subclasses)): ?>
<tr><th>Subclasses</th><td><?= $renderer->renderClasses($type->subclasses) ?></td></tr> <tr><th>Subclasses</th><td><?= $renderer->renderClasses($type->subclasses) ?></td></tr>
<?php endif; ?> <?php endif; ?>
<?php if ($type instanceof InterfaceDoc && !empty($type->implementedBy)): ?> <?php if ($type instanceof InterfaceDoc && !empty($type->implementedBy)): ?>
...@@ -67,7 +67,7 @@ $renderer = $this->context; ...@@ -67,7 +67,7 @@ $renderer = $this->context;
<?php if ($type instanceof TraitDoc && !empty($type->usedBy)): ?> <?php if ($type instanceof TraitDoc && !empty($type->usedBy)): ?>
<tr><th>Implemented by</th><td><?= $renderer->renderClasses($type->usedBy) ?></td></tr> <tr><th>Implemented by</th><td><?= $renderer->renderClasses($type->usedBy) ?></td></tr>
<?php endif; ?> <?php endif; ?>
<?php if(!empty($type->since)): ?> <?php if (!empty($type->since)): ?>
<tr><th>Available since version</th><td><?= $type->since ?></td></tr> <tr><th>Available since version</th><td><?= $type->since ?></td></tr>
<?php endif; ?> <?php endif; ?>
<tr> <tr>
...@@ -97,6 +97,6 @@ $renderer = $this->context; ...@@ -97,6 +97,6 @@ $renderer = $this->context;
<?= $this->render('@yii/apidoc/templates/html/views/propertyDetails', ['type' => $type]) ?> <?= $this->render('@yii/apidoc/templates/html/views/propertyDetails', ['type' => $type]) ?>
<?= $this->render('@yii/apidoc/templates/html/views/methodDetails', ['type' => $type]) ?> <?= $this->render('@yii/apidoc/templates/html/views/methodDetails', ['type' => $type]) ?>
<?php if($type instanceof ClassDoc): ?> <?php if ($type instanceof ClassDoc): ?>
<?= $this->render('@yii/apidoc/templates/html/views/eventDetails', ['type' => $type]) ?> <?= $this->render('@yii/apidoc/templates/html/views/eventDetails', ['type' => $type]) ?>
<?php endif; ?> <?php endif; ?>
...@@ -175,7 +175,7 @@ class OAuth1 extends BaseOAuth ...@@ -175,7 +175,7 @@ class OAuth1 extends BaseOAuth
} }
case 'POST': { case 'POST': {
$curlOptions[CURLOPT_POST] = true; $curlOptions[CURLOPT_POST] = true;
if (!empty($params)){ if (!empty($params)) {
$curlOptions[CURLOPT_POSTFIELDS] = $params; $curlOptions[CURLOPT_POSTFIELDS] = $params;
} }
$authorizationHeader = $this->composeAuthorizationHeader($params); $authorizationHeader = $this->composeAuthorizationHeader($params);
......
...@@ -243,10 +243,10 @@ class OpenId extends BaseClient implements ClientInterface ...@@ -243,10 +243,10 @@ class OpenId extends BaseClient implements ClientInterface
if ($this->verifyPeer !== null) { if ($this->verifyPeer !== null) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer);
if($this->capath) { if ($this->capath) {
curl_setopt($curl, CURLOPT_CAPATH, $this->capath); curl_setopt($curl, CURLOPT_CAPATH, $this->capath);
} }
if($this->cainfo) { if ($this->cainfo) {
curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo); curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo);
} }
} }
......
...@@ -73,7 +73,7 @@ HTML; ...@@ -73,7 +73,7 @@ HTML;
} }
} }
// Added lines only on the right side // Added lines only on the right side
else if ($change['tag'] === 'insert') { elseif ($change['tag'] === 'insert') {
foreach ($change['changed']['lines'] as $no => $line) { foreach ($change['changed']['lines'] as $no => $line) {
$toLine = $change['changed']['offset'] + $no + 1; $toLine = $change['changed']['offset'] + $no + 1;
$html .= <<<HTML $html .= <<<HTML
...@@ -86,7 +86,7 @@ HTML; ...@@ -86,7 +86,7 @@ HTML;
} }
} }
// Show deleted lines only on the left side // Show deleted lines only on the left side
else if ($change['tag'] === 'delete') { elseif ($change['tag'] === 'delete') {
foreach ($change['base']['lines'] as $no => $line) { foreach ($change['base']['lines'] as $no => $line) {
$fromLine = $change['base']['offset'] + $no + 1; $fromLine = $change['base']['offset'] + $no + 1;
$html .= <<<HTML $html .= <<<HTML
...@@ -99,7 +99,7 @@ HTML; ...@@ -99,7 +99,7 @@ HTML;
} }
} }
// Show modified lines on both sides // Show modified lines on both sides
else if ($change['tag'] === 'replace') { elseif ($change['tag'] === 'replace') {
foreach ($change['base']['lines'] as $no => $line) { foreach ($change['base']['lines'] as $no => $line) {
$fromLine = $change['base']['offset'] + $no + 1; $fromLine = $change['base']['offset'] + $no + 1;
$html .= <<<HTML $html .= <<<HTML
......
...@@ -78,7 +78,7 @@ class Cache extends \yii\caching\Cache ...@@ -78,7 +78,7 @@ class Cache extends \yii\caching\Cache
parent::init(); parent::init();
if (is_string($this->redis)) { if (is_string($this->redis)) {
$this->redis = Yii::$app->getComponent($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'])) { if (!isset($this->redis['class'])) {
$this->redis['class'] = Connection::className(); $this->redis['class'] = Connection::className();
} }
......
...@@ -81,7 +81,7 @@ class Session extends \yii\web\Session ...@@ -81,7 +81,7 @@ class Session extends \yii\web\Session
{ {
if (is_string($this->redis)) { if (is_string($this->redis)) {
$this->redis = Yii::$app->getComponent($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'])) { if (!isset($this->redis['class'])) {
$this->redis['class'] = Connection::className(); $this->redis['class'] = Connection::className();
} }
......
...@@ -268,7 +268,7 @@ class MessageController extends Controller ...@@ -268,7 +268,7 @@ class MessageController extends Controller
{ {
echo "Saving messages to $fileName..."; echo "Saving messages to $fileName...";
if (is_file($fileName)) { if (is_file($fileName)) {
if($format === 'po'){ if ($format === 'po') {
$translated = file_get_contents($fileName); $translated = file_get_contents($fileName);
preg_match_all('/(?<=msgid ").*(?="\n(#*)msgstr)/', $translated, $keys); preg_match_all('/(?<=msgid ").*(?="\n(#*)msgstr)/', $translated, $keys);
preg_match_all('/(?<=msgstr ").*(?="\n\n)/', $translated, $values); preg_match_all('/(?<=msgstr ").*(?="\n\n)/', $translated, $values);
...@@ -285,7 +285,7 @@ class MessageController extends Controller ...@@ -285,7 +285,7 @@ class MessageController extends Controller
$merged = []; $merged = [];
$untranslated = []; $untranslated = [];
foreach ($messages as $message) { foreach ($messages as $message) {
if($format === 'po'){ if ($format === 'po') {
$message = preg_replace('/\"/', '\"', $message); $message = preg_replace('/\"/', '\"', $message);
} }
if (array_key_exists($message, $translated) && strlen($translated[$message]) > 0) { if (array_key_exists($message, $translated) && strlen($translated[$message]) > 0) {
...@@ -317,7 +317,7 @@ class MessageController extends Controller ...@@ -317,7 +317,7 @@ class MessageController extends Controller
if (false === $overwrite) { if (false === $overwrite) {
$fileName .= '.merged'; $fileName .= '.merged';
} }
if ($format === 'po'){ if ($format === 'po') {
$output = ''; $output = '';
foreach ($merged as $k => $v){ foreach ($merged as $k => $v){
$k = preg_replace('/(\")|(\\\")/', "\\\"", $k); $k = preg_replace('/(\")|(\\\")/', "\\\"", $k);
......
...@@ -397,7 +397,7 @@ class BaseFileHelper ...@@ -397,7 +397,7 @@ class BaseFileHelper
if ($pattern === $baseName) { if ($pattern === $baseName) {
return true; return true;
} }
} else if ($flags & self::PATTERN_ENDSWITH) { } elseif ($flags & self::PATTERN_ENDSWITH) {
/* "*literal" matching against "fooliteral" */ /* "*literal" matching against "fooliteral" */
$n = StringHelper::byteLength($pattern); $n = StringHelper::byteLength($pattern);
if (StringHelper::byteSubstr($pattern, 1, $n) === StringHelper::byteSubstr($baseName, -$n, $n)) { if (StringHelper::byteSubstr($pattern, 1, $n) === StringHelper::byteSubstr($baseName, -$n, $n)) {
......
...@@ -86,7 +86,7 @@ class BaseMarkdown ...@@ -86,7 +86,7 @@ class BaseMarkdown
/** @var \cebe\markdown\Markdown $parser */ /** @var \cebe\markdown\Markdown $parser */
if (!isset(static::$flavors[$flavor])) { if (!isset(static::$flavors[$flavor])) {
throw new InvalidParamException("Markdown flavor '$flavor' is not defined.'"); throw new InvalidParamException("Markdown flavor '$flavor' is not defined.'");
} elseif(!is_object($config = static::$flavors[$flavor])) { } elseif (!is_object($config = static::$flavors[$flavor])) {
$parser = Yii::createObject($config); $parser = Yii::createObject($config);
if (is_array($config)) { if (is_array($config)) {
foreach ($config as $name => $value) { foreach ($config as $name => $value) {
......
...@@ -70,9 +70,9 @@ class GettextMessageSource extends MessageSource ...@@ -70,9 +70,9 @@ class GettextMessageSource extends MessageSource
if ($messages === null && $fallbackMessages === null && $fallbackLanguage != $this->sourceLanguage) { if ($messages === null && $fallbackMessages === null && $fallbackLanguage != $this->sourceLanguage) {
Yii::error("The message file for category '$category' does not exist: $messageFile Fallback file does not exist as well: $fallbackMessageFile", __METHOD__); Yii::error("The message file for category '$category' does not exist: $messageFile Fallback file does not exist as well: $fallbackMessageFile", __METHOD__);
} else if (empty($messages)) { } elseif (empty($messages)) {
return $fallbackMessages; return $fallbackMessages;
} else if (!empty($fallbackMessages)) { } elseif (!empty($fallbackMessages)) {
foreach ($fallbackMessages as $key => $value) { foreach ($fallbackMessages as $key => $value) {
if (!empty($value) && empty($messages[$key])) { if (!empty($value) && empty($messages[$key])) {
$messages[$key] = $fallbackMessages[$key]; $messages[$key] = $fallbackMessages[$key];
......
...@@ -73,9 +73,9 @@ class PhpMessageSource extends MessageSource ...@@ -73,9 +73,9 @@ class PhpMessageSource extends MessageSource
if ($messages === null && $fallbackMessages === null && $fallbackLanguage != $this->sourceLanguage) { if ($messages === null && $fallbackMessages === null && $fallbackLanguage != $this->sourceLanguage) {
Yii::error("The message file for category '$category' does not exist: $messageFile Fallback file does not exist as well: $fallbackMessageFile", __METHOD__); Yii::error("The message file for category '$category' does not exist: $messageFile Fallback file does not exist as well: $fallbackMessageFile", __METHOD__);
} else if (empty($messages)) { } elseif (empty($messages)) {
return $fallbackMessages; return $fallbackMessages;
} else if (!empty($fallbackMessages)) { } elseif (!empty($fallbackMessages)) {
foreach ($fallbackMessages as $key => $value) { foreach ($fallbackMessages as $key => $value) {
if (!empty($value) && empty($messages[$key])) { if (!empty($value) && empty($messages[$key])) {
$messages[$key] = $fallbackMessages[$key]; $messages[$key] = $fallbackMessages[$key];
......
...@@ -27,7 +27,7 @@ class ElasticSearchTestCase extends TestCase ...@@ -27,7 +27,7 @@ class ElasticSearchTestCase extends TestCase
if (strpos($host, ':')===false) { if (strpos($host, ':')===false) {
$host .= ':9200'; $host .= ':9200';
} }
if(!@stream_socket_client($host, $errorNumber, $errorDescription, 0.5)) { if (!@stream_socket_client($host, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No elasticsearch server running at ' . $params['dsn'] . ' : ' . $errorNumber . ' - ' . $errorDescription); $this->markTestSkipped('No elasticsearch server running at ' . $params['dsn'] . ' : ' . $errorNumber . ' - ' . $errorDescription);
} }
......
...@@ -28,7 +28,7 @@ class RedisCacheTest extends CacheTestCase ...@@ -28,7 +28,7 @@ class RedisCacheTest extends CacheTestCase
$this->markTestSkipped('No redis server connection configured.'); $this->markTestSkipped('No redis server connection configured.');
} }
$connection = new Connection($params); $connection = new Connection($params);
if(!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) { if (!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription); $this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription);
} }
......
...@@ -21,7 +21,7 @@ abstract class RedisTestCase extends TestCase ...@@ -21,7 +21,7 @@ abstract class RedisTestCase extends TestCase
$this->markTestSkipped('No redis server connection configured.'); $this->markTestSkipped('No redis server connection configured.');
} }
$connection = new Connection($params); $connection = new Connection($params);
if(!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) { if (!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription); $this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription);
} }
......
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