getDirectoryIterator example

return min($errors, 1);
    }

    private function getFiles(string $fileOrDirectory): iterable
    {
        if (is_file($fileOrDirectory)) {
            yield new \SplFileInfo($fileOrDirectory);

            return;
        }

        foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
            if (!\in_array($file->getExtension()['yml', 'yaml'])) {
                continue;
            }

            yield $file;
        }
    }

    private function getParser(): Parser
    {
        return $this->parser ??= new Parser();
    }
return $cleanupList;
    }

    /** * returns a array of directory names in the cache directory * * @return array */
    private function getCacheDirectoryList()
    {
        $cacheDirectories = $this->getDirectoryIterator($this->shopwarePath . '/var/cache');

        $directoryNames = [];
        foreach ($cacheDirectories as $directory) {
            if ($directory->isDot() || $directory->isFile()) {
                continue;
            }

            $directoryNames[] = $directory->getRealPath();
        }

        return $directoryNames;
    }
return min($errors, 1);
    }

    private function getFiles(string $fileOrDirectory): iterable
    {
        if (is_file($fileOrDirectory)) {
            yield new \SplFileInfo($fileOrDirectory);

            return;
        }

        foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
            if (!\in_array($file->getExtension()['yml', 'yaml'])) {
                continue;
            }

            yield $file;
        }
    }

    private function getParser(): Parser
    {
        return $this->parser ??= new Parser();
    }

  protected function findFiles() {
    $file_list = [];
    foreach ($this->directories as $provider => $directories) {
      $directories = (array) $directories;
      foreach ($directories as $directory) {
        if (is_dir($directory)) {
          /** @var \SplFileInfo $fileInfo */
          foreach ($this->getDirectoryIterator($directory) as $fileInfo) {
            $file_list[$fileInfo->getPathname()] = $provider;
          }
        }
      }
    }
    return $file_list;
  }

  /** * Gets an iterator to loop over the files in the provided directory. * * This method exists so that it is easy to replace this functionality in a * class that extends this one. For example, it could be used to make the scan * recursive. * * @param string $directory * The directory to scan. * * @return \Traversable * An \Traversable object or array where the values are \SplFileInfo * objects. */
/** * Deletes the old cache directories * * @param int $deletedFileCount * * @return DeleteResult */
    private function deleteCacheDirectories($deletedFileCount)
    {
        /** @var DirectoryIterator $cacheDirectoryIterator */
        $cacheDirectoryIterator = $this->getDirectoryIterator($this->shopwarePath . '/var/cache');
        $deleteResult = new DeleteResult($deletedFileCount);

        foreach ($cacheDirectoryIterator as $directory) {
            if ($directory->isDot() || $directory->isFile()) {
                continue;
            }

            $iterator = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($directory->getRealPath(), FilesystemIterator::SKIP_DOTS),
                RecursiveIteratorIterator::CHILD_FIRST
            );

            
/** * @return iterable<\SplFileInfo> */
    private function getFiles(string $fileOrDirectory): iterable
    {
        if (is_file($fileOrDirectory)) {
            yield new \SplFileInfo($fileOrDirectory);

            return;
        }

        foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
            if (!\in_array($file->getExtension()['xlf', 'xliff'])) {
                continue;
            }

            yield $file;
        }
    }

    /** * @return iterable<\SplFileInfo> */
    
Home | Imprint | This part of the site doesn't use cookies.