Blame view
sources/apps/contacts/lib/dicontainer.php
2.05 KB
|
923852aa1
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
<?php
/**
* @author Thomas Tanghus
* Copyright (c) 2013 Thomas Tanghus (thomas@tanghus.net)
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Contacts;
use OCA\AppFramework\DependencyInjection\DIContainer as BaseContainer,
OCA\AppFramework\Middleware\MiddlewareDispatcher,
OCA\AppFramework\Middleware\Security\SecurityMiddleware,
OCA\Contacts\Middleware\Http as HttpMiddleware,
OCA\Contacts\Controller\AddressBookController,
OCA\Contacts\Controller\GroupController,
OCA\Contacts\Controller\ContactController,
OCA\Contacts\Controller\ContactPhotoController,
OCA\Contacts\Controller\SettingsController,
OCA\Contacts\Controller\ImportController;
class DIContainer extends BaseContainer {
/**
* Define your dependencies in here
*/
public function __construct(){
// tell parent container about the app name
parent::__construct('contacts');
$this['HttpMiddleware'] = $this->share(function($c){
return new HttpMiddleware($c['API']);
});
$this['MiddlewareDispatcher'] = $this->share(function($c){
$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware($c['HttpMiddleware']);
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
return $dispatcher;
});
/**
* CONTROLLERS
*/
$this['AddressBookController'] = $this->share(function($c){
return new AddressBookController($c['API'], $c['Request']);
});
$this['GroupController'] = $this->share(function($c){
return new GroupController($c['API'], $c['Request']);
});
$this['ContactController'] = $this->share(function($c){
return new ContactController($c['API'], $c['Request']);
});
$this['ContactPhotoController'] = $this->share(function($c){
return new ContactPhotoController($c['API'], $c['Request']);
});
$this['SettingsController'] = $this->share(function($c){
return new SettingsController($c['API'], $c['Request']);
});
$this['ImportController'] = $this->share(function($c){
return new ImportController($c['API'], $c['Request']);
});
}
}
|