use \stdClass;
use \Iterator;
use \ReflectionClass;
+use \SplFileInfo;
/**
* The simulator system class is the super class of all other classes. This
*/
private $stateInstance = NULL;
+ /**
+ * Registry instance (implementing Register)
+ */
+ private $registryInstance = NULL;
+
+ /**
+ * Call-back instance
+ */
+ private $callbackInstance = NULL;
+
/**
* Thousands separator
*/
return $this->outputInstance;
}
+ /**
+ * Setter for registry instance
+ *
+ * @param $registryInstance An instance of a Register class
+ * @return void
+ */
+ protected final function setRegistryInstance (Register $registryInstance) {
+ $this->registryInstance = $registryInstance;
+ }
+
+ /**
+ * Getter for registry instance
+ *
+ * @return $registryInstance The debug registry instance
+ */
+ public final function getRegistryInstance () {
+ return $this->registryInstance;
+ }
+
+ /**
+ * Setter for call-back instance
+ *
+ * @param $callbackInstance An instance of a FrameworkInterface class
+ * @return void
+ */
+ public final function setCallbackInstance (FrameworkInterface $callbackInstance) {
+ $this->callbackInstance = $callbackInstance;
+ }
+
+ /**
+ * Getter for call-back instance
+ *
+ * @return $callbackInstance An instance of a FrameworkInterface class
+ */
+ protected final function getCallbackInstance () {
+ return $this->callbackInstance;
+ }
+
/**
* Setter for command name
*
);
// Output it
- ApplicationEntryPoint::app_exit(sprintf('<div class="debug_header">
+ ApplicationEntryPoint::exitApplication(sprintf('<div class="debug_header">
%s debug output:
</div>
<div class="debug_content">
// Get backtrace
$backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
- // Is function 'partialStub' ?
- if ($backtrace[1]['function'] == 'partialStub') {
+ // Is function partialStub/__callStatic ?
+ if (in_array($backtrace[1]['function'], array('partialStub', '__call', '__callStatic'))) {
// Prepend class::function:line from 3rd element
$message = sprintf('[%s::%s:%d]: %s',
$backtrace[2]['class'],
*
* @param $str The string with maybe dashes inside
* @return $str The converted string with no dashed, but underscores
- */
- public static final function convertDashesToUnderscores ($str) {
+ * @throws NullPointerException If $str is null
+ * @throws InvalidArgumentException If $str is empty
+ */
+ public static function convertDashesToUnderscores ($str) {
+ // Is it null?
+ if (is_null($str)) {
+ // Throw NPE
+ throw new NullPointerException($this, BaseFrameworkSystem::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_string($str)) {
+ // Entry is empty
+ throw new InvalidArgumentException(sprintf('str[]=%s is not a string', gettype($str)), self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ } elseif ((is_string($str)) && (empty($str))) {
+ // Entry is empty
+ throw new InvalidArgumentException('str is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ }
+
// Convert them all
$str = str_replace('-', '_', $str);
* Creates a full-qualified file name (FQFN) for given file name by adding
* a configured temporary file path to it.
*
- * @param $fileName Name for temporary file
- * @return $fqfn Full-qualified file name
+ * @param $infoInstance An instance of a SplFileInfo class
+ * @return $tempInstance An instance of a SplFileInfo class (temporary file)
* @throw PathWriteProtectedException If the path in 'temp_file_path' is write-protected
* @throws FileIoException If the file cannot be written
*/
- protected static function createTempPathForFile ($fileName) {
+ protected static function createTempPathForFile (SplFileInfo $infoInstance) {
// Get config entry
$basePath = FrameworkConfiguration::getSelfInstance()->getConfigEntry('temp_file_path');
// Is the path writeable?
if (!is_writable($basePath)) {
// Path is write-protected
- throw new PathWriteProtectedException($fileName, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN);
+ throw new PathWriteProtectedException($infoInstance, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN);
} // END - if
// Add it
- $fqfn = $basePath . DIRECTORY_SEPARATOR . $fileName;
+ $tempInstance = new SplFileInfo($basePath . DIRECTORY_SEPARATOR . $infoInstance->getBasename());
// Is it reachable?
- if (!FrameworkBootstrap::isReachableFilePath($fqfn)) {
+ if (!FrameworkBootstrap::isReachableFilePath($tempInstance)) {
// Not reachable
- throw new FileIoException($fqfn, self::EXCEPTION_FILE_NOT_REACHABLE);
+ throw new FileIoException($tempInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
} // END - if
// Return it
- return $fqfn;
+ return $tempInstance;
}
/**