Passed
Push — master ( b75b16...d31021 )
by Sebastian
02:13
created
src/Mailcode/Variables.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
 {
23 23
     const REGEX_VARIABLE_NAME = '/\$\s*([A-Z0-9_]+)\s*\.\s*([A-Z0-9_]+)|\$\s*([A-Z0-9_]+)/six';
24 24
     
25
-   /**
26
-    * @var Mailcode_Variables_Collection_Regular
27
-    */
25
+    /**
26
+     * @var Mailcode_Variables_Collection_Regular
27
+     */
28 28
     protected $collection;
29 29
     
30
-   /**
31
-    * Parses the specified string to find all variable names contained within, if any.
32
-    * 
33
-    * @param string $subject
34
-    * @return Mailcode_Variables_Collection_Regular
35
-    */
30
+    /**
31
+     * Parses the specified string to find all variable names contained within, if any.
32
+     * 
33
+     * @param string $subject
34
+     * @return Mailcode_Variables_Collection_Regular
35
+     */
36 36
     public function parseString(string $subject) : Mailcode_Variables_Collection_Regular
37 37
     {
38 38
         $this->collection = new Mailcode_Variables_Collection_Regular();
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         $matches = array();
41 41
         preg_match_all(self::REGEX_VARIABLE_NAME, $subject, $matches, PREG_PATTERN_ORDER);
42 42
         
43
-        if(!isset($matches[0]) || empty($matches[0]))
43
+        if (!isset($matches[0]) || empty($matches[0]))
44 44
         {
45 45
             return $this->collection;
46 46
         }
47 47
         
48
-        foreach($matches[0] as $idx => $matchedText)
48
+        foreach ($matches[0] as $idx => $matchedText)
49 49
         {
50
-            if(!empty($matches[3][$idx]))
50
+            if (!empty($matches[3][$idx]))
51 51
             {
52 52
                 $this->addSingle($matches[3][$idx], $matchedText);
53 53
             }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     protected function addSingle(string $name, string $matchedText) : void
64 64
     {
65 65
         // ignore US style numbers like $451
66
-        if(is_numeric($name))
66
+        if (is_numeric($name))
67 67
         {
68 68
             return;
69 69
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     protected function addPathed(string $path, string $name, string $matchedText) : void
75 75
     {
76 76
         // ignore US style numbers like $45.12
77
-        if(is_numeric($path.'.'.$name))
77
+        if (is_numeric($path.'.'.$name))
78 78
         {
79 79
             return;
80 80
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
             if(!empty($matches[3][$idx]))
51 51
             {
52 52
                 $this->addSingle($matches[3][$idx], $matchedText);
53
-            }
54
-            else 
53
+            } else 
55 54
             {
56 55
                 $this->addPathed($matches[1][$idx], $matches[2][$idx], $matchedText);
57 56
             }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $params = $command->getParams();
26 26
         
27
-        if($params)
27
+        if ($params)
28 28
         {
29 29
             return sprintf(
30 30
                 '#elseif(%s)',
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $params = $command->getParams();
46 46
     
47
-        if($params)
47
+        if ($params)
48 48
         {
49 49
             return sprintf(
50 50
                 '#if(%s)',
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $params = $command->getParams();
66 66
         
67
-        if($params)
67
+        if ($params)
68 68
         {
69 69
             return sprintf(
70 70
                 '#for(%s)',
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $params = $command->getParams();
81 81
         
82
-        if($params)
82
+        if ($params)
83 83
         {
84 84
             return sprintf(
85 85
                 '#set(%s)',
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 {
24 24
     const ERROR_UNKNOWN_COMMAND_TYPE = 50401;
25 25
     
26
-   /**
27
-    * Retrieves the syntax' type ID, e.g. "ApacheVelocity".
28
-    * @return string
29
-    */
26
+    /**
27
+     * Retrieves the syntax' type ID, e.g. "ApacheVelocity".
28
+     * @return string
29
+     */
30 30
     public function getTypeID() : string
31 31
     {
32 32
         $parts = explode('_', get_class($this));
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
         return array_pop($parts);
35 35
     }
36 36
     
37
-   /**
38
-    * Translates a single command to the target syntax.
39
-    * 
40
-    * @param Mailcode_Commands_Command $command
41
-    * @throws Mailcode_Translator_Exception
42
-    * @return string
43
-    */
37
+    /**
38
+     * Translates a single command to the target syntax.
39
+     * 
40
+     * @param Mailcode_Commands_Command $command
41
+     * @throws Mailcode_Translator_Exception
42
+     * @return string
43
+     */
44 44
     public function translateCommand(Mailcode_Commands_Command $command) : string
45 45
     {
46 46
         $id = $command->getID();
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
         return $this->$method($command);
64 64
     }
65 65
     
66
-   /**
67
-    * Translates all safeguarded commands in the subject string to the 
68
-    * target syntax in one go.
69
-    * 
70
-    * @param Mailcode_Parser_Safeguard $safeguard
71
-    * @return string
72
-    */
66
+    /**
67
+     * Translates all safeguarded commands in the subject string to the 
68
+     * target syntax in one go.
69
+     * 
70
+     * @param Mailcode_Parser_Safeguard $safeguard
71
+     * @return string
72
+     */
73 73
     public function translateSafeguard(Mailcode_Parser_Safeguard $safeguard) : string
74 74
     {
75 75
         $subject = $safeguard->makeSafe();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         
48 48
         $method = '_translate'.$id;
49 49
         
50
-        if(!method_exists($this, $method))
50
+        if (!method_exists($this, $method))
51 51
         {
52 52
             throw new Mailcode_Translator_Exception(
53 53
                 'Unknown command type in translator',
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $subject = $safeguard->makeSafe();
76 76
         
77
-        if(!$safeguard->hasPlaceholders())
77
+        if (!$safeguard->hasPlaceholders())
78 78
         {
79 79
             return $subject;
80 80
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         
84 84
         $replaces = array();
85 85
         
86
-        foreach($placeholders as $placeholder)
86
+        foreach ($placeholders as $placeholder)
87 87
         {
88 88
             $replaces[$placeholder->getReplacementText()] = $this->translateCommand($placeholder->getCommand());
89 89
         }
Please login to merge, or discard this patch.
src/Mailcode.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -26,51 +26,51 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class Mailcode
28 28
 {
29
-   /**
30
-    * @var Mailcode_Parser|NULL
31
-    */
29
+    /**
30
+     * @var Mailcode_Parser|NULL
31
+     */
32 32
     protected $parser = null;
33 33
     
34
-   /**
35
-    * @var Mailcode_Commands|NULL
36
-    */
34
+    /**
35
+     * @var Mailcode_Commands|NULL
36
+     */
37 37
     protected $commands = null;
38 38
     
39
-   /**
40
-    * @var Mailcode_Variables|NULL
41
-    */
39
+    /**
40
+     * @var Mailcode_Variables|NULL
41
+     */
42 42
     protected $variables = null;
43 43
     
44
-   /**
45
-    * @var Mailcode_Translator|NULL
46
-    */
44
+    /**
45
+     * @var Mailcode_Translator|NULL
46
+     */
47 47
     protected $translator = null;
48 48
     
49
-   /**
50
-    * Creates a new mailcode instance.
51
-    * @return Mailcode
52
-    */
49
+    /**
50
+     * Creates a new mailcode instance.
51
+     * @return Mailcode
52
+     */
53 53
     public static function create() : Mailcode
54 54
     {
55 55
         return new Mailcode();
56 56
     }
57 57
     
58
-   /**
59
-    * Parses the string to detect all commands contained within.
60
-    * 
61
-    * @param string $string
62
-    * @return Mailcode_Collection
63
-    */
58
+    /**
59
+     * Parses the string to detect all commands contained within.
60
+     * 
61
+     * @param string $string
62
+     * @return Mailcode_Collection
63
+     */
64 64
     public function parseString(string $string) : Mailcode_Collection
65 65
     {
66 66
         return $this->getParser()->parseString($string);
67 67
     }
68 68
     
69
-   /**
70
-    * Retrieves the string parser instance used to detect commands.
71
-    * 
72
-    * @return Mailcode_Parser
73
-    */
69
+    /**
70
+     * Retrieves the string parser instance used to detect commands.
71
+     * 
72
+     * @return Mailcode_Parser
73
+     */
74 74
     public function getParser() : Mailcode_Parser
75 75
     {
76 76
         if(!isset($this->parser)) 
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
         return $this->parser;
82 82
     }
83 83
     
84
-   /**
85
-    * Retrieves the commands collection, which is used to
86
-    * access information on the available commands.
87
-    * 
88
-    * @return Mailcode_Commands
89
-    */
84
+    /**
85
+     * Retrieves the commands collection, which is used to
86
+     * access information on the available commands.
87
+     * 
88
+     * @return Mailcode_Commands
89
+     */
90 90
     public function getCommands() : Mailcode_Commands
91 91
     {
92 92
         if(!isset($this->commands)) 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
         return $this->getParser()->createSafeguard($subject);
103 103
     }
104 104
     
105
-   /**
106
-    * Attempts to find all variables in the target string.
107
-    * 
108
-    * @param string $subject
109
-    * @return Mailcode_Variables_Collection_Regular
110
-    */
105
+    /**
106
+     * Attempts to find all variables in the target string.
107
+     * 
108
+     * @param string $subject
109
+     * @return Mailcode_Variables_Collection_Regular
110
+     */
111 111
     public function findVariables(string $subject) : Mailcode_Variables_Collection_Regular
112 112
     {
113 113
         return $this->createVariables()->parseString($subject);
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
         return $this->variables;
124 124
     }
125 125
     
126
-   /**
127
-    * Creates the translator, which can be used to convert commands
128
-    * to another supported syntax.
129
-    * 
130
-    * @return Mailcode_Translator
131
-    */
126
+    /**
127
+     * Creates the translator, which can be used to convert commands
128
+     * to another supported syntax.
129
+     * 
130
+     * @return Mailcode_Translator
131
+     */
132 132
     public function createTranslator() : Mailcode_Translator
133 133
     {
134 134
         if(!isset($this->translator))
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     */
74 74
     public function getParser() : Mailcode_Parser
75 75
     {
76
-        if(!isset($this->parser)) 
76
+        if (!isset($this->parser)) 
77 77
         {
78 78
             $this->parser = new Mailcode_Parser($this);
79 79
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     */
90 90
     public function getCommands() : Mailcode_Commands
91 91
     {
92
-        if(!isset($this->commands)) 
92
+        if (!isset($this->commands)) 
93 93
         {
94 94
             $this->commands = new Mailcode_Commands();
95 95
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     
116 116
     public function createVariables() : Mailcode_Variables
117 117
     {
118
-        if(!isset($this->variables))
118
+        if (!isset($this->variables))
119 119
         {
120 120
             $this->variables = new Mailcode_Variables();
121 121
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     */
132 132
     public function createTranslator() : Mailcode_Translator
133 133
     {
134
-        if(!isset($this->translator))
134
+        if (!isset($this->translator))
135 135
         {
136 136
             $this->translator = new Mailcode_Translator(); 
137 137
         }
Please login to merge, or discard this patch.