@@ -53,7 +53,7 @@ public function getProjectRoot(): string
5353 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
5454 } catch (ObjectNotFoundException ) {
5555 }
56- $ projectRoot = $ this ->parameterBag ->validateAndGetDirectoryPathValue (' project_root ' , false );
56+ $ projectRoot = $ this ->parameterBag ->validateAndGetDirectoryPathValue (ConfigurationKey:: PROJECT_ROOT , false );
5757 $ this ->localObjectCache ->cacheMethodResult (__METHOD__ , '' , $ projectRoot );
5858 return $ projectRoot ;
5959 }
@@ -70,7 +70,7 @@ public function getSourceLocators(): SourceLocatorsCollection
7070 } catch (ObjectNotFoundException ) {
7171 }
7272 $ sourceLocators = $ this ->parameterBag ->validateAndGetClassListValue (
73- ' source_locators ' ,
73+ ConfigurationKey:: SOURCE_LOCATORS ,
7474 SourceLocatorInterface::class
7575 );
7676 $ cachedSourceLocatorsCollection = SourceLocatorsCollection::create (...$ sourceLocators );
@@ -87,11 +87,14 @@ public function getTemplatesDir(): string
8787 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
8888 } catch (ObjectNotFoundException ) {
8989 }
90- $ templatesDir = $ this ->parameterBag ->validateAndGetStringValue (' templates_dir ' , false );
90+ $ templatesDir = $ this ->parameterBag ->validateAndGetStringValue (ConfigurationKey:: TEMPLATES_DIR , false );
9191 $ parentDir = dirname ($ templatesDir );
9292 if (!$ parentDir || !is_dir ($ parentDir )) {
9393 throw new InvalidConfigurationParameterException (
94- "`output_dir` cannot be created because parent directory ` {$ parentDir }` does not exist "
94+ sprintf (
95+ "`%s` cannot be created because parent directory ` {$ parentDir }` does not exist " ,
96+ ConfigurationKey::TEMPLATES_DIR
97+ )
9598 );
9699 }
97100 if (!file_exists ($ templatesDir )) {
@@ -112,17 +115,23 @@ public function getOutputDir(): string
112115 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
113116 } catch (ObjectNotFoundException ) {
114117 }
115- $ outputDir = $ this ->parameterBag ->validateAndGetStringValue (' output_dir ' , false );
118+ $ outputDir = $ this ->parameterBag ->validateAndGetStringValue (ConfigurationKey:: OUTPUT_DIR , false );
116119 $ parentDir = dirname ($ outputDir );
117120 if (!$ parentDir || !is_dir ($ parentDir )) {
118121 throw new InvalidConfigurationParameterException (
119- "`output_dir` cannot be created because parent directory ` {$ parentDir }` does not exist "
122+ sprintf (
123+ "`%s` cannot be created because parent directory ` {$ parentDir }` does not exist " ,
124+ ConfigurationKey::OUTPUT_DIR
125+ )
120126 );
121127 }
122128
123129 if (!is_writable ($ parentDir )) {
124130 throw new InvalidConfigurationParameterException (
125- "`output_dir` cannot be created because parent directory ` {$ parentDir }` is not writable "
131+ sprintf (
132+ "`%s` cannot be created because parent directory ` {$ parentDir }` is not writable " ,
133+ ConfigurationKey::OUTPUT_DIR
134+ )
126135 );
127136 }
128137
@@ -144,7 +153,7 @@ public function getOutputDirBaseUrl(): string
144153 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
145154 } catch (ObjectNotFoundException ) {
146155 }
147- $ outputDirBaseUrl = $ this ->parameterBag ->validateAndGetStringValue (' output_dir_base_url ' , false );
156+ $ outputDirBaseUrl = $ this ->parameterBag ->validateAndGetStringValue (ConfigurationKey:: OUTPUT_DIR_BASE_URL , false );
148157 $ this ->localObjectCache ->cacheMethodResult (__METHOD__ , '' , $ outputDirBaseUrl );
149158 return $ outputDirBaseUrl ;
150159 }
@@ -161,7 +170,7 @@ public function getLanguageHandlersCollection(): LanguageHandlersCollection
161170 } catch (ObjectNotFoundException ) {
162171 }
163172 $ languageHandlers = $ this ->parameterBag ->validateAndGetClassListValue (
164- ' language_handlers ' ,
173+ ConfigurationKey:: LANGUAGE_HANDLERS ,
165174 LanguageHandlerInterface::class,
166175 false
167176 );
@@ -182,7 +191,7 @@ public function getPlugins(): PluginsCollection
182191 } catch (ObjectNotFoundException ) {
183192 }
184193 $ pluginsList = $ this ->parameterBag ->validateAndGetClassListValue (
185- ' plugins ' ,
194+ ConfigurationKey:: PLUGINS ,
186195 PluginInterface::class
187196 );
188197 $ cachedPlugins = PluginsCollection::create (...$ pluginsList );
@@ -200,11 +209,14 @@ public function getCacheDir(): ?string
200209 } catch (ObjectNotFoundException ) {
201210 }
202211
203- $ cacheDir = $ this ->parameterBag ->validateAndGetStringValue (' cache_dir ' );
212+ $ cacheDir = $ this ->parameterBag ->validateAndGetStringValue (ConfigurationKey:: CACHE_DIR );
204213 $ parentDir = dirname ($ cacheDir );
205214 if (!is_dir ($ parentDir )) {
206215 throw new InvalidConfigurationParameterException (
207- "`cache_dir` cannot be created because parent directory ` {$ parentDir }` does not exist "
216+ sprintf (
217+ "`%s` cannot be created because parent directory ` {$ parentDir }` does not exist " ,
218+ ConfigurationKey::CACHE_DIR
219+ )
208220 );
209221 }
210222 if (!file_exists ($ cacheDir )) {
@@ -229,7 +241,7 @@ public function getPageLinkProcessor(): PageLinkProcessorInterface
229241 }
230242 /** @var PageLinkProcessorInterface $pageLinkProcessor */
231243 $ pageLinkProcessor = $ this ->parameterBag ->validateAndGetClassValue (
232- ' page_link_processor ' ,
244+ ConfigurationKey:: PAGE_LINK_PROCESSOR ,
233245 PageLinkProcessorInterface::class
234246 );
235247 $ this ->localObjectCache ->cacheMethodResult (__METHOD__ , '' , $ pageLinkProcessor );
@@ -245,7 +257,7 @@ public function getGitClientPath(): string
245257 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
246258 } catch (ObjectNotFoundException ) {
247259 }
248- $ gitClientPath = $ this ->parameterBag ->validateAndGetStringValue (' git_client_path ' , false );
260+ $ gitClientPath = $ this ->parameterBag ->validateAndGetStringValue (ConfigurationKey:: GIT_CLIENT_PATH , false );
249261 $ this ->localObjectCache ->cacheMethodResult (__METHOD__ , '' , $ gitClientPath );
250262 return $ gitClientPath ;
251263 }
@@ -262,7 +274,7 @@ public function getTwigFunctions(): CustomFunctionsCollection
262274 } catch (ObjectNotFoundException ) {
263275 }
264276 $ customFunctions = $ this ->parameterBag ->validateAndGetClassListValue (
265- ' twig_functions ' ,
277+ ConfigurationKey:: TWIG_FUNCTIONS ,
266278 CustomFunctionInterface::class
267279 );
268280 $ customFunctionsCollection = new CustomFunctionsCollection ();
@@ -285,7 +297,7 @@ public function getTwigFilters(): CustomFiltersCollection
285297 } catch (ObjectNotFoundException ) {
286298 }
287299 $ customFilters = $ this ->parameterBag ->validateAndGetClassListValue (
288- ' twig_filters ' ,
300+ ConfigurationKey:: TWIG_FILTERS ,
289301 CustomFilterInterface::class
290302 );
291303 $ customFiltersCollection = new CustomFiltersCollection ();
@@ -305,7 +317,7 @@ public function useSharedCache(): bool
305317 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
306318 } catch (ObjectNotFoundException ) {
307319 }
308- $ useSharedCache = $ this ->parameterBag ->validateAndGetBooleanValue (' use_shared_cache ' );
320+ $ useSharedCache = $ this ->parameterBag ->validateAndGetBooleanValue (ConfigurationKey:: USE_SHARED_CACHE );
309321 $ this ->localObjectCache ->cacheMethodResult (__METHOD__ , '' , $ useSharedCache );
310322 return $ useSharedCache ;
311323 }
@@ -319,7 +331,7 @@ public function isCheckFileInGitBeforeCreatingDocEnabled(): bool
319331 return $ this ->localObjectCache ->getMethodCachedResult (__METHOD__ , '' );
320332 } catch (ObjectNotFoundException ) {
321333 }
322- $ useSharedCache = $ this ->parameterBag ->validateAndGetBooleanValue (' check_file_in_git_before_creating_doc ' );
334+ $ useSharedCache = $ this ->parameterBag ->validateAndGetBooleanValue (ConfigurationKey:: CHECK_FILE_IN_GIT_BEFORE_CREATING_DOC );
323335 $ this ->localObjectCache ->cacheMethodResult (__METHOD__ , '' , $ useSharedCache );
324336 return $ useSharedCache ;
325337 }
@@ -353,7 +365,7 @@ public function getAdditionalConsoleCommands(): AdditionalCommandCollection
353365 } catch (ObjectNotFoundException ) {
354366 }
355367 $ customFilters = $ this ->parameterBag ->validateAndGetClassListValue (
356- ' additional_console_commands ' ,
368+ ConfigurationKey:: ADDITIONAL_CONSOLE_COMMANDS ,
357369 Command::class
358370 );
359371 $ additionalCommandCollection = AdditionalCommandCollection::create (...$ customFilters );
0 commit comments