1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Fwk |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2011-2012, Julien Ballestracci <[email protected]>. |
6
|
|
|
* All rights reserved. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
12
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
13
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
14
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
15
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
16
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
17
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
18
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
19
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
20
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
21
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
22
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
23
|
|
|
* |
24
|
|
|
* PHP Version 5.3 |
25
|
|
|
* |
26
|
|
|
* @category DependencyInjection |
27
|
|
|
* @package Fwk\Di |
28
|
|
|
* @author Julien Ballestracci <[email protected]> |
29
|
|
|
* @copyright 2011-2014 Julien Ballestracci <[email protected]> |
30
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
31
|
|
|
* @link http://fwk.io/di |
32
|
|
|
*/ |
33
|
|
|
namespace Fwk\Di; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* DefinitionInterface |
37
|
|
|
* |
38
|
|
|
* Represents a Definition |
39
|
|
|
* |
40
|
|
|
* @category Interfaces |
41
|
|
|
* @package Fwk\Di |
42
|
|
|
* @author Julien Ballestracci <[email protected]> |
43
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
44
|
|
|
* @link http://fwk.io/di |
45
|
|
|
*/ |
46
|
|
|
interface DefinitionInterface extends InvokableInterface |
47
|
|
|
{ |
48
|
|
|
/** |
49
|
|
|
* Defines if the Definition's result/instance should be "shared" |
50
|
|
|
* |
51
|
|
|
* @param boolean $bool true or false |
52
|
|
|
* |
53
|
|
|
* @return DefinitionInterface |
54
|
|
|
*/ |
55
|
|
|
public function setShared($bool); |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Tells if the Definition's result/instance is shared or not |
59
|
|
|
* |
60
|
|
|
* @return boolean |
61
|
|
|
*/ |
62
|
|
|
public function isShared(); |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Sets (erase) definition meta-data |
66
|
|
|
* |
67
|
|
|
* @param array $data The Definition's data |
68
|
|
|
* |
69
|
|
|
* @return DefinitionInterface |
70
|
|
|
*/ |
71
|
|
|
public function setData(array $data); |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Returns all definition meta-data |
75
|
|
|
* |
76
|
|
|
* @return array |
77
|
|
|
*/ |
78
|
|
|
public function getData(); |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Returns a meta-data parameter ($param) or $default if not defined |
82
|
|
|
* |
83
|
|
|
* @param string $param Parameter key |
84
|
|
|
* @param null|mixed $default Default return value if not defined |
85
|
|
|
* |
86
|
|
|
* @return mixed |
87
|
|
|
*/ |
88
|
|
|
public function get($param, $default = null); |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Defines a meta-data parameter |
92
|
|
|
* |
93
|
|
|
* @param string $param Parameter key |
94
|
|
|
* @param mixed $value Parameter value |
95
|
|
|
* |
96
|
|
|
* @return DefinitionInterface |
97
|
|
|
*/ |
98
|
|
|
public function set($param, $value); |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Tells if definition's meta-data matches $dataQuery |
102
|
|
|
* |
103
|
|
|
* @param array $query |
104
|
|
|
* |
105
|
|
|
* @return boolean |
106
|
|
|
*/ |
107
|
|
|
public function match(array $query, Container $container); |
|
|
|
|
108
|
|
|
} |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.