| Total Complexity | 11 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class Mailcode_Commands_Command_If extends Mailcode_Commands_Command_Type_Opening |
||
| 22 | { |
||
| 23 | const VALIDATION_VARIABLE_COUNT_MISMATCH = 49201; |
||
| 24 | |||
| 25 | public function getName() : string |
||
| 26 | { |
||
| 27 | return 'if'; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function getLabel() : string |
||
| 31 | { |
||
| 32 | return t('IF condition'); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function supportsType(): bool |
||
| 36 | { |
||
| 37 | return true; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function requiresParameters(): bool |
||
| 41 | { |
||
| 42 | return true; |
||
| 43 | } |
||
| 44 | |||
| 45 | protected function validateSyntax_require_variable() |
||
| 46 | { |
||
| 47 | $amount = $this->getVariables()->countVariables(); |
||
| 48 | |||
| 49 | if($amount >= 1) |
||
| 50 | { |
||
| 51 | return; |
||
| 52 | } |
||
| 53 | |||
| 54 | $this->validationResult->makeError( |
||
| 55 | t('Command has %1$s variables, %2$s expected.', $amount, 1), |
||
| 56 | self::VALIDATION_VARIABLE_COUNT_MISMATCH |
||
| 57 | ); |
||
| 58 | } |
||
| 59 | |||
| 60 | protected function getValidations() : array |
||
| 70 | } |
||
| 71 | |||
| 72 | public function generatesContent() : bool |
||
| 75 | } |
||
| 76 | |||
| 77 | public function getSupportedTypes() : array |
||
| 78 | { |
||
| 79 | return array( |
||
| 80 | 'variable', |
||
| 81 | 'command' |
||
| 82 | ); |
||
| 83 | } |
||
| 84 | |||
| 85 | public function getSiblings() : array |
||
| 90 | ); |
||
| 91 | } |
||
| 92 | } |
||
| 93 |