CoreFiles by mySites.guru
Patterns.php29 lines, 602 bytes, from Joomla_6.1.3-Stable-Full_Package.zip
Raw History Compare with 6.1.2
md5
72ea7e7262f4b48760c41b96bcd8422a
sha1
7d836fd0ddc56615b5af0dd4878baebed0dbd73f
sha256
693363c167422a2799bf125ba1df263bcc944337dd4777a5d5bfec0aee6299bf
<?php

declare(strict_types=1);

namespace Doctrine\Inflector\Rules;

use function array_map;
use function implode;
use function preg_match;

class Patterns
{
    /** @var string */
    private $regex;

    public function __construct(Pattern ...$patterns)
    {
        $patterns = array_map(static function (Pattern $pattern): string {
            return $pattern->getPattern();
        }, $patterns);

        $this->regex = '/^(?:' . implode('|', $patterns) . ')$/i';
    }

    public function matches(string $word): bool
    {
        return preg_match($this->regex, $word, $regs) === 1;
    }
}

The same content is in 46 releases, Joomla 6.0.0-rc1 to 6.3.0-alpha1. See them all, or every version of this file.