private function registerApplication() { $this->container->registerService('UseCaseGetActivityHistory', function ($c) { return new GetActivityHistory($c->query('ActivityRepository'), $c->query('FilterFactory')); }); $this->container->registerService('UseCaseGetStorageHistory', function ($c) { return new GetStorageHistory($c->query('StorageRepository'), $c->query('FilterFactory')); }); $this->container->registerService('AddStorageHandler', function ($c) { return new AddStorageHandler($c->query('StorageRepository')); }); }
public function registerServices() { $app = $this->app; $appName = $this->appName; $this->container->registerService('HttpMiddleware', function($container) { return new HttpMiddleware(); }); $this->container->registerService('PageController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); return new PageController($appName, $request); }); $this->container->registerService('AddressBookController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); $api = $container->query('API'); return new AddressBookController($appName, $request, $app, $api); }); $this->container->registerService('BackendController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); return new BackendController($container, $request, $app); }); $this->container->registerService('GroupController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); $tags = $container->getServer()->getTagManager()->load('contact', array(), true); return new GroupController($appName, $request, $app, $tags); }); $this->container->registerService('ContactController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); return new ContactController($appName, $request, $app); }); $this->container->registerService('ContactPhotoController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); $cache = $container->getServer()->getCache(); return new ContactPhotoController($appName, $request, $app, $cache); }); $this->container->registerService('SettingsController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); return new SettingsController($appName, $request, $app); }); $this->container->registerService('ImportController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); $cache = $container->getServer()->getCache(); $tags = $container->getServer()->getTagManager()->load('contact'); return new ImportController($appName, $request, $app, $cache, $tags); }); $this->container->registerService('ExportController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); return new ExportController($appName, $request, $app); }); }
/** * Instantiates the environment * * @return Environment */ private function instantiateEnvironment() { $this->container->registerService('UserId', function ($c) { return $this->userId; }); $this->container->registerService('userFolder', function ($c) { return $this->userFolder; }); return $this->container->query('OCA\\GalleryPlus\\Environment\\Environment'); }
protected function setUp() { $app = new Application(); $this->container = $app->getContainer(); $this->requestMock = $requestMock = $this->getMock('\\OCP\\IRequest'); $this->container->registerService('Request', function ($c) use($requestMock) { return $requestMock; }); $this->loggerMock = $loggerMock = $this->getMock('\\OCP\\ILogger'); $this->container->registerService('Logger', function ($c) use($loggerMock) { return $loggerMock; }); $this->translationMock = $translationMock = $this->getMock('\\OCP\\IL10N'); $this->container->registerService('TranslationService', function ($c) use($translationMock) { return $translationMock; }); $this->responseFactoryMock = $responseFactoryMock = $this->getMock('\\OCA\\EasyBackup\\ResponseFactory'); $this->container->registerService('ResponseFactory', function ($c) use($responseFactoryMock) { return $responseFactoryMock; }); }
private function registerUsageChartsApi() { $this->container->registerService('ContentStatisticsClientApiConnection', function ($c) { return new ApiConnection(new \GuzzleHttp\Client(), $c->query('ServerContainer')->getConfig()->getAppValue($c->query('AppName'), 'url'), $c->query('ServerContainer')->getConfig()->getAppValue($c->query('AppName'), 'username'), $c->query('ServerContainer')->getConfig()->getAppValue($c->query('AppName'), 'password')); }); $this->container->registerService('ContentStatisticsClient', function ($c) { return new ContentStatisticsClient(new ActivityStream($c->query('ContentStatisticsClientApiConnection')), new StorageStream($c->query('ContentStatisticsClientApiConnection'))); }); $useApi = $this->container->query('ServerContainer')->getConfig()->getAppValue($this->container->query('AppName'), 'useapi'); $this->container->registerService('FileHooks', function ($c) use(&$useApi) { return new FileHooks($c->query('ContentStatisticsClient'), $useApi); }); $this->container->registerService('ContentStatisticsUpdater', function ($c) { return new ContentStatisticsUpdater($c->query('ContentStatisticsClient'), $c->query('DataProviderFactory'), $c->query('OwncloudUsers')); }); }
/** * register reader classes * @param IAppContainer $container */ private function registerReaders(IAppContainer $container) { $container->registerService('JSONCalendarReader', function (IAppContainer $c) { return function ($request) use($c) { $calendarFactory = $c->query('CalendarFactory'); $reader = new Calendar\Http\JSON\CalendarReader($request, $calendarFactory); $reader->getObject(); }; }); $container->registerService('JSONSubscriptionReader', function (IAppContainer $c) { return function ($request) use($c) { $subscriptionFactory = $c->query('SubscriptionFactory'); $reader = new Calendar\Http\JSON\SubscriptionReader($request, $subscriptionFactory); $reader->getObject(); }; }); }