@@ -23,16 +23,16 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -25,24 +25,24 @@ |
||
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) |
@@ -20,9 +20,9 @@ discard block |
||
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 |
||
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); |
@@ -29,19 +29,19 @@ |
||
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) |
@@ -20,19 +20,19 @@ |
||
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 |
@@ -24,9 +24,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -22,9 +22,9 @@ discard block |
||
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 |
||
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)) |
@@ -20,19 +20,19 @@ discard block |
||
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 |
||
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(); |
@@ -32,34 +32,34 @@ |
||
32 | 32 | const VALIDATION_ERROR_PATH_UNDERSCORE = 48203; |
33 | 33 | const VALIDATION_ERROR_NAME_UNDERSCORE = 48204; |
34 | 34 | |
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | protected $path; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $name; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + */ |
|
48 | 48 | protected $matchedText; |
49 | 49 | |
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | 53 | protected $hash = ''; |
54 | 54 | |
55 | - /** |
|
56 | - * @var OperationResult |
|
57 | - */ |
|
55 | + /** |
|
56 | + * @var OperationResult |
|
57 | + */ |
|
58 | 58 | protected $validationResult = null; |
59 | 59 | |
60 | - /** |
|
61 | - * @var array<string> |
|
62 | - */ |
|
60 | + /** |
|
61 | + * @var array<string> |
|
62 | + */ |
|
63 | 63 | protected $validations = array( |
64 | 64 | 'number_path', |
65 | 65 | 'number_name', |