use CoreFramework\Crypto\Cryptable;
use CoreFramework\Crypto\RandomNumber\RandomNumberGenerator;
use CoreFramework\Database\Frontend\DatabaseWrapper;
+use CoreFramework\EntryPoint\ApplicationEntryPoint;
use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Filesystem\Block;
use CoreFramework\Generic\UnsupportedOperationException;
use CoreFramework\Handler\Handleable;
use CoreFramework\Handler\Stream\IoHandler;
+use CoreFramework\Helper\Helper;
use CoreFramework\Index\Indexable;
use CoreFramework\Lists\Listable;
use CoreFramework\Loader\ClassLoader;
use CoreFramework\Result\Search\SearchableResult;
use CoreFramework\Stacker\Stackable;
use CoreFramework\State\Stateable;
+use CoreFramework\Stream\Input\InputStream;
use CoreFramework\Stream\Output\OutputStreamer;
+use CoreFramework\Stream\Output\OutputStream;
use CoreFramework\Template\CompileableTemplate;
use CoreFramework\User\ManageableAccount;
use CoreFramework\Visitor\Visitor;
*/
private $parserInstance = NULL;
- /**
- * A HandleableProtocol instance
- */
- private $protocolInstance = NULL;
-
/**
* A database wrapper instance
*/
*/
private $visitorInstance = NULL;
- /**
- * DHT instance
- */
- private $dhtInstance = NULL;
-
/**
* An instance of a database wrapper class
*/
*/
private $stateInstance = NULL;
+ /**
+ * Registry instance (implementing Register)
+ */
+ private $registryInstance = NULL;
+
/**
* Thousands separator
*/
*/
private $controllerName = '';
- /**
- * Name of used protocol
- */
- private $protocolName = 'invalid';
-
/**
* Array with bitmasks and such for pack/unpack methods to support both
* 32-bit and 64-bit systems
$this->setRealClass('DestructedObject');
} elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
// Already destructed object
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] The object <span class="object_name">%s</span> is already destroyed.',
- __CLASS__,
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('The object <span class="object_name">%s</span> is already destroyed.',
$this->__toString()
));
} else {
// Output stub message
// @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[unknown::%s:] Stub! Args: %s',
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[unknown::%s]: Stub! Args: %s',
$methodName,
$argsString
));
return $this->parserInstance;
}
- /**
- * Setter for HandleableProtocol instance
- *
- * @param $protocolInstance An instance of an HandleableProtocol
- * @return void
- */
- public final function setProtocolInstance (HandleableProtocol $protocolInstance) {
- $this->protocolInstance = $protocolInstance;
- }
-
- /**
- * Getter for HandleableProtocol instance
- *
- * @return $protocolInstance An instance of an HandleableProtocol
- */
- public final function getProtocolInstance () {
- return $this->protocolInstance;
- }
-
/**
* Setter for DatabaseWrapper instance
*
return $this->visitorInstance;
}
- /**
- * Setter for DHT instance
- *
- * @param $dhtInstance A Distributable instance
- * @return void
- */
- protected final function setDhtInstance (Distributable $dhtInstance) {
- $this->dhtInstance = $dhtInstance;
- }
-
- /**
- * Getter for DHT instance
- *
- * @return $dhtInstance A Distributable instance
- */
- protected final function getDhtInstance () {
- return $this->dhtInstance;
- }
-
/**
* Setter for raw package Data
*
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 command name
*
return $this->controllerName;
}
- /**
- * Getter for protocol name
- *
- * @return $protocolName Name of used protocol
- */
- public final function getProtocolName () {
- return $this->protocolName;
- }
-
- /**
- * Setter for protocol name
- *
- * @param $protocolName Name of used protocol
- * @return void
- */
- protected final function setProtocolName ($protocolName) {
- $this->protocolName = $protocolName;
- }
-
/**
* Checks whether an object equals this object. You should overwrite this
* method to implement own equality checks
// Is a message set?
if (!empty($message)) {
// Construct message
- $content = sprintf('<div class="debug_message">Message: %s</div>' . PHP_EOL, $message);
+ $content = sprintf('<div class="debug_message">
+ Message: %s
+</div>' . PHP_EOL, $message);
} // END - if
// Generate the output
);
// Output it
- ApplicationEntryPoint::app_exit(sprintf('<div class="debug_header">%s debug output:</div><div class="debug_content">%s</div>Loaded includes: <div class="debug_include_list">%s</div>',
+ ApplicationEntryPoint::app_exit(sprintf('<div class="debug_header">
+ %s debug output:
+</div>
+<div class="debug_content">
+ %s
+</div>
+Loaded includes:
+<div class="debug_include_list">
+ %s
+</div>',
$this->__toString(),
$content,
ClassLoader::getSelfInstance()->getPrintableIncludeList()
* @return void
*/
protected function partialStub ($message = '') {
- // Get the backtrace
- $backtrace = debug_backtrace();
-
- // Generate the class::method string
- $methodName = 'UnknownClass->unknownMethod';
- if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
- $methodName = $backtrace[1]['class'] . '->' . $backtrace[1]['function'];
- } // END - if
-
- // Construct the full message
- $stubMessage = sprintf('[%s:] Partial stub!',
- $methodName
- );
+ // Init variable
+ $stubMessage = 'Partial Stub!';
// Is the extra message given?
if (!empty($message)) {
// Empty string should be ignored and used for testing the middleware
DebugMiddleware::getSelfInstance()->output('');
- // Set it in its own class. This will set it in the registry
- $debugInstance->setDebugInstance($debugInstance);
+ // Set it in registry
+ Registry::getRegistry()->addInstance('debug', $debugInstance);
} else {
// Get instance from registry
- $debugInstance = Registry::getRegistry()->getDebugInstance();
+ $debugInstance = Registry::getRegistry()->getInstance('debug');
}
// Return it
// Set debug instance to NULL
$debugInstance = NULL;
+ // Get backtrace
+ $backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
+
+ // 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'],
+ $backtrace[2]['function'],
+ (isset($backtrace[2]['line']) ? $backtrace[2]['line'] : '0'),
+ $message
+ );
+ } else {
+ // Prepend class::function:line from 2nd element
+ $message = sprintf('[%s::%s:%d]: %s',
+ $backtrace[1]['class'],
+ $backtrace[1]['function'],
+ (isset($backtrace[1]['line']) ? $backtrace[1]['line'] : '0'),
+ $message
+ );
+ }
+
// Try it:
try {
// Get debug instance
} // END - if
// Add it
- $fqfn = $basePath . '/' . $fileName;
+ $fqfn = $basePath . DIRECTORY_SEPARATOR . $fileName;
// Is it reachable?
if (!FrameworkBootstrap::isReachableFilePath($fqfn)) {