/** * Returns the actual object referenced by this Instance object. * * @param ServiceLocator|Container $container the container used to locate the referenced object. * If null, the method will first try `Leaps::$app` then `Leaps::$container`. * @return object the actual object referenced by this Instance object. */ public function get($container = null) { if ($container) { return $container->get($this->id); } if (Leaps::$app && Leaps::$app->has($this->id)) { return Leaps::$app->get($this->id); } else { return Leaps::$container->get($this->id); } }
/** * Constructor. * * @param string $id the ID of this module * @param Module $parent the parent module (if any) * @param array $config name-value pairs that will be used to initialize the object properties */ public function __construct($id, $parent = null, $config = []) { $this->id = $id; $this->module = $parent; parent::__construct($config); }