for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Doctrine\Inflector\Rules;
use function preg_match;
final class Pattern
{
/** @var string */
private $pattern;
public function __construct(string $pattern)
$this->pattern = $pattern;
}
public function getPattern() : string
return $this->pattern;
public function getRegex() : string
if ($this->pattern[0] === '/') {
return '/' . $this->pattern . '/i';
public function matches(string $word) : bool
return preg_match($this->getRegex(), $word) === 1;