1 | <?php |
||
11 | final class ConfigProvider implements ConfigProviderContract |
||
12 | { |
||
13 | private const NAMESPACE = 'docweaver'; |
||
14 | private const KEY_CACHE_KEY = 'cache.key'; |
||
15 | private const KEY_DEBUG = 'debug'; |
||
16 | private const KEY_TABLE_OF_CONTENTS_PAGE_NAME = 'doc.index'; |
||
17 | private const KEY_VERSIONS_ALLOW_WORDED_DEFAULT = 'versions.allow_worded_default'; |
||
18 | private const KEY_VIEW_MASTER_TEMPLATE = 'view.master_template'; |
||
19 | private const KEY_ROUTE = 'route'; |
||
20 | private const KEY_STORAGE_DIRECTORY = 'storage.dir'; |
||
21 | private const KEY_ROUTE_BINDINGS = 'route.bindings'; |
||
22 | private const KEY_ROUTE_NAME_INDEX = 'route.names.index'; |
||
23 | private const KEY_ROUTE_NAME_PRODUCT_INDEX = 'route.names.product_index'; |
||
24 | private const KEY_ROUTE_NAME_PRODUCT_PAGE = 'route.names.product_page'; |
||
25 | private const KEY_ROUTE_PREFIX = 'route.prefix'; |
||
26 | private const KEY_VIEW_INDEX_TITLE = 'view.docs_title'; |
||
27 | private const KEY_VIEW_MASTER_SECTION = 'view.master_section'; |
||
28 | private const KEY_VIEW_STYLE_STACK = 'view.style_stack'; |
||
29 | private const KEY_VIEW_SCRIPT_STACK = 'view.script_stack'; |
||
30 | private const KEY_VIEW_INDEX_INTRO = 'view.docs_intro'; |
||
31 | private const KEY_VIEW_ACCENTS_PRODUCT_LINE = 'view.accents.product_line'; |
||
32 | private const KEY_VIEW_ACCENTS_FOOTNOTES = 'view.accents.footnotes'; |
||
33 | private const DEFAULT_INDEX_ROUTE_NAME = 'docs'; |
||
34 | private const DEFAULT_PRODUCT_INDEX_ROUTE_NAME = 'docs.index'; |
||
35 | private const DEFAULT_PRODUCT_PAGE_ROUTE_NAME = 'docs.show'; |
||
36 | private const DEFAULT_ROUTE_PREFIX = 'docs'; |
||
37 | private const DEFAULT_CACHE_KEY = 'docweaver.docs'; |
||
38 | private const DEFAULT_TABLE_OF_CONTENTS_PAGE_NAME = 'documentation'; |
||
39 | private const DEFAULT_INDEX_TITLE = 'Documentation'; |
||
40 | |||
41 | /** |
||
42 | * @var Config |
||
43 | */ |
||
44 | private $config; |
||
45 | |||
46 | /** |
||
47 | * ConfigProvider constructor. |
||
48 | * |
||
49 | * @param Config $config |
||
50 | */ |
||
51 | public function __construct(Config $config) |
||
55 | |||
56 | /** |
||
57 | * Get directory path to where documentation are stored. |
||
58 | * |
||
59 | * @param bool $absolute whether to return full |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getDocumentationDirectory($absolute = false): string |
||
73 | |||
74 | /** |
||
75 | * Get route config. |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | public function getRouteConfig(): array |
||
83 | |||
84 | /** |
||
85 | * Get route prefix for docs. |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getRoutePrefix(): string |
||
93 | |||
94 | /** |
||
95 | * Get bindings for routes. |
||
96 | * |
||
97 | * @param array $bindings |
||
98 | * |
||
99 | * @return array |
||
100 | */ |
||
101 | public function getRouteGroupBindings(array $bindings = []): array |
||
108 | |||
109 | public function isDebug(): bool |
||
113 | |||
114 | /** |
||
115 | * @return bool |
||
116 | */ |
||
117 | public function isWordedDefaultVersionAllowed(): bool |
||
121 | |||
122 | /** |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getIndexRouteName(): string |
||
129 | |||
130 | /** |
||
131 | * @return string |
||
132 | */ |
||
133 | public function getProductIndexRouteName(): string |
||
137 | |||
138 | /** |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getProductPageRouteName(): string |
||
145 | |||
146 | /** |
||
147 | * @return string |
||
148 | */ |
||
149 | public function getCacheKey(): string |
||
153 | |||
154 | /** |
||
155 | * Page used as content index (or Table of Contents) for product documentation. |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | public function getContentIndexPageName(): string |
||
163 | |||
164 | /** |
||
165 | * @return TemplateConfig |
||
166 | */ |
||
167 | public function getTemplateConfig(): TemplateConfig |
||
189 | |||
190 | /** |
||
191 | * @param null|string $key |
||
192 | * @param mixed $default |
||
193 | * |
||
194 | * @return mixed |
||
195 | */ |
||
196 | private function get(?string $key, $default = null) |
||
207 | } |
||
208 |