/** * Constructor */ public function __construct(Configuration $configuration, $line, $position, $value = null) { parent::__construct($configuration, $line, $position); $this->value = $value; }
/** * Required by Cleanable interface. */ public function clean(LoggerInterface $logger) { return AbstractToken::cleanChildTokens($this->configuration, $this->children, $logger); }
/** * Required by the Cleanable interface. */ public function clean(LoggerInterface $logger) { if ($this->configuration->get('clean-strategy') == Configuration::CLEAN_STRATEGY_NONE) { return true; } // Assign attributes to the attributes. (Soooo meta ....) foreach ($this->attributes as $attribute) { $attributeParameters = $this->getAttributeParameters($attribute->getName()); $isStandard = true; if (empty($attributeParameters)) { $attributeParameters = array('name' => $attribute->getName(), 'regex' => '/\\S*/i', 'valueType' => Attribute::UNKNOWN); $isStandard = false; } $attribute->setType($attributeParameters['valueType']); $attribute->setIsStandard($isStandard); } // Clean attributes. foreach ($this->attributes as $attribute) { $attributeCleanResult = $attribute->clean($this->configuration, $this, $logger); if (!$attributeCleanResult && $this->configuration->get('clean-strategy') !== Configuration::CLEAN_STRATEGY_LENIENT) { unset($this->attributes[$attribute->getName()]); } } // Fix self (if possible) $this->fixSelf($logger); // Remove self or children? if ($this->configuration->get('clean-strategy') !== Configuration::CLEAN_STRATEGY_LENIENT) { // Remove self? if ($this->removeInvalidSelf($logger)) { return false; } // Remove children? $this->removeInvalidChildren($logger); } // Clean children. return AbstractToken::cleanChildTokens($this->configuration, $this->children, $logger); }