*/
public static function loadInclude (SplFileInfo $fileInstance) {
// Should be there ...
- //* NOISY-DEBUG: */ printf('[%s:%d]: fileInstance=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $fileInstance);
+ //* NOISY-DEBUG: */ printf('[%s:%d]: fileInstance=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $fileInstance->__toString());
if (!self::isReadableFile($fileInstance)) {
// Abort here
throw new InvalidArgumentException(sprintf('Cannot find fileInstance.pathname=%s.', $fileInstance->getPathname()));
+ } elseif (!$fileInstance->isFile()) {
+ // Not a file
+ throw new InvalidArgumentException(sprintf('fileInstance.pathname=%s is not a file', $fileInstance->getPathname()));
+ } elseif (substr($fileInstance->__toString(), -4, 4) != '.php') {
+ // Not PHP script
+ throw new InvalidArgumentException(sprintf('fileInstance.pathname=%s is not a PHP script', $fileInstance->getPathname()));
}
// Load it
* Now check and load all files, found deprecated files will throw a
* warning at the user.
*/
+ /* NOISY-DEBUG: */ printf('[%s:%d]: self::configAppIncludes()=%d' . PHP_EOL, __METHOD__, __LINE__, count(self::$configAppIncludes));
foreach (self::$configAppIncludes as $fileName => $status) {
// Construct file instance
+ //* NOISY-DEBUG: */ printf('[%s:%d]: fileName=%s,status=%s' . PHP_EOL, __METHOD__, __LINE__, $fileName, $status);
$fileInstance = new SplFileInfo(sprintf('%s%s.php', self::getDetectedApplicationPath(), $fileName));
// Determine if this file is wanted/readable/deprecated
ApplicationEntryPoint::exitApplication(sprintf('File "%s.php" from application "%s" cannot be read. Please fix CHMOD.', $fileInstance->getBasename(), self::getDetectedApplicationName()));
} elseif (($status != 'required') && (!self::isReadableFile($fileInstance))) {
// Not found but optional/deprecated file, skip it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: fileName=%s,status=%s - SKIPPED!' . PHP_EOL, __METHOD__, __LINE__, $fileName, $status);
continue;
}
}
// Load it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking self::loadInclude(%s) ...' . PHP_EOL, __METHOD__, __LINE__, $fileInstance->__toString());
self::loadInclude($fileInstance);
}
*/
public static function startApplication () {
// Is there an application helper instance?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
$applicationInstance = call_user_func_array(
[
'Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance'
);
// Some sanity checks
+ //* NOISY-DEBUG: */ printf('[%s:%d]: applicationInstance=%s' . PHP_EOL, __METHOD__, __LINE__, $applicationInstance->__toString());
if ((empty($applicationInstance)) || (is_null($applicationInstance))) {
// Something went wrong!
ApplicationEntryPoint::exitApplication(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because the helper class <span class="class_name">%s</span> is not loaded.',
}
// Now call all methods in one go
+ //* NOISY-DEBUG: */ printf('[%s:%d]: Initializing application ...' . PHP_EOL, __METHOD__, __LINE__);
foreach (['setupApplicationData', 'initApplication', 'launchApplication'] as $methodName) {
// Call method
- //*NOISY-DEBUG: */ printf('[%s:%d]: Calling methodName=%s ...' . PHP_EOL, __METHOD__, __LINE__, $methodName);
+ //*NOISY-DEBUG: */ printf('[%s:%d]: Invoking methodName=%s ...' . PHP_EOL, __METHOD__, __LINE__, $methodName);
call_user_func([$applicationInstance, $methodName]);
}
+
+ // Trace message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
}
/**