Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
EnumType::parseValue
Method of the class: EnumType{}
No Hooks.
Returns
null. Nothing (null).
Usage
$EnumType = new EnumType(); $EnumType->parseValue( $value );
- $value(required)
- .
EnumType::parseValue() EnumType::parseValue code WC 11.1.2
public function parseValue($value)
{
if (! is_string($value)) {
$safeValue = Utils::printSafeJson($value);
throw new Error("Enum \"{$this->name}\" cannot represent non-string value: {$safeValue}.{$this->didYouMean($safeValue)}");
}
if (! isset($this->nameLookup)) {
$this->initializeNameLookup();
}
if (! isset($this->nameLookup[$value])) {
throw new Error("Value \"{$value}\" does not exist in \"{$this->name}\" enum.{$this->didYouMean($value)}");
}
return $this->nameLookup[$value]->value;
}