Example #1
0
 /**
  * Getter for registry
  *
  * @author Benjamin Carl <*****@*****.**>
  * @return Doozr_Registry The registry of Doozr
  * @access protected
  * @static
  */
 protected static function getRegistry()
 {
     if (self::$registry === null) {
         self::$registry = Doozr_Registry::getInstance();
     }
     return self::$registry;
 }
Example #2
0
 /**
  * Returns the response object for sending header(s).
  *
  * @author Benjamin Carl <*****@*****.**>
  *
  * @return Doozr_Response_Cli|Doozr_Response_Httpd|Doozr_Response_Web
  */
 protected function getResponse()
 {
     // get registry
     $registry = Doozr_Registry::getInstance();
     // get response
     /* @var $response Doozr_Response_Web */
     return $registry->front->getResponse();
 }
Example #3
0
 /**
  * Constructor.
  *
  * @param Doozr_Datetime_Service $datetime    Datetime Service of Doozr
  * @param int                    $level       Loglevel of the logging extending this class
  * @param string                 $fingerprint Fingerprint of the client
  *
  * @author Benjamin Carl <*****@*****.**>
  *
  * @return \Doozr_Logging_File
  */
 public function __construct(Doozr_Datetime_Service $datetime, $level = null, $fingerprint = null)
 {
     // call parents constructor
     parent::__construct($datetime, $level, $fingerprint);
     // get registry
     $registry = Doozr_Registry::getInstance();
     // store path-manager
     $this->setPath($registry->path);
     // set logfile-name (+path)
     $this->setLogfile($_SERVER['PHP_SELF']);
     // set filesystem service
     $this->setFilesystem(Doozr_Loader_Serviceloader::load('filesystem'));
 }
Example #4
0
 /**
  * Initializes the registry of the Doozr Framework. The registry itself
  * is intend to store the instances mainly used by core classes like Doozr_Path, Doozr_Configuration,
  * Doozr_Logging and this instances are always accessible by its name after the underscore (_ - written lowercase)
  * e.g. Doozr_Logging will be available like this $registry->logging, Doozr_Configuration like $registry->configuration
  * and so on.
  *
  * @param array $parameters The parameters to store in parameter bag.
  *
  * @author Benjamin Carl <*****@*****.**>
  *
  * @return bool TRUE on success
  * @static
  */
 protected static function initRegistry(array $parameters = [])
 {
     self::$registry = Doozr_Registry::getInstance($parameters);
     // Important for bootstrap result
     return true;
 }
Example #5
0
 /**
  * Prepares setup for Tests.
  *
  * @author Benjamin Carl <*****@*****.**>
  */
 protected function setUp()
 {
     /* @var $app Doozr_Kernel_App Get kernel instance */
     self::$kernel = Doozr_Kernel_App::boot(DOOZR_APP_ENVIRONMENT, DOOZR_RUNTIME_ENVIRONMENT, DOOZR_UNIX, DOOZR_DEBUGGING, DOOZR_CACHING, DOOZR_CACHING_CONTAINER, DOOZR_LOGGING, DOOZR_PROFILING, DOOZR_APP_ROOT, DOOZR_DIRECTORY_TEMP, DOOZR_DOCUMENT_ROOT, DOOZR_NAMESPACE, DOOZR_NAMESPACE_FLAT);
     // Store className
     self::$serviceClassName = 'Doozr_' . self::$serviceName . '_Service';
     // Get registry
     self::$registry = Doozr_Registry::getInstance();
     // Load service
     self::$service = Doozr_Loader_Serviceloader::load(self::$serviceName);
 }
Example #6
0
 /**
  * Rewinds the position to 0.
  *
  * @author Benjamin Carl <*****@*****.**>
  *
  * @return mixed The result of the operation
  */
 public function rewind()
 {
     self::$position = 0;
 }
Example #7
0
 /**
  * Constructor.
  *
  * @param Doozr_Registry &$registry The instance of Doozr_Registry
  * @param string          $resource The resource to load
  * @param array           $config   The resource to set as input (optional)
  *                                  defaults come from configuration
  *
  * @throws Doozr_Template_Service_Exception
  * @author Benjamin Carl <*****@*****.**>
  * @return \Doozr_Template_Service
  * @access public
  */
 public function __construct(Doozr_Registry &$registry, $resource = null, array $config = null)
 {
     // Detect and store settings
     if ($config) {
         $path = $config['path'];
         $library = $config['library'];
     } else {
         $path = $registry->getConfiguration()->kernel->view->template->path;
         $library = $registry->getConfiguration()->kernel->view->template->engine->library;
     }
     // Store registry instance
     self::setRegistry($registry);
     // Init
     $this->resource($resource)->path($path)->library($library)->initEngine($library, $path);
 }
Example #8
0
 /**
  * Initialize the instance, registry and DI.
  *
  * @author Benjamin Carl <*****@*****.**>
  * @static
  */
 public static function init()
 {
     // create instance like we would by calling getInstance()
     self::getInstance();
     self::$registry = Doozr_Registry::getInstance();
     self::initDependencyInjection();
 }