* @param $code Code number for the exception
* @return void
*/
- public function __construct (FrameworkInterface $class, $code) {
- // Add a message around the missing class
- $message = sprintf('[%s:%d] An object instance is set to <em>null</em>.',
- $class->__toString(),
- $this->getLine()
- );
+ public function __construct (FrameworkInterface $class = NULL, $code) {
+ // Is the instance set?
+ if (is_null($class)) {
+ // Add a message around the missing class
+ $message = sprintf('[unknown:%d] An object instance is set to <em>null</em>.',
+ $this->getLine()
+ );
+ } else {
+ // Add a message around the missing class
+ $message = sprintf('[%s:%d] An object instance is set to <em>null</em>.',
+ $class->__toString(),
+ $this->getLine()
+ );
+ }
// Call parent constructor
parent::__construct($message, $code);