public function castToType()
{
// load the params value
$value = $this->getNodeValue()->__toString();
// query whether or not we've an environment variable and/or a constant
$this->isEnv() ? $value = getenv($value) : $value;
$this->isConstant() ? $value = constant($value) : $value;
// query the parameters type
switch ($type = $this->getType()) {
case 'bool':
case 'boolean':
// bool + boolean needs custom handling
$value = Boolean::valueOf(new String($value))->booleanValue();
break;
default:
// all other can go the same way
settype($value, $type);
}
// return the value
return $value;
}