CoreFiles by mySites.guru
CachedWordInflector.php24 lines, 511 bytes, from Joomla_6.1.1-Stable-Full_Package.zip
Raw History Compare with 6.1.0
md5
81761d357ed2dfbda2cb031c74c3b487
sha1
1a47fee422785913f0754db5d663821b656cb13c
sha256
b4a317a81ab4776a2d49094144e4f669cb6c2f8ee54750d95b72badd60348d72
<?php

declare(strict_types=1);

namespace Doctrine\Inflector;

class CachedWordInflector implements WordInflector
{
    /** @var WordInflector */
    private $wordInflector;

    /** @var string[] */
    private $cache = [];

    public function __construct(WordInflector $wordInflector)
    {
        $this->wordInflector = $wordInflector;
    }

    public function inflect(string $word): string
    {
        return $this->cache[$word] ?? $this->cache[$word] = $this->wordInflector->inflect($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.