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);
}