Completed
Push — master ( 6e284f...f2c220 )
by Josh
02:18
created
src/Escaper.php 2 patches
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.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -9,51 +9,51 @@
 block discarded – undo
9 9
 
10 10
 class Escaper
11 11
 {
12
-	/**
13
-	* @var array Characters to escape in a character class
14
-	*/
15
-	public $inCharacterClass = ['-' => '\\-', '\\' => '\\\\', ']' => '\\]'];
12
+    /**
13
+     * @var array Characters to escape in a character class
14
+     */
15
+    public $inCharacterClass = ['-' => '\\-', '\\' => '\\\\', ']' => '\\]'];
16 16
 
17
-	/**
18
-	* @var array Characters to escape outside of a character class
19
-	*/
20
-	public $inLiteral = [
21
-		'$'  => '\\$',  '(' => '\\(', ')' => '\\)', '*' => '\\*',
22
-		'+'  => '\\+',  '.' => '\\.', '?' => '\\?', '[' => '\\]',
23
-		'\\' => '\\\\', '^' => '\\^', '{' => '\\{', '|' => '\\|'
24
-	];
17
+    /**
18
+     * @var array Characters to escape outside of a character class
19
+     */
20
+    public $inLiteral = [
21
+        '$'  => '\\$',  '(' => '\\(', ')' => '\\)', '*' => '\\*',
22
+        '+'  => '\\+',  '.' => '\\.', '?' => '\\?', '[' => '\\]',
23
+        '\\' => '\\\\', '^' => '\\^', '{' => '\\{', '|' => '\\|'
24
+    ];
25 25
 
26
-	/**
27
-	* @param string $delimiter Delimiter used in the final regexp
28
-	*/
29
-	public function __construct($delimiter = '/')
30
-	{
31
-		foreach (str_split($delimiter, 1) as $char)
32
-		{
33
-			$this->inCharacterClass[$char] = '\\' . $char;
34
-			$this->inLiteral[$char]        = '\\' . $char;
35
-		}
36
-	}
26
+    /**
27
+     * @param string $delimiter Delimiter used in the final regexp
28
+     */
29
+    public function __construct($delimiter = '/')
30
+    {
31
+        foreach (str_split($delimiter, 1) as $char)
32
+        {
33
+            $this->inCharacterClass[$char] = '\\' . $char;
34
+            $this->inLiteral[$char]        = '\\' . $char;
35
+        }
36
+    }
37 37
 
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
-	*/
44
-	public function escapeCharacterClass($char)
45
-	{
46
-		return (isset($this->inCharacterClass[$char])) ? $this->inCharacterClass[$char] : $char;
47
-	}
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
+     */
44
+    public function escapeCharacterClass($char)
45
+    {
46
+        return (isset($this->inCharacterClass[$char])) ? $this->inCharacterClass[$char] : $char;
47
+    }
48 48
 
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
-	*/
55
-	public function escapeLiteral($char)
56
-	{
57
-		return (isset($this->inLiteral[$char])) ? $this->inLiteral[$char] : $char;
58
-	}
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
+     */
55
+    public function escapeLiteral($char)
56
+    {
57
+        return (isset($this->inLiteral[$char])) ? $this->inLiteral[$char] : $char;
58
+    }
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/GroupSingleCharacters.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,40 +9,40 @@
 block discarded – undo
9 9
 
10 10
 class GroupSingleCharacters extends AbstractPass
11 11
 {
12
-	/**
13
-	* {@inheritdoc}
14
-	*/
15
-	protected function processStrings(array $strings)
16
-	{
17
-		$singles = $this->getSingleCharStrings($strings);
18
-		$cnt     = count($singles);
19
-		if ($cnt > 1 && $cnt < count($strings))
20
-		{
21
-			// Remove the singles from the input, then prepend them as a new string
22
-			$strings = array_diff_key($strings, $singles);
23
-			array_unshift($strings, [array_values($singles)]);
24
-		}
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    protected function processStrings(array $strings)
16
+    {
17
+        $singles = $this->getSingleCharStrings($strings);
18
+        $cnt     = count($singles);
19
+        if ($cnt > 1 && $cnt < count($strings))
20
+        {
21
+            // Remove the singles from the input, then prepend them as a new string
22
+            $strings = array_diff_key($strings, $singles);
23
+            array_unshift($strings, [array_values($singles)]);
24
+        }
25 25
 
26
-		return $strings;
27
-	}
26
+        return $strings;
27
+    }
28 28
 
29
-	/**
30
-	* Return an array of every single-char string in given list of strings
31
-	*
32
-	* @param  array[] $strings
33
-	* @return array[]
34
-	*/
35
-	protected function getSingleCharStrings(array $strings)
36
-	{
37
-		$singles = [];
38
-		foreach ($strings as $k => $string)
39
-		{
40
-			if (count($string) === 1 && !is_array($string[0]))
41
-			{
42
-				$singles[$k] = $string;
43
-			}
44
-		}
29
+    /**
30
+     * Return an array of every single-char string in given list of strings
31
+     *
32
+     * @param  array[] $strings
33
+     * @return array[]
34
+     */
35
+    protected function getSingleCharStrings(array $strings)
36
+    {
37
+        $singles = [];
38
+        foreach ($strings as $k => $string)
39
+        {
40
+            if (count($string) === 1 && !is_array($string[0]))
41
+            {
42
+                $singles[$k] = $string;
43
+            }
44
+        }
45 45
 
46
-		return $singles;
47
-	}
46
+        return $singles;
47
+    }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/AbstractPass.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,61 +9,61 @@
 block discarded – undo
9 9
 
10 10
 abstract class AbstractPass implements PassInterface
11 11
 {
12
-	/**
13
-	* @var bool Whether the current set of strings is optional
14
-	*/
15
-	protected $isOptional;
12
+    /**
13
+     * @var bool Whether the current set of strings is optional
14
+     */
15
+    protected $isOptional;
16 16
 
17
-	/**
18
-	* {@inheritdoc}
19
-	*/
20
-	public function run(array $strings)
21
-	{
22
-		$strings = $this->beforeRun($strings);
23
-		$strings = $this->processStrings($strings);
24
-		$strings = $this->afterRun($strings);
17
+    /**
18
+     * {@inheritdoc}
19
+     */
20
+    public function run(array $strings)
21
+    {
22
+        $strings = $this->beforeRun($strings);
23
+        $strings = $this->processStrings($strings);
24
+        $strings = $this->afterRun($strings);
25 25
 
26
-		return $strings;
27
-	}
26
+        return $strings;
27
+    }
28 28
 
29
-	/**
30
-	* Process the list of strings after the pass is run
31
-	*
32
-	* @param  array[] $strings
33
-	* @return array[]
34
-	*/
35
-	protected function afterRun(array $strings)
36
-	{
37
-		if ($this->isOptional && $strings[0] !== [])
38
-		{
39
-			array_unshift($strings, []);
40
-		}
29
+    /**
30
+     * Process the list of strings after the pass is run
31
+     *
32
+     * @param  array[] $strings
33
+     * @return array[]
34
+     */
35
+    protected function afterRun(array $strings)
36
+    {
37
+        if ($this->isOptional && $strings[0] !== [])
38
+        {
39
+            array_unshift($strings, []);
40
+        }
41 41
 
42
-		return $strings;
43
-	}
42
+        return $strings;
43
+    }
44 44
 
45
-	/**
46
-	* Prepare the list of strings before the pass is run
47
-	*
48
-	* @param  array[] $strings
49
-	* @return array[]
50
-	*/
51
-	protected function beforeRun(array $strings)
52
-	{
53
-		$this->isOptional = (isset($strings[0]) && $strings[0] === []);
54
-		if ($this->isOptional)
55
-		{
56
-			array_shift($strings);
57
-		}
45
+    /**
46
+     * Prepare the list of strings before the pass is run
47
+     *
48
+     * @param  array[] $strings
49
+     * @return array[]
50
+     */
51
+    protected function beforeRun(array $strings)
52
+    {
53
+        $this->isOptional = (isset($strings[0]) && $strings[0] === []);
54
+        if ($this->isOptional)
55
+        {
56
+            array_shift($strings);
57
+        }
58 58
 
59
-		return $strings;
60
-	}
59
+        return $strings;
60
+    }
61 61
 
62
-	/**
63
-	* Process a given list of strings
64
-	*
65
-	* @param  array[] $strings
66
-	* @return array[]
67
-	*/
68
-	abstract protected function processStrings(array $strings);
62
+    /**
63
+     * Process a given list of strings
64
+     *
65
+     * @param  array[] $strings
66
+     * @return array[]
67
+     */
68
+    abstract protected function processStrings(array $strings);
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/PassInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@
 block discarded – undo
9 9
 
10 10
 interface PassInterface
11 11
 {
12
-	/**
13
-	* Run this pass
14
-	*
15
-	* @param  array[] $strings Original strings
16
-	* @return array[]          Modified strings
17
-	*/
18
-	public function run(array $strings);
12
+    /**
13
+     * Run this pass
14
+     *
15
+     * @param  array[] $strings Original strings
16
+     * @return array[]          Modified strings
17
+     */
18
+    public function run(array $strings);
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/Recurse.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,45 +11,45 @@
 block discarded – undo
11 11
 
12 12
 class Recurse extends AbstractPass
13 13
 {
14
-	/**
15
-	* @var Runner
16
-	*/
17
-	protected $runner;
14
+    /**
15
+     * @var Runner
16
+     */
17
+    protected $runner;
18 18
 
19
-	/**
20
-	* @param Runner $runner
21
-	*/
22
-	public function __construct(Runner $runner)
23
-	{
24
-		$this->runner = $runner;
25
-	}
19
+    /**
20
+     * @param Runner $runner
21
+     */
22
+    public function __construct(Runner $runner)
23
+    {
24
+        $this->runner = $runner;
25
+    }
26 26
 
27
-	/**
28
-	* {@inheritdoc}
29
-	*/
30
-	protected function processStrings(array $strings)
31
-	{
32
-		return array_map([$this, 'recurseString'], $strings);
33
-	}
27
+    /**
28
+     * {@inheritdoc}
29
+     */
30
+    protected function processStrings(array $strings)
31
+    {
32
+        return array_map([$this, 'recurseString'], $strings);
33
+    }
34 34
 
35
-	/**
36
-	* Recurse into given string and run all passes on each element
37
-	*
38
-	* @param  array $string
39
-	* @return array
40
-	*/
41
-	protected function recurseString(array $string)
42
-	{
43
-		$isOptional = $this->isOptional;
44
-		foreach ($string as $k => $element)
45
-		{
46
-			if (is_array($element))
47
-			{
48
-				$string[$k] = $this->runner->run($element);
49
-			}
50
-		}
51
-		$this->isOptional = $isOptional;
35
+    /**
36
+     * Recurse into given string and run all passes on each element
37
+     *
38
+     * @param  array $string
39
+     * @return array
40
+     */
41
+    protected function recurseString(array $string)
42
+    {
43
+        $isOptional = $this->isOptional;
44
+        foreach ($string as $k => $element)
45
+        {
46
+            if (is_array($element))
47
+            {
48
+                $string[$k] = $this->runner->run($element);
49
+            }
50
+        }
51
+        $this->isOptional = $isOptional;
52 52
 
53
-		return $string;
54
-	}
53
+        return $string;
54
+    }
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
src/Input/Utf8ToSurrogates.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@
 block discarded – undo
11 11
 
12 12
 class Utf8ToSurrogates extends Utf8
13 13
 {
14
-	/**
15
-	* {@inheritdoc}
16
-	*/
17
-	protected function charsToCodepoints(array $chars)
18
-	{
19
-		$codepoints = [];
20
-		foreach ($chars as $char)
21
-		{
22
-			$cp = $this->cp($char);
23
-			if ($cp < 0x10000)
24
-			{
25
-				$codepoints[] = $cp;
26
-			}
27
-			else
28
-			{
29
-				$codepoints[] = 0xD7C0 + ($cp >> 10);
30
-				$codepoints[] = 0xDC00 + ($cp & 0x3FF);
31
-			}
32
-		}
14
+    /**
15
+     * {@inheritdoc}
16
+     */
17
+    protected function charsToCodepoints(array $chars)
18
+    {
19
+        $codepoints = [];
20
+        foreach ($chars as $char)
21
+        {
22
+            $cp = $this->cp($char);
23
+            if ($cp < 0x10000)
24
+            {
25
+                $codepoints[] = $cp;
26
+            }
27
+            else
28
+            {
29
+                $codepoints[] = 0xD7C0 + ($cp >> 10);
30
+                $codepoints[] = 0xDC00 + ($cp & 0x3FF);
31
+            }
32
+        }
33 33
 
34
-		return $codepoints;
35
-	}
34
+        return $codepoints;
35
+    }
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
src/Input/Bytes.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
 
10 10
 class Bytes implements InputInterface
11 11
 {
12
-	/**
13
-	* {@inheritdoc}
14
-	*/
15
-	public function split($string)
16
-	{
17
-		if ($string === '')
18
-		{
19
-			return [];
20
-		}
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    public function split($string)
16
+    {
17
+        if ($string === '')
18
+        {
19
+            return [];
20
+        }
21 21
 
22
-		return array_map('ord', str_split($string, 1));
23
-	}
22
+        return array_map('ord', str_split($string, 1));
23
+    }
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Input/InputInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@
 block discarded – undo
9 9
 
10 10
 interface InputInterface
11 11
 {
12
-	/**
13
-	* Split given string into a list of values
14
-	*
15
-	* @param  string    $string
16
-	* @return integer[]
17
-	*/
18
-	public function split($string);
12
+    /**
13
+     * Split given string into a list of values
14
+     *
15
+     * @param  string    $string
16
+     * @return integer[]
17
+     */
18
+    public function split($string);
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
src/Runner.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -11,35 +11,35 @@
 block discarded – undo
11 11
 
12 12
 class Runner
13 13
 {
14
-	/**
15
-	* @var PassInterface[]
16
-	*/
17
-	protected $passes = [];
14
+    /**
15
+     * @var PassInterface[]
16
+     */
17
+    protected $passes = [];
18 18
 
19
-	/**
20
-	* Add a pass to the list
21
-	*
22
-	* @param  PassInterface $pass
23
-	* @return void
24
-	*/
25
-	public function addPass(PassInterface $pass)
26
-	{
27
-		$this->passes[] = $pass;
28
-	}
19
+    /**
20
+     * Add a pass to the list
21
+     *
22
+     * @param  PassInterface $pass
23
+     * @return void
24
+     */
25
+    public function addPass(PassInterface $pass)
26
+    {
27
+        $this->passes[] = $pass;
28
+    }
29 29
 
30
-	/**
31
-	* Run all passes on the list of strings
32
-	*
33
-	* @param  array[] $strings
34
-	* @return array[]
35
-	*/
36
-	public function run(array $strings)
37
-	{
38
-		foreach ($this->passes as $pass)
39
-		{
40
-			$strings = $pass->run($strings);
41
-		}
30
+    /**
31
+     * Run all passes on the list of strings
32
+     *
33
+     * @param  array[] $strings
34
+     * @return array[]
35
+     */
36
+    public function run(array $strings)
37
+    {
38
+        foreach ($this->passes as $pass)
39
+        {
40
+            $strings = $pass->run($strings);
41
+        }
42 42
 
43
-		return $strings;
44
-	}
43
+        return $strings;
44
+    }
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.