Test Failed
Push — master ( d4e985...d9cf0c )
by Sebastian
03:32
created
src/Mailcode/Traits/Formatting/HTMLHighlighting.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@  discard block
 block discarded – undo
23 23
  */
24 24
 trait Mailcode_Traits_Formatting_HTMLHighlighting
25 25
 {
26
-   /**
27
-    * Stored this way, so we can use isset() instead
28
-    * of using in_array, which is some magnitudes slower.
29
-    * The boolean value is not used otherwise.
30
-    *
31
-    * @var array<string,bool>
32
-    */
26
+    /**
27
+     * Stored this way, so we can use isset() instead
28
+     * of using in_array, which is some magnitudes slower.
29
+     * The boolean value is not used otherwise.
30
+     *
31
+     * @var array<string,bool>
32
+     */
33 33
     private array $excludeTags = array(
34 34
         'style' => true, // NOTE: style tags are excluded natively on the parser level.
35 35
         'script' => true
36 36
     );
37 37
     
38
-   /**
39
-    * Adds an HTML tag name to the list of tags within which
40
-    * commands may not be highlighted.
41
-    *
42
-    * @param string $tagName Case-insensitive.
43
-    * @return $this
44
-    */
38
+    /**
39
+     * Adds an HTML tag name to the list of tags within which
40
+     * commands may not be highlighted.
41
+     *
42
+     * @param string $tagName Case-insensitive.
43
+     * @return $this
44
+     */
45 45
     public function excludeTag(string $tagName) : self
46 46
     {
47 47
         $tagName = strtolower($tagName);
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
         return $this;
52 52
     }
53 53
     
54
-   /**
55
-    * Adds several excluded tag names at once.
56
-    *
57
-    * @param string[] $tagNames
58
-    * @return $this
59
-    */
54
+    /**
55
+     * Adds several excluded tag names at once.
56
+     *
57
+     * @param string[] $tagNames
58
+     * @return $this
59
+     */
60 60
     public function excludeTags(array $tagNames) : self
61 61
     {
62 62
         foreach($tagNames as $tagName)
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         return $this;
68 68
     }
69 69
     
70
-   /**
71
-    * Whether the specified tag name is in the exclusion list.
72
-    *
73
-    * @param string $tagName
74
-    * @return bool
75
-    */
70
+    /**
71
+     * Whether the specified tag name is in the exclusion list.
72
+     *
73
+     * @param string $tagName
74
+     * @return bool
75
+     */
76 76
     public function isTagExcluded(string $tagName) : bool
77 77
     {
78 78
         $tagName = strtolower($tagName);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     */
60 60
     public function excludeTags(array $tagNames) : self
61 61
     {
62
-        foreach($tagNames as $tagName)
62
+        foreach ($tagNames as $tagName)
63 63
         {
64 64
             $this->excludeTag((string)$tagName);
65 65
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Highlighter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $this->parts[] = $this->renderTag(array('command-name'), $this->command->getName());
54 54
         
55
-        if($this->command->hasType())
55
+        if ($this->command->hasType())
56 56
         {
57 57
             $this->parts[] = ' '.$this->renderTag(array('command-type'), $this->command->getType());
58 58
         }
59 59
         
60
-        if($this->command->requiresParameters())
60
+        if ($this->command->requiresParameters())
61 61
         {
62 62
             $this->parts[] = $this->renderTag(array('hyphen'), ':');
63 63
             $this->parts[] = '<wbr>';
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $params = $command->getParams();
70 70
         
71
-        if($params === null)
71
+        if ($params === null)
72 72
         {
73 73
             return;
74 74
         }
75 75
         
76 76
         $tokens = $params->getInfo()->getTokens();
77 77
 
78
-        if(!empty($tokens))
78
+        if (!empty($tokens))
79 79
         {
80 80
             $this->parts[] = ' ';
81 81
             $this->parts[] = '<span class="mailcode-params">';
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
         }
92 92
     }
93 93
     
94
-    protected function appendParamToken(Mailcode_Parser_Statement_Tokenizer_Token $token, ?Mailcode_Parser_Statement_Tokenizer_Token $previous=null) : void
94
+    protected function appendParamToken(Mailcode_Parser_Statement_Tokenizer_Token $token, ?Mailcode_Parser_Statement_Tokenizer_Token $previous = null) : void
95 95
     {
96
-        if($previous && $previous->hasSpacing()) {
96
+        if ($previous && $previous->hasSpacing()) {
97 97
             $this->parts[] = ' ';
98 98
         }
99 99
 
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
     
103 103
     protected function appendLogicKeywords() : 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->appendLogicKeyword($keyword);
115 115
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         
122 122
         $type = $keyword->getType();
123 123
         
124
-        if(!empty($type))
124
+        if (!empty($type))
125 125
         {
126 126
             $this->parts[] = ' '.$this->renderTag(array('command-type'), $type);
127 127
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $parts = array();
142 142
         
143
-        foreach($classes as $class)
143
+        foreach ($classes as $class)
144 144
         {
145 145
             $parts[] = 'mailcode-'.$class;
146 146
         }
Please login to merge, or discard this patch.
src/Mailcode.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
     public const PACKAGE_NAME = 'Mailcode';
32 32
 
33 33
     /**
34
-    * @var Mailcode_Parser|NULL
35
-    */
34
+     * @var Mailcode_Parser|NULL
35
+     */
36 36
     protected $parser = null;
37 37
     
38
-   /**
39
-    * @var Mailcode_Commands|NULL
40
-    */
38
+    /**
39
+     * @var Mailcode_Commands|NULL
40
+     */
41 41
     protected $commands = null;
42 42
     
43
-   /**
44
-    * @var Mailcode_Variables|NULL
45
-    */
43
+    /**
44
+     * @var Mailcode_Variables|NULL
45
+     */
46 46
     protected $variables = null;
47 47
     
48
-   /**
49
-    * @var Mailcode_Translator|NULL
50
-    */
48
+    /**
49
+     * @var Mailcode_Translator|NULL
50
+     */
51 51
     protected $translator = null;
52 52
     
53
-   /**
54
-    * Creates a new mailcode instance.
55
-    * @return Mailcode
56
-    */
53
+    /**
54
+     * Creates a new mailcode instance.
55
+     * @return Mailcode
56
+     */
57 57
     public static function create() : Mailcode
58 58
     {
59 59
         return new Mailcode();
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
     }
66 66
 
67 67
     /**
68
-    * Parses the string to detect all commands contained within.
69
-    * 
70
-    * @param string $string
71
-    * @return Mailcode_Collection
72
-    */
68
+     * Parses the string to detect all commands contained within.
69
+     * 
70
+     * @param string $string
71
+     * @return Mailcode_Collection
72
+     */
73 73
     public function parseString(string $string) : Mailcode_Collection
74 74
     {
75 75
         return $this->getParser()
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
             ->getCollection();
78 78
     }
79 79
     
80
-   /**
81
-    * Retrieves the string parser instance used to detect commands.
82
-    * 
83
-    * @return Mailcode_Parser
84
-    */
80
+    /**
81
+     * Retrieves the string parser instance used to detect commands.
82
+     * 
83
+     * @return Mailcode_Parser
84
+     */
85 85
     public function getParser() : Mailcode_Parser
86 86
     {
87 87
         if(!isset($this->parser)) 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
         return $this->parser;
93 93
     }
94 94
     
95
-   /**
96
-    * Retrieves the commands collection, which is used to
97
-    * access information on the available commands.
98
-    * 
99
-    * @return Mailcode_Commands
100
-    */
95
+    /**
96
+     * Retrieves the commands collection, which is used to
97
+     * access information on the available commands.
98
+     * 
99
+     * @return Mailcode_Commands
100
+     */
101 101
     public function getCommands() : Mailcode_Commands
102 102
     {
103 103
         if(!isset($this->commands)) 
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
         return $this->variables;
141 141
     }
142 142
     
143
-   /**
144
-    * Creates the translator, which can be used to convert commands
145
-    * to another supported syntax.
146
-    * 
147
-    * @return Mailcode_Translator
148
-    */
143
+    /**
144
+     * Creates the translator, which can be used to convert commands
145
+     * to another supported syntax.
146
+     * 
147
+     * @return Mailcode_Translator
148
+     */
149 149
     public function createTranslator() : Mailcode_Translator
150 150
     {
151 151
         if(!isset($this->translator))
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
         return $this->translator;
157 157
     }
158 158
     
159
-   /**
160
-    * Creates the styler, which can be used to retrieve the 
161
-    * CSS required to style the highlighted commands in HTML.
162
-    * 
163
-    * @return Mailcode_Styler
164
-    */
159
+    /**
160
+     * Creates the styler, which can be used to retrieve the 
161
+     * CSS required to style the highlighted commands in HTML.
162
+     * 
163
+     * @return Mailcode_Styler
164
+     */
165 165
     public function createStyler() : Mailcode_Styler
166 166
     {
167 167
         return new Mailcode_Styler();
Please login to merge, or discard this patch.
tools/extractPhoneCountries.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use AppUtils\CSVHelper;
16 16
 use AppUtils\FileHelper;
17 17
 use libphonenumber\PhoneNumberFormat;
18
-use libphonenumber\PhoneNumberUtil;use Mailcode\Mailcode;use function AppLocalize\pts;
18
+use libphonenumber\PhoneNumberUtil; use Mailcode\Mailcode; use function AppLocalize\pts;
19 19
 
20 20
 require_once 'prepend.php';
21 21
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $meta = $phoneNumberUtil->getMetadataForRegion($code);
91 91
         if (!$meta) {
92
-            die('No metadata for ' . $code);
92
+            die('No metadata for '.$code);
93 93
         }
94 94
 
95 95
         $exampleNumber = $phoneNumberUtil->getExampleNumber($code);
Please login to merge, or discard this patch.
tools/syntax-highlighter.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use Mailcode\Mailcode_Exception;
17 17
 use Mailcode\Mailcode_Translator_Exception;
18 18
 use function \AppLocalize\pt;
19
-use function \AppLocalize\pts;use function AppLocalize\t;
19
+use function \AppLocalize\pts; use function AppLocalize\t;
20 20
 
21 21
 require_once 'prepend.php';
22 22
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $translated = '';
28 28
 $error = null;
29 29
 
30
-if($request->getBool('highlight'))
30
+if ($request->getBool('highlight'))
31 31
 {
32 32
     $commandsText = $request->getParam('mailcode');
33 33
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
         $error = $e->getMessage();
43 43
 
44 44
         $collection = $e->getCollection();
45
-        if($collection)
45
+        if ($collection)
46 46
         {
47 47
             $first = $collection->getFirstError();
48 48
             $error = $first->getMessage();
49 49
             $matched = $first->getMatchedText();
50
-            if(!empty($matched)) {
51
-                $error .= '<br>'. t('In command:').' <code>'.$matched.'</code>';
50
+            if (!empty($matched)) {
51
+                $error .= '<br>'.t('In command:').' <code>'.$matched.'</code>';
52 52
             }
53 53
         }
54 54
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         <p></p><br>
93 93
         <h2><?php pt('Highlighted commands') ?></h2>
94 94
         <?php
95
-            if(empty($commandsText))
95
+            if (empty($commandsText))
96 96
             {
97 97
                 ?>
98 98
                     <div class="alert alert-info">
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                     </div>
101 101
                 <?php
102 102
             }
103
-            else if($error)
103
+            else if ($error)
104 104
             {
105 105
                 ?>
106 106
                     <div class="alert alert-danger">
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
         $safeguard = $mailcode->createSafeguard($commandsText);
37 37
         $safe = htmlspecialchars($safeguard->makeSafe(), ENT_QUOTES, 'UTF-8');
38 38
         $highlighted = $safeguard->makeHighlighted($safe);
39
-    }
40
-    catch (Mailcode_Exception $e)
39
+    } catch (Mailcode_Exception $e)
41 40
     {
42 41
         $error = $e->getMessage();
43 42
 
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
                         <?php pt('No commands specified.') ?>
100 99
                     </div>
101 100
                 <?php
102
-            }
103
-            else if($error)
101
+            } else if($error)
104 102
             {
105 103
                 ?>
106 104
                     <div class="alert alert-danger">
@@ -108,8 +106,7 @@  discard block
 block discarded – undo
108 106
                         <?php echo $error ?>
109 107
                     </div>
110 108
                 <?php
111
-            }
112
-            else
109
+            } else
113 110
             {
114 111
                 ?>
115 112
                     <pre style="border: solid 1px #ccc;padding:12px;border-radius: 5px"><?php
Please login to merge, or discard this patch.