@@ -12,8 +12,8 @@ |
||
| 12 | 12 | class JavaScript extends PrintableAscii |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * {@inheritdoc} |
|
| 16 | - */ |
|
| 15 | + * {@inheritdoc} |
|
| 16 | + */ |
|
| 17 | 17 | public function escapeUnicode($cp) |
| 18 | 18 | { |
| 19 | 19 | if ($cp > 0xFFFF) |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | class JavaScript extends PrintableAscii |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * {@inheritdoc} |
|
| 16 | - */ |
|
| 15 | + * {@inheritdoc} |
|
| 16 | + */ |
|
| 17 | 17 | public function escapeUnicode($cp) |
| 18 | 18 | { |
| 19 | 19 | if ($cp > 0xFFFF) |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | class JavaScript extends PrintableAscii |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * {@inheritdoc} |
|
| 16 | - */ |
|
| 15 | + * {@inheritdoc} |
|
| 16 | + */ |
|
| 17 | 17 | public function escapeUnicode($cp) |
| 18 | 18 | { |
| 19 | 19 | if ($cp > 0xFFFF) |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | class JavaScript extends PrintableAscii |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * {@inheritdoc} |
|
| 16 | - */ |
|
| 15 | + * {@inheritdoc} |
|
| 16 | + */ |
|
| 17 | 17 | public function escapeUnicode($cp) |
| 18 | 18 | { |
| 19 | 19 | if ($cp > 0xFFFF) |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | class MergePrefix extends AbstractPass |
| 11 | 11 | { |
| 12 | 12 | /** |
| 13 | - * {@inheritdoc} |
|
| 14 | - */ |
|
| 13 | + * {@inheritdoc} |
|
| 14 | + */ |
|
| 15 | 15 | protected function processStrings(array $strings) |
| 16 | 16 | { |
| 17 | 17 | $newStrings = []; |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Get the number of leading elements common to all given strings |
|
| 28 | - * |
|
| 29 | - * @param array[] $strings |
|
| 30 | - * @return integer |
|
| 31 | - */ |
|
| 27 | + * Get the number of leading elements common to all given strings |
|
| 28 | + * |
|
| 29 | + * @param array[] $strings |
|
| 30 | + * @return integer |
|
| 31 | + */ |
|
| 32 | 32 | protected function getPrefixLength(array $strings) |
| 33 | 33 | { |
| 34 | 34 | $len = 1; |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Return given strings grouped by their first element |
|
| 46 | - * |
|
| 47 | - * NOTE: assumes that this pass is run before the first element of any string could be replaced |
|
| 48 | - * |
|
| 49 | - * @param array[] $strings |
|
| 50 | - * @return array[] |
|
| 51 | - */ |
|
| 45 | + * Return given strings grouped by their first element |
|
| 46 | + * |
|
| 47 | + * NOTE: assumes that this pass is run before the first element of any string could be replaced |
|
| 48 | + * |
|
| 49 | + * @param array[] $strings |
|
| 50 | + * @return array[] |
|
| 51 | + */ |
|
| 52 | 52 | protected function getStringsByPrefix(array $strings) |
| 53 | 53 | { |
| 54 | 54 | $byPrefix = []; |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Merge given strings into a new single string |
|
| 65 | - * |
|
| 66 | - * @param array[] $strings |
|
| 67 | - * @return array |
|
| 68 | - */ |
|
| 64 | + * Merge given strings into a new single string |
|
| 65 | + * |
|
| 66 | + * @param array[] $strings |
|
| 67 | + * @return array |
|
| 68 | + */ |
|
| 69 | 69 | protected function mergeStrings(array $strings) |
| 70 | 70 | { |
| 71 | 71 | $len = $this->getPrefixLength($strings); |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | - * Test whether all given strings' elements match at given position |
|
| 83 | - * |
|
| 84 | - * @param array[] $strings |
|
| 85 | - * @param integer $pos |
|
| 86 | - * @return bool |
|
| 87 | - */ |
|
| 82 | + * Test whether all given strings' elements match at given position |
|
| 83 | + * |
|
| 84 | + * @param array[] $strings |
|
| 85 | + * @param integer $pos |
|
| 86 | + * @return bool |
|
| 87 | + */ |
|
| 88 | 88 | protected function stringsMatch(array $strings, $pos) |
| 89 | 89 | { |
| 90 | 90 | $value = $strings[0][$pos]; |
@@ -12,18 +12,18 @@ discard block |
||
| 12 | 12 | abstract class BaseImplementation implements OutputInterface |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * @var integer |
|
| 16 | - */ |
|
| 15 | + * @var integer |
|
| 16 | + */ |
|
| 17 | 17 | protected $maxValue = 0; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var integer |
|
| 21 | - */ |
|
| 20 | + * @var integer |
|
| 21 | + */ |
|
| 22 | 22 | protected $minValue = 0; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * {@inheritdoc} |
|
| 26 | - */ |
|
| 25 | + * {@inheritdoc} |
|
| 26 | + */ |
|
| 27 | 27 | public function output($value) |
| 28 | 28 | { |
| 29 | 29 | if ($value < $this->minValue || $value > $this->maxValue) |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Serialize a valid value into a character |
|
| 39 | - * |
|
| 40 | - * @param integer $value |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 38 | + * Serialize a valid value into a character |
|
| 39 | + * |
|
| 40 | + * @param integer $value |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | 43 | abstract protected function outputValidValue($value); |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | protected $maxValue = 0x10FFFF; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * {@inheritdoc} |
|
| 17 | - */ |
|
| 16 | + * {@inheritdoc} |
|
| 17 | + */ |
|
| 18 | 18 | protected function outputValidValue($value) |
| 19 | 19 | { |
| 20 | 20 | if ($value < 0x80) |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | if ($value < 0x10000) |
| 29 | 29 | { |
| 30 | 30 | return chr(0xE0 | ($value >> 12)) |
| 31 | - . chr(0x80 | (($value >> 6) & 0x3F)) |
|
| 32 | - . chr(0x80 | ($value & 0x3F)); |
|
| 31 | + . chr(0x80 | (($value >> 6) & 0x3F)) |
|
| 32 | + . chr(0x80 | ($value & 0x3F)); |
|
| 33 | 33 | } |
| 34 | 34 | return chr(0xF0 | ($value >> 18)) |
| 35 | - . chr(0x80 | (($value >> 12) & 0x3F)) |
|
| 36 | - . chr(0x80 | (($value >> 6) & 0x3F)) |
|
| 37 | - . chr(0x80 | ($value & 0x3F)); |
|
| 35 | + . chr(0x80 | (($value >> 12) & 0x3F)) |
|
| 36 | + . chr(0x80 | (($value >> 6) & 0x3F)) |
|
| 37 | + . chr(0x80 | ($value & 0x3F)); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -19,23 +19,23 @@ discard block |
||
| 19 | 19 | class Builder |
| 20 | 20 | { |
| 21 | 21 | /** |
| 22 | - * @var InputInterface |
|
| 23 | - */ |
|
| 22 | + * @var InputInterface |
|
| 23 | + */ |
|
| 24 | 24 | protected $input; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * @var Runner |
|
| 28 | - */ |
|
| 27 | + * @var Runner |
|
| 28 | + */ |
|
| 29 | 29 | protected $runner; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @var Serializer |
|
| 33 | - */ |
|
| 32 | + * @var Serializer |
|
| 33 | + */ |
|
| 34 | 34 | protected $serializer; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * @param array $config |
|
| 38 | - */ |
|
| 37 | + * @param array $config |
|
| 38 | + */ |
|
| 39 | 39 | public function __construct(array $config = []) |
| 40 | 40 | { |
| 41 | 41 | $config += [ |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Build and return a regular expression that matches all of the given strings |
|
| 54 | - * |
|
| 55 | - * @param string[] $strings Literal strings to be matched |
|
| 56 | - * @return string Regular expression (without delimiters) |
|
| 57 | - */ |
|
| 53 | + * Build and return a regular expression that matches all of the given strings |
|
| 54 | + * |
|
| 55 | + * @param string[] $strings Literal strings to be matched |
|
| 56 | + * @return string Regular expression (without delimiters) |
|
| 57 | + */ |
|
| 58 | 58 | public function build(array $strings) |
| 59 | 59 | { |
| 60 | 60 | $strings = array_unique($strings); |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * Compare two split strings |
|
| 75 | - * |
|
| 76 | - * Will sort strings in ascending order |
|
| 77 | - * |
|
| 78 | - * @param integer[] $a |
|
| 79 | - * @param integer[] $b |
|
| 80 | - * @return integer |
|
| 81 | - */ |
|
| 74 | + * Compare two split strings |
|
| 75 | + * |
|
| 76 | + * Will sort strings in ascending order |
|
| 77 | + * |
|
| 78 | + * @param integer[] $a |
|
| 79 | + * @param integer[] $b |
|
| 80 | + * @return integer |
|
| 81 | + */ |
|
| 82 | 82 | protected function compareStrings(array $a, array $b) |
| 83 | 83 | { |
| 84 | 84 | $i = -1; |
@@ -95,22 +95,22 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * Test whether the list of strings is empty |
|
| 99 | - * |
|
| 100 | - * @param string[] $strings |
|
| 101 | - * @return bool |
|
| 102 | - */ |
|
| 98 | + * Test whether the list of strings is empty |
|
| 99 | + * |
|
| 100 | + * @param string[] $strings |
|
| 101 | + * @return bool |
|
| 102 | + */ |
|
| 103 | 103 | protected function isEmpty(array $strings) |
| 104 | 104 | { |
| 105 | 105 | return (empty($strings) || $strings === ['']); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | - * Set the InputInterface instance in $this->input |
|
| 110 | - * |
|
| 111 | - * @param string $inputType |
|
| 112 | - * @return void |
|
| 113 | - */ |
|
| 109 | + * Set the InputInterface instance in $this->input |
|
| 110 | + * |
|
| 111 | + * @param string $inputType |
|
| 112 | + * @return void |
|
| 113 | + */ |
|
| 114 | 114 | protected function setInput($inputType) |
| 115 | 115 | { |
| 116 | 116 | $className = __NAMESPACE__ . '\\Input\\' . $inputType; |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | - * Set the Runner instance $in this->runner |
|
| 122 | - * |
|
| 123 | - * @return void |
|
| 124 | - */ |
|
| 121 | + * Set the Runner instance $in this->runner |
|
| 122 | + * |
|
| 123 | + * @return void |
|
| 124 | + */ |
|
| 125 | 125 | protected function setRunner() |
| 126 | 126 | { |
| 127 | 127 | $this->runner = new Runner; |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | - * Set the Serializer instance in $this->serializer |
|
| 138 | - * |
|
| 139 | - * @param string $outputType |
|
| 140 | - * @param string $delimiter |
|
| 141 | - * @return void |
|
| 142 | - */ |
|
| 137 | + * Set the Serializer instance in $this->serializer |
|
| 138 | + * |
|
| 139 | + * @param string $outputType |
|
| 140 | + * @param string $delimiter |
|
| 141 | + * @return void |
|
| 142 | + */ |
|
| 143 | 143 | protected function setSerializer($outputType, $delimiter) |
| 144 | 144 | { |
| 145 | 145 | $className = __NAMESPACE__ . '\\Output\\' . $outputType; |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | - * Split all given strings by character |
|
| 154 | - * |
|
| 155 | - * @param string[] $strings List of strings |
|
| 156 | - * @return array[] List of arrays |
|
| 157 | - */ |
|
| 153 | + * Split all given strings by character |
|
| 154 | + * |
|
| 155 | + * @param string[] $strings List of strings |
|
| 156 | + * @return array[] List of arrays |
|
| 157 | + */ |
|
| 158 | 158 | protected function splitStrings(array $strings) |
| 159 | 159 | { |
| 160 | 160 | return array_map([$this->input, 'split'], $strings); |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | abstract class AbstractPass implements PassInterface |
| 11 | 11 | { |
| 12 | 12 | /** |
| 13 | - * @var bool Whether the current set of strings is optional |
|
| 14 | - */ |
|
| 13 | + * @var bool Whether the current set of strings is optional |
|
| 14 | + */ |
|
| 15 | 15 | protected $isOptional; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * {@inheritdoc} |
|
| 19 | - */ |
|
| 18 | + * {@inheritdoc} |
|
| 19 | + */ |
|
| 20 | 20 | public function run(array $strings) |
| 21 | 21 | { |
| 22 | 22 | $strings = $this->beforeRun($strings); |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Process the list of strings after the pass is run |
|
| 34 | - * |
|
| 35 | - * @param array[] $strings |
|
| 36 | - * @return array[] |
|
| 37 | - */ |
|
| 33 | + * Process the list of strings after the pass is run |
|
| 34 | + * |
|
| 35 | + * @param array[] $strings |
|
| 36 | + * @return array[] |
|
| 37 | + */ |
|
| 38 | 38 | protected function afterRun(array $strings) |
| 39 | 39 | { |
| 40 | 40 | if ($this->isOptional && $strings[0] !== []) |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Prepare the list of strings before the pass is run |
|
| 50 | - * |
|
| 51 | - * @param array[] $strings |
|
| 52 | - * @return array[] |
|
| 53 | - */ |
|
| 49 | + * Prepare the list of strings before the pass is run |
|
| 50 | + * |
|
| 51 | + * @param array[] $strings |
|
| 52 | + * @return array[] |
|
| 53 | + */ |
|
| 54 | 54 | protected function beforeRun(array $strings) |
| 55 | 55 | { |
| 56 | 56 | $this->isOptional = (isset($strings[0]) && $strings[0] === []); |
@@ -63,21 +63,21 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * Test whether this pass can be run on a given list of strings |
|
| 67 | - * |
|
| 68 | - * @param array[] $strings |
|
| 69 | - * @return bool |
|
| 70 | - */ |
|
| 66 | + * Test whether this pass can be run on a given list of strings |
|
| 67 | + * |
|
| 68 | + * @param array[] $strings |
|
| 69 | + * @return bool |
|
| 70 | + */ |
|
| 71 | 71 | protected function canRun(array $strings) |
| 72 | 72 | { |
| 73 | 73 | return true; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | - * Run this pass on a list of strings |
|
| 78 | - * |
|
| 79 | - * @param array[] $strings |
|
| 80 | - * @return array[] |
|
| 81 | - */ |
|
| 77 | + * Run this pass on a list of strings |
|
| 78 | + * |
|
| 79 | + * @param array[] $strings |
|
| 80 | + * @return array[] |
|
| 81 | + */ |
|
| 82 | 82 | abstract protected function runPass(array $strings); |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |