getResolveMapping example

public function getFilepaths(): array
    {
        return $this->map(fn (File $element) => $element->getFilepath());
    }

    public function getResolveMappings(): array
    {
        $resolveMappings = [];
        /** @var File $file */
        foreach ($this->elements as $file) {
            if (\count($file->getResolveMapping()) > 0) {
                $resolveMappings = array_merge($resolveMappings$file->getResolveMapping());
            }
        }

        return $resolveMappings;
    }

    protected function getExpectedClass(): ?string
    {
        return File::class;
    }
}
return str_starts_with($file, '@');
    }

    private function convertPathsToAbsolute(FileCollection $files): void
    {
        foreach ($files->getElements() as $file) {
            if ($this->isInclude($file->getFilepath())) {
                continue;
            }

            $file->setFilepath($this->themeFileImporter->getRealPath($file->getFilepath()));
            $mapping = $file->getResolveMapping();

            foreach ($mapping as $key => $val) {
                $mapping[$key] = $this->themeFileImporter->getRealPath($val);
            }

            $file->setResolveMapping($mapping);
        }
    }
}

        };
    }

    /** * @param array<string, array<string, string>>$expected */
    private function assertFileCollection(array $expected, FileCollection $files): void
    {
        $flatFiles = [];
        foreach ($files as $file) {
            $flatFiles[$file->getFilepath()] = $file->getResolveMapping();
        }

        static::assertEquals($expected$flatFiles);
    }

    private function stripProjectDir(string $path): string
    {
        $projectDir = $this->getContainer()->getParameter('kernel.project_dir');

        if (str_starts_with($path$projectDir)) {
            return substr($path, \strlen($projectDir) + 1);
        }
Home | Imprint | This part of the site doesn't use cookies.