getCleanName() public method

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
示例#1
0
 /**
  * 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 : '');
     }
 }
示例#2
0
 /**
  * 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());
 }
示例#3
0
 /**
  * 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));
 }