Completed
Push — master ( f572b2...f86bb2 )
by Josh
02:17
created
src/Escaper.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 class Escaper
11 11
 {
12 12
 	/**
13
-	* @var array Characters to escape in a character class
14
-	*/
13
+	 * @var array Characters to escape in a character class
14
+	 */
15 15
 	public $inCharacterClass = ['-' => '\\-', '\\' => '\\\\', ']' => '\\]'];
16 16
 
17 17
 	/**
18
-	* @var array Characters to escape outside of a character class
19
-	*/
18
+	 * @var array Characters to escape outside of a character class
19
+	 */
20 20
 	public $inLiteral = [
21 21
 		'$'  => '\\$',  '(' => '\\(', ')' => '\\)', '*' => '\\*',
22 22
 		'+'  => '\\+',  '.' => '\\.', '?' => '\\?', '[' => '\\]',
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	];
25 25
 
26 26
 	/**
27
-	* @param string $delimiter Delimiter used in the final regexp
28
-	*/
27
+	 * @param string $delimiter Delimiter used in the final regexp
28
+	 */
29 29
 	public function __construct($delimiter = '/')
30 30
 	{
31 31
 		foreach (str_split($delimiter, 1) as $char)
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	/**
39
-	* Escape given character to be used in a character class
40
-	*
41
-	* @param  string $char Original character
42
-	* @return string       Escaped character
43
-	*/
39
+	 * Escape given character to be used in a character class
40
+	 *
41
+	 * @param  string $char Original character
42
+	 * @return string       Escaped character
43
+	 */
44 44
 	public function escapeCharacterClass($char)
45 45
 	{
46 46
 		return (isset($this->inCharacterClass[$char])) ? $this->inCharacterClass[$char] : $char;
47 47
 	}
48 48
 
49 49
 	/**
50
-	* Escape given character to be used outside of a character class
51
-	*
52
-	* @param  string $char Original character
53
-	* @return string       Escaped character
54
-	*/
50
+	 * Escape given character to be used outside of a character class
51
+	 *
52
+	 * @param  string $char Original character
53
+	 * @return string       Escaped character
54
+	 */
55 55
 	public function escapeLiteral($char)
56 56
 	{
57 57
 		return (isset($this->inLiteral[$char])) ? $this->inLiteral[$char] : $char;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
 	* @var array Characters to escape outside of a character class
19 19
 	*/
20 20
 	public $inLiteral = [
21
-		'$'  => '\\$',  '(' => '\\(', ')' => '\\)', '*' => '\\*',
22
-		'+'  => '\\+',  '.' => '\\.', '?' => '\\?', '[' => '\\]',
21
+		'$'  => '\\$', '(' => '\\(', ')' => '\\)', '*' => '\\*',
22
+		'+'  => '\\+', '.' => '\\.', '?' => '\\?', '[' => '\\]',
23 23
 		'\\' => '\\\\', '^' => '\\^', '{' => '\\{', '|' => '\\|'
24 24
 	];
25 25
 
Please login to merge, or discard this patch.
src/Builder.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,23 +19,23 @@  discard block
 block discarded – undo
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 = $this->getConfig($config);
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	/**
49
-	* Build and return a regular expression that matches all of the given strings
50
-	*
51
-	* @param  string[] $strings Literal strings to be matched
52
-	* @return string            Regular expression (without delimiters)
53
-	*/
49
+	 * Build and return a regular expression that matches all of the given strings
50
+	 *
51
+	 * @param  string[] $strings Literal strings to be matched
52
+	 * @return string            Regular expression (without delimiters)
53
+	 */
54 54
 	public function build(array $strings)
55 55
 	{
56 56
 		$strings = array_unique($strings);
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	/**
70
-	* Build the full config array based on given input
71
-	*
72
-	* @param  array $config Sparse config
73
-	* @return array         Full config
74
-	*/
70
+	 * Build the full config array based on given input
71
+	 *
72
+	 * @param  array $config Sparse config
73
+	 * @return array         Full config
74
+	 */
75 75
 	protected function getConfig(array $config)
76 76
 	{
77 77
 		$config += [
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 
110 110
 	/**
111
-	* Split all given strings by character
112
-	*
113
-	* @param  string[] $strings List of strings
114
-	* @return array[]           List of arrays
115
-	*/
111
+	 * Split all given strings by character
112
+	 *
113
+	 * @param  string[] $strings List of strings
114
+	 * @return array[]           List of arrays
115
+	 */
116 116
 	protected function splitStrings(array $strings)
117 117
 	{
118 118
 		return array_map([$this->input, 'split'], $strings);
Please login to merge, or discard this patch.
src/Input/InputInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 interface InputInterface
11 11
 {
12 12
 	/**
13
-	* Split given string into a list of values
14
-	*
15
-	* @param  string    $string
16
-	* @return integer[]
17
-	*/
13
+	 * Split given string into a list of values
14
+	 *
15
+	 * @param  string    $string
16
+	 * @return integer[]
17
+	 */
18 18
 	public function split($string);
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
src/Input/Utf8.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 class Utf8 implements InputInterface
13 13
 {
14 14
 	/**
15
-	* {@inheritdoc}
16
-	*/
15
+	 * {@inheritdoc}
16
+	 */
17 17
 	public function split($string)
18 18
 	{
19 19
 		if (preg_match_all('(.)us', $string, $matches) === false)
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	/**
28
-	* Convert a list of UTF-8 characters to a list of Unicode codepoint
29
-	*
30
-	* @param  string[]  $chars
31
-	* @return integer[]
32
-	*/
28
+	 * Convert a list of UTF-8 characters to a list of Unicode codepoint
29
+	 *
30
+	 * @param  string[]  $chars
31
+	 * @return integer[]
32
+	 */
33 33
 	protected function charsToCodepoints(array $chars)
34 34
 	{
35 35
 		return array_map([$this, 'cp'], $chars);
36 36
 	}
37 37
 
38 38
 	/**
39
-	* Compute and return the Unicode codepoint for given UTF-8 char
40
-	*
41
-	* @param  string $char UTF-8 char
42
-	* @return integer
43
-	*/
39
+	 * Compute and return the Unicode codepoint for given UTF-8 char
40
+	 *
41
+	 * @param  string $char UTF-8 char
42
+	 * @return integer
43
+	 */
44 44
 	protected function cp($char)
45 45
 	{
46 46
 		$size = strlen($char);
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 		elseif ($size === 2)
52 52
 		{
53 53
 			$cp = ((ord($char[0]) & 0b00011111) << 6)
54
-			    |  (ord($char[1]) & 0b00111111);
54
+				|  (ord($char[1]) & 0b00111111);
55 55
 		}
56 56
 		elseif ($size === 3)
57 57
 		{
58 58
 			$cp = ((ord($char[0]) & 0b00001111) << 12)
59
-			    | ((ord($char[1]) & 0b00111111) << 6)
60
-			    |  (ord($char[2]) & 0b00111111);
59
+				| ((ord($char[1]) & 0b00111111) << 6)
60
+				|  (ord($char[2]) & 0b00111111);
61 61
 		}
62 62
 		else
63 63
 		{
64 64
 			$cp = ((ord($char[0]) & 0b00000111) << 18)
65
-			    | ((ord($char[1]) & 0b00111111) << 12)
66
-			    | ((ord($char[2]) & 0b00111111) << 6)
67
-			    |  (ord($char[3]) & 0b00111111);
65
+				| ((ord($char[1]) & 0b00111111) << 12)
66
+				| ((ord($char[2]) & 0b00111111) << 6)
67
+				|  (ord($char[3]) & 0b00111111);
68 68
 		}
69 69
 
70 70
 		return $cp;
Please login to merge, or discard this patch.
src/Runner.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,27 +12,27 @@
 block discarded – undo
12 12
 class Runner
13 13
 {
14 14
 	/**
15
-	* @var PassInterface[]
16
-	*/
15
+	 * @var PassInterface[]
16
+	 */
17 17
 	protected $passes = [];
18 18
 
19 19
 	/**
20
-	* Add a pass to the list
21
-	*
22
-	* @param  PassInterface $pass
23
-	* @return void
24
-	*/
20
+	 * Add a pass to the list
21
+	 *
22
+	 * @param  PassInterface $pass
23
+	 * @return void
24
+	 */
25 25
 	public function addPass(PassInterface $pass)
26 26
 	{
27 27
 		$this->passes[] = $pass;
28 28
 	}
29 29
 
30 30
 	/**
31
-	* Run all passes on the list of strings
32
-	*
33
-	* @param  array[] $strings
34
-	* @return array[]
35
-	*/
31
+	 * Run all passes on the list of strings
32
+	 *
33
+	 * @param  array[] $strings
34
+	 * @return array[]
35
+	 */
36 36
 	public function run(array $strings)
37 37
 	{
38 38
 		foreach ($this->passes as $pass)
Please login to merge, or discard this patch.
src/Serializer.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@  discard block
 block discarded – undo
12 12
 class Serializer
13 13
 {
14 14
 	/**
15
-	* @var Escaper
16
-	*/
15
+	 * @var Escaper
16
+	 */
17 17
 	protected $escaper;
18 18
 
19 19
 	/**
20
-	* @var OutputInterface
21
-	*/
20
+	 * @var OutputInterface
21
+	 */
22 22
 	protected $output;
23 23
 
24 24
 	/**
25
-	* @param OutputInterface $output
26
-	* @param Escaper         $escaper
27
-	*/
25
+	 * @param OutputInterface $output
26
+	 * @param Escaper         $escaper
27
+	 */
28 28
 	public function __construct(OutputInterface $output, Escaper $escaper)
29 29
 	{
30 30
 		$this->escaper = $escaper;
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	/**
35
-	* Serialize given strings into a regular expression
36
-	*
37
-	* @param  array[] $strings
38
-	* @return string
39
-	*/
35
+	 * Serialize given strings into a regular expression
36
+	 *
37
+	 * @param  array[] $strings
38
+	 * @return string
39
+	 */
40 40
 	public function serializeStrings(array $strings)
41 41
 	{
42 42
 		$info = $this->analyzeStrings($strings);
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	* Analyze given strings to determine how to serialize them
56
-	*
57
-	* The returned array may contains any of the following elements:
58
-	*
59
-	*  - (string) quantifier Either '' or '?'
60
-	*  - (array)  chars      List of values from single-char strings
61
-	*  - (array)  strings    List of multi-char strings
62
-	*
63
-	* @param  array[] $strings
64
-	* @return array
65
-	*/
55
+	 * Analyze given strings to determine how to serialize them
56
+	 *
57
+	 * The returned array may contains any of the following elements:
58
+	 *
59
+	 *  - (string) quantifier Either '' or '?'
60
+	 *  - (array)  chars      List of values from single-char strings
61
+	 *  - (array)  strings    List of multi-char strings
62
+	 *
63
+	 * @param  array[] $strings
64
+	 * @return array
65
+	 */
66 66
 	protected function analyzeStrings(array $strings)
67 67
 	{
68 68
 		$info  = ['quantifier' => ''];
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	/**
95
-	* Build the list of alternations based on given info
96
-	*
97
-	* @param  array    $info
98
-	* @return string[]
99
-	*/
95
+	 * Build the list of alternations based on given info
96
+	 *
97
+	 * @param  array    $info
98
+	 * @return string[]
99
+	 */
100 100
 	protected function buildAlternations(array $info)
101 101
 	{
102 102
 		$alternations = [];
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 
115 115
 	/**
116
-	* Get the list of ranges that cover all given values
117
-	*
118
-	* @param  integer[] $values Ordered list of values
119
-	* @return array[]           List of ranges in the form [start, end]
120
-	*/
116
+	 * Get the list of ranges that cover all given values
117
+	 *
118
+	 * @param  integer[] $values Ordered list of values
119
+	 * @return array[]           List of ranges in the form [start, end]
120
+	 */
121 121
 	protected function getRanges(array $values)
122 122
 	{
123 123
 		$i     = 0;
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 
144 144
 	/**
145
-	* Test whether a string is optional and has more than one character
146
-	*
147
-	* @param  array $info
148
-	* @return bool
149
-	*/
145
+	 * Test whether a string is optional and has more than one character
146
+	 *
147
+	 * @param  array $info
148
+	 * @return bool
149
+	 */
150 150
 	protected function isOneOptionalString(array $info)
151 151
 	{
152 152
 		// Test whether the first string has a quantifier and more than one element
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	/**
157
-	* Serialize a given list of values into a character class
158
-	*
159
-	* @param  integer[] $values
160
-	* @return string
161
-	*/
157
+	 * Serialize a given list of values into a character class
158
+	 *
159
+	 * @param  integer[] $values
160
+	 * @return string
161
+	 */
162 162
 	protected function serializeCharacterClass(array $values)
163 163
 	{
164 164
 		$expr = '[';
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 	/**
183
-	* Serialize a given string into a regular expression
184
-	*
185
-	* @param  array  $string
186
-	* @return string
187
-	*/
183
+	 * Serialize a given string into a regular expression
184
+	 *
185
+	 * @param  array  $string
186
+	 * @return string
187
+	 */
188 188
 	protected function serializeString(array $string)
189 189
 	{
190 190
 		$expr = '';
Please login to merge, or discard this patch.
src/Output/JavaScript.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Output/PrintableAscii.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 abstract class PrintableAscii implements OutputInterface
11 11
 {
12 12
 	/**
13
-	* {@inheritdoc}
14
-	*/
13
+	 * {@inheritdoc}
14
+	 */
15 15
 	public function output($value)
16 16
 	{
17 17
 		if ($value < 32)
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	/**
31
-	* Escape given ASCII codepoint
32
-	*
33
-	* @param  integer $cp
34
-	* @return string
35
-	*/
31
+	 * Escape given ASCII codepoint
32
+	 *
33
+	 * @param  integer $cp
34
+	 * @return string
35
+	 */
36 36
 	protected function escapeAscii($cp)
37 37
 	{
38 38
 		return '\\x' . sprintf('%02X', $cp);
39 39
 	}
40 40
 
41 41
 	/**
42
-	* Escape given control code
43
-	*
44
-	* @param  integer $cp
45
-	* @return string
46
-	*/
42
+	 * Escape given control code
43
+	 *
44
+	 * @param  integer $cp
45
+	 * @return string
46
+	 */
47 47
 	protected function escapeControlCode($cp)
48 48
 	{
49 49
 		$table = [9 => '\\t', 10 => '\\n', 13 => '\\r'];
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	* Output the representation of a unicode character
56
-	*
57
-	* @param  integer $cp Unicode codepoint
58
-	* @return string
59
-	*/
55
+	 * Output the representation of a unicode character
56
+	 *
57
+	 * @param  integer $cp Unicode codepoint
58
+	 * @return string
59
+	 */
60 60
 	abstract protected function escapeUnicode($cp);
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
src/Output/OutputInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 interface OutputInterface
11 11
 {
12 12
 	/**
13
-	* Serialize a value into a character
14
-	*
15
-	* @param  integer $value
16
-	* @return string
17
-	*/
13
+	 * Serialize a value into a character
14
+	 *
15
+	 * @param  integer $value
16
+	 * @return string
17
+	 */
18 18
 	public function output($value);
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.