getPaths example

$this->format = $input->getOption('format') ?? (GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt');

        if (['-'] === $filenames) {
            return $this->display($input$output$io[$this->validate(file_get_contents('php://stdin')uniqid('sf_', true))]);
        }

        if (!$filenames) {
            $loader = $this->twig->getLoader();
            if ($loader instanceof FilesystemLoader) {
                $paths = [];
                foreach ($loader->getNamespaces() as $namespace) {
                    $paths[] = $loader->getPaths($namespace);
                }
                $filenames = array_merge(...$paths);
            }

            if (!$filenames) {
                throw new RuntimeException('Please provide a filename or pipe template content to STDIN.');
            }
        }

        if ($showDeprecations) {
            $prevErrorHandler = set_error_handler(static function D$level$message$file$line) use (&$prevErrorHandler) {
                
public function __construct(Request $request, Response $response, Container $container, Slim $app)
    {
        $this->request = $request;
        $this->response = $response;
        $this->container = $container;
        $this->app = $app;
    }

    public function checkRequirements()
    {
        $paths = Utils::getPaths(SW_PATH . '/engine/Shopware/Components/Check/Data/Path.xml');

        clearstatcache();
        $systemCheckPathResults = Utils::checkPaths($paths, SW_PATH);

        foreach ($systemCheckPathResults as $value) {
            if (!$value['result']) {
                $fileName = SW_PATH . '/' . $value['name'];
                @mkdir($fileName, 0777, true);
                @chmod($fileName, 0777);
            }
        }

        
->willReturn($this->directories['theme']);

    $this->helpLoader = new HelpTopicTwigLoader('\fake\root\path', $module_handler$theme_handler);
  }

  /** * @covers ::__construct */
  public function testConstructor() {
    // Verify that the module/theme directories were added in the constructor,     // and non-existent directories were omitted.     $paths = $this->helpLoader->getPaths(HelpTopicTwigLoader::MAIN_NAMESPACE);
    $this->assertCount(2, $paths);
    $this->assertContains($this->directories['module']['test'] . '/help_topics', $paths);
    $this->assertContains($this->directories['theme']['test'] . '/help_topics', $paths);
  }

  /** * @covers ::getSourceContext */
  public function testGetSourceContext() {
    $source = $this->helpLoader->getSourceContext('@' . HelpTopicTwigLoader::MAIN_NAMESPACE . '/test.topic.html.twig');
    $this->assertEquals('{% line 4 %}<h2>Test</h2>', $source->getCode());
  }
$this->assertFileExists($projectDir.'/public/bundles/legacy/legacy.css');

        $fs->remove($projectDir);
    }

    public function testBundleTwigTemplatesDir()
    {
        static::bootKernel(['test_case' => 'BundlePaths']);
        $twig = static::getContainer()->get('twig.alias');
        $bundlesMetadata = static::getContainer()->getParameter('kernel.bundles_metadata');

        $this->assertSame([$bundlesMetadata['LegacyBundle']['path'].'/Resources/views']$twig->getLoader()->getPaths('Legacy'));
        $this->assertSame("OK\n", $twig->render('@Legacy/index.html.twig'));

        $this->assertSame([$bundlesMetadata['ModernBundle']['path'].'/templates']$twig->getLoader()->getPaths('Modern'));
        $this->assertSame("OK\n", $twig->render('@Modern/index.html.twig'));
    }

    public function testBundleTranslationsDir()
    {
        static::bootKernel(['test_case' => 'BundlePaths']);
        $translator = static::getContainer()->get('translator.alias');

        
private function getLoaderPaths(string $name = null): array
    {
        $loaderPaths = [];
        foreach ($this->getFilesystemLoaders() as $loader) {
            $namespaces = $loader->getNamespaces();
            if (null !== $name) {
                $namespace = $this->parseTemplateName($name)[0];
                $namespaces = array_intersect([$namespace]$namespaces);
            }

            foreach ($namespaces as $namespace) {
                $paths = array_map($this->getRelativePath(...)$loader->getPaths($namespace));

                if (FilesystemLoader::MAIN_NAMESPACE === $namespace) {
                    $namespace = '(None)';
                } else {
                    $namespace = '@'.$namespace;
                }

                $loaderPaths[$namespace] = array_merge($loaderPaths[$namespace] ?? []$paths);
            }
        }

        
$pattern = substr($pattern, \strlen($prefix));
        }

        try {
            $prefix = $this->locator->locate($prefix$this->currentDir, true);
        } catch (FileLocatorFileNotFoundException $e) {
            if (!$ignoreErrors) {
                throw $e;
            }

            $resource = [];
            foreach ($e->getPaths() as $path) {
                $resource[] = new FileExistenceResource($path);
            }

            return;
        }
        $resource = new GlobResource($prefix$pattern$recursive$forExclusion$excluded);

        yield from $resource;
    }

    private function doImport(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null): mixed
    {
Home | Imprint | This part of the site doesn't use cookies.