rector/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php
Tomas Votruba 750add220d Updated Rector to commit 305c524662
305c524662 [TypeDeclaration] Improve typed property (#1221)
2021-11-13 00:51:27 +00:00

24 lines
650 B
PHP

<?php
declare (strict_types=1);
namespace RectorPrefix20211113\Doctrine\Inflector;
class CachedWordInflector implements \RectorPrefix20211113\Doctrine\Inflector\WordInflector
{
/** @var WordInflector */
private $wordInflector;
/** @var string[] */
private $cache = [];
public function __construct(\RectorPrefix20211113\Doctrine\Inflector\WordInflector $wordInflector)
{
$this->wordInflector = $wordInflector;
}
/**
* @param string $word
*/
public function inflect($word) : string
{
return $this->cache[$word] ?? ($this->cache[$word] = $this->wordInflector->inflect($word));
}
}