/** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void */ public function register(Container $container) { $closure = function (Container $container) { return new \S3($container->get('app')->get('amazon.access_key'), $container->get('app')->get('amazon.secret_key')); }; Ioc::getContainer()->share('s3', $closure); }
/** * onBeforeRouting * * @param Event $event * * @return void * * @throws \Exception */ public function onAfterRouting(Event $event) { $app = Ioc::getApplication(); $controller = Ioc::get('main.controller'); $route = $app->get('uri.route'); if (trim($route, '/')) { return; } Ioc::getContainer()->share('main.controller', $controller); }
/** * onAfterInitialise * * @param Event $event * * @return void */ public function onAfterInitialise(Event $event) { Ioc::getContainer()->share('system.profiler', new Profiler('system')); }