AppserverIo\Appserver\AspectContainer\AspectManager::generatePointcutPointcut PHP Method

generatePointcutPointcut() protected method

Needs a list of these pointcuts
protected generatePointcutPointcut ( array $pointcutNames, AppserverIo\Doppelgaenger\Entities\Definitions\Aspect $aspect ) : AppserverIo\Doppelgaenger\Entities\Pointcuts\PointcutPointcut
$pointcutNames array List of names of referenced pointcuts
$aspect AppserverIo\Doppelgaenger\Entities\Definitions\Aspect The aspect to which the advice belongs
return AppserverIo\Doppelgaenger\Entities\Pointcuts\PointcutPointcut
    protected function generatePointcutPointcut(array $pointcutNames, Aspect $aspect)
    {
        // there might be several pointcuts
        // we have to look them up within the pointcuts we got here and the ones we already have in our register
        $pointcutFactory = new PointcutFactory();
        $referencedPointcuts = array();
        $pointcutExpression = array();
        foreach ($pointcutNames as $pointcutName) {
            $pointcutName = (string) $pointcutName;
            $referenceCount = count($referencedPointcuts);
            // check if we recently parsed the referenced pointcut
            if ($pointcut = $aspect->getPointcuts()->get($pointcutName)) {
                $referencedPointcuts[] = $pointcut;
            } else {
                // or did we already know of it?
                $referencedPointcuts = array_merge($referencedPointcuts, $this->getAspectRegister()->lookupPointcuts($pointcutName));
            }
            // build up the expression string for the PointcutPointcut instance
            if ($referenceCount < count($referencedPointcuts)) {
                $pointcutExpression[] = $pointcutName;
            }
        }
        /** @var \AppserverIo\Doppelgaenger\Entities\Pointcuts\PointcutPointcut $pointcutPointcut */
        $pointcutPointcut = $pointcutFactory->getInstance(PointcutPointcut::TYPE . '(' . implode(PointcutPointcut::EXPRESSION_CONNECTOR, $pointcutExpression) . ')');
        $pointcutPointcut->setReferencedPointcuts($referencedPointcuts);
        return $pointcutPointcut;
    }