Completed
Push — master ( f68f3b...859d26 )
by Josh
02:07
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/JavaScript.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 JavaScript extends PrintableAscii
11 11
 {
12
-	/** {@inheritdoc} */
13
-	protected $maxValue = 0xFFFF;
12
+    /** {@inheritdoc} */
13
+    protected $maxValue = 0xFFFF;
14 14
 
15
-	/**
16
-	* {@inheritdoc}
17
-	*/
18
-	protected function escapeUnicode($cp)
19
-	{
20
-		return sprintf('\\u%04X', $cp);
21
-	}
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    protected function escapeUnicode($cp)
19
+    {
20
+        return sprintf('\\u%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 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	{
29 29
 		if ($value < $this->minValue || $value > $this->maxValue)
30 30
 		{
31
-			throw new InvalidArgumentException('Value ' . $value  .' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
31
+			throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
32 32
 		}
33 33
 
34 34
 		return $this->outputValidValue($value);
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.