1919 * @author Ibrahim
2020 */
2121class JsonDriver implements ConfigurationDriver {
22+
2223 /**
23- * The location at which the configuration file will be kept at.
24- *
25- * @var string The file will be stored at [APP_PATH]/config/';
24+ * Returns the path to JSON configuration files.
2625 */
27- const JSON_CONFIG_FILE_PATH = APP_PATH .'config ' .DIRECTORY_SEPARATOR ;
26+ private static function getConfigPath (): string {
27+ return APP_PATH .'config ' .DIRECTORY_SEPARATOR ;
28+ }
2829 /**
2930 * The name of JSON configuration file.
3031 */
@@ -466,7 +467,7 @@ public function getTitleSeparator(): string {
466467 * file with same name, it will be overriden.
467468 */
468469 public function initialize (bool $ reCreate = false ) {
469- $ path = self ::JSON_CONFIG_FILE_PATH .self ::getConfigFileName ().'.json ' ;
470+ $ path = self ::getConfigPath () .self ::getConfigFileName ().'.json ' ;
470471
471472 if (!file_exists ($ path ) || $ reCreate ) {
472473 $ this ->writeJson ();
@@ -480,7 +481,7 @@ public function initialize(bool $reCreate = false) {
480481 * be set using the method JsonDriver::setConfigFileName()
481482 */
482483 public function remove () {
483- $ f = new File (self ::JSON_CONFIG_FILE_PATH . DIRECTORY_SEPARATOR .self ::getConfigFileName ().'.json ' );
484+ $ f = new File (self ::getConfigPath () .self ::getConfigFileName ().'.json ' );
484485 $ f ->remove ();
485486 }
486487 public function removeAllDBConnections () {
@@ -746,7 +747,7 @@ private function isValidLangCode($langCode) {
746747 return $ code ;
747748 }
748749 private function writeJson () {
749- $ file = new File (self ::JSON_CONFIG_FILE_PATH .self ::getConfigFileName ().'.json ' );
750+ $ file = new File (self ::getConfigPath () .self ::getConfigFileName ().'.json ' );
750751 $ file ->remove ();
751752 $ json = $ this ->toJSON ();
752753 $ json ->setIsFormatted (true );
0 commit comments