/
container.php
43 lines (32 loc) · 1.14 KB
/
container.php
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
<?php
use Doctrine\Common\Cache\FilesystemCache;
use Pimple\Container;
use Polidog\Esa\Client;
use Symfony\Component\Console\Application;
use Ttskch\EsaCli\Command\DiffCommand;
use Ttskch\EsaCli\Command\GrepCommand;
use Ttskch\EsaCli\Esa\Proxy;
$container = new Container();
require __DIR__ . '/parameters.php';
$container['console'] = function($container) {
$console = new Application('ttskch/esa-cli');
$console->add($container['grep_command']);
$console->add($container['diff_command']);
return $console;
};
$container['cache'] = function() {
return new FilesystemCache(__DIR__ . '/../var/cache');
};
$container['grep_command'] = function($container) {
return new GrepCommand($container['esa_proxy']);
};
$container['diff_command'] = function($container) {
return new DiffCommand($container['esa_proxy']);
};
$container['esa_proxy'] = function($container) {
return new Proxy($container['esa'], $container['cache'], $container['parameters.esa_paging_limit']);
};
$container['esa'] = function($container) {
return new Client($container['parameters.access_token'], $container['parameters.team_name']);
};
return $container;