/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Config/FileIterator.php
126 строк
2 KB
Alexandra Zota
ACP2E-4362: Additional CE copyright updates for 2.4.9-beta1
29 ноя 2025, 18:29
29 ноя 2025, 18:29
27ab0ac
Код
Авторство
О чём код?
<?php /** * Copyright 2014 Adobe * All Rights Reserved. */ namespace Magento\Framework\Config; use Magento\Framework\Filesystem\DriverPool; use Magento\Framework\Filesystem\File\ReadFactory; /** * @api * @since 100.0.2 */ class FileIterator implements \Iterator, \Countable { /** * @var array */ protected $paths = []; /** * @var int */ protected $position; /** * @var ReadFactory */ protected $fileReadFactory; /** * Constructor * * @param ReadFactory $readFactory * @param array $paths */ public function __construct(ReadFactory $readFactory, array $paths) { $this->fileReadFactory = $readFactory; $this->paths = $paths; $this->position = 0; } /** * Rewind * * @return void */ #[\ReturnTypeWillChange] public function rewind() { reset($this->paths); } /** * Current * * @return string */ #[\ReturnTypeWillChange] public function current() { $fileRead = $this->fileReadFactory->create($this->key(), DriverPool::FILE); return $fileRead->readAll(); } /** * Key * * @return mixed */ #[\ReturnTypeWillChange] public function key() { return current($this->paths); } /** * Next * * @return void */ #[\ReturnTypeWillChange] public function next() { next($this->paths); } /** * Valid * * @return bool */ #[\ReturnTypeWillChange] public function valid() { return (bool) $this->key(); } /** * Convert to an array * * @return array */ #[\ReturnTypeWillChange] public function toArray() { $result = []; foreach ($this as $item) { $result[$this->key()] = $item; } return $result; } /** * Count * * @return int */ #[\ReturnTypeWillChange] public function count() { return count($this->paths); } }