/** * Sets the param with the passed name, type and value. * * @param string $name The param name * @param string $type The param type * @param mixed $value The param value * * @return void */ public function setParam($name, $type, $value) { // initialize the param to set $paramToSet = new ParamNode($name, $type, new NodeValue($value)); // query whether a param with this name has already been set foreach ($this->params as $key => $param) { if ($param->getName() === $paramToSet->getName()) { // override the param $this->params[$key] = $paramToSet; return; } } // append the param $this->params[] = $paramToSet; }
/** * Returns an array with initialized parameters. * * @return array<\AppserverIo\Appserver\Core\Api\Node\ParamNode> The array with params */ public function getParamNodes() { $configuration = new Configuration(); $configuration->initFromFile(__DIR__ . '/_files/params.xml'); $params = array(); foreach ($configuration->getChilds('/params/param') as $paramConfiguration) { $paramNode = new ParamNode(); $paramNode->initFromConfiguration($paramConfiguration); $params[$paramNode->getName()] = $paramNode; } return $params; }