protected function setAnnotation(array $matches, int $index, array &$annotations): void
    {
        $properties = $this->getAnnotationProperties($matches, $index);

        // Get the annotation model from the annotations map
        $annotation = $this->getAnnotationFromMap($properties['annotation']);

        // Set the annotation's type
        $annotation->setAnnotationType($properties['annotation']);

        // If there are arguments
        if (null !== $properties['arguments'] && $properties['arguments']) {
            // Filter the arguments and set them in the annotation
            $annotation->setAnnotationArguments(
                $this->getArguments($properties['arguments'])
            );

            // Having set the arguments there's no need to retain this key in
            // the properties
            unset($properties['arguments']);

            // Set the annotation's arguments to setters if they exist
            $this->setAnnotationArguments($annotation);

            // If all arguments have been set to their own properties in the
            // annotation model
            if (empty($annotation->getAnnotationArguments())) {
                // Set the arguments to null
                $annotation->setAnnotationArguments();
            }
        }

        // Set all the matches
        $annotation->setMatches($properties);

        // Set the annotation in the list
        $annotations[] = $annotation;
    }
protected function setAnnotation(array $matches, int $index, array &$annotations): void
    {
        $properties = $this->getAnnotationProperties($matches, $index);

        // Get the annotation model from the annotations map
        $annotation = $this->getAnnotationFromMap($properties['annotation']);

        // Set the annotation's type
        $annotation->setAnnotationType($properties['annotation']);

        // If there are arguments
        if (null !== $properties['arguments'] && $properties['arguments']) {
            // Filter the arguments and set them in the annotation
            $annotation->setAnnotationArguments(
                $this->getArguments($properties['arguments'])
            );

            // Having set the arguments there's no need to retain this key in
            // the properties
            unset($properties['arguments']);

            // Set the annotation's arguments to setters if they exist
            $this->setAnnotationArguments($annotation);

            // If all arguments have been set to their own properties in the
            // annotation model
            if (empty($annotation->getAnnotationArguments())) {
                // Set the arguments to null
                $annotation->setAnnotationArguments();
            }
        }

        // Set all the matches
        $annotation->setMatches($properties);

        // Set the annotation in the list
        $annotations[] = $annotation;
    }
protected function setAnnotation ( array $ matches , int $ index , array & $ annotations ) : void { $ properties = $ this -> getAnnotationProperties ( $ matches , $ index ) ; // Get the annotation model from the annotations map $ annotation = $ this -> getAnnotationFromMap ( $ properties [ 'annotation' ] ) ; // Set the annotation's type $ annotation -> setAnnotationType ( $ properties [ 'annotation' ] ) ; // If there are arguments if ( null !== $ properties [ 'arguments' ] && $ properties [ 'arguments' ] ) { // Filter the arguments and set them in the annotation $ annotation -> setAnnotationArguments ( $ this -> getArguments ( $ properties [ 'arguments' ] ) ) ; // Having set the arguments there's no need to retain this key in // the properties unset ( $ properties [ 'arguments' ] ) ; // Set the annotation's arguments to setters if they exist $ this -> setAnnotationArguments ( $ annotation ) ; // If all arguments have been set to their own properties in the // annotation model if ( empty ( $ annotation -> getAnnotationArguments ( ) ) ) { // Set the arguments to null $ annotation -> setAnnotationArguments ( ) ; } } // Set all the matches $ annotation -> setMatches ( $ properties ) ; // Set the annotation in the list $ annotations [ ] = $ annotation ; }
Set a matched annotation.

@param array $matches     The matches
[
0 => matches,
1 => annotation,
2 => type,
3 => args,
4 => var,
5 => desc
]
@param int   $index       The index
@param array $annotations The annotations list

@throws \Valkyrja\Annotations\Exceptions\InvalidAnnotationKeyArgument

@return void
Set a matched annotation .