Returns a valid clean name for PHP
public getCleanName ( boolean $keepMultipleUnderscores = true ) : string | ||
$keepMultipleUnderscores | boolean | optional, allows to keep the multiple consecutive underscores |
return | string |
/** * Returns the name of the value as constant * @see AbstractModel::getCleanName() * @uses AbstractModel::getCleanName() * @uses AbstractModel::getName() * @uses AbstractModel::getOwner() * @uses StructValue::constantSuffix() * @uses StructValue::getIndex() * @uses StructValue::getOwner() * @uses Generator::getOptionGenericConstantsNames() * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores * @return string */ public function getCleanName($keepMultipleUnderscores = false) { if ($this->getGenerator()->getOptionGenericConstantsNames()) { return 'ENUM_VALUE_' . $this->getIndex(); } else { $key = self::constantSuffix($this->getOwner()->getName(), parent::getCleanName($keepMultipleUnderscores), $this->getIndex()); return 'VALUE_' . strtoupper(parent::getCleanName($keepMultipleUnderscores)) . ($key ? '_' . $key : ''); } }
/** * Gets gather name class * @param AbstractModel $model the model for which we generate the folder * @return string */ private function getGather(AbstractModel $model) { return Utils::getPart($this->getOptionGatherMethods(), $model->getCleanName()); }
/** * Method name can't starts with numbers * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getCleanName() * @return string */ public function getCleanName($keepMultipleUnderscores = true) { return preg_replace('/^(\\d+)([a-zA-Z0-9]*)$/', '_$2', parent::getCleanName($keepMultipleUnderscores)); }