Passed
Push — master ( e7c89c...d9a062 )
by Sebastian
06:11 queued 12s
created
src/Mailcode/Parser/Statement.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
     public const VALIDATION_EMPTY = 48801;
27 27
     public const VALIDATION_UNQUOTED_STRING_LITERALS = 48802;
28 28
     
29
-   /**
30
-    * @var string
31
-    */
29
+    /**
30
+     * @var string
31
+     */
32 32
     protected string $statement;
33 33
     
34
-   /**
35
-    * @var OperationResult
36
-    */
34
+    /**
35
+     * @var OperationResult
36
+     */
37 37
     protected OperationResult $result;
38 38
     
39
-   /**
40
-    * @var Mailcode_Parser_Statement_Tokenizer
41
-    */
39
+    /**
40
+     * @var Mailcode_Parser_Statement_Tokenizer
41
+     */
42 42
     protected Mailcode_Parser_Statement_Tokenizer $tokenizer;
43 43
     
44
-   /**
45
-    * @var Mailcode_Parser_Statement_Info|NULL
46
-    */
44
+    /**
45
+     * @var Mailcode_Parser_Statement_Info|NULL
46
+     */
47 47
     protected ?Mailcode_Parser_Statement_Info $info = null;
48 48
 
49 49
     /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         if($unknown)
139 139
         {
140 140
             $this->result->makeError(
141
-               t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
141
+                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
142 142
                 self::VALIDATION_UNQUOTED_STRING_LITERALS
143 143
             );
144 144
         }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     private ?Mailcode_Commands_Command $sourceCommand = null;
58 58
 
59
-    public function __construct(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null)
59
+    public function __construct(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null)
60 60
     {
61 61
         $this->sourceCommand = $sourceCommand;
62 62
         $this->statement = $this->prepareStatement($statement);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     
107 107
     public function getInfo() : Mailcode_Parser_Statement_Info
108 108
     {
109
-        if($this->info instanceof Mailcode_Parser_Statement_Info)
109
+        if ($this->info instanceof Mailcode_Parser_Statement_Info)
110 110
         {
111 111
             return $this->info; 
112 112
         }
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
     
119 119
     protected function validate() : void
120 120
     {
121
-        if($this->freeform)
121
+        if ($this->freeform)
122 122
         {
123 123
             return;
124 124
         }
125 125
 
126
-        if(!$this->tokenizer->hasTokens())
126
+        if (!$this->tokenizer->hasTokens())
127 127
         {
128 128
             $this->result->makeError(
129 129
                 t('Empty statement'),
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         
136 136
         $unknown = $this->tokenizer->getFirstUnknown();
137 137
         
138
-        if($unknown)
138
+        if ($unknown)
139 139
         {
140 140
             $this->result->makeError(
141 141
                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
Please login to merge, or discard this patch.
src/Mailcode/Parser/PreParser/CommandDef.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,11 +139,11 @@
 block discarded – undo
139 139
         $commands = $parser->getCommands();
140 140
         $content = $this->getContent();
141 141
 
142
-        foreach($commands as $command)
142
+        foreach ($commands as $command)
143 143
         {
144 144
             $string = $command->getOpeningText();
145 145
 
146
-            if(strpos($content, $string) !== false)
146
+            if (strpos($content, $string) !== false)
147 147
             {
148 148
                 $this->addEscapeError($command, $collection);
149 149
                 return false;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/PlaceholderCollection.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function getByIndex(int $index) : Mailcode_Parser_Safeguard_Placeholder
41 41
     {
42
-        if(isset($this->placeholders[$index]))
42
+        if (isset($this->placeholders[$index]))
43 43
         {
44 44
             return $this->placeholders[$index];
45 45
         }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function getByCommand(Mailcode_Commands_Command $command) : Mailcode_Parser_Safeguard_Placeholder
55 55
     {
56
-        foreach($this->placeholders as $placeholder)
56
+        foreach ($this->placeholders as $placeholder)
57 57
         {
58
-            if($placeholder->getCommand() === $command)
58
+            if ($placeholder->getCommand() === $command)
59 59
             {
60 60
                 return $placeholder;
61 61
             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getByID(int $id) : Mailcode_Parser_Safeguard_Placeholder
79 79
     {
80
-        foreach($this->placeholders as $placeholder)
80
+        foreach ($this->placeholders as $placeholder)
81 81
         {
82
-            if($placeholder->getID() === $id)
82
+            if ($placeholder->getID() === $id)
83 83
             {
84 84
                 return $placeholder;
85 85
             }
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function getByString(string $string) : Mailcode_Parser_Safeguard_Placeholder
106 106
     {
107
-        foreach($this->placeholders as $placeholder)
107
+        foreach ($this->placeholders as $placeholder)
108 108
         {
109
-            if($placeholder->getReplacementText() === $string)
109
+            if ($placeholder->getReplacementText() === $string)
110 110
             {
111 111
                 return $placeholder;
112 112
             }
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function getStrings() : array
131 131
     {
132
-        if(is_array($this->placeholderStrings))
132
+        if (is_array($this->placeholderStrings))
133 133
         {
134 134
             return $this->placeholderStrings;
135 135
         }
136 136
 
137 137
         $this->placeholderStrings = array();
138 138
 
139
-        foreach($this->placeholders as $placeholder)
139
+        foreach ($this->placeholders as $placeholder)
140 140
         {
141 141
             $this->placeholderStrings[] = $placeholder->getReplacementText();
142 142
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
      */
36 36
     private ?Mailcode_Factory_CommandSets_Set_Misc $misc = null;
37 37
     
38
-   /**
39
-    * @var Mailcode_Factory_CommandSets_Set_Set|NULL
40
-    */
38
+    /**
39
+     * @var Mailcode_Factory_CommandSets_Set_Set|NULL
40
+     */
41 41
     private ?Mailcode_Factory_CommandSets_Set_Set $set = null;
42 42
     
43
-   /**
44
-    * @var Mailcode_Factory_CommandSets_Set_ElseIf|NULL
45
-    */
43
+    /**
44
+     * @var Mailcode_Factory_CommandSets_Set_ElseIf|NULL
45
+     */
46 46
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
47 47
     
48 48
     public function if() : Mailcode_Factory_CommandSets_Set_If
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     */
46 46
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
47 47
     
48
-    public function if() : Mailcode_Factory_CommandSets_Set_If
48
+    public function if () : Mailcode_Factory_CommandSets_Set_If
49 49
     {
50
-        if(!isset($this->if))
50
+        if (!isset($this->if))
51 51
         {
52 52
             $this->if = new Mailcode_Factory_CommandSets_Set_If();
53 53
         }
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         return $this->if;
56 56
     }
57 57
     
58
-    public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
58
+    public function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
59 59
     {
60
-        if(!isset($this->elseIf))
60
+        if (!isset($this->elseIf))
61 61
         {
62 62
             $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf();
63 63
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     
68 68
     public function show() : Mailcode_Factory_CommandSets_Set_Show
69 69
     {
70
-        if(!isset($this->show))
70
+        if (!isset($this->show))
71 71
         {
72 72
             $this->show = new Mailcode_Factory_CommandSets_Set_Show();
73 73
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     
78 78
     public function misc() : Mailcode_Factory_CommandSets_Set_Misc
79 79
     {
80
-        if(!isset($this->misc))
80
+        if (!isset($this->misc))
81 81
         {
82 82
             $this->misc = new Mailcode_Factory_CommandSets_Set_Misc();
83 83
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     public function set() : Mailcode_Factory_CommandSets_Set_Set
89 89
     {
90
-        if(!isset($this->set))
90
+        if (!isset($this->set))
91 91
         {
92 92
             $this->set = new Mailcode_Factory_CommandSets_Set_Set();
93 93
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/Validation/NoHTML.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
         $keywords = $this->params->getInfo()->getKeywords();
40 40
 
41
-        foreach($keywords as $keyword)
41
+        foreach ($keywords as $keyword)
42 42
         {
43
-            if($keyword->isNoHTML())
43
+            if ($keyword->isNoHTML())
44 44
             {
45 45
                 $this->noHTMLToken = $keyword;
46 46
                 break;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @return $this
56 56
      * @throws Mailcode_Exception
57 57
      */
58
-    public function setHTMLEnabled(bool $enabled=true) : self
58
+    public function setHTMLEnabled(bool $enabled = true) : self
59 59
     {
60 60
         $this->params->getInfo()->setKeywordEnabled(Mailcode_Commands_Keywords::TYPE_NOHTML, !$enabled);
61 61
 
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     public const ERROR_UNKNOWN_COMMAND_TYPE = 50401;
25 25
     public const ERROR_INVALID_COMMAND_INSTANCE = 50402;
26 26
     
27
-   /**
28
-    * @var string
29
-    */
27
+    /**
28
+     * @var string
29
+     */
30 30
     protected string $typeID;
31 31
     
32 32
     public function __construct(string $typeID)
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
         $this->typeID = $typeID;
35 35
     }
36 36
     
37
-   /**
38
-    * Retrieves the syntax' type ID, e.g. "ApacheVelocity".
39
-    * @return string
40
-    */
37
+    /**
38
+     * Retrieves the syntax' type ID, e.g. "ApacheVelocity".
39
+     * @return string
40
+     */
41 41
     public function getTypeID() : string
42 42
     {
43 43
         return $this->typeID;
44 44
     }
45 45
     
46
-   /**
47
-    * Translates a single command to the target syntax.
48
-    * 
49
-    * @param Mailcode_Commands_Command $command
50
-    * @throws Mailcode_Translator_Exception
51
-    * @return string
52
-    */
46
+    /**
47
+     * Translates a single command to the target syntax.
48
+     * 
49
+     * @param Mailcode_Commands_Command $command
50
+     * @throws Mailcode_Translator_Exception
51
+     * @return string
52
+     */
53 53
     public function translateCommand(Mailcode_Commands_Command $command) : string
54 54
     {
55 55
         return $this->createTranslator($command)->translate($command);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $command->getID()
64 64
         );
65 65
 
66
-        if(!class_exists($class))
66
+        if (!class_exists($class))
67 67
         {
68 68
             $class = sprintf(
69 69
                 'Mailcode\Translator\Syntax\%s\%s',
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             );
73 73
         }
74 74
         
75
-        if(!class_exists($class))
75
+        if (!class_exists($class))
76 76
         {
77 77
             throw new Mailcode_Translator_Exception(
78 78
                 sprintf('Unknown command %s in translator', $command->getID()),
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         
87 87
         $translator = new $class($command);
88 88
 
89
-        if($translator instanceof Mailcode_Translator_Command)
89
+        if ($translator instanceof Mailcode_Translator_Command)
90 90
         {
91 91
             return $translator;
92 92
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $subject = $safeguard->makeSafe();
116 116
         
117
-        if(!$safeguard->hasPlaceholders())
117
+        if (!$safeguard->hasPlaceholders())
118 118
         {
119 119
             return $subject;
120 120
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         
124 124
         $replaces = array();
125 125
         
126
-        foreach($placeholders as $placeholder)
126
+        foreach ($placeholders as $placeholder)
127 127
         {
128 128
             $command = $placeholder->getCommand();
129 129
 
Please login to merge, or discard this patch.
src/Mailcode/Factory.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
     public const URL_ENCODING_DECODE = 'decode';
29 29
 
30 30
     /**
31
-    * @var Mailcode_Factory_CommandSets|NULL
32
-    */
31
+     * @var Mailcode_Factory_CommandSets|NULL
32
+     */
33 33
     private static ?Mailcode_Factory_CommandSets $commandSets = null;
34 34
 
35 35
     /**
@@ -83,33 +83,33 @@  discard block
 block discarded – undo
83 83
     }
84 84
 
85 85
     /**
86
-    * Creates a renderer instance, which can be used to easily
87
-    * create and convert commands to strings.
88
-    * 
89
-    * @return Mailcode_Renderer
90
-    */
86
+     * Creates a renderer instance, which can be used to easily
87
+     * create and convert commands to strings.
88
+     * 
89
+     * @return Mailcode_Renderer
90
+     */
91 91
     public static function createRenderer() : Mailcode_Renderer
92 92
     {
93 93
         return new Mailcode_Renderer();
94 94
     }
95 95
     
96
-   /**
97
-    * Creates a printer instance, which works like the renderer,
98
-    * but outputs the generated strings to standard output.
99
-    * 
100
-    * @return Mailcode_Printer
101
-    */
96
+    /**
97
+     * Creates a printer instance, which works like the renderer,
98
+     * but outputs the generated strings to standard output.
99
+     * 
100
+     * @return Mailcode_Printer
101
+     */
102 102
     public static function createPrinter() : Mailcode_Printer
103 103
     {
104 104
         return new Mailcode_Printer();
105 105
     }
106 106
     
107
-   /**
108
-    * Gets/creates the global instance of the date format info
109
-    * class, used to handle date formatting aspects.
110
-    * 
111
-    * @return Mailcode_Date_FormatInfo
112
-    */
107
+    /**
108
+     * Gets/creates the global instance of the date format info
109
+     * class, used to handle date formatting aspects.
110
+     * 
111
+     * @return Mailcode_Date_FormatInfo
112
+     */
113 113
     public static function createDateInfo() : Mailcode_Date_FormatInfo
114 114
     {
115 115
         return Mailcode_Date_FormatInfo::getInstance();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return Mailcode_Factory_CommandSets_Set_If
59 59
      */
60
-    public static function if() : Mailcode_Factory_CommandSets_Set_If
60
+    public static function if () : Mailcode_Factory_CommandSets_Set_If
61 61
     {
62 62
         return self::getSets()->if();
63 63
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return Mailcode_Factory_CommandSets_Set_ElseIf
69 69
      */
70
-    public static function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
70
+    public static function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
71 71
     {
72 72
         return self::getSets()->elseIf();
73 73
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
     protected static function getSets() : Mailcode_Factory_CommandSets
119 119
     {
120
-        if(!isset(self::$commandSets))
120
+        if (!isset(self::$commandSets))
121 121
         {
122 122
             self::$commandSets = new Mailcode_Factory_CommandSets();
123 123
         }
Please login to merge, or discard this patch.
src/Mailcode/Collection/TypeFilter.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $result = array();
34 34
 
35
-        foreach($commands as $command)
35
+        foreach ($commands as $command)
36 36
         {
37
-            if($command instanceof Mailcode_Commands_ShowBase)
37
+            if ($command instanceof Mailcode_Commands_ShowBase)
38 38
             {
39 39
                 $result[] = $command;
40 40
             }
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $result = array();
58 58
 
59
-        foreach($commands as $command)
59
+        foreach ($commands as $command)
60 60
         {
61
-            if($command instanceof Mailcode_Interfaces_Commands_ListVariables)
61
+            if ($command instanceof Mailcode_Interfaces_Commands_ListVariables)
62 62
             {
63 63
                 $result[] = $command;
64 64
             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $result = array();
79 79
 
80
-        foreach($commands as $command)
80
+        foreach ($commands as $command)
81 81
         {
82
-            if($command instanceof Mailcode_Commands_Command_ShowVariable)
82
+            if ($command instanceof Mailcode_Commands_Command_ShowVariable)
83 83
             {
84 84
                 $result[] = $command;
85 85
             }
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $result = array();
100 100
 
101
-        foreach($commands as $command)
101
+        foreach ($commands as $command)
102 102
         {
103
-            if($command instanceof Mailcode_Commands_Command_For)
103
+            if ($command instanceof Mailcode_Commands_Command_For)
104 104
             {
105 105
                 $result[] = $command;
106 106
             }
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $result = array();
121 121
 
122
-        foreach($commands as $command)
122
+        foreach ($commands as $command)
123 123
         {
124
-            if($command instanceof Mailcode_Commands_Command_ShowDate)
124
+            if ($command instanceof Mailcode_Commands_Command_ShowDate)
125 125
             {
126 126
                 $result[] = $command;
127 127
             }
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $result = array();
142 142
 
143
-        foreach($commands as $command)
143
+        foreach ($commands as $command)
144 144
         {
145
-            if($command instanceof Mailcode_Commands_Command_If)
145
+            if ($command instanceof Mailcode_Commands_Command_If)
146 146
             {
147 147
                 $result[] = $command;
148 148
             }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Normalizer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     
38 38
     public function normalize() : string
39 39
     {
40
-        if(!$this->command->isValid())
40
+        if (!$this->command->isValid())
41 41
         {
42 42
             return '';
43 43
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     
58 58
     private function addType() : void
59 59
     {
60
-        if(!$this->command->supportsType() || !$this->command->hasType())
60
+        if (!$this->command->supportsType() || !$this->command->hasType())
61 61
         {
62 62
             return;
63 63
         }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $params = $this->getParamsString($command);
71 71
         
72
-        if(empty($params))
72
+        if (empty($params))
73 73
         {
74 74
             return;
75 75
         }
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $params = $this->getParamsStatement($command);
89 89
 
90
-        if($params === null)
90
+        if ($params === null)
91 91
         {
92 92
             return '';
93 93
         }
94 94
 
95
-        if($command->hasFreeformParameters())
95
+        if ($command->hasFreeformParameters())
96 96
         {
97 97
             return $params->getStatementString();
98 98
         }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 
103 103
     private function addLogicKeywords() : void
104 104
     {
105
-        if(!$this->command->supportsLogicKeywords())
105
+        if (!$this->command->supportsLogicKeywords())
106 106
         {
107 107
             return;
108 108
         }
109 109
         
110 110
         $keywords = $this->command->getLogicKeywords()->getKeywords();
111 111
         
112
-        foreach($keywords as $keyword)
112
+        foreach ($keywords as $keyword)
113 113
         {
114 114
             $this->parts[] = ' ';
115 115
             $this->parts[] = $keyword->getKeywordString(); // e.g. "if variable"
Please login to merge, or discard this patch.