for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File containing the {@see Mailcode_Commands_Command_If} class.
*
* @package Mailcode
* @subpackage Commands
* @see Mailcode_Commands_Command_If
*/
declare(strict_types=1);
namespace Mailcode;
* Mailcode command: opening IF statement.
* @author Sebastian Mordziol <[email protected]>
class Mailcode_Commands_Command_If extends Mailcode_Commands_Command_Type_Opening
{
const VALIDATION_VARIABLE_COUNT_MISMATCH = 49201;
public function getName() : string
return 'if';
}
public function getLabel() : string
return t('IF condition');
public function supportsType(): bool
return true;
public function requiresParameters(): bool
protected function validateSyntax_require_variable()
$amount = $this->getVariables()->countVariables();
if($amount >= 1)
return;
$this->validationResult->makeError(
t('Command has %1$s variables, %2$s expected.', $amount, 1),
self::VALIDATION_VARIABLE_COUNT_MISMATCH
);
protected function getValidations() : array
$validations = array();
if($this->getType() === 'variable')
$validations[] = 'require_variable';
return $validations;
public function generatesContent() : bool
return false;
public function getSupportedTypes() : array
return array(
'variable',
'command'
public function getSiblings() : array
'else',
'elseif'