Phpro\SoapClient\CodeGenerator\Util\Normalizer::generatePropertyMethod PHP Method

generatePropertyMethod() public static method

public static generatePropertyMethod ( $prefix, $property ) : string
$prefix
$property
return string
    public static function generatePropertyMethod($prefix, $property)
    {
        return strtolower($prefix) . ucfirst(self::normalizeProperty($property));
    }

Usage Example

Example #1
0
 /**
  * @param ContextInterface|PropertyContext $context
  *
  * @throws AssemblerException
  */
 public function assemble(ContextInterface $context)
 {
     $class = $context->getClass();
     $property = $context->getProperty();
     try {
         $methodName = Normalizer::generatePropertyMethod('get', $property->getName());
         $class->removeMethod($methodName);
         $class->addMethodFromGenerator(MethodGenerator::fromArray(['name' => $methodName, 'parameters' => [], 'visibility' => MethodGenerator::VISIBILITY_PUBLIC, 'body' => sprintf('return $this->%s;', $property->getName()), 'docblock' => DocBlockGenerator::fromArray(['tags' => [['name' => 'return', 'description' => $property->getType()]]])]));
     } catch (\Exception $e) {
         throw AssemblerException::fromException($e);
     }
 }
All Usage Examples Of Phpro\SoapClient\CodeGenerator\Util\Normalizer::generatePropertyMethod