Passed
Push — master ( 89d9c2...d06d8f )
by Sebastian
02:25
created
src/Mailcode/Commands.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 {
24 24
     const ERROR_COMMAND_NAME_DOES_NOT_EXIST = 45901;
25 25
     
26
-   /**
27
-    * @var Mailcode_Commands_Command[]
28
-    */
26
+    /**
27
+     * @var Mailcode_Commands_Command[]
28
+     */
29 29
     private $commands = array();
30 30
     
31
-   /**
32
-    * Retrieves a list of all available command IDs.
33
-    * 
34
-    * @return string[]
35
-    */
31
+    /**
32
+     * Retrieves a list of all available command IDs.
33
+     * 
34
+     * @return string[]
35
+     */
36 36
     public function getIDs() : array
37 37
     {
38 38
         static $ids = array();
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
         return $ids;
46 46
     }
47 47
     
48
-   /**
49
-    * Retrieves a list of all available commands, sorted by label.
50
-    * 
51
-    * NOTE: These instances are only used for information purposes.
52
-    * 
53
-    * @return Mailcode_Commands_Command[]
54
-    */
48
+    /**
49
+     * Retrieves a list of all available commands, sorted by label.
50
+     * 
51
+     * NOTE: These instances are only used for information purposes.
52
+     * 
53
+     * @return Mailcode_Commands_Command[]
54
+     */
55 55
     public function getAll()
56 56
     {
57 57
         if(!empty($this->commands)) {
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
         return $result;
78 78
     }
79 79
     
80
-   /**
81
-    * Gets an available command by its ID.
82
-    * 
83
-    * @param string $id
84
-    * @return Mailcode_Commands_Command
85
-    */
80
+    /**
81
+     * Gets an available command by its ID.
82
+     * 
83
+     * @param string $id
84
+     * @return Mailcode_Commands_Command
85
+     */
86 86
     public function getByID(string $id) : Mailcode_Commands_Command
87 87
     {
88 88
         static $instances = array();
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
         return $instances[$id];
96 96
     }
97 97
     
98
-   /**
99
-    * Retrieves the ID of a command by its name.
100
-    * 
101
-    * @param string $name
102
-    * @throws Mailcode_Exception
103
-    * @return string
104
-    * 
105
-    * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST
106
-    */
98
+    /**
99
+     * Retrieves the ID of a command by its name.
100
+     * 
101
+     * @param string $name
102
+     * @throws Mailcode_Exception
103
+     * @return string
104
+     * 
105
+     * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST
106
+     */
107 107
     public function getIDByName(string $name) : string
108 108
     {
109 109
         $items = $this->getAll();
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
         return in_array($id, $ids);
133 133
     }
134 134
     
135
-   /**
136
-    * Checks wether the specified name exists.
137
-    * 
138
-    * @param string $name For example: "showvar".
139
-    * @return bool
140
-    */
135
+    /**
136
+     * Checks wether the specified name exists.
137
+     * 
138
+     * @param string $name For example: "showvar".
139
+     * @return bool
140
+     */
141 141
     public function nameExists(string $name) : bool
142 142
     {
143 143
         $items = $this->getAll();
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Placeholder.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,24 +25,24 @@
 block discarded – undo
25 25
 {
26 26
     const ERROR_PLACEHOLDER_TOO_LONG = 47901;
27 27
     
28
-   /**
29
-    * @var int
30
-    */
28
+    /**
29
+     * @var int
30
+     */
31 31
     protected $id;
32 32
     
33
-   /**
34
-    * @var Mailcode_Parser_Safeguard
35
-    */
33
+    /**
34
+     * @var Mailcode_Parser_Safeguard
35
+     */
36 36
     protected $safeguard;
37 37
 
38
-   /**
39
-    * @var Mailcode_Commands_Command
40
-    */
38
+    /**
39
+     * @var Mailcode_Commands_Command
40
+     */
41 41
     protected $command;
42 42
     
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     protected $replacement = '';
47 47
     
48 48
     public function __construct(int $id, Mailcode_Commands_Command $command, Mailcode_Parser_Safeguard $safeguard)
Please login to merge, or discard this patch.
src/Mailcode.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -26,46 +26,46 @@  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
-    * Creates a new mailcode instance.
46
-    * @return Mailcode
47
-    */
44
+    /**
45
+     * Creates a new mailcode instance.
46
+     * @return Mailcode
47
+     */
48 48
     public static function create() : Mailcode
49 49
     {
50 50
         return new Mailcode();
51 51
     }
52 52
     
53
-   /**
54
-    * Parses the string to detect all commands contained within.
55
-    * 
56
-    * @param string $string
57
-    * @return Mailcode_Collection
58
-    */
53
+    /**
54
+     * Parses the string to detect all commands contained within.
55
+     * 
56
+     * @param string $string
57
+     * @return Mailcode_Collection
58
+     */
59 59
     public function parseString(string $string) : Mailcode_Collection
60 60
     {
61 61
         return $this->getParser()->parseString($string);
62 62
     }
63 63
     
64
-   /**
65
-    * Retrieves the string parser instance used to detect commands.
66
-    * 
67
-    * @return Mailcode_Parser
68
-    */
64
+    /**
65
+     * Retrieves the string parser instance used to detect commands.
66
+     * 
67
+     * @return Mailcode_Parser
68
+     */
69 69
     public function getParser() : Mailcode_Parser
70 70
     {
71 71
         if(!isset($this->parser)) 
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
         return $this->parser;
77 77
     }
78 78
     
79
-   /**
80
-    * Retrieves the commands collection, which is used to
81
-    * access information on the available commands.
82
-    * 
83
-    * @return Mailcode_Commands
84
-    */
79
+    /**
80
+     * Retrieves the commands collection, which is used to
81
+     * access information on the available commands.
82
+     * 
83
+     * @return Mailcode_Commands
84
+     */
85 85
     public function getCommands() : Mailcode_Commands
86 86
     {
87 87
         if(!isset($this->commands)) 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
         return $this->getParser()->createSafeguard($subject);
98 98
     }
99 99
     
100
-   /**
101
-    * Attempts to find all variables in the target string.
102
-    * 
103
-    * @param string $subject
104
-    * @return Mailcode_Variables_Collection_Regular
105
-    */
100
+    /**
101
+     * Attempts to find all variables in the target string.
102
+     * 
103
+     * @param string $subject
104
+     * @return Mailcode_Variables_Collection_Regular
105
+     */
106 106
     public function findVariables(string $subject) : Mailcode_Variables_Collection_Regular
107 107
     {
108 108
         return $this->createVariables()->parseString($subject);
Please login to merge, or discard this patch.
src/Mailcode/Variables/Collection/Regular.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Mailcode_Variables_Collection_Regular extends Mailcode_Variables_Collection
22 22
 {
23
-   /**
24
-    * @var Mailcode_Variables_Collection_Invalid
25
-    */
23
+    /**
24
+     * @var Mailcode_Variables_Collection_Invalid
25
+     */
26 26
     protected $invalid;
27 27
 
28 28
     protected function init() : void
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
         return $this;
48 48
     }
49 49
 
50
-   /**
51
-    * Whether any of the variables in the collection are invalid.
52
-    * 
53
-    * @return bool
54
-    */
50
+    /**
51
+     * Whether any of the variables in the collection are invalid.
52
+     * 
53
+     * @return bool
54
+     */
55 55
     public function hasInvalid() : bool
56 56
     {
57 57
         return isset($this->invalid) && $this->invalid->hasVariables();
58 58
     }
59 59
     
60
-   /**
61
-    * Retrieves the collection of invalid variables, if any.
62
-    * Behaves like a variables collection.
63
-    * 
64
-    * @return Mailcode_Variables_Collection_Invalid
65
-    */
60
+    /**
61
+     * Retrieves the collection of invalid variables, if any.
62
+     * Behaves like a variables collection.
63
+     * 
64
+     * @return Mailcode_Variables_Collection_Invalid
65
+     */
66 66
     public function getInvalid() : Mailcode_Variables_Collection_Invalid
67 67
     {
68 68
         return $this->invalid;
69 69
     }
70 70
     
71
-   /**
72
-    * @return Mailcode_Variables_Collection_Regular
73
-    */
71
+    /**
72
+     * @return Mailcode_Variables_Collection_Regular
73
+     */
74 74
     public function mergeWith(Mailcode_Variables_Collection $collection) : Mailcode_Variables_Collection
75 75
     {
76 76
         parent::mergeWith($collection);
Please login to merge, or discard this patch.
src/Mailcode/Collection/NestingValidator.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
     const VALIDATION_COMMANDS_ALREADY_CLOSED = 49103;
30 30
     const VALIDATION_UNCLOSED_COMMAND = 49104;
31 31
     
32
-   /**
33
-    * @var Mailcode_Collection
34
-    */
32
+    /**
33
+     * @var Mailcode_Collection
34
+     */
35 35
     protected $collection;
36 36
     
37
-   /**
38
-    * @var OperationResult
39
-    */
37
+    /**
38
+     * @var OperationResult
39
+     */
40 40
     protected $validationResult;
41 41
     
42
-   /**
43
-    * @var Mailcode_Commands_Command[]
44
-    */
42
+    /**
43
+     * @var Mailcode_Commands_Command[]
44
+     */
45 45
     protected $stack = array();
46 46
     
47 47
     public function __construct(Mailcode_Collection $collection)
Please login to merge, or discard this patch.
src/Mailcode/Collection/Error.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
  */
21 21
 abstract class Mailcode_Collection_Error
22 22
 {
23
-   /**
24
-    * @var integer
25
-    */
23
+    /**
24
+     * @var integer
25
+     */
26 26
     protected $code = 0;
27 27
 
28
-   /**
29
-    * @var string
30
-    */
28
+    /**
29
+     * @var string
30
+     */
31 31
     protected $matchedText = '';
32 32
 
33
-   /**
34
-    * @var string
35
-    */
33
+    /**
34
+     * @var string
35
+     */
36 36
     protected $message = '';
37 37
     
38 38
     public function getCode() : int
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowVariable.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     
25 25
     const VALIDATION_VARIABLE_COUNT_MISMATCH = 48401;
26 26
     
27
-   /**
28
-    * @var Mailcode_Variables_Variable|NULL
29
-    */
27
+    /**
28
+     * @var Mailcode_Variables_Variable|NULL
29
+     */
30 30
     protected $variable;
31 31
     
32 32
     public function getName() : string
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
         return true;
50 50
     }
51 51
     
52
-   /**
53
-    * Retrieves the variable to show.
54
-    * 
55
-    * NOTE: Only available once the command has been
56
-    * validated. Always use isValid() first.
57
-    * 
58
-    * @throws Mailcode_Exception
59
-    * @return Mailcode_Variables_Variable
60
-    */
52
+    /**
53
+     * Retrieves the variable to show.
54
+     * 
55
+     * NOTE: Only available once the command has been
56
+     * validated. Always use isValid() first.
57
+     * 
58
+     * @throws Mailcode_Exception
59
+     * @return Mailcode_Variables_Variable
60
+     */
61 61
     public function getVariable() : Mailcode_Variables_Variable
62 62
     {
63 63
         $this->validate();
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
         );
75 75
     }
76 76
     
77
-   /**
78
-    * Retrieves the full name of the variable to show.
79
-    * 
80
-    * NOTE: Only available once the command has been
81
-    * validated. Always use isValid() first.
82
-    * 
83
-    * @throws Mailcode_Exception
84
-    * @return string
85
-    */
77
+    /**
78
+     * Retrieves the full name of the variable to show.
79
+     * 
80
+     * NOTE: Only available once the command has been
81
+     * validated. Always use isValid() first.
82
+     * 
83
+     * @throws Mailcode_Exception
84
+     * @return string
85
+     */
86 86
     public function getVariableName() : string
87 87
     {
88 88
         return $this->getVariable()->getFullName();
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 
91 91
     protected function validateSyntax_require_variable() : void
92 92
     {
93
-         $vars = $this->getVariables()->getGroupedByName();
94
-         $amount = count($vars);
93
+            $vars = $this->getVariables()->getGroupedByName();
94
+            $amount = count($vars);
95 95
          
96
-         if($amount === 1)
97
-         {
98
-             $this->variable = array_pop($vars);
99
-             return;
100
-         }
96
+            if($amount === 1)
97
+            {
98
+                $this->variable = array_pop($vars);
99
+                return;
100
+            }
101 101
          
102
-         $this->validationResult->makeError(
102
+            $this->validationResult->makeError(
103 103
             t('Command has %1$s variables, %2$s expected.', $amount, 1),
104 104
             self::VALIDATION_VARIABLE_COUNT_MISMATCH
105
-         );
105
+            );
106 106
     }
107 107
     
108 108
     protected function getValidations() : array
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/If.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 {
23 23
     const VALIDATION_VARIABLE_COUNT_MISMATCH = 49201;
24 24
     
25
-   /**
26
-    * @var Mailcode_Variables_Variable
27
-    */
25
+    /**
26
+     * @var Mailcode_Variables_Variable
27
+     */
28 28
     protected $variable;
29 29
     
30 30
     public function getName() : string
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
         return $this->type === 'variable';
58 58
     }
59 59
     
60
-   /**
61
-    * Available only if the command is of type "variable".
62
-    * 
63
-    * @return Mailcode_Variables_Variable|NULL
64
-    */
60
+    /**
61
+     * Available only if the command is of type "variable".
62
+     * 
63
+     * @return Mailcode_Variables_Variable|NULL
64
+     */
65 65
     public function getVariable() : ?Mailcode_Variables_Variable
66 66
     {
67 67
         if(isset($this->variable))
Please login to merge, or discard this patch.
src/Mailcode/Commands/Highlighter.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Mailcode_Commands_Highlighter
22 22
 {
23
-   /**
24
-    * @var Mailcode_Commands_Command
25
-    */
23
+    /**
24
+     * @var Mailcode_Commands_Command
25
+     */
26 26
     protected $command;
27 27
     
28
-   /**
29
-    * @var string[]
30
-    */
28
+    /**
29
+     * @var string[]
30
+     */
31 31
     protected $parts = array();
32 32
     
33 33
     public function __construct(Mailcode_Commands_Command $command)
34 34
     {
35
-       $this->command = $command;
35
+        $this->command = $command;
36 36
     }
37 37
     
38 38
     public function highlight() : string
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
     
71
-   /**
72
-    * @param string[] $classes
73
-    * @param string $content
74
-    * @return string
75
-    */
71
+    /**
72
+     * @param string[] $classes
73
+     * @param string $content
74
+     * @return string
75
+     */
76 76
     protected function renderTag(array $classes, string $content) : string
77 77
     {
78 78
         $parts = array();
Please login to merge, or discard this patch.