WsdlToPhp\PackageGenerator\Model\AbstractModel::replacePhpReservedKeyword PHP Method

replacePhpReservedKeyword() public static method

Returns a usable keyword for a original keyword
public static replacePhpReservedKeyword ( string $keyword, string $context = null ) : string
$keyword string the keyword
$context string the context
return string
    public static function replacePhpReservedKeyword($keyword, $context = null)
    {
        if (PhpReservedKeyword::instance()->is($keyword)) {
            if ($context !== null) {
                $keywordKey = $keyword . '_' . $context;
                if (!array_key_exists($keywordKey, self::$replacedPhpReservedKeywords)) {
                    self::$replacedPhpReservedKeywords[$keywordKey] = 0;
                } else {
                    self::$replacedPhpReservedKeywords[$keywordKey]++;
                }
                return '_' . $keyword . (self::$replacedPhpReservedKeywords[$keywordKey] ? '_' . self::$replacedPhpReservedKeywords[$keywordKey] : '');
            } else {
                return '_' . $keyword;
            }
        } else {
            return $keyword;
        }
    }