55
66use Neos \Flow \Annotations as Flow ;
77use Neos \Flow \ObjectManagement \ObjectManagerInterface ;
8- use Neos \Flow \Reflection \ReflectionService ;
9- use function PHPUnit \Framework \fileExists ;
108
119#[Flow \Scope("singleton " )]
1210class StyleguideRepository
1311{
1412 #[Flow \Inject]
1513 protected ObjectManagerInterface $ objectManager ;
1614
17- #[Flow \InjectConfiguration(path: 'styleguideProviders ' )]
15+ #[Flow \InjectConfiguration(package: ' Sitegeist.Monocle ' , path: 'styleguideProviders ' )]
1816 protected array $ styleguideProviderConfiguration ;
1917
20- #[Flow \InjectConfiguration(path: 'defaultStyleguide ' )]
18+ #[Flow \InjectConfiguration(package: ' Sitegeist.Monocle ' , path: 'defaultStyleguide ' )]
2119 protected ?string $ defaultStyleguide ;
2220
2321 /**
@@ -28,7 +26,10 @@ class StyleguideRepository
2826 public function getDefault (): StyleguideMetadata
2927 {
3028 $ all = $ this ->getAllStyleGuides ();
31- return $ all ->metadataItems [array_key_first ($ all ->metadataItems )];
29+ if ($ this ->defaultStyleguide ) {
30+ return $ all ->byAddress (StyleguideAddress::fromString ($ this ->defaultStyleguide ));
31+ }
32+ return $ all ->first ();
3233 }
3334
3435 public function getAllStyleGuides (): StyleguideMetadataCollection
@@ -46,7 +47,7 @@ public function getStyleGuide(StyleguideAddress $address): StyleguideInterface
4647 $ providers = $ this ->getProviders ();
4748 $ provider = $ providers [$ address ->provider ->value ] ?? null ;
4849 if ($ provider instanceof StyleguideProviderInterface) {
49- return $ provider ->getStyleguide ($ address-> styleguide );
50+ return $ provider ->getStyleguide ($ address );
5051 }
5152
5253 throw new \Exception (sprintf ('Styleguide %s in Provider %s was not found ' , $ address ->styleguide ->value , $ address ->provider ->value ));
0 commit comments