Beispiel #1
0
 /**
  * Module constructor.
  *
  * @param string             $path
  * @param ResourcesInterface $resources
  * @param SystemInterface    $system
  * @param Generator          $generator
  */
 public function __construct($path, ResourcesInterface $resources, SystemInterface $system, Generator $generator = null)
 {
     parent::__construct($path, $resources, $system);
     $this->generator = isset($generator) ? $generator : new Generator(new \samsonphp\generator\Generator(), 'view', array('\\www', '\\view'), View::class);
     // Register View class file autoloader
     spl_autoload_register(array($this, 'autoload'));
 }
Beispiel #2
0
 /**
  * ExternalModule constructor.
  *
  * @param string             $path   Path to module
  * @param ResourcesInterface $resources
  * @param SystemInterface    $system Framework instance
  */
 public function __construct($path, ResourcesInterface $resources, SystemInterface $system)
 {
     // Получим имя класса
     $class = self::getName(get_class($this));
     // Search instance
     if (!isset(self::$factory[$class])) {
         self::$factory[$class] = $this;
         // If service is configured to gather ancestors data
         if ($this->gatherAncestorData) {
             $this->gatherAncestorsData($this, $this);
         }
     } else {
         e('Attempt to create another instance of Factory class: ##', E_SAMSON_FATAL_ERROR, $class);
     }
     // Вызовем родительский конструктор
     parent::__construct($path, $resources, $system);
 }
Beispiel #3
0
 /**
  * VirtualModule constructor.
  *
  * @param string             $path
  * @param ResourcesInterface $resources
  * @param SystemInterface    $system
  * @param null               $moduleId
  */
 public function __construct($path, ResourcesInterface $resources, SystemInterface $system, $moduleId = null)
 {
     $this->id = $moduleId;
     parent::__construct($path, $resources, $system);
 }