public hasConstant ( string $constantName ) : boolean | ||
$constantName | string | |
Résultat | boolean |
protected function handleEnumeration(Generator\ClassGenerator $class, PHPClass $type) { if ($type->getChecks('__value') && isset($type->getChecks('__value')['enumeration'])) { $enums = $type->getChecks('__value')['enumeration']; foreach ($enums as $enum) { $name = $enum['value']; $name = preg_replace("~([a-z])([A-Z])~", "\$1_\$2", $name); $name = preg_replace("~([a-z])([0-9])~", "\$1_\$2", $name); $name = strtoupper($name); $name = str_replace(':', '_', $name); switch ($name) { case "DEFAULT": case "PRIVATE": case "EMPTY": $name .= "_CONSTANT"; break; } $value = $enum['value']; if (!$class->hasConstant($name)) { $class->addConstant($name, $value); } } } }
protected function handleEnumeration(Generator\ClassGenerator $class, PHPClass $type) { if ($type->getChecks('__value') && isset($type->getChecks('__value')['enumeration'])) { $enums = $type->getChecks('__value')['enumeration']; foreach ($enums as $enum) { $name = strtoupper($enum['value']); $value = strtoupper($enum['value']); if (!$class->hasConstant($name)) { $class->addConstant($name, $value); } } } }