protected static function Init() { if (static::$instance === null) { static::$instance = new ConfigManager(Path::Create($_SERVER['DOCUMENT_ROOT'])->append('../config/'), Environment::get()); } }
public function findSource() { if ($this->external) { $this->sourcePath = $this->name; _u(); return; } $envPrefix = '.' . Environment::get(); if ($this->type == self::SCRIPT) { $possibleExtensions = [$envPrefix . '.js', '.js']; $extfind = "#\\.js\$#"; } else { if ($this->type == self::STYLE) { $possibleExtensions = [$envPrefix . '.css', '.css', $envPrefix . '.less', '.less', $envPrefix . '.scss', '.scss']; $extfind = '#\\.css$#'; } } $baseName = $this->config->sourcePath . '/' . $this->type . '/' . $this->name; foreach ($possibleExtensions as $extreplace) { $testfile = preg_replace($extfind, $extreplace, $baseName); if (file_exists($testfile)) { $this->sourcePath = $testfile; $this->sourceTime = filemtime($testfile); break; } } }