bitExpert\Disco\Proxy\Configuration\MethodGenerator\GetAlias::__construct PHP Method

__construct() public method

Creates a new {@link \bitExpert\Disco\Proxy\Configuration\MethodGenerator\GetAlias}.
public __construct ( ReflectionClass $originalClass, AliasesProperty $aliasesProperty )
$originalClass ReflectionClass
$aliasesProperty bitExpert\Disco\Proxy\Configuration\PropertyGenerator\AliasesProperty
    public function __construct(ReflectionClass $originalClass, AliasesProperty $aliasesProperty)
    {
        parent::__construct('getAlias');
        $aliasParameter = new ParameterGenerator('alias');
        $aliasParameter->setType('string');
        $body = 'if ($this->hasAlias($' . $aliasParameter->getName() . ')) {' . PHP_EOL;
        $body .= '    $methodname = $this->' . $aliasesProperty->getName() . '[$' . $aliasParameter->getName() . '];' . PHP_EOL;
        $body .= '    return $this->$methodname();' . PHP_EOL;
        $body .= '}' . PHP_EOL . PHP_EOL;
        $body .= 'throw new ' . BeanNotFoundException::class . '(sprintf(\'Alias "%s" is not defined!\', $' . $aliasParameter->getName() . '));' . PHP_EOL;
        $this->setParameter($aliasParameter);
        $this->setVisibility(self::VISIBILITY_PUBLIC);
        $this->setBody($body);
    }
GetAlias