@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * MessageFormatter.php |
|
| 4 | - * |
|
| 5 | - * MIT LICENSE |
|
| 6 | - * |
|
| 7 | - * LICENSE: This source file is subject to the MIT license. |
|
| 8 | - * A copy of the licenses text was distributed alongside this |
|
| 9 | - * file (usually the repository or package root). The text can also |
|
| 10 | - * be obtained through one of the following sources: |
|
| 11 | - * * http://opensource.org/licenses/MIT |
|
| 12 | - * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | - * |
|
| 14 | - * @author suralc <[email protected]> |
|
| 15 | - * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | - */ |
|
| 3 | + * MessageFormatter.php |
|
| 4 | + * |
|
| 5 | + * MIT LICENSE |
|
| 6 | + * |
|
| 7 | + * LICENSE: This source file is subject to the MIT license. |
|
| 8 | + * A copy of the licenses text was distributed alongside this |
|
| 9 | + * file (usually the repository or package root). The text can also |
|
| 10 | + * be obtained through one of the following sources: |
|
| 11 | + * * http://opensource.org/licenses/MIT |
|
| 12 | + * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | + * |
|
| 14 | + * @author suralc <[email protected]> |
|
| 15 | + * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | + */ |
|
| 17 | 17 | namespace Pvra\Result; |
| 18 | 18 | |
| 19 | 19 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @var array |
| 48 | 48 | */ |
| 49 | - private $messageFormatters = []; |
|
| 49 | + private $messageFormatters = [ ]; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @param array|MessageLocator $locator |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if ($addDefaultFormatter) { |
| 75 | - $this->addMessageFormatter(function ($id, $format) { |
|
| 75 | + $this->addMessageFormatter(function($id, $format) { |
|
| 76 | 76 | return sprintf('%s in :%s:::%s:', $format, MessageFormatter::FORMAT_KEY_TARGET_ID, |
| 77 | 77 | MessageFormatter::FORMAT_KEY_LINE); |
| 78 | 78 | }); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | if ($addDefaultExclusiveMissingMessageLocatorHandler) { |
| 82 | - $this->getLocator()->addMissingMessageHandler(function ($id, MessageLocator $locator) { |
|
| 82 | + $this->getLocator()->addMissingMessageHandler(function($id, MessageLocator $locator) { |
|
| 83 | 83 | $locator->terminateCallbackChain(); |
| 84 | 84 | $msg = 'Message for id "%s" %s could not be found.'; |
| 85 | 85 | $desc = ''; |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | * @return mixed |
| 117 | 117 | * @throws \Exception |
| 118 | 118 | */ |
| 119 | - public function getFormattedMessageFromId($msgId, array $data = []) |
|
| 119 | + public function getFormattedMessageFromId($msgId, array $data = [ ]) |
|
| 120 | 120 | { |
| 121 | - return $this->format(['id' => $msgId, 'template' => $this->getMessageTemplate($msgId)], $data); |
|
| 121 | + return $this->format([ 'id' => $msgId, 'template' => $this->getMessageTemplate($msgId) ], $data); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | * @param bool $runUserFormatters |
| 128 | 128 | * @return mixed |
| 129 | 129 | */ |
| 130 | - public function format($messageInfo, array $data = [], $runUserFormatters = true) |
|
| 130 | + public function format($messageInfo, array $data = [ ], $runUserFormatters = true) |
|
| 131 | 131 | { |
| 132 | 132 | if (is_string($messageInfo)) { |
| 133 | - $messageInfo = ['template' => $messageInfo, 'id' => 'unknown_message_id']; |
|
| 133 | + $messageInfo = [ 'template' => $messageInfo, 'id' => 'unknown_message_id' ]; |
|
| 134 | 134 | } |
| 135 | - $data += ['id' => $messageInfo['id']]; |
|
| 135 | + $data += [ 'id' => $messageInfo[ 'id' ] ]; |
|
| 136 | 136 | if ($runUserFormatters) { |
| 137 | 137 | $this->inCallbackChain(true); |
| 138 | 138 | /** @var callable $formatter */ |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if ($this->isCallbackChainToBeTerminated()) { |
| 141 | 141 | break; |
| 142 | 142 | } |
| 143 | - $messageInfo['template'] = $formatter($messageInfo['id'], $messageInfo['template'], $this, $data); |
|
| 143 | + $messageInfo[ 'template' ] = $formatter($messageInfo[ 'id' ], $messageInfo[ 'template' ], $this, $data); |
|
| 144 | 144 | } |
| 145 | 145 | $this->markCallbackChainTerminated(); |
| 146 | 146 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | foreach ($data as $name => $value) { |
| 149 | 149 | // str_replace(array, array) would be better |
| 150 | 150 | // but this appears to be faster than iterating over the $data array and manipulating the keys |
| 151 | - $messageInfo['template'] = str_replace(':' . $name . ':', $value, $messageInfo['template']); |
|
| 151 | + $messageInfo[ 'template' ] = str_replace(':' . $name . ':', $value, $messageInfo[ 'template' ]); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - return $messageInfo['template']; |
|
| 154 | + return $messageInfo[ 'template' ]; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * ResultFileWriterException.php |
|
| 4 | - * |
|
| 5 | - * MIT LICENSE |
|
| 6 | - * |
|
| 7 | - * LICENSE: This source file is subject to the MIT license. |
|
| 8 | - * A copy of the licenses text was distributed alongside this |
|
| 9 | - * file (usually the repository or package root). The text can also |
|
| 10 | - * be obtained on one of the following sources: |
|
| 11 | - * * http://opensource.org/licenses/MIT |
|
| 12 | - * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | - * |
|
| 14 | - * @author suralc <[email protected]> |
|
| 15 | - * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | - */ |
|
| 3 | + * ResultFileWriterException.php |
|
| 4 | + * |
|
| 5 | + * MIT LICENSE |
|
| 6 | + * |
|
| 7 | + * LICENSE: This source file is subject to the MIT license. |
|
| 8 | + * A copy of the licenses text was distributed alongside this |
|
| 9 | + * file (usually the repository or package root). The text can also |
|
| 10 | + * be obtained on one of the following sources: |
|
| 11 | + * * http://opensource.org/licenses/MIT |
|
| 12 | + * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | + * |
|
| 14 | + * @author suralc <[email protected]> |
|
| 15 | + * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | + */ |
|
| 17 | 17 | |
| 18 | 18 | namespace Pvra\Result\Exceptions; |
| 19 | 19 | |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * StringAnalyser.php |
|
| 4 | - * |
|
| 5 | - * MIT LICENSE |
|
| 6 | - * |
|
| 7 | - * LICENSE: This source file is subject to the MIT license. |
|
| 8 | - * A copy of the licenses text was distributed alongside this |
|
| 9 | - * file (usually the repository or package root). The text can also |
|
| 10 | - * be obtained through one of the following sources: |
|
| 11 | - * * http://opensource.org/licenses/MIT |
|
| 12 | - * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | - * |
|
| 14 | - * @author suralc <[email protected]> |
|
| 15 | - * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | - */ |
|
| 3 | + * StringAnalyser.php |
|
| 4 | + * |
|
| 5 | + * MIT LICENSE |
|
| 6 | + * |
|
| 7 | + * LICENSE: This source file is subject to the MIT license. |
|
| 8 | + * A copy of the licenses text was distributed alongside this |
|
| 9 | + * file (usually the repository or package root). The text can also |
|
| 10 | + * be obtained through one of the following sources: |
|
| 11 | + * * http://opensource.org/licenses/MIT |
|
| 12 | + * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | + * |
|
| 14 | + * @author suralc <[email protected]> |
|
| 15 | + * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | + */ |
|
| 17 | 17 | namespace Pvra; |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * CollectionWriter.php |
|
| 4 | - * |
|
| 5 | - * MIT LICENSE |
|
| 6 | - * |
|
| 7 | - * LICENSE: This source file is subject to the MIT license. |
|
| 8 | - * A copy of the licenses text was distributed alongside this |
|
| 9 | - * file (usually the repository or package root). The text can also |
|
| 10 | - * be obtained on one of the following sources: |
|
| 11 | - * * http://opensource.org/licenses/MIT |
|
| 12 | - * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | - * |
|
| 14 | - * @author suralc <[email protected]> |
|
| 15 | - * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | - */ |
|
| 3 | + * CollectionWriter.php |
|
| 4 | + * |
|
| 5 | + * MIT LICENSE |
|
| 6 | + * |
|
| 7 | + * LICENSE: This source file is subject to the MIT license. |
|
| 8 | + * A copy of the licenses text was distributed alongside this |
|
| 9 | + * file (usually the repository or package root). The text can also |
|
| 10 | + * be obtained on one of the following sources: |
|
| 11 | + * * http://opensource.org/licenses/MIT |
|
| 12 | + * * https://github.com/suralc/pvra/blob/master/LICENSE |
|
| 13 | + * |
|
| 14 | + * @author suralc <[email protected]> |
|
| 15 | + * @license http://opensource.org/licenses/MIT MIT |
|
| 16 | + */ |
|
| 17 | 17 | |
| 18 | 18 | namespace Pvra\Result; |
| 19 | 19 | |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | Reason::GOTO_KEYWORD, |
| 100 | 100 | $node->getLine(), |
| 101 | 101 | null, |
| 102 | - ['name' => $node->name] |
|
| 102 | + [ 'name' => $node->name ] |
|
| 103 | 103 | ); |
| 104 | 104 | } elseif ($node instanceof Node\Stmt\Label) { |
| 105 | 105 | $this->getResult()->addRequirement( |
| 106 | 106 | Reason::JUMP_LABEL, |
| 107 | 107 | $node->getLine(), |
| 108 | 108 | null, |
| 109 | - ['name' => $node->name] |
|
| 109 | + [ 'name' => $node->name ] |
|
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | Reason::NAMESPACE_DECLERATION, |
| 122 | 122 | $node->getLine(), |
| 123 | 123 | null, |
| 124 | - ['name' => isset($node->name) ? $node->name->toString() : '::global::'] |
|
| 124 | + [ 'name' => isset($node->name) ? $node->name->toString() : '::global::' ] |
|
| 125 | 125 | ); |
| 126 | 126 | } elseif ($node instanceof Node\Scalar\MagicConst\Namespace_) { |
| 127 | 127 | $this->getResult()->addRequirement(Reason::NAMESPACE_MAGIC_CONSTANT, $node->getLine()); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | Reason::NAMESPACE_IMPORT, |
| 131 | 131 | $node->getLine(), |
| 132 | 132 | null, |
| 133 | - ['import_count' => count($node->uses)] |
|
| 133 | + [ 'import_count' => count($node->uses) ] |
|
| 134 | 134 | ); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | Reason::CONST_KEYWORD_DOC_SYNTAX, |
| 182 | 182 | $const->value->getLine(), |
| 183 | 183 | null, |
| 184 | - ['name' => $const->name] |
|
| 184 | + [ 'name' => $const->name ] |
|
| 185 | 185 | ); |
| 186 | 186 | } |
| 187 | 187 | } |