@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $params = $command->getParams(); |
26 | 26 | |
27 | - if($params) |
|
27 | + if ($params) |
|
28 | 28 | { |
29 | 29 | return sprintf( |
30 | 30 | '#elseif(%s)', |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $params = $command->getParams(); |
46 | 46 | |
47 | - if($params) |
|
47 | + if ($params) |
|
48 | 48 | { |
49 | 49 | return sprintf( |
50 | 50 | '#if(%s)', |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $params = $command->getParams(); |
66 | 66 | |
67 | - if($params) |
|
67 | + if ($params) |
|
68 | 68 | { |
69 | 69 | return sprintf( |
70 | 70 | '#for(%s)', |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $params = $command->getParams(); |
81 | 81 | |
82 | - if($params) |
|
82 | + if ($params) |
|
83 | 83 | { |
84 | 84 | return sprintf( |
85 | 85 | '#set(%s)', |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | { |
24 | 24 | const ERROR_UNKNOWN_COMMAND_TYPE = 50401; |
25 | 25 | |
26 | - /** |
|
27 | - * Retrieves the syntax' type ID, e.g. "ApacheVelocity". |
|
28 | - * @return string |
|
29 | - */ |
|
26 | + /** |
|
27 | + * Retrieves the syntax' type ID, e.g. "ApacheVelocity". |
|
28 | + * @return string |
|
29 | + */ |
|
30 | 30 | public function getTypeID() : string |
31 | 31 | { |
32 | 32 | $parts = explode('_', get_class($this)); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array_pop($parts); |
35 | 35 | } |
36 | 36 | |
37 | - /** |
|
38 | - * Translates a single command to the target syntax. |
|
39 | - * |
|
40 | - * @param Mailcode_Commands_Command $command |
|
41 | - * @throws Mailcode_Translator_Exception |
|
42 | - * @return string |
|
43 | - */ |
|
37 | + /** |
|
38 | + * Translates a single command to the target syntax. |
|
39 | + * |
|
40 | + * @param Mailcode_Commands_Command $command |
|
41 | + * @throws Mailcode_Translator_Exception |
|
42 | + * @return string |
|
43 | + */ |
|
44 | 44 | public function translateCommand(Mailcode_Commands_Command $command) : string |
45 | 45 | { |
46 | 46 | $id = $command->getID(); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | return $this->$method($command); |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Translates all safeguarded commands in the subject string to the |
|
68 | - * target syntax in one go. |
|
69 | - * |
|
70 | - * @param Mailcode_Parser_Safeguard $safeguard |
|
71 | - * @return string |
|
72 | - */ |
|
66 | + /** |
|
67 | + * Translates all safeguarded commands in the subject string to the |
|
68 | + * target syntax in one go. |
|
69 | + * |
|
70 | + * @param Mailcode_Parser_Safeguard $safeguard |
|
71 | + * @return string |
|
72 | + */ |
|
73 | 73 | public function translateSafeguard(Mailcode_Parser_Safeguard $safeguard) : string |
74 | 74 | { |
75 | 75 | $subject = $safeguard->makeSafe(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $method = '_translate'.$id; |
49 | 49 | |
50 | - if(!method_exists($this, $method)) |
|
50 | + if (!method_exists($this, $method)) |
|
51 | 51 | { |
52 | 52 | throw new Mailcode_Translator_Exception( |
53 | 53 | 'Unknown command type in translator', |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $subject = $safeguard->makeSafe(); |
76 | 76 | |
77 | - if(!$safeguard->hasPlaceholders()) |
|
77 | + if (!$safeguard->hasPlaceholders()) |
|
78 | 78 | { |
79 | 79 | return $subject; |
80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $replaces = array(); |
85 | 85 | |
86 | - foreach($placeholders as $placeholder) |
|
86 | + foreach ($placeholders as $placeholder) |
|
87 | 87 | { |
88 | 88 | $replaces[$placeholder->getReplacementText()] = $this->translateCommand($placeholder->getCommand()); |
89 | 89 | } |
@@ -26,51 +26,51 @@ discard block |
||
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 | - * @var Mailcode_Translator|NULL |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var Mailcode_Translator|NULL |
|
46 | + */ |
|
47 | 47 | protected $translator = null; |
48 | 48 | |
49 | - /** |
|
50 | - * Creates a new mailcode instance. |
|
51 | - * @return Mailcode |
|
52 | - */ |
|
49 | + /** |
|
50 | + * Creates a new mailcode instance. |
|
51 | + * @return Mailcode |
|
52 | + */ |
|
53 | 53 | public static function create() : Mailcode |
54 | 54 | { |
55 | 55 | return new Mailcode(); |
56 | 56 | } |
57 | 57 | |
58 | - /** |
|
59 | - * Parses the string to detect all commands contained within. |
|
60 | - * |
|
61 | - * @param string $string |
|
62 | - * @return Mailcode_Collection |
|
63 | - */ |
|
58 | + /** |
|
59 | + * Parses the string to detect all commands contained within. |
|
60 | + * |
|
61 | + * @param string $string |
|
62 | + * @return Mailcode_Collection |
|
63 | + */ |
|
64 | 64 | public function parseString(string $string) : Mailcode_Collection |
65 | 65 | { |
66 | 66 | return $this->getParser()->parseString($string); |
67 | 67 | } |
68 | 68 | |
69 | - /** |
|
70 | - * Retrieves the string parser instance used to detect commands. |
|
71 | - * |
|
72 | - * @return Mailcode_Parser |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Retrieves the string parser instance used to detect commands. |
|
71 | + * |
|
72 | + * @return Mailcode_Parser |
|
73 | + */ |
|
74 | 74 | public function getParser() : Mailcode_Parser |
75 | 75 | { |
76 | 76 | if(!isset($this->parser)) |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | return $this->parser; |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * Retrieves the commands collection, which is used to |
|
86 | - * access information on the available commands. |
|
87 | - * |
|
88 | - * @return Mailcode_Commands |
|
89 | - */ |
|
84 | + /** |
|
85 | + * Retrieves the commands collection, which is used to |
|
86 | + * access information on the available commands. |
|
87 | + * |
|
88 | + * @return Mailcode_Commands |
|
89 | + */ |
|
90 | 90 | public function getCommands() : Mailcode_Commands |
91 | 91 | { |
92 | 92 | if(!isset($this->commands)) |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | return $this->getParser()->createSafeguard($subject); |
103 | 103 | } |
104 | 104 | |
105 | - /** |
|
106 | - * Attempts to find all variables in the target string. |
|
107 | - * |
|
108 | - * @param string $subject |
|
109 | - * @return Mailcode_Variables_Collection_Regular |
|
110 | - */ |
|
105 | + /** |
|
106 | + * Attempts to find all variables in the target string. |
|
107 | + * |
|
108 | + * @param string $subject |
|
109 | + * @return Mailcode_Variables_Collection_Regular |
|
110 | + */ |
|
111 | 111 | public function findVariables(string $subject) : Mailcode_Variables_Collection_Regular |
112 | 112 | { |
113 | 113 | return $this->createVariables()->parseString($subject); |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | return $this->variables; |
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * Creates the translator, which can be used to convert commands |
|
128 | - * to another supported syntax. |
|
129 | - * |
|
130 | - * @return Mailcode_Translator |
|
131 | - */ |
|
126 | + /** |
|
127 | + * Creates the translator, which can be used to convert commands |
|
128 | + * to another supported syntax. |
|
129 | + * |
|
130 | + * @return Mailcode_Translator |
|
131 | + */ |
|
132 | 132 | public function createTranslator() : Mailcode_Translator |
133 | 133 | { |
134 | 134 | if(!isset($this->translator)) |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getParser() : Mailcode_Parser |
75 | 75 | { |
76 | - if(!isset($this->parser)) |
|
76 | + if (!isset($this->parser)) |
|
77 | 77 | { |
78 | 78 | $this->parser = new Mailcode_Parser($this); |
79 | 79 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function getCommands() : Mailcode_Commands |
91 | 91 | { |
92 | - if(!isset($this->commands)) |
|
92 | + if (!isset($this->commands)) |
|
93 | 93 | { |
94 | 94 | $this->commands = new Mailcode_Commands(); |
95 | 95 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | public function createVariables() : Mailcode_Variables |
117 | 117 | { |
118 | - if(!isset($this->variables)) |
|
118 | + if (!isset($this->variables)) |
|
119 | 119 | { |
120 | 120 | $this->variables = new Mailcode_Variables(); |
121 | 121 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function createTranslator() : Mailcode_Translator |
133 | 133 | { |
134 | - if(!isset($this->translator)) |
|
134 | + if (!isset($this->translator)) |
|
135 | 135 | { |
136 | 136 | $this->translator = new Mailcode_Translator(); |
137 | 137 | } |