CoreFiles by mySites.guru
Transformation.php39 lines, 790 bytes, from Joomla_6.0.3-Stable-Full_Package.zip
Raw History Compare with 6.0.2
md5
adc311cfa26e1e810211374be40c22e7
sha1
f848b42b58884b39f8377be8c37b8b3d891854ef
sha256
68d176d1dff1c5d33b5288e7d01ccead9bfbf953f15931a715f38ed96b145935
<?php

declare(strict_types=1);

namespace Doctrine\Inflector\Rules;

use Doctrine\Inflector\WordInflector;

use function preg_replace;

final class Transformation implements WordInflector
{
    /** @var Pattern */
    private $pattern;

    /** @var string */
    private $replacement;

    public function __construct(Pattern $pattern, string $replacement)
    {
        $this->pattern     = $pattern;
        $this->replacement = $replacement;
    }

    public function getPattern(): Pattern
    {
        return $this->pattern;
    }

    public function getReplacement(): string
    {
        return $this->replacement;
    }

    public function inflect(string $word): string
    {
        return (string) preg_replace($this->pattern->getRegex(), $this->replacement, $word);
    }
}

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.