/** * Meta data system constraint constructor * * @param string $constraintType * @param string $type * @param string $value * @param string $minVersion * @param string $maxVersion * @author Christopher Hlubek <*****@*****.**> */ public function __construct($constraintType, $type, $value = NULL, $minVersion = NULL, $maxVersion = NULL) { if (!strlen($value)) { $value = NULL; } parent::__construct($constraintType, $value, $minVersion, $maxVersion); $this->type = $type; }
/** * Add a constraint * * @param F3\FLOW3\Package\MetaData\AbstractConstraint $constraint The constraint to add * @return void * @author Christopher Hlubek <*****@*****.**> */ public function addConstraint(\F3\FLOW3\Package\MetaData\AbstractConstraint $constraint) { $this->constraints[$constraint->getConstraintType()][] = $constraint; }
/** * Write the constraint to a XMLWriter instance. * * @param \XMLWriter $xml The XMLWriter to write to * @param \F3\FLOW3\Package\MetaData\AbstractConstraint $constraint The constraint to write * @return void * @author Christopher Hlubek <*****@*****.**> */ protected function writeConstraint(\XMLWriter $xml, \F3\FLOW3\Package\MetaData\AbstractConstraint $constraint) { $xml->startElement($constraint->getConstraintScope()); if (strlen($constraint->getMinVersion())) { $xml->writeAttribute('minVersion', $constraint->getMinVersion()); } if (strlen($constraint->getMaxVersion())) { $xml->writeAttribute('maxVersion', $constraint->getMaxVersion()); } switch ($constraint->getConstraintScope()) { case \F3\FLOW3\Package\MetaData::CONSTRAINT_SCOPE_SYSTEM: if (strlen($constraint->getType())) { $xml->writeAttribute('type', $constraint->getType()); } break; case \F3\FLOW3\Package\MetaData::CONSTRAINT_SCOPE_PACKAGE: break; } if (strlen($constraint->getValue())) { $xml->text($constraint->getValue()); } $xml->endElement(); }