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 BeforeServiceRegisteredEvent extends Event |
40
|
|
|
{ |
41
|
39 |
|
public function __construct(Container $container, $serviceName, DefinitionInterface $definition) { |
42
|
39 |
|
parent::__construct( |
43
|
39 |
|
'beforeServiceRegistered', |
44
|
39 |
|
array('definition' => $definition, 'serviceName' => $serviceName), |
45
|
|
|
$container |
46
|
|
|
); |
47
|
39 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Returns the service's name |
51
|
|
|
* |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function getServiceName() |
55
|
|
|
{ |
56
|
|
|
return $this->serviceName; |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Returns the service's definition |
61
|
|
|
* |
62
|
|
|
* @return DefinitionInterface |
63
|
|
|
*/ |
64
|
|
|
public function getDefinition() |
65
|
|
|
{ |
66
|
|
|
return $this->definition; |
|
|
|
|
67
|
|
|
} |
68
|
|
|
} |
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@property
annotation 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.