<commit_before><?php

declare(strict_types=1);

/*
 * This file is part of the Valkyrja framework.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Valkyrja\Annotation\Filters;

use Valkyrja\Annotation\Annotation;
use Valkyrja\Annotation\Annotator;
use Valkyrja\Annotation\Filter as AnnotationsFilterContract;

use function in_array;

/**
 * Class AnnotationsFilter.
 *
 * @author <NAME>
 */
class Filter implements AnnotationsFilterContract
{
    /**
     * The annotations.
     *
     * @var Annotator
     */
    protected Annotator $annotations;

    /**
     * AnnotationsFilter constructor.
     *
     * @param Annotator $annotations
     */
    public function __construct(Annotator $annotations)
    {
        $this->annotations = $annotations;
    }

    /**
     * Get a class's annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     *
     * @return Annotation[]
     */
    public function classAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->classAnnotations($class));
    }

    /**
     * Get a class's members' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     *
     * @return Annotation[]
     */
    public function classMembersAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->classMembersAnnotations($class));
    }

    /**
     * Get a class's and class's members' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     *
     * @return Annotation[]
     */
    public function classAndMembersAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->classAndMembersAnnotations($class));
    }

    /**
     * Get a property's annotations by type.
     *
     * @param string $type     The type
     * @param string $class    The class
     * @param string $property The property
     *
     *
     * @return Annotation[]
     */
    public function propertyAnnotationsByType(string $type, string $class, string $property): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->propertyAnnotations($class, $property));
    }

    /**
     * Get a class's properties' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     *
     * @return Annotation[]
     */
    public function propertiesAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->propertiesAnnotations($class));
    }

    /**
     * Get a method's annotations by type.
     *
     * @param string $type   The type
     * @param string $class  The class
     * @param string $method The method
     *
     *
     * @return Annotation[]
     */
    public function methodAnnotationsByType(string $type, string $class, string $method): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->methodAnnotations($class, $method));
    }

    /**
     * Get a class's methods' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     *
     * @return Annotation[]
     */
    public function methodsAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->methodsAnnotations($class));
    }

    /**
     * Get a function's annotations.
     *
     * @param string $type     The type
     * @param string $function The function
     *
     *
     * @return Annotation[]
     */
    public function functionAnnotationsByType(string $type, string $function): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->functionAnnotations($function));<commit_msg>Apply fixes from StyleCI<commit_after><?php

declare(strict_types=1);

/*
 * This file is part of the Valkyrja framework.
 *
 * (c) Me<NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Valkyrja\Annotation\Filters;

use Valkyrja\Annotation\Annotation;
use Valkyrja\Annotation\Annotator;
use Valkyrja\Annotation\Filter as AnnotationsFilterContract;

use function in_array;

/**
 * Class AnnotationsFilter.
 *
 * @author <NAME>
 */
class Filter implements AnnotationsFilterContract
{
    /**
     * The annotations.
     *
     * @var Annotator
     */
    protected Annotator $annotations;

    /**
     * AnnotationsFilter constructor.
     *
     * @param Annotator $annotations
     */
    public function __construct(Annotator $annotations)
    {
        $this->annotations = $annotations;
    }

    /**
     * Get a class's annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     * @return Annotation[]
     */
    public function classAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->classAnnotations($class));
    }

    /**
     * Get a class's members' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     * @return Annotation[]
     */
    public function classMembersAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->classMembersAnnotations($class));
    }

    /**
     * Get a class's and class's members' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     * @return Annotation[]
     */
    public function classAndMembersAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->classAndMembersAnnotations($class));
    }

    /**
     * Get a property's annotations by type.
     *
     * @param string $type     The type
     * @param string $class    The class
     * @param string $property The property
     *
     * @return Annotation[]
     */
    public function propertyAnnotationsByType(string $type, string $class, string $property): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->propertyAnnotations($class, $property));
    }

    /**
     * Get a class's properties' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     * @return Annotation[]
     */
    public function propertiesAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->propertiesAnnotations($class));
    }

    /**
     * Get a method's annotations by type.
     *
     * @param string $type   The type
     * @param string $class  The class
     * @param string $method The method
     *
     * @return Annotation[]
     */
    public function methodAnnotationsByType(string $type, string $class, string $method): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->methodAnnotations($class, $method));
    }

    /**
     * Get a class's methods' annotations by type.
     *
     * @param string $type  The type
     * @param string $class The class
     *
     * @return Annotation[]
     */
    public function methodsAnnotationsByType(string $type, string $class): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->methodsAnnotations($class));
    }

    /**
     * Get a function's annotations.
     *
     * @param string $type     The type
     * @param string $function The function
     *
     * @return Annotation[]
     */
    public function functionAnnotationsByType(string $type, string $function): array
    {
        return $this->filterAnnotationsByType($type, ...$this->annotations->functionAnnotations($function));
{'fraction_non_alphanumeric': 0.11672494875195949, 'fraction_numerical': 0.0002411672494875196, 'mean_word_length': 2.6505281690140845, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '358343', 'n_tokens_mistral': 2341, 'n_tokens_neox': 2287, 'n_words': 630}