From 65c94080f6b8eae4a8217751de0dc847579c923d Mon Sep 17 00:00:00 2001 From: Sam Light Date: Sat, 15 Jun 2024 11:16:44 +0100 Subject: Initial commit --- src/SvgService.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/SvgService.php (limited to 'src/SvgService.php') diff --git a/src/SvgService.php b/src/SvgService.php new file mode 100644 index 0000000..436e9ec --- /dev/null +++ b/src/SvgService.php @@ -0,0 +1,53 @@ + $collection) { + $this->addCollectionConfig($k, $collection); + } + } + + protected function addCollectionFromConfig( + string $collectionName, + array $collectionConfig + ): void + { + $c = new SvgCollection($collectionName); + + foreach ($collectionConfig['paths'] as $p) { + $c->addPath($p); + } + + $this->addCollection($c); + } + + + public function addCollection(SvgCollection $collection): void + { + $this->collections[$collection->getName()] = $collection; + } + + public function registerCollection(string $collection): void + { + $this->addCollection(new SvgCollection($collection)); + } + + public function addCollectionPath(string $collection, string $path): void + { + $this->collections[$collection]->addPath($path); + } + + public function getSvgUrl(string $collection, string $svg): string + { + return $this->collections[$collection]->getSvgUrl($collection, $svg); + } + +} -- cgit v1.2.3