isDir example

return 0;
    }

    protected function exportDefaultPlugins(InputInterface $input, OutputInterface $output, QueryHandler $queryLoader)
    {
        $pluginDirectories = (array) $this->container->getParameter('shopware.plugin_directories');
        $pluginBasePath = $pluginDirectories['Default'];

        foreach (['Backend', 'Core', 'Frontend'] as $namespace) {
            foreach (new DirectoryIterator($pluginBasePath . $namespace) as $pluginDir) {
                if ($pluginDir->isDot() || !$pluginDir->isDir()) {
                    continue;
                }

                $output->writeln('<info>Importing snippets for ' . $pluginDir->getBasename() . ' plugin</info>');
                $this->exportPluginSnippets($queryLoader$pluginDir->getPathname()$input->getArgument('file'));
            }
        }

        $output->writeln('<info>Default Plugin snippets processed correctly</info>');
    }

    
$this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
        }

        parent::__construct($iterator);
    }

    /** * Filters the iterator values. */
    public function accept(): bool
    {
        if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
            return false;
        }

        if ($this->excludedPattern) {
            $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
            $path = str_replace('\\', '/', $path);

            return !preg_match($this->excludedPattern, $path);
        }

        return true;
    }

        $this->removeDirectory($this->directory);
    }

    protected function removeDirectory(string $directory): void
    {
        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::CHILD_FIRST);
        foreach ($iterator as $path) {
            if (preg_match('#[/\\\\]\.\.?$#', $path->__toString())) {
                continue;
            }
            if ($path->isDir()) {
                rmdir($path->__toString());
            } else {
                unlink($path->__toString());
            }
        }
        rmdir($directory);
    }

    public function testGetResource()
    {
        $resource = new DirectoryResource($this->directory);
        

  protected function copyTestingOverrides() {
    $dest = $this->siteDirectory . '/profiles/testing_config_overrides';
    mkdir($dest, 0777, TRUE);
    $source = DRUPAL_ROOT . '/core/profiles/testing_config_overrides';
    $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
    foreach ($iterator as $item) {
      if ($item->isDir()) {
        mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
      }
      else {
        copy($item$dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
      }
    }

    // Add a dependency that can not be met.     $config_file = $dest . DIRECTORY_SEPARATOR . InstallStorage::CONFIG_INSTALL_DIRECTORY . DIRECTORY_SEPARATOR . 'system.action.user_block_user_action.yml';
    $action = Yaml::decode(file_get_contents($config_file));
    $action['dependencies']['module'][] = 'does_not_exist';
    
$files = iterator_to_array(new \RecursiveIteratorIterator(
            new \RecursiveCallbackFilterIterator(
                new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS),
                fn (\SplFileInfo $current) => !str_starts_with($current->getBasename(), '.')
            ),
            \RecursiveIteratorIterator::SELF_FIRST
        ));
        usort($filesfn (\SplFileInfo $a, \SplFileInfo $b) => (string) $a > (string) $b ? 1 : -1);

        /** @var \SplFileInfo $file */
        foreach ($files as $file) {
            if ($file->isDir()) {
                $collection->addCollection($this->loadFromDirectory($file->getPathname()$psr4Prefix.'\\'.$file->getFilename()));

                continue;
            }
            if ('php' !== $file->getExtension() || !class_exists($className = $psr4Prefix.'\\'.$file->getBasename('.php')) || (new \ReflectionClass($className))->isAbstract()) {
                continue;
            }

            $collection->addCollection($this->import($className, 'attribute'));
        }

        
// Add all components in \Drupal\Core and \Drupal\Component that have one of     // the following directories:     // - Element     // - Entity     // - Plugin     foreach (['Core', 'Component'] as $parent_directory) {
      $path = 'core/lib/Drupal/' . $parent_directory;
      $parent_namespace = 'Drupal\\' . $parent_directory;
      foreach (new \DirectoryIterator($this->root . '/' . $path) as $component) {
        /** @var \DirectoryIterator $component */
        $pathname = $component->getPathname();
        if (!$component->isDot() && $component->isDir() && (
          is_dir($pathname . '/Plugin') ||
          is_dir($pathname . '/Entity') ||
          is_dir($pathname . '/Element')
        )) {
          $namespaces[$parent_namespace . '\\' . $component->getFilename()] = $path . '/' . $component->getFilename();
        }
      }
    }
    $container->setParameter('container.namespaces', $namespaces);

    // Store the default language values on the container. This is so that the
// ignore files matching first characters from option 'ignore' and all files below                             continue 2;
                        }
                    }
                } else {
                    if (strpos($directory, DIRECTORY_SEPARATOR . $options['ignore']) !== false) {
                        // ignore files matching first characters from option 'ignore' and all files below                         continue;
                    }
                }

                if ($info->isDir()) {
                    // pathname as locale                     if (($options['scan'] === self::LOCALE_DIRECTORY) and (Zend_Locale::isLocale($file, true, false))) {
                        $options['locale'] = $file;
                        $prev              = (string) $options['locale'];
                    }
                } else if ($info->isFile()) {
                    // filename as locale                     if ($options['scan'] === self::LOCALE_FILENAME) {
                        $filename = explode('.', $file);
                        array_pop($filename);
                        $filename = implode('.', $filename);
                        
if ($this->forExclusion && (null === $regex || preg_match($regexsubstr(str_replace('\\', '/', $path)$prefixLen)))) {
                    yield $path => new \SplFileInfo($path);
                    continue;
                }
                if (!($this->recursive || null !== $regex) || isset($this->excludedPrefixes[str_replace('\\', '/', $path)])) {
                    continue;
                }
                $files = iterator_to_array(new \RecursiveIteratorIterator(
                    new \RecursiveCallbackFilterIterator(
                        new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS),
                        fn (\SplFileInfo $file$path) => !isset($this->excludedPrefixes[$path = str_replace('\\', '/', $path)])
                            && (null === $regex || preg_match($regexsubstr($path$prefixLen)) || $file->isDir())
                            && '.' !== $file->getBasename()[0]
                    ),
                    \RecursiveIteratorIterator::LEAVES_ONLY
                ));
                uksort($files, 'strnatcmp');

                foreach ($files as $path => $info) {
                    if ($info->isFile()) {
                        yield $path => $info;
                    }
                }
            }
try {
            if (\strlen($this->path) && $fileInfo->getRealPath()) {
                $this->perms = $fileInfo->getPerms();
                $this->size = $fileInfo->getSize();
                $this->owner = $fileInfo->getOwner();
                $this->group = $fileInfo->getGroup();
                $this->ctime = $fileInfo->getCTime();
                $this->mtime = $fileInfo->getMTime();
                $this->realpath = $fileInfo->getRealPath();
            }

            $this->is_dir = $fileInfo->isDir();
            $this->is_file = $fileInfo->isFile();
            $this->is_link = $fileInfo->isLink();

            if ($this->is_link) {
                $this->linktarget = $fileInfo->getLinkTarget();
            }
        } catch (RuntimeException $e) {
            if (false === \strpos($e->getMessage(), ' open_basedir ')) {
                throw $e;
            }
        }

        
/** * {@inheritdoc} */
  #[\ReturnTypeWillChange]   public function accept() {
    $name = $this->current()->getFilename();
    // FilesystemIterator::SKIP_DOTS only skips '.' and '..', but not hidden     // directories (like '.git').     if ($name[0] == '.') {
      return FALSE;
    }
    if ($this->current()->isDir()) {
      // If this is a subdirectory of a base search path, only recurse into the       // fixed list of expected extension type directory names. Required for       // scanning the top-level/root directory; without this condition, we would       // recurse into the whole filesystem tree that possibly contains other       // files aside from Drupal.       if ($this->current()->getSubPath() == '') {
        return in_array($name$this->allowedExtensionTypes, TRUE);
      }
      // 'config' directories are special-cased here, because every extension       // contains one. However, those default configuration directories cannot       // contain extensions. The directory name cannot be globally skipped,
$source->seek($offset);
        } catch (Exception $e) {
            @unlink($this->source);
            throw new Exception(sprintf('Could not open update package:<br>%s', $e->getMessage()), 0, $e);
        }

        /** @var ZipEntry $entry */
        while (list($position$entry) = $source->each()) {
            $name = $entry->getName();
            $targetName = $this->destinationDir . $name;

            if (!$entry->isDir()) {
                $fs->dumpFile($targetName$entry->getContents());
            }

            if (time() - $requestTime >= 20 || ($position + 1) % 1000 === 0) {
                $source->close();

                return new ValidResult($position + 1, $count);
            }
        }

        $source->close();
        
protected function deleteTmpDir()
    {
        if (!file_exists($dir = $this->tmpDir)) {
            return;
        }

        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir), \RecursiveIteratorIterator::CHILD_FIRST);
        foreach ($iterator as $path) {
            if (preg_match('#[/\\\\]\.\.?$#', $path->__toString())) {
                continue;
            }
            if ($path->isDir()) {
                rmdir($path->__toString());
            } else {
                unlink($path->__toString());
            }
        }
        rmdir($this->tmpDir);
    }

    /** * @dataProvider runForDebugAndProduction */
    
throw new Enlight_Exception('Plugin "' . $name . '" in namespace "' . $this->getName() . '" not found');
        }
    }

    /** * Loads all plugins in the plugin namespace. Iterate the prefix paths and looking for bootstrap files. */
    public function loadAll()
    {
        foreach ($this->prefixPaths as $path => $prefix) {
            foreach (new DirectoryIterator($path) as $dir) {
                if (!$dir->isDir() || $dir->isDot()) {
                    continue;
                }
                $file = $dir->getPathname() . DIRECTORY_SEPARATOR . 'Bootstrap.php';
                if (!file_exists($file)) {
                    continue;
                }
                $name = $dir->getFilename();
                $this->initPlugin($name$prefix$file);
            }
        }

        
parent::__construct($iterator);
    }

    /** * Filters the iterator values. */
    public function accept(): bool
    {
        $fileinfo = $this->current();
        if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
            return false;
        } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
            return false;
        }

        return true;
    }
}


  /** * Data provider. * * @return array */
  public function getComponents() {
    $root_component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/lib/Drupal/Component';
    $component_paths = [];
    foreach (new \DirectoryIterator($root_component_path) as $file) {
      if ($file->isDir() && !$file->isDot()) {
        $component_paths[$file->getBasename()] = [$file->getPathname()];
      }
    }
    return $component_paths;
  }

  /** * Searches a directory recursively for PHP classes. * * @param string $dir * The full path to the directory that should be checked. * * @return array * An array of class paths. */
Home | Imprint | This part of the site doesn't use cookies.