rector/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php
Tomas Votruba 0ead874fad Updated Rector to commit 75c06eab69
75c06eab69 Fix match static method name in annotation (#446)
2021-07-19 05:06:26 +00:00

24 lines
650 B
PHP

<?php
declare (strict_types=1);
namespace RectorPrefix20210719\Doctrine\Inflector;
class CachedWordInflector implements \RectorPrefix20210719\Doctrine\Inflector\WordInflector
{
/** @var WordInflector */
private $wordInflector;
/** @var string[] */
private $cache = [];
public function __construct(\RectorPrefix20210719\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));
}
}