AfterActionEvent::getActionProxy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Fwk\Core\Events;
3
4
use Fwk\Core\Application;
5
use Fwk\Core\Context;
6
use Fwk\Core\CoreEvent;
7
use Fwk\Core\AppEvents;
8
use Fwk\Core\ActionProxy;
9
10
class AfterActionEvent extends CoreEvent
11
{
12 23
    public function __construct(ActionProxy $actionProxy,
13
        Application $app = null, Context $context = null
14
    ) {
15 23
        parent::__construct(
16 23
            AppEvents::AFTER_ACTION, 
17
            array(
18
                'actionProxy'   => $actionProxy
19 23
            ), 
20 23
            $app, 
21
            $context
22 23
        );
23 23
    }
24
    
25
    /**
26
     * 
27
     * @return ActionProxy
28
     */
29 5
    public function getActionProxy()
30
    {
31 5
        return $this->actionProxy;
0 ignored issues
show
Documentation introduced by
The property actionProxy does not exist on object<Fwk\Core\Events\AfterActionEvent>. Since you implemented __get, maybe consider adding a @property annotation.

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.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
32
    }
33
}