* @package tao */ class tao_models_classes_service_ConstantParameter extends tao_models_classes_service_Parameter { /** * @var string */ private $value; /** * Instantiates a parameter that takes * a constant value * * @param core_kernel_classes_Resource $definition * @param string $value */ public function __construct(core_kernel_classes_Resource $definition, $value) { parent::__construct($definition); $this->value = is_object($value) && $value instanceof core_kernel_classes_Resource ? $value->getUri() : (string)$value; } /** * Returns the actual value associated to this parameter * * @return string */ public function getValue() { return $this->value; } /** * (non-PHPdoc) * @see tao_models_classes_service_Parameter::serialize() */ public function toOntology(Ontology $model) { $serviceCallClass = $model->getClass(WfEngineOntology::CLASS_URI_ACTUAL_PARAMETER); $resource = $serviceCallClass->createInstanceWithProperties([ WfEngineOntology::PROPERTY_ACTUAL_PARAMETER_FORMAL_PARAMETER => $this->getDefinition(), WfEngineOntology::PROPERTY_ACTUAL_PARAMETER_CONSTANT_VALUE => $this->value ]); return $resource; } public function jsonSerialize() { return [ 'def' => $this->getDefinition()->getUri(), 'const' => $this->getValue() ]; } }