mirror of
https://github.com/rectorphp/rector.git
synced 2024-08-28 19:29:37 +00:00
24 lines
650 B
PHP
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));
|
|
}
|
|
}
|