|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Fwk |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright (c) 2011-2015, 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 Dependency Injection |
|
27
|
|
|
* @package Fwk\Di |
|
28
|
|
|
* @author Julien Ballestracci <[email protected]> |
|
29
|
|
|
* @copyright 2011-2015 Julien Ballestracci <[email protected]> |
|
30
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
31
|
|
|
* @link http://www.phpfwk.com |
|
32
|
|
|
*/ |
|
33
|
|
|
namespace Fwk\Di\Events; |
|
34
|
|
|
|
|
35
|
|
|
use Fwk\Di\Container; |
|
36
|
|
|
use Fwk\Di\DefinitionInterface; |
|
37
|
|
|
use Fwk\Di\Event; |
|
38
|
|
|
|
|
39
|
|
|
class AfterServiceLoadedEvent extends Event |
|
40
|
19 |
|
{ |
|
41
|
|
|
public function __construct(Container $container, $serviceName, DefinitionInterface $definition, &$valueObject) |
|
42
|
19 |
|
{ |
|
43
|
19 |
|
parent::__construct( |
|
44
|
|
|
'afterServiceLoaded', |
|
45
|
19 |
|
array( |
|
46
|
19 |
|
'definition' => $definition, |
|
47
|
19 |
|
'serviceName' => $serviceName, |
|
48
|
|
|
'valueObject' => $valueObject |
|
49
|
19 |
|
), |
|
50
|
|
|
$container |
|
51
|
19 |
|
); |
|
52
|
19 |
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Returns the service's name |
|
56
|
|
|
* |
|
57
|
|
|
* @return string |
|
58
|
|
|
*/ |
|
59
|
|
|
public function getServiceName() |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->serviceName; |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Returns the service's definition |
|
66
|
|
|
* |
|
67
|
|
|
* @return DefinitionInterface |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getDefinition() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->definition; |
|
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Returns the service's value |
|
76
|
|
|
* |
|
77
|
|
|
* @return mixed |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getValueObject() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->valueObject; |
|
|
|
|
|
|
82
|
|
|
} |
|
83
|
|
|
} |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.