Completed
Push — master ( e8252c...0ac2b6 )
by Josh
02:40
created
src/Output/PrintableAscii.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -9,53 +9,53 @@
 block discarded – undo
9 9
 
10 10
 abstract class PrintableAscii extends BaseImplementation
11 11
 {
12
-	/**
13
-	* {@inheritdoc}
14
-	*/
15
-	protected function outputValidValue($value)
16
-	{
17
-		if ($value < 32)
18
-		{
19
-			return $this->escapeControlCode($value);
20
-		}
21
-
22
-		if ($value < 127)
23
-		{
24
-			return chr($value);
25
-		}
26
-
27
-		return ($value > 255) ? $this->escapeUnicode($value) : $this->escapeAscii($value);
28
-	}
29
-
30
-	/**
31
-	* Escape given ASCII codepoint
32
-	*
33
-	* @param  integer $cp
34
-	* @return string
35
-	*/
36
-	protected function escapeAscii($cp)
37
-	{
38
-		return '\\x' . sprintf('%02X', $cp);
39
-	}
40
-
41
-	/**
42
-	* Escape given control code
43
-	*
44
-	* @param  integer $cp
45
-	* @return string
46
-	*/
47
-	protected function escapeControlCode($cp)
48
-	{
49
-		$table = [9 => '\\t', 10 => '\\n', 13 => '\\r'];
50
-
51
-		return (isset($table[$cp])) ? $table[$cp] : $this->escapeAscii($cp);
52
-	}
53
-
54
-	/**
55
-	* Output the representation of a unicode character
56
-	*
57
-	* @param  integer $cp Unicode codepoint
58
-	* @return string
59
-	*/
60
-	abstract protected function escapeUnicode($cp);
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    protected function outputValidValue($value)
16
+    {
17
+        if ($value < 32)
18
+        {
19
+            return $this->escapeControlCode($value);
20
+        }
21
+
22
+        if ($value < 127)
23
+        {
24
+            return chr($value);
25
+        }
26
+
27
+        return ($value > 255) ? $this->escapeUnicode($value) : $this->escapeAscii($value);
28
+    }
29
+
30
+    /**
31
+     * Escape given ASCII codepoint
32
+     *
33
+     * @param  integer $cp
34
+     * @return string
35
+     */
36
+    protected function escapeAscii($cp)
37
+    {
38
+        return '\\x' . sprintf('%02X', $cp);
39
+    }
40
+
41
+    /**
42
+     * Escape given control code
43
+     *
44
+     * @param  integer $cp
45
+     * @return string
46
+     */
47
+    protected function escapeControlCode($cp)
48
+    {
49
+        $table = [9 => '\\t', 10 => '\\n', 13 => '\\r'];
50
+
51
+        return (isset($table[$cp])) ? $table[$cp] : $this->escapeAscii($cp);
52
+    }
53
+
54
+    /**
55
+     * Output the representation of a unicode character
56
+     *
57
+     * @param  integer $cp Unicode codepoint
58
+     * @return string
59
+     */
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/Utf8.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -9,31 +9,31 @@
 block discarded – undo
9 9
 
10 10
 class Utf8 extends BaseImplementation
11 11
 {
12
-	/** {@inheritdoc} */
13
-	protected $maxValue = 0x10FFFF;
12
+    /** {@inheritdoc} */
13
+    protected $maxValue = 0x10FFFF;
14 14
 
15
-	/**
16
-	* {@inheritdoc}
17
-	*/
18
-	protected function outputValidValue($value)
19
-	{
20
-		if ($value < 0x80)
21
-		{
22
-			return chr($value);
23
-		}
24
-		if ($value < 0x800)
25
-		{
26
-			return chr(0xC0 | ($value >> 6)) . chr(0x80 | ($value & 0x3F));
27
-		}
28
-		if ($value < 0x10000)
29
-		{
30
-			return chr(0xE0 | ($value >> 12))
31
-			     . chr(0x80 | (($value >> 6) & 0x3F))
32
-			     . chr(0x80 | ($value & 0x3F));
33
-		}
34
-		return chr(0xF0 | ($value >> 18))
35
-		     . chr(0x80 | (($value >> 12) & 0x3F))
36
-		     . chr(0x80 | (($value >> 6) & 0x3F))
37
-		     . chr(0x80 | ($value & 0x3F));
38
-	}
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    protected function outputValidValue($value)
19
+    {
20
+        if ($value < 0x80)
21
+        {
22
+            return chr($value);
23
+        }
24
+        if ($value < 0x800)
25
+        {
26
+            return chr(0xC0 | ($value >> 6)) . chr(0x80 | ($value & 0x3F));
27
+        }
28
+        if ($value < 0x10000)
29
+        {
30
+            return chr(0xE0 | ($value >> 12))
31
+                    . chr(0x80 | (($value >> 6) & 0x3F))
32
+                    . chr(0x80 | ($value & 0x3F));
33
+        }
34
+        return chr(0xF0 | ($value >> 18))
35
+                . chr(0x80 | (($value >> 12) & 0x3F))
36
+                . chr(0x80 | (($value >> 6) & 0x3F))
37
+                . chr(0x80 | ($value & 0x3F));
38
+    }
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
src/Output/Bytes.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
9 9
 
10 10
 class Bytes extends BaseImplementation
11 11
 {
12
-	/** {@inheritdoc} */
13
-	protected $maxValue = 255;
12
+    /** {@inheritdoc} */
13
+    protected $maxValue = 255;
14 14
 
15
-	/**
16
-	* {@inheritdoc}
17
-	*/
18
-	protected function outputValidValue($value)
19
-	{
20
-		return chr($value);
21
-	}
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    protected function outputValidValue($value)
19
+    {
20
+        return chr($value);
21
+    }
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/Output/PHP.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
9 9
 
10 10
 class PHP extends PrintableAscii
11 11
 {
12
-	/** {@inheritdoc} */
13
-	protected $maxValue = 0x10FFFF;
12
+    /** {@inheritdoc} */
13
+    protected $maxValue = 0x10FFFF;
14 14
 
15
-	/**
16
-	* {@inheritdoc}
17
-	*/
18
-	protected function escapeUnicode($cp)
19
-	{
20
-		return sprintf('\\x{%04X}', $cp);
21
-	}
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    protected function escapeUnicode($cp)
19
+    {
20
+        return sprintf('\\x{%04X}', $cp);
21
+    }
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/Output/BaseImplementation.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,34 +11,34 @@
 block discarded – undo
11 11
 
12 12
 abstract class BaseImplementation implements OutputInterface
13 13
 {
14
-	/**
15
-	* @var integer
16
-	*/
17
-	protected $maxValue = 0;
14
+    /**
15
+     * @var integer
16
+     */
17
+    protected $maxValue = 0;
18 18
 
19
-	/**
20
-	* @var integer
21
-	*/
22
-	protected $minValue = 0;
19
+    /**
20
+     * @var integer
21
+     */
22
+    protected $minValue = 0;
23 23
 
24
-	/**
25
-	* {@inheritdoc}
26
-	*/
27
-	public function output($value)
28
-	{
29
-		if ($value < $this->minValue || $value > $this->maxValue)
30
-		{
31
-			throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
32
-		}
24
+    /**
25
+     * {@inheritdoc}
26
+     */
27
+    public function output($value)
28
+    {
29
+        if ($value < $this->minValue || $value > $this->maxValue)
30
+        {
31
+            throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
32
+        }
33 33
 
34
-		return $this->outputValidValue($value);
35
-	}
34
+        return $this->outputValidValue($value);
35
+    }
36 36
 
37
-	/**
38
-	* Serialize a valid value into a character
39
-	*
40
-	* @param  integer $value
41
-	* @return string
42
-	*/
43
-	abstract protected function outputValidValue($value);
37
+    /**
38
+     * Serialize a valid value into a character
39
+     *
40
+     * @param  integer $value
41
+     * @return string
42
+     */
43
+    abstract protected function outputValidValue($value);
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/MergePrefix.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -9,93 +9,93 @@
 block discarded – undo
9 9
 
10 10
 class MergePrefix extends AbstractPass
11 11
 {
12
-	/**
13
-	* {@inheritdoc}
14
-	*/
15
-	protected function processStrings(array $strings)
16
-	{
17
-		$newStrings = [];
18
-		foreach ($this->getStringsByPrefix($strings) as $prefix => $strings)
19
-		{
20
-			$newStrings[] = (isset($strings[1])) ? $this->mergeStrings($strings) : $strings[0];
21
-		}
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    protected function processStrings(array $strings)
16
+    {
17
+        $newStrings = [];
18
+        foreach ($this->getStringsByPrefix($strings) as $prefix => $strings)
19
+        {
20
+            $newStrings[] = (isset($strings[1])) ? $this->mergeStrings($strings) : $strings[0];
21
+        }
22 22
 
23
-		return $newStrings;
24
-	}
23
+        return $newStrings;
24
+    }
25 25
 
26
-	/**
27
-	* Get the number of leading elements common to all given strings
28
-	*
29
-	* @param  array[] $strings
30
-	* @return integer
31
-	*/
32
-	protected function getPrefixLength(array $strings)
33
-	{
34
-		$len = 1;
35
-		$cnt = count($strings[0]);
36
-		while ($len < $cnt && $this->stringsMatch($strings, $len))
37
-		{
38
-			++$len;
39
-		}
26
+    /**
27
+     * Get the number of leading elements common to all given strings
28
+     *
29
+     * @param  array[] $strings
30
+     * @return integer
31
+     */
32
+    protected function getPrefixLength(array $strings)
33
+    {
34
+        $len = 1;
35
+        $cnt = count($strings[0]);
36
+        while ($len < $cnt && $this->stringsMatch($strings, $len))
37
+        {
38
+            ++$len;
39
+        }
40 40
 
41
-		return $len;
42
-	}
41
+        return $len;
42
+    }
43 43
 
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
-	*/
52
-	protected function getStringsByPrefix(array $strings)
53
-	{
54
-		$byPrefix = [];
55
-		foreach ($strings as $string)
56
-		{
57
-			$byPrefix[$string[0]][] = $string;
58
-		}
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
+     */
52
+    protected function getStringsByPrefix(array $strings)
53
+    {
54
+        $byPrefix = [];
55
+        foreach ($strings as $string)
56
+        {
57
+            $byPrefix[$string[0]][] = $string;
58
+        }
59 59
 
60
-		return $byPrefix;
61
-	}
60
+        return $byPrefix;
61
+    }
62 62
 
63
-	/**
64
-	* Merge given strings into a new single string
65
-	*
66
-	* @param  array[] $strings
67
-	* @return array
68
-	*/
69
-	protected function mergeStrings(array $strings)
70
-	{
71
-		$len       = $this->getPrefixLength($strings);
72
-		$newString = array_slice($strings[0], 0, $len);
73
-		foreach ($strings as $string)
74
-		{
75
-			$newString[$len][] = array_slice($string, $len);
76
-		}
63
+    /**
64
+     * Merge given strings into a new single string
65
+     *
66
+     * @param  array[] $strings
67
+     * @return array
68
+     */
69
+    protected function mergeStrings(array $strings)
70
+    {
71
+        $len       = $this->getPrefixLength($strings);
72
+        $newString = array_slice($strings[0], 0, $len);
73
+        foreach ($strings as $string)
74
+        {
75
+            $newString[$len][] = array_slice($string, $len);
76
+        }
77 77
 
78
-		return $newString;
79
-	}
78
+        return $newString;
79
+    }
80 80
 
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
-	*/
88
-	protected function stringsMatch(array $strings, $pos)
89
-	{
90
-		$value = $strings[0][$pos];
91
-		foreach ($strings as $string)
92
-		{
93
-			if (!isset($string[$pos]) || $string[$pos] !== $value)
94
-			{
95
-				return false;
96
-			}
97
-		}
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
+     */
88
+    protected function stringsMatch(array $strings, $pos)
89
+    {
90
+        $value = $strings[0][$pos];
91
+        foreach ($strings as $string)
92
+        {
93
+            if (!isset($string[$pos]) || $string[$pos] !== $value)
94
+            {
95
+                return false;
96
+            }
97
+        }
98 98
 
99
-		return true;
100
-	}
99
+        return true;
100
+    }
101 101
 }
102 102
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/MergeSuffix.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -9,80 +9,80 @@
 block discarded – undo
9 9
 
10 10
 class MergeSuffix extends AbstractPass
11 11
 {
12
-	/**
13
-	* {@inheritdoc}
14
-	*/
15
-	protected function processStrings(array $strings)
16
-	{
17
-		if (!$this->isEligible($strings))
18
-		{
19
-			return $strings;
20
-		}
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    protected function processStrings(array $strings)
16
+    {
17
+        if (!$this->isEligible($strings))
18
+        {
19
+            return $strings;
20
+        }
21 21
 
22
-		$newString = [];
23
-		while ($this->hasMatchingSuffix($strings))
24
-		{
25
-			array_unshift($newString, end($strings[0]));
26
-			$strings = $this->pop($strings);
27
-		}
28
-		array_unshift($newString, $strings);
22
+        $newString = [];
23
+        while ($this->hasMatchingSuffix($strings))
24
+        {
25
+            array_unshift($newString, end($strings[0]));
26
+            $strings = $this->pop($strings);
27
+        }
28
+        array_unshift($newString, $strings);
29 29
 
30
-		return [$newString];
31
-	}
30
+        return [$newString];
31
+    }
32 32
 
33
-	/**
34
-	* Test whether all given strings have the same last element
35
-	*
36
-	* @param  array[] $strings
37
-	* @return bool
38
-	*/
39
-	protected function hasMatchingSuffix(array $strings)
40
-	{
41
-		$suffix = end($strings[1]);
42
-		foreach ($strings as $string)
43
-		{
44
-			if (end($string) !== $suffix)
45
-			{
46
-				return false;
47
-			}
48
-		}
33
+    /**
34
+     * Test whether all given strings have the same last element
35
+     *
36
+     * @param  array[] $strings
37
+     * @return bool
38
+     */
39
+    protected function hasMatchingSuffix(array $strings)
40
+    {
41
+        $suffix = end($strings[1]);
42
+        foreach ($strings as $string)
43
+        {
44
+            if (end($string) !== $suffix)
45
+            {
46
+                return false;
47
+            }
48
+        }
49 49
 
50
-		return ($suffix !== false);
51
-	}
50
+        return ($suffix !== false);
51
+    }
52 52
 
53
-	/**
54
-	* Test whether this pass can be run on given list of strings
55
-	*
56
-	* @param  array[] $strings
57
-	* @return bool
58
-	*/
59
-	protected function isEligible(array $strings)
60
-	{
61
-		return (count($strings) > 1 && $this->hasMatchingSuffix($strings));
62
-	}
53
+    /**
54
+     * Test whether this pass can be run on given list of strings
55
+     *
56
+     * @param  array[] $strings
57
+     * @return bool
58
+     */
59
+    protected function isEligible(array $strings)
60
+    {
61
+        return (count($strings) > 1 && $this->hasMatchingSuffix($strings));
62
+    }
63 63
 
64
-	/**
65
-	* Remove the last element of every string
66
-	*
67
-	* @param  array[] $strings Original strings
68
-	* @return array[]          Processed strings
69
-	*/
70
-	protected function pop(array $strings)
71
-	{
72
-		$cnt = count($strings);
73
-		$i   = $cnt;
74
-		while (--$i >= 0)
75
-		{
76
-			array_pop($strings[$i]);
77
-		}
64
+    /**
65
+     * Remove the last element of every string
66
+     *
67
+     * @param  array[] $strings Original strings
68
+     * @return array[]          Processed strings
69
+     */
70
+    protected function pop(array $strings)
71
+    {
72
+        $cnt = count($strings);
73
+        $i   = $cnt;
74
+        while (--$i >= 0)
75
+        {
76
+            array_pop($strings[$i]);
77
+        }
78 78
 
79
-		// Remove empty elements then prepend one back at the start of the array if applicable
80
-		$strings = array_filter($strings);
81
-		if (count($strings) < $cnt)
82
-		{
83
-			array_unshift($strings, []);
84
-		}
79
+        // Remove empty elements then prepend one back at the start of the array if applicable
80
+        $strings = array_filter($strings);
81
+        if (count($strings) < $cnt)
82
+        {
83
+            array_unshift($strings, []);
84
+        }
85 85
 
86
-		return $strings;
87
-	}
86
+        return $strings;
87
+    }
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
src/Passes/CoalesceSingleCharacterPrefix.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -9,67 +9,67 @@
 block discarded – undo
9 9
 
10 10
 class CoalesceSingleCharacterPrefix extends AbstractPass
11 11
 {
12
-	/**
13
-	* {@inheritdoc}
14
-	*/
15
-	protected function processStrings(array $strings)
16
-	{
17
-		$newStrings = [];
18
-		foreach ($this->getEligibleKeys($strings) as $keys)
19
-		{
20
-			// Create a new string to hold the merged strings and replace the first element with
21
-			// an empty character class
22
-			$newString    = $strings[$keys[0]];
23
-			$newString[0] = [];
24
-			foreach ($keys as $key)
25
-			{
26
-				$newString[0][] = [$strings[$key][0]];
27
-				unset($strings[$key]);
28
-			}
29
-			$newStrings[] = $newString;
30
-		}
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    protected function processStrings(array $strings)
16
+    {
17
+        $newStrings = [];
18
+        foreach ($this->getEligibleKeys($strings) as $keys)
19
+        {
20
+            // Create a new string to hold the merged strings and replace the first element with
21
+            // an empty character class
22
+            $newString    = $strings[$keys[0]];
23
+            $newString[0] = [];
24
+            foreach ($keys as $key)
25
+            {
26
+                $newString[0][] = [$strings[$key][0]];
27
+                unset($strings[$key]);
28
+            }
29
+            $newStrings[] = $newString;
30
+        }
31 31
 
32
-		return array_merge($newStrings, $strings);
33
-	}
32
+        return array_merge($newStrings, $strings);
33
+    }
34 34
 
35
-	/**
36
-	* Filter the list of eligible keys and keep those that have at least two matches
37
-	*
38
-	* @param  array[] $eligibleKeys List of lists of keys
39
-	* @return array[]
40
-	*/
41
-	protected function filterEligibleKeys(array $eligibleKeys)
42
-	{
43
-		$filteredKeys = [];
44
-		foreach ($eligibleKeys as $k => $keys)
45
-		{
46
-			if (count($keys) > 1)
47
-			{
48
-				$filteredKeys[] = $keys;
49
-			}
50
-		}
35
+    /**
36
+     * Filter the list of eligible keys and keep those that have at least two matches
37
+     *
38
+     * @param  array[] $eligibleKeys List of lists of keys
39
+     * @return array[]
40
+     */
41
+    protected function filterEligibleKeys(array $eligibleKeys)
42
+    {
43
+        $filteredKeys = [];
44
+        foreach ($eligibleKeys as $k => $keys)
45
+        {
46
+            if (count($keys) > 1)
47
+            {
48
+                $filteredKeys[] = $keys;
49
+            }
50
+        }
51 51
 
52
-		return $filteredKeys;
53
-	}
52
+        return $filteredKeys;
53
+    }
54 54
 
55
-	/**
56
-	* Get a list of keys of strings eligible to be merged together, grouped by suffix
57
-	*
58
-	* @param  array[] $strings
59
-	* @return array[]
60
-	*/
61
-	protected function getEligibleKeys(array $strings)
62
-	{
63
-		$eligibleKeys = [];
64
-		foreach ($strings as $k => $string)
65
-		{
66
-			if (!is_array($string[0]) && isset($string[1]))
67
-			{
68
-				$suffix = serialize(array_slice($string, 1));
69
-				$eligibleKeys[$suffix][] = $k;
70
-			}
71
-		}
55
+    /**
56
+     * Get a list of keys of strings eligible to be merged together, grouped by suffix
57
+     *
58
+     * @param  array[] $strings
59
+     * @return array[]
60
+     */
61
+    protected function getEligibleKeys(array $strings)
62
+    {
63
+        $eligibleKeys = [];
64
+        foreach ($strings as $k => $string)
65
+        {
66
+            if (!is_array($string[0]) && isset($string[1]))
67
+            {
68
+                $suffix = serialize(array_slice($string, 1));
69
+                $eligibleKeys[$suffix][] = $k;
70
+            }
71
+        }
72 72
 
73
-		return $this->filterEligibleKeys($eligibleKeys);
74
-	}
73
+        return $this->filterEligibleKeys($eligibleKeys);
74
+    }
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/Input/Utf8.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -11,52 +11,52 @@
 block discarded – undo
11 11
 
12 12
 class Utf8 implements InputInterface
13 13
 {
14
-	/**
15
-	* {@inheritdoc}
16
-	*/
17
-	public function split($string)
18
-	{
19
-		if (preg_match_all('(.)us', $string, $matches) === false)
20
-		{
21
-			throw new InvalidArgumentException('Invalid UTF-8 string');
22
-		}
14
+    /**
15
+     * {@inheritdoc}
16
+     */
17
+    public function split($string)
18
+    {
19
+        if (preg_match_all('(.)us', $string, $matches) === false)
20
+        {
21
+            throw new InvalidArgumentException('Invalid UTF-8 string');
22
+        }
23 23
 
24
-		return $this->charsToCodepoints($matches[0]);
25
-	}
24
+        return $this->charsToCodepoints($matches[0]);
25
+    }
26 26
 
27
-	/**
28
-	* Convert a list of UTF-8 characters to a list of Unicode codepoint
29
-	*
30
-	* @param  string[]  $chars
31
-	* @return integer[]
32
-	*/
33
-	protected function charsToCodepoints(array $chars)
34
-	{
35
-		return array_map([$this, 'cp'], $chars);
36
-	}
27
+    /**
28
+     * Convert a list of UTF-8 characters to a list of Unicode codepoint
29
+     *
30
+     * @param  string[]  $chars
31
+     * @return integer[]
32
+     */
33
+    protected function charsToCodepoints(array $chars)
34
+    {
35
+        return array_map([$this, 'cp'], $chars);
36
+    }
37 37
 
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
-	*/
44
-	protected function cp($char)
45
-	{
46
-		$cp = ord($char[0]);
47
-		if ($cp >= 0xF0)
48
-		{
49
-			$cp = ($cp << 18) + (ord($char[1]) << 12) + (ord($char[2]) << 6) + ord($char[3]) - 0x3C82080;
50
-		}
51
-		elseif ($cp >= 0xE0)
52
-		{
53
-			$cp = ($cp << 12) + (ord($char[1]) << 6) + ord($char[2]) - 0xE2080;
54
-		}
55
-		elseif ($cp >= 0xC0)
56
-		{
57
-			$cp = ($cp << 6) + ord($char[1]) - 0x3080;
58
-		}
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
+     */
44
+    protected function cp($char)
45
+    {
46
+        $cp = ord($char[0]);
47
+        if ($cp >= 0xF0)
48
+        {
49
+            $cp = ($cp << 18) + (ord($char[1]) << 12) + (ord($char[2]) << 6) + ord($char[3]) - 0x3C82080;
50
+        }
51
+        elseif ($cp >= 0xE0)
52
+        {
53
+            $cp = ($cp << 12) + (ord($char[1]) << 6) + ord($char[2]) - 0xE2080;
54
+        }
55
+        elseif ($cp >= 0xC0)
56
+        {
57
+            $cp = ($cp << 6) + ord($char[1]) - 0x3080;
58
+        }
59 59
 
60
-		return $cp;
61
-	}
60
+        return $cp;
61
+    }
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.