Commit eaaa5b1b by AlexGx

fix code style

parent c6183fc2
......@@ -268,7 +268,7 @@ class MessageController extends Controller
{
echo "Saving messages to $fileName...";
if (is_file($fileName)) {
if($format === 'po'){
if ($format === 'po') {
$translated = file_get_contents($fileName);
preg_match_all('/(?<=msgid ").*(?="\n(#*)msgstr)/', $translated, $keys);
preg_match_all('/(?<=msgstr ").*(?="\n\n)/', $translated, $values);
......@@ -285,7 +285,7 @@ class MessageController extends Controller
$merged = [];
$untranslated = [];
foreach ($messages as $message) {
if($format === 'po'){
if ($format === 'po') {
$message = preg_replace('/\"/', '\"', $message);
}
if (array_key_exists($message, $translated) && strlen($translated[$message]) > 0) {
......@@ -317,9 +317,9 @@ class MessageController extends Controller
if (false === $overwrite) {
$fileName .= '.merged';
}
if ($format === 'po'){
if ($format === 'po') {
$output = '';
foreach ($merged as $k => $v){
foreach ($merged as $k => $v) {
$k = preg_replace('/(\")|(\\\")/', "\\\"", $k);
$v = preg_replace('/(\")|(\\\")/', "\\\"", $v);
if (substr($v, 0, 2) === '@@' && substr($v, -2) === '@@') {
......@@ -338,7 +338,7 @@ class MessageController extends Controller
if ($format === 'po') {
$merged = '';
sort($messages);
foreach($messages as $message) {
foreach ($messages as $message) {
$message = preg_replace('/(\")|(\\\")/', '\\\"', $message);
$merged .= "msgid \"$message\"\n";
$merged .= "msgstr \"\"\n";
......
......@@ -281,14 +281,14 @@ class BaseFileHelper
$options['basePath'] = realpath($dir);
// this should also be done only once
if (isset($options['except'])) {
foreach($options['except'] as $key=>$value) {
foreach ($options['except'] as $key => $value) {
if (is_string($value)) {
$options['except'][$key] = static::parseExcludePattern($value);
}
}
}
if (isset($options['only'])) {
foreach($options['only'] as $key=>$value) {
foreach ($options['only'] as $key => $value) {
if (is_string($value)) {
$options['only'][$key] = static::parseExcludePattern($value);
}
......@@ -398,7 +398,7 @@ class BaseFileHelper
if ($pattern === $baseName) {
return true;
}
} else if ($flags & self::PATTERN_ENDSWITH) {
} elseif ($flags & self::PATTERN_ENDSWITH) {
/* "*literal" matching against "fooliteral" */
$n = StringHelper::byteLength($pattern);
if (StringHelper::byteSubstr($pattern, 1, $n) === StringHelper::byteSubstr($baseName, -$n, $n)) {
......@@ -473,7 +473,7 @@ class BaseFileHelper
*/
private static function lastExcludeMatchingFromList($basePath, $path, $excludes)
{
foreach(array_reverse($excludes) as $exclude) {
foreach (array_reverse($excludes) as $exclude) {
if (is_string($exclude)) {
$exclude = self::parseExcludePattern($exclude);
}
......
......@@ -86,7 +86,7 @@ class BaseMarkdown
/** @var \cebe\markdown\Markdown $parser */
if (!isset(static::$flavors[$flavor])) {
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);
if (is_array($config)) {
foreach ($config as $name => $value) {
......
......@@ -107,10 +107,10 @@ class BaseSecurity
*/
protected static function stripPadding($data)
{
$end = StringHelper::byteSubstr($data, -1, NULL);
$end = StringHelper::byteSubstr($data, -1, null);
$last = ord($end);
$n = StringHelper::byteLength($data) - $last;
if (StringHelper::byteSubstr($data, $n, NULL) == str_repeat($end, $last)) {
if (StringHelper::byteSubstr($data, $n, null) == str_repeat($end, $last)) {
return StringHelper::byteSubstr($data, 0, $n);
}
return false;
......
......@@ -70,9 +70,9 @@ class GettextMessageSource extends MessageSource
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__);
} else if (empty($messages)) {
} elseif (empty($messages)) {
return $fallbackMessages;
} else if (!empty($fallbackMessages)) {
} elseif (!empty($fallbackMessages)) {
foreach ($fallbackMessages as $key => $value) {
if (!empty($value) && empty($messages[$key])) {
$messages[$key] = $fallbackMessages[$key];
......
......@@ -126,7 +126,7 @@ class I18N extends Component
}
$p = [];
foreach($params as $name => $value) {
foreach ($params as $name => $value) {
$p['{' . $name . '}'] = $value;
}
return strtr($message, $p);
......
......@@ -143,7 +143,7 @@ class MessageFormatter extends Component
return false;
}
$map = [];
foreach($tokens as $i => $token) {
foreach ($tokens as $i => $token) {
if (is_array($token)) {
$param = trim($token[0]);
if (!isset($map[$param])) {
......@@ -169,7 +169,7 @@ class MessageFormatter extends Component
return false;
} else {
$values = [];
foreach($result as $key => $value) {
foreach ($result as $key => $value) {
$values[$map[$key]] = $value;
}
return $values;
......@@ -190,7 +190,7 @@ class MessageFormatter extends Component
if (($tokens = self::tokenizePattern($pattern)) === false) {
return false;
}
foreach($tokens as $i => $token) {
foreach ($tokens as $i => $token) {
if (!is_array($token)) {
continue;
}
......@@ -244,7 +244,7 @@ class MessageFormatter extends Component
$this->_errorMessage = "Message pattern is invalid.";
return false;
}
foreach($tokens as $i => $token) {
foreach ($tokens as $i => $token) {
if (is_array($token)) {
if (($tokens[$i] = $this->parseToken($token, $args, $locale)) === false) {
$this->_errorCode = -1;
......
......@@ -73,9 +73,9 @@ class PhpMessageSource extends MessageSource
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__);
} else if (empty($messages)) {
} elseif (empty($messages)) {
return $fallbackMessages;
} else if (!empty($fallbackMessages)) {
} elseif (!empty($fallbackMessages)) {
foreach ($fallbackMessages as $key => $value) {
if (!empty($value) && empty($messages[$key])) {
$messages[$key] = $fallbackMessages[$key];
......
......@@ -348,5 +348,4 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
$event = new MailEvent(['message' => $message, 'isSuccessful' => $isSuccessful]);
$this->trigger(self::EVENT_AFTER_SEND, $event);
}
}
......@@ -82,4 +82,3 @@ class Fixture extends Component
{
}
}
......@@ -82,7 +82,7 @@ class AssetConverter extends Component implements AssetConverterInterface
$proc = proc_open($command, $descriptor, $pipes, $basePath);
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
foreach($pipes as $pipe) {
foreach ($pipes as $pipe) {
fclose($pipe);
}
$status = proc_close($proc);
......
......@@ -128,7 +128,7 @@ class LinkPager extends Widget
protected function registerLinkTags()
{
$view = $this->getView();
foreach($this->pagination->getLinks() as $rel => $href) {
foreach ($this->pagination->getLinks() as $rel => $href) {
$view->registerLinkTag(['rel' => $rel, 'href' => $href], $rel);
}
}
......
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