Passed
Push — master ( e6fd03...a950a4 )
by Sebastian
04:03
created
src/Mailcode/Translator/BaseSyntax.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $command->getID()
45 45
         );
46 46
 
47
-        if(!class_exists($class))
47
+        if (!class_exists($class))
48 48
         {
49 49
             throw new Mailcode_Translator_Exception(
50 50
                 sprintf('Unknown command %s in translator', $command->getID()),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         
59 59
         $translator = new $class($this);
60 60
 
61
-        if($translator instanceof BaseCommandTranslation)
61
+        if ($translator instanceof BaseCommandTranslation)
62 62
         {
63 63
             return $translator;
64 64
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $subject = $safeguard->makeSafe();
84 84
         
85
-        if(!$safeguard->hasPlaceholders())
85
+        if (!$safeguard->hasPlaceholders())
86 86
         {
87 87
             return $subject;
88 88
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         
92 92
         $replaces = array();
93 93
         
94
-        foreach($placeholders as $placeholder)
94
+        foreach ($placeholders as $placeholder)
95 95
         {
96 96
             $command = $placeholder->getCommand();
97 97
 
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/BaseApacheVelocityCommandTranslation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         // All other special characters have to be escaped
81 81
         // with two backslashes.
82 82
         foreach ($this->regexSpecialChars as $char) {
83
-            $string = str_replace($char, '\\' . $char, $string);
83
+            $string = str_replace($char, '\\'.$char, $string);
84 84
         }
85 85
 
86 86
         // Restore the escaped quotes, which stay escaped
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
         if ($currencyToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) {
142 142
             $displayedCurrency = $currencyToken->getNormalized();
143 143
         } else if ($currencyToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) {
144
-            $displayedCurrency = '"' . $currencyToken->getText() . '"';
144
+            $displayedCurrency = '"'.$currencyToken->getText().'"';
145 145
         } else if ($withCurrencyName) {
146
-            $displayedCurrency = '"' . $localCurrency->getCurrencyName() . '"';
146
+            $displayedCurrency = '"'.$localCurrency->getCurrencyName().'"';
147 147
         } else {
148
-            $displayedCurrency = '"' . $localCurrency->getCurrencySymbol() . '"';
148
+            $displayedCurrency = '"'.$localCurrency->getCurrencySymbol().'"';
149 149
         }
150 150
 
151 151
         $regionToken = $localCurrency->getRegion();
152 152
         if ($regionToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) {
153 153
             $displayedCountry = $regionToken->getNormalized();
154 154
         } else if ($regionToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) {
155
-            $displayedCountry = '"' . $regionToken->getText() . '"';
155
+            $displayedCountry = '"'.$regionToken->getText().'"';
156 156
         } else {
157
-            $displayedCountry = '"' . $localCurrency->getCountry() . '"';
157
+            $displayedCountry = '"'.$localCurrency->getCountry().'"';
158 158
         }
159 159
 
160 160
         return sprintf(
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/BaseHubLCommandTranslation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $varName = undollarize($name);
44 44
 
45
-        if(self::areVariableNamesLowercase()) {
45
+        if (self::areVariableNamesLowercase()) {
46 46
             $varName = strtolower($varName);
47 47
         }
48 48
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $variables = Mailcode::create()->createVariables()->parseString($subject)->getAll();
55 55
 
56
-        foreach($variables as $variable) {
56
+        foreach ($variables as $variable) {
57 57
             $subject = str_replace($variable->getMatchedText(), $this->formatVariableName($variable->getFullName()), $subject);
58 58
         }
59 59
 
Please login to merge, or discard this patch.
src/Mailcode/ClassCache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @return class-string[]
28 28
      * @throws FileHelper_Exception
29 29
      */
30
-    public static function findClassesInFolder($folder, bool $recursive=false, ?string $instanceOf=null) : array
30
+    public static function findClassesInFolder($folder, bool $recursive = false, ?string $instanceOf = null) : array
31 31
     {
32 32
         return self::createCache()
33 33
             ->findClassesInFolder(
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     private static function createCache() : ClassRepositoryManager
44 44
     {
45
-        if(!isset(self::$cache)) {
45
+        if (!isset(self::$cache)) {
46 46
             self::$cache = ClassRepositoryManager::create(Mailcode::getCacheFolder());
47 47
         }
48 48
 
Please login to merge, or discard this patch.
src/Mailcode/Translator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public static function create() : Mailcode_Translator
35 35
     {
36
-        if(is_null(self::$instance)) {
36
+        if (is_null(self::$instance)) {
37 37
             self::$instance = new self();
38 38
         }
39 39
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function __construct()
44 44
     {
45
-        foreach($this->resolveSyntaxClasses() as $class) {
45
+        foreach ($this->resolveSyntaxClasses() as $class) {
46 46
             $syntax = new $class();
47 47
             $this->syntaxes[$syntax->getTypeID()] = $syntax;
48 48
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function createSyntax(string $name) : SyntaxInterface
58 58
     {
59
-        if(isset($this->syntaxes[$name])) {
59
+        if (isset($this->syntaxes[$name])) {
60 60
             return $this->syntaxes[$name];
61 61
         }
62 62
 
Please login to merge, or discard this patch.
src/Mailcode.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
         );
60 60
     }
61 61
 
62
-   /**
63
-    * Creates a new mailcode instance.
64
-    * @return Mailcode
65
-    */
62
+    /**
63
+     * Creates a new mailcode instance.
64
+     * @return Mailcode
65
+     */
66 66
     public static function create() : Mailcode
67 67
     {
68 68
         return new Mailcode();
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
     }
75 75
 
76 76
     /**
77
-    * Parses the string to detect all commands contained within.
78
-    * 
79
-    * @param string $string
80
-    * @return Mailcode_Collection
81
-    */
77
+     * Parses the string to detect all commands contained within.
78
+     * 
79
+     * @param string $string
80
+     * @return Mailcode_Collection
81
+     */
82 82
     public function parseString(string $string) : Mailcode_Collection
83 83
     {
84 84
         return $this->getParser()
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
             ->getCollection();
87 87
     }
88 88
     
89
-   /**
90
-    * Retrieves the string parser instance used to detect commands.
91
-    * 
92
-    * @return Mailcode_Parser
93
-    */
89
+    /**
90
+     * Retrieves the string parser instance used to detect commands.
91
+     * 
92
+     * @return Mailcode_Parser
93
+     */
94 94
     public function getParser() : Mailcode_Parser
95 95
     {
96 96
         if(!isset($this->parser)) 
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
         return $this->parser;
102 102
     }
103 103
     
104
-   /**
105
-    * Retrieves the commands collection, which is used to
106
-    * access information on the available commands.
107
-    * 
108
-    * @return Mailcode_Commands
109
-    */
104
+    /**
105
+     * Retrieves the commands collection, which is used to
106
+     * access information on the available commands.
107
+     * 
108
+     * @return Mailcode_Commands
109
+     */
110 110
     public function getCommands() : Mailcode_Commands
111 111
     {
112 112
         if(!isset($this->commands)) 
@@ -149,23 +149,23 @@  discard block
 block discarded – undo
149 149
         return $this->variables;
150 150
     }
151 151
     
152
-   /**
153
-    * Creates the translator, which can be used to convert commands
154
-    * to another supported syntax.
155
-    * 
156
-    * @return Mailcode_Translator
157
-    */
152
+    /**
153
+     * Creates the translator, which can be used to convert commands
154
+     * to another supported syntax.
155
+     * 
156
+     * @return Mailcode_Translator
157
+     */
158 158
     public function createTranslator() : Mailcode_Translator
159 159
     {
160 160
         return Mailcode_Translator::create();
161 161
     }
162 162
     
163
-   /**
164
-    * Creates the styler, which can be used to retrieve the 
165
-    * CSS required to style the highlighted commands in HTML.
166
-    * 
167
-    * @return Mailcode_Styler
168
-    */
163
+    /**
164
+     * Creates the styler, which can be used to retrieve the 
165
+     * CSS required to style the highlighted commands in HTML.
166
+     * 
167
+     * @return Mailcode_Styler
168
+     */
169 169
     public function createStyler() : Mailcode_Styler
170 170
     {
171 171
         return new Mailcode_Styler();
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 
47 47
     public static function getCacheFolder() : FolderInfo
48 48
     {
49
-        if(isset(self::$cacheFolder)) {
49
+        if (isset(self::$cacheFolder)) {
50 50
             return self::$cacheFolder;
51 51
         }
52 52
 
53 53
         $folder = ClassHelper::getCacheFolder();
54
-        if($folder !== null) {
54
+        if ($folder !== null) {
55 55
             return $folder;
56 56
         }
57 57
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     */
100 100
     public function getParser() : Mailcode_Parser
101 101
     {
102
-        if(!isset($this->parser)) 
102
+        if (!isset($this->parser)) 
103 103
         {
104 104
             $this->parser = new Mailcode_Parser($this);
105 105
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     */
116 116
     public function getCommands() : Mailcode_Commands
117 117
     {
118
-        if(!isset($this->commands)) 
118
+        if (!isset($this->commands)) 
119 119
         {
120 120
             $this->commands = new Mailcode_Commands();
121 121
         }
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
      * @param Mailcode_Commands_Command|null $sourceCommand
141 141
      * @return Mailcode_Variables_Collection_Regular
142 142
      */
143
-    public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Variables_Collection_Regular
143
+    public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Variables_Collection_Regular
144 144
     {
145 145
         return $this->createVariables()->parseString($subject, $sourceCommand);
146 146
     }
147 147
     
148 148
     public function createVariables() : Mailcode_Variables
149 149
     {
150
-        if(!isset($this->variables))
150
+        if (!isset($this->variables))
151 151
         {
152 152
             $this->variables = new Mailcode_Variables();
153 153
         }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         return self::$logger;
207 207
     }
208 208
 
209
-    public static function setDebugging(bool $enabled=true) : void
209
+    public static function setDebugging(bool $enabled = true) : void
210 210
     {
211 211
         self::$debug = $enabled;
212 212
     }
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
      * @param array<string|int,mixed> $context
222 222
      * @return void
223 223
      */
224
-    public static function debug(string $message, array $context=array()) : void
224
+    public static function debug(string $message, array $context = array()) : void
225 225
     {
226
-        if(self::$debug && isset(self::$logger))
226
+        if (self::$debug && isset(self::$logger))
227 227
         {
228 228
             self::$logger->debug($message, $context);
229 229
         }
Please login to merge, or discard this patch.
tools/extractPhoneCountries.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 declare(strict_types=1);
14 14
 
15
-use AppUtils\ConvertHelper\JSONConverter;use AppUtils\CSVHelper;
16
-use AppUtils\CSVHelper_Exception;use AppUtils\FileHelper;
17
-use AppUtils\FileHelper_Exception;use libphonenumber\PhoneNumberFormat;
18
-use libphonenumber\PhoneNumberUtil;use Mailcode\Mailcode;use function AppLocalize\pts;
15
+use AppUtils\ConvertHelper\JSONConverter; use AppUtils\CSVHelper;
16
+use AppUtils\CSVHelper_Exception; use AppUtils\FileHelper;
17
+use AppUtils\FileHelper_Exception; use libphonenumber\PhoneNumberFormat;
18
+use libphonenumber\PhoneNumberUtil; use Mailcode\Mailcode; use function AppLocalize\pts;
19 19
 
20 20
 require_once 'prepend.php';
21 21
 
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 
95 95
         $meta = $phoneNumberUtil->getMetadataForRegion($code);
96 96
         if (!$meta) {
97
-            die('No metadata for ' . $code);
97
+            die('No metadata for '.$code);
98 98
         }
99 99
 
100 100
         $exampleNumber = $phoneNumberUtil->getExampleNumber($code);
101 101
 
102 102
         // PHPStan complains about this, but the method can return null - it's not documented correctly.
103
-        if($exampleNumber === null) {
104
-            die('No example number for ' . $code);
103
+        if ($exampleNumber === null) {
104
+            die('No example number for '.$code);
105 105
         }
106 106
 
107 107
         $local = $phoneNumberUtil->formatInOriginalFormat($exampleNumber, $code);
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowURLTranslation.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,21 +52,21 @@
 block discarded – undo
52 52
         $statements = array();
53 53
         $statements[] = $this->renderURL($urlVar);
54 54
 
55
-        if($command->isTrackingEnabled())
55
+        if ($command->isTrackingEnabled())
56 56
         {
57 57
             $statements[] = $this->renderTracking($command);
58 58
         }
59 59
 
60
-        if($command->isShortenEnabled())
60
+        if ($command->isShortenEnabled())
61 61
         {
62 62
             $statements[] = $this->renderShorten();
63 63
         }
64 64
 
65
-        if($command->hasQueryParams())
65
+        if ($command->hasQueryParams())
66 66
         {
67 67
             $params = $command->getQueryParams();
68 68
 
69
-            foreach($params as $name => $value)
69
+            foreach ($params as $name => $value)
70 70
             {
71 71
                 $statements[] = $this->renderQueryParam($name, $value);
72 72
             }
Please login to merge, or discard this patch.
src/Mailcode/Factory/Exception.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 {
22 22
     protected ?Mailcode_Commands_Command $command = null;
23 23
     
24
-   /**
25
-    * @param string $message
26
-    * @param string|NULL $details
27
-    * @param int|NULL $code
28
-    * @param Exception|NULL $previous
29
-    * @param Mailcode_Commands_Command|NULL $command
30
-    */
24
+    /**
25
+     * @param string $message
26
+     * @param string|NULL $details
27
+     * @param int|NULL $code
28
+     * @param Exception|NULL $previous
29
+     * @param Mailcode_Commands_Command|NULL $command
30
+     */
31 31
     public function __construct(string $message, $details=null, $code=null, $previous=null, ?Mailcode_Commands_Command $command=null)
32 32
     {
33 33
         parent::__construct($message, $details, $code, $previous);
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
         $this->command = $command;
36 36
     }
37 37
     
38
-   /**
39
-    * Retrieves the erroneous command, if any.
40
-    * 
41
-    * @return Mailcode_Commands_Command|NULL
42
-    */
38
+    /**
39
+     * Retrieves the erroneous command, if any.
40
+     * 
41
+     * @return Mailcode_Commands_Command|NULL
42
+     */
43 43
     public function getCommand() : ?Mailcode_Commands_Command
44 44
     {
45 45
         return $this->command;
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
     * @param Exception|NULL $previous
29 29
     * @param Mailcode_Commands_Command|NULL $command
30 30
     */
31
-    public function __construct(string $message, $details=null, $code=null, $previous=null, ?Mailcode_Commands_Command $command=null)
31
+    public function __construct(string $message, $details = null, $code = null, $previous = null, ?Mailcode_Commands_Command $command = null)
32 32
     {
33 33
         parent::__construct($message, $details, $code, $previous);
34 34
         
Please login to merge, or discard this patch.