Passed
Push — master ( 2f714f...1c67eb )
by Sebastian
02:15
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/Variables.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 {
23 23
     const REGEX_VARIABLE_NAME = '/\$\s*([A-Z0-9_]+)\s*\.\s*([A-Z0-9_]+)/sx';
24 24
     
25
-   /**
26
-    * Parses the specified string to find all variable names contained within, if any.
27
-    * 
28
-    * @param string $subject
29
-    * @return Mailcode_Variables_Collection_Regular
30
-    */
25
+    /**
26
+     * Parses the specified string to find all variable names contained within, if any.
27
+     * 
28
+     * @param string $subject
29
+     * @return Mailcode_Variables_Collection_Regular
30
+     */
31 31
     public function parseString(string $subject) : Mailcode_Variables_Collection_Regular
32 32
     {
33 33
         $collection = new Mailcode_Variables_Collection_Regular();
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/Factory.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
     
25 25
     const ERROR_UNEXPECTED_COMMAND_TYPE = 50002;
26 26
     
27
-   /**
28
-    * Creates a ShowVariable command.
29
-    * 
30
-    * @param string $variableName A variable name, with or without the $ sign prepended.
31
-    * @return Mailcode_Commands_Command_ShowVariable
32
-    */
27
+    /**
28
+     * Creates a ShowVariable command.
29
+     * 
30
+     * @param string $variableName A variable name, with or without the $ sign prepended.
31
+     * @return Mailcode_Commands_Command_ShowVariable
32
+     */
33 33
     public static function showVariable(string $variableName) : Mailcode_Commands_Command_ShowVariable
34 34
     {
35 35
         $variableName = self::_filterVariableName($variableName);
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
         return $cmd;
46 46
     }
47 47
     
48
-   /**
49
-    * Creates a SetVariable command.
50
-    * 
51
-    * @param string $variableName A variable name, with or without the $ sign prepended.
52
-    * @param string $value
53
-    * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it.
54
-    * @return Mailcode_Commands_Command_SetVariable
55
-    * @throws Mailcode_Factory_Exception
56
-    * 
57
-    * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED
58
-    */
48
+    /**
49
+     * Creates a SetVariable command.
50
+     * 
51
+     * @param string $variableName A variable name, with or without the $ sign prepended.
52
+     * @param string $value
53
+     * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it.
54
+     * @return Mailcode_Commands_Command_SetVariable
55
+     * @throws Mailcode_Factory_Exception
56
+     * 
57
+     * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED
58
+     */
59 59
     public static function setVariable(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable
60 60
     {
61 61
         $variableName = self::_filterVariableName($variableName);
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
         return '$'.ltrim($name, '$');
266 266
     }
267 267
     
268
-   /**
269
-    * Quotes a string literal: adds the quotes, and escapes any quotes already present in it.
270
-    * 
271
-    * @param string $string
272
-    * @return string
273
-    */
268
+    /**
269
+     * Quotes a string literal: adds the quotes, and escapes any quotes already present in it.
270
+     * 
271
+     * @param string $string
272
+     * @return string
273
+     */
274 274
     protected static function _quoteString(string $string) : string
275 275
     {
276 276
         return '"'.str_replace('"', '\"', $string).'"';
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -30,44 +30,44 @@  discard block
 block discarded – undo
30 30
     const VALIDATION_UNKNOWN_COMMAND_NAME = 48304;
31 31
     const VALIDATION_INVALID_PARAMS_STATEMENT = 48305;
32 32
 
33
-   /**
34
-    * @var string
35
-    */
33
+    /**
34
+     * @var string
35
+     */
36 36
     protected $type = '';
37 37
 
38
-   /**
39
-    * @var string
40
-    */
38
+    /**
39
+     * @var string
40
+     */
41 41
     protected $paramsString = '';
42 42
     
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     protected $matchedText = '';
47 47
 
48
-   /**
49
-    * @var string
50
-    */
48
+    /**
49
+     * @var string
50
+     */
51 51
     protected $hash = '';
52 52
     
53
-   /**
54
-    * @var \AppUtils\OperationResult
55
-    */
53
+    /**
54
+     * @var \AppUtils\OperationResult
55
+     */
56 56
     protected $validationResult = null;
57 57
     
58
-   /**
59
-    * @var \Mailcode\Mailcode
60
-    */
58
+    /**
59
+     * @var \Mailcode\Mailcode
60
+     */
61 61
     protected $mailcode;
62 62
     
63
-   /**
64
-    * @var \Mailcode\Mailcode_Parser_Statement
65
-    */
63
+    /**
64
+     * @var \Mailcode\Mailcode_Parser_Statement
65
+     */
66 66
     protected $params;
67 67
 
68
-   /**
69
-    * @var string[] 
70
-    */
68
+    /**
69
+     * @var string[] 
70
+     */
71 71
     protected $validations = array(
72 72
         'params',
73 73
         'type_supported',
@@ -89,33 +89,33 @@  discard block
 block discarded – undo
89 89
         
90 90
     }
91 91
     
92
-   /**
93
-    * @return string The ID of the command = the name of the command class file.
94
-    */
92
+    /**
93
+     * @return string The ID of the command = the name of the command class file.
94
+     */
95 95
     public function getID() : string
96 96
     {
97 97
         $tokens = explode('_', get_class($this));
98 98
         return array_pop($tokens);
99 99
     }
100 100
     
101
-   /**
102
-    * Checks whether this is a dummy command, which is only
103
-    * used to access information on the command type. It cannot
104
-    * be used as an actual live command.
105
-    * 
106
-    * @return bool
107
-    */
101
+    /**
102
+     * Checks whether this is a dummy command, which is only
103
+     * used to access information on the command type. It cannot
104
+     * be used as an actual live command.
105
+     * 
106
+     * @return bool
107
+     */
108 108
     public function isDummy() : bool
109 109
     {
110 110
         return $this->type === '__dummy';
111 111
     }
112 112
     
113
-   /**
114
-    * Retrieves a hash of the actual matched command string,
115
-    * which is used in collections to detect duplicate commands.
116
-    * 
117
-    * @return string
118
-    */
113
+    /**
114
+     * Retrieves a hash of the actual matched command string,
115
+     * which is used in collections to detect duplicate commands.
116
+     * 
117
+     * @return string
118
+     */
119 119
     public function getHash() : string
120 120
     {
121 121
         $this->requireNonDummy();
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
         }
208 208
     }
209 209
     
210
-   /**
211
-    * @return string[]
212
-    */
210
+    /**
211
+     * @return string[]
212
+     */
213 213
     abstract protected function getValidations() : array;
214 214
     
215 215
     protected function validateSyntax_params() : void
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
         return implode('', $parts);
365 365
     }
366 366
     
367
-   /**
368
-    * Retrieves the names of all the command's supported types: the part
369
-    * between the command name and the colon. Example: {command type: params}.
370
-    * 
371
-    * @return string[]
372
-    */
367
+    /**
368
+     * Retrieves the names of all the command's supported types: the part
369
+     * between the command name and the colon. Example: {command type: params}.
370
+     * 
371
+     * @return string[]
372
+     */
373 373
     public function getSupportedTypes() : array
374 374
     {
375 375
         return array();
Please login to merge, or discard this patch.