1 | <?php |
||
21 | class SwitchRule extends \yii\base\Component |
||
22 | { |
||
23 | /** |
||
24 | * @var Action parent action. |
||
25 | */ |
||
26 | public $switch; |
||
27 | |||
28 | /** |
||
29 | * @var string rule unique name and condition if not given explicitly. |
||
30 | */ |
||
31 | public $name; |
||
32 | |||
33 | /** |
||
34 | * @var boolean whether to save data before running action |
||
35 | */ |
||
36 | public $save = false; |
||
37 | |||
38 | /** |
||
39 | * @var boolean whether to generate a flash notification with success or error message |
||
40 | */ |
||
41 | public $flash = true; |
||
42 | |||
43 | /** |
||
44 | * @var mixed rule condition, can be object in future. |
||
45 | */ |
||
46 | protected $_condition; |
||
47 | |||
48 | public function setCondition($condition) |
||
52 | |||
53 | /** |
||
54 | * If no condition the name is used instead. |
||
55 | */ |
||
56 | public function getCondition() |
||
60 | |||
61 | /** |
||
62 | * Synthetic ID for the ruled action. |
||
63 | * |
||
64 | * @param string $postfix |
||
65 | * @return string |
||
66 | */ |
||
67 | public function getId($postfix = null) |
||
68 | { |
||
69 | return $this->switch->id . ' ' . $this->name . ($postfix ? ' ' . $postfix : ''); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Run action. |
||
74 | * |
||
75 | * @param string $postfix |
||
76 | * @return mixed result of the action |
||
77 | */ |
||
78 | public function runAction($postfix = null) |
||
84 | |||
85 | public function run($postfix = null) |
||
89 | |||
90 | /** |
||
91 | * Setter for action. Saves the action to the controller. |
||
92 | * |
||
93 | * @param mixed $action action config. |
||
94 | * @param null $postfix |
||
95 | */ |
||
96 | public function setAction($action, $postfix = null) |
||
106 | |||
107 | public function setSuccess($success) |
||
111 | |||
112 | public function setError($error) |
||
116 | |||
117 | public function isApplicable() |
||
151 | |||
152 | /** |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getRequestType() |
||
174 | } |
||
175 |
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.