* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Proxy; use PrestaShop\PrestaShop\Core\File\FileFinderInterface; /** * Class CachedFileFinderProxy is a local cache proxy of file finder. */ final class CachedFileFinderProxy implements FileFinderInterface { /** * @var FileFinderInterface */ private $delegate; /** * @var array */ private $filesCache; /** * @param FileFinderInterface $delegate instance of file finder */ public function __construct(FileFinderInterface $delegate) { $this->delegate = $delegate; } /** * {@inheritdoc} */ public function find() { if (null === $this->filesCache) { $this->filesCache = $this->delegate->find(); } return $this->filesCache; } }