*/
public function __destruct () {
// Skip here if dev-mode
- if (defined('DEVELOPER')) {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
return;
- } // END - if
+ }
// Skip here if already cached
if ($this->listCached === false) {
// And write whole list
$fileObject->fwrite($cacheContent);
- } // END - if
+ }
// Skip here if already cached
if ($this->classesCached === false) {
// Load the file
// @TODO Add some uglifying code (compress) here
$cacheContent .= $fileObject->fread($fileInstance->getSize());
- } // END - foreach
+ }
// Open file
$fileObject = $this->classCacheFile->openFile('w');
// And write it away
$fileObject->fwrite($cacheContent);
- } // END - if
+ }
}
/**
* @return void
*/
public static function scanFrameworkClasses () {
- // Trace message
- //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
-
// Get loader instance
+ //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
$loaderInstance = self::getSelfInstance();
// Get config instance
// Load all classes
foreach (self::$frameworkPaths as $shortPath) {
- // Debug message
- //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
-
// Generate full path from it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
$realPathName = realpath(sprintf(
'%smain%s%s%s',
$configInstance->getConfigEntry('framework_base_path'),
DIRECTORY_SEPARATOR
));
- // Debug message
- //* NOISY-DEBUG: */ printf('[%s:%d]: realPathName=%s' . PHP_EOL, __METHOD__, __LINE__, $realPathName);
-
// Is it not false and accessible?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: realPathName=%s' . PHP_EOL, __METHOD__, __LINE__, $realPathName);
if (is_bool($realPathName)) {
// Skip this
continue;
// Try to load the framework classes
$loaderInstance->scanClassPath($realPathName);
- } // END - foreach
+ }
// Trace message
//* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
* @return void
*/
public static function scanApplicationClasses () {
- // Trace message
- //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
-
// Get loader instance
+ //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
$loaderInstance = self::getSelfInstance();
// Get config instance
// Load all classes for the application
foreach (self::$frameworkPaths as $shortPath) {
- // Debug message
- //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
-
// Create path name
+ //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
$pathName = realpath(sprintf(
'%s%s%s%s%s',
$configInstance->getConfigEntry('application_base_path'),
$shortPath
));
- // Debug message
- //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName);
-
// Is the path readable?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName);
if (is_dir($pathName)) {
// Try to load the application classes
$loaderInstance->scanClassPath($pathName);
- } // END - if
- } // END - foreach
+ }
+ }
// Trace message
//* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
$shortPath
);
- // Debug message
- //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s - BEFORE!' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName);
-
// Try to find it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s - BEFORE!' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName);
$realPathName = realpath($pathName);
- // Debug message
- //* NOISY-DEBUG: */ printf('[%s:%d]: realPathName[%s]=%s - AFTER!' . PHP_EOL, __METHOD__, __LINE__, gettype($realPathName), $realPathName);
-
// Is the path readable?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: realPathName[%s]=%s - AFTER!' . PHP_EOL, __METHOD__, __LINE__, gettype($realPathName), $realPathName);
if ((is_dir($realPathName)) && (is_readable($realPathName))) {
// Try to load the application classes
ClassLoader::getSelfInstance()->scanClassPath($realPathName);
- } // END - if
- } // END - foreach
+ }
+ }
// Trace message
//* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
* @return void
*/
public static function registerTestsPath (string $relativePath) {
- // Trace message
- //* NOISY-DEBUG: */ printf('[%s:%d]: relativePath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $relativePath);
-
// "Register" it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: relativePath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $relativePath);
self::$testPaths[$relativePath] = $relativePath;
// Trace message
if (is_null(self::$selfInstance)) {
// Get a new one
self::$selfInstance = ClassLoader::createClassLoader(FrameworkBootstrap::getConfigurationInstance());
- } // END - if
+ }
// Return the instance
return self::$selfInstance;
if ($this->listCached === true) {
// Abort here
return;
- } // END - if
+ }
// Keep it in class for later usage
$this->ignoreList = $ignoreList;
// Skip non-file entries
//* NOISY-DEBUG: */ printf('[%s:%d] SKIP: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
continue;
- } // END - if
+ }
// Is this file wanted?
//* NOISY-DEBUG: */ printf('[%s:%d] FOUND: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
// Advance to next entry
//* NOISY-DEBUG: */ printf('[%s:%d] NEXT: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
$iteratorInstance->next();
- } // END - while
+ }
}
/**
$includeList = '';
foreach ($this->loadedClasses as $classFile) {
$includeList .= basename($classFile) . '<br />' . PHP_EOL;
- } // END - foreach
+ }
// And return it
return $includeList;
$this->configInstance = $configInstance;
// Construct the FQFN for the cache
- if (!defined('DEVELOPER')) {
+ if (!FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
+ // Init cache instances
$this->listCacheFile = new SplFileInfo($this->configInstance->getConfigEntry('local_database_path') . 'list-' . $this->configInstance->getConfigEntry('detected_app_name') . '.cache');
$this->classCacheFile = new SplFileInfo($this->configInstance->getConfigEntry('local_database_path') . 'class-' . $this->configInstance->getConfigEntry('detected_app_name') . '.cache');
- } // END - if
+ }
// Set suffix and prefix from configuration
$this->suffix = $configInstance->getConfigEntry('class_suffix');
self::$selfInstance = $this;
// Skip here if no dev-mode
- if (defined('DEVELOPER')) {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
return;
- } // END - if
+ }
// Is the cache there?
if (FrameworkBootstrap::isReadableFile($this->listCacheFile)) {
// List has been restored from cache!
$this->listCached = true;
- } // END - if
+ }
// Does the class cache exist?
if (FrameworkBootstrap::isReadableFile($this->classCacheFile)) {
// Mark the class cache as loaded
$this->classesCached = true;
- } // END - if
+ }
}
/**
if ((self::$strictNamingConvention === true) && (count($classNameParts) < 5)) {
// Namespace scheme is: Project\Package[\SubPackage...]
throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $className));
- } // END - if
+ }
// Get last element
$shortClassName = array_pop($classNameParts);
unset($this->foundClasses[$fileName]);
// Developer mode excludes caching (better debugging)
- if (!defined('DEVELOPER')) {
+ if (!FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
// Reset cache
//* NOISY-DEBUG: */ printf('[%s:%d] classesCached=false' . PHP_EOL, __METHOD__, __LINE__);
$this->classesCached = false;
- } // END - if
+ }
} else {
// Not found
//* NOISY-DEBUG: */ printf('[%s:%d] 404: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);