1
|
|
|
<?php |
2
|
|
|
namespace Fwlib\Base; |
3
|
|
|
|
4
|
|
|
use Fwlib\Bridge\Smarty; |
5
|
|
|
use Fwlib\Cache\CachedCaller; |
6
|
|
|
use Fwlib\Html\ListTable; |
7
|
|
|
use Fwlib\Html\ListView\ListView; |
8
|
|
|
use Fwlib\Net\Curl; |
9
|
|
|
use Fwlib\Validator\Validator; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Service Container |
13
|
|
|
* |
14
|
|
|
* This is a working service container, can be used directly in production, or |
15
|
|
|
* extend to add more service classes or creation methods. |
16
|
|
|
* |
17
|
|
|
* @copyright Copyright 2013-2015 Fwolf |
18
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
19
|
|
|
*/ |
20
|
|
|
class ServiceContainer implements ServiceContainerInterface |
21
|
|
|
{ |
22
|
|
|
use ServiceContainerTrait; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
*/ |
28
|
|
|
protected function buildClassMap() |
29
|
|
|
{ |
30
|
|
|
$classMap = [ |
31
|
|
|
'CachedCaller' => CachedCaller::class, |
32
|
|
|
'Curl' => Curl::class, |
33
|
|
|
'ListView' => ListView::class, |
34
|
|
|
'Smarty' => Smarty::class, |
35
|
|
|
'Validator' => Validator::class, |
36
|
|
|
]; |
37
|
|
|
|
38
|
|
|
return $classMap; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Create ListTable service instance |
44
|
|
|
* |
45
|
|
|
* @return ListTable |
46
|
|
|
*/ |
47
|
|
|
protected function createListTable() |
48
|
|
|
{ |
49
|
|
|
return new ListTable($this->getSmarty()); |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return CachedCaller |
55
|
|
|
*/ |
56
|
|
|
public function getCachedCaller() |
57
|
|
|
{ |
58
|
|
|
return $this->get('CachedCaller'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return Curl |
64
|
|
|
*/ |
65
|
|
|
public function getCurl() |
66
|
|
|
{ |
67
|
|
|
return $this->get('Curl'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return ListTable |
73
|
|
|
* @deprecated Use ListView |
74
|
|
|
*/ |
75
|
|
|
public function getListTable() |
76
|
|
|
{ |
77
|
|
|
return $this->get('ListTable'); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return ListView |
83
|
|
|
*/ |
84
|
|
|
public function getListView() |
85
|
|
|
{ |
86
|
|
|
return $this->get('ListView'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return Smarty |
92
|
|
|
*/ |
93
|
|
|
public function getSmarty() |
94
|
|
|
{ |
95
|
|
|
return $this->get('Smarty'); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return Validator |
101
|
|
|
*/ |
102
|
|
|
public function getValidator() |
103
|
|
|
{ |
104
|
|
|
return $this->get('Validator'); |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.