Completed
Push — master ( 74dde8...83c363 )
by Thomas
02:00
created
src/parser/PrettyPrinter.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@  discard block
 block discarded – undo
7 7
 class PrettyPrinter extends Standard {
8 8
 	
9 9
  /**
10
-     * Pretty prints an array of nodes (statements) and indents them optionally.
11
-     *
12
-     * @param Node[] $nodes  Array of nodes
13
-     * @param bool   $indent Whether to indent the printed nodes
14
-     *
15
-     * @return string Pretty printed statements
16
-     */
17
-    protected function pStmts(array $nodes, $indent = true) {
18
-        $result = '';
10
+  * Pretty prints an array of nodes (statements) and indents them optionally.
11
+  *
12
+  * @param Node[] $nodes  Array of nodes
13
+  * @param bool   $indent Whether to indent the printed nodes
14
+  *
15
+  * @return string Pretty printed statements
16
+  */
17
+	protected function pStmts(array $nodes, $indent = true) {
18
+		$result = '';
19 19
 	   $nodeBefore = NULL;
20
-        foreach ($nodes as $node) {
21
-            $comments = $node->getAttribute('comments', array());
22
-            if ($comments) {
23
-                $result .= "\n" . $this->pComments($comments);
24
-                if ($node instanceof Stmt\Nop) {
25
-                    continue;
26
-                }
27
-            }
20
+		foreach ($nodes as $node) {
21
+			$comments = $node->getAttribute('comments', array());
22
+			if ($comments) {
23
+				$result .= "\n" . $this->pComments($comments);
24
+				if ($node instanceof Stmt\Nop) {
25
+					continue;
26
+				}
27
+			}
28 28
 		  
29 29
 		  if ($nodeBefore && $nodeBefore->getLine() && $node->getLine()) {
30 30
 			  $diff = $node->getLine()- $nodeBefore->getLine();
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 			  }
34 34
 		  }
35 35
 		  
36
-            $result .= "\n" . $this->p($node) . ($node instanceof Expr ? ';' : '');
36
+			$result .= "\n" . $this->p($node) . ($node instanceof Expr ? ';' : '');
37 37
 		  $nodeBefore = $node;
38
-        }
38
+		}
39 39
 
40 40
 	   if ($indent) {
41
-            return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n    ", $result);
42
-        } else {
43
-            return $result;
44
-        }
45
-    }
41
+			return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n    ", $result);
42
+		} else {
43
+			return $result;
44
+		}
45
+	}
46 46
     
47 47
 	public function pExpr_Array(Array_ $node) {
48 48
 		return '[' . $this->pCommaSeparated($node->items) . ']';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
             }
28 28
 		  
29 29
 		  if ($nodeBefore && $nodeBefore->getLine() && $node->getLine()) {
30
-			  $diff = $node->getLine()- $nodeBefore->getLine();
30
+			  $diff = $node->getLine() - $nodeBefore->getLine();
31 31
 			  if ($diff > 0) {
32 32
 				  $result .= str_repeat("\n", $diff - 1);
33 33
 			  }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      */
17 17
     protected function pStmts(array $nodes, $indent = true) {
18 18
         $result = '';
19
-	   $nodeBefore = NULL;
19
+	   $nodeBefore = null;
20 20
         foreach ($nodes as $node) {
21 21
             $comments = $node->getAttribute('comments', array());
22 22
             if ($comments) {
Please login to merge, or discard this patch.