1 | <?php /** MicroFlashMessage */ |
||
17 | class FlashMessage |
||
18 | { |
||
19 | /** @var integer $TYPE_SUCCESS success */ |
||
20 | const TYPE_SUCCESS = 1; |
||
21 | /** @var integer $TYPE_NOTICE notice */ |
||
22 | const TYPE_INFO = 2; |
||
23 | /** @var integer $TYPE_WARNING warning */ |
||
24 | const TYPE_WARNING = 3; |
||
25 | /** @var integer TYPE_DANGER danger */ |
||
26 | const TYPE_DANGER = 4; |
||
27 | |||
28 | |||
29 | /** @var ISession $session Session component */ |
||
30 | protected $session; |
||
31 | |||
32 | |||
33 | /** |
||
34 | * Constructor messenger |
||
35 | * |
||
36 | * @access public |
||
37 | * |
||
38 | * @param ISession $session |
||
39 | * |
||
40 | * @result void |
||
41 | */ |
||
42 | public function __construct(ISession $session) |
||
46 | |||
47 | /** |
||
48 | * Get label for type by id |
||
49 | * |
||
50 | * @access public |
||
51 | * |
||
52 | * @param int $type type id |
||
53 | * |
||
54 | * @return string |
||
55 | * @static |
||
56 | */ |
||
57 | public static function getTypeLabel($type = self::TYPE_SUCCESS) |
||
61 | |||
62 | /** |
||
63 | * Get labels for types |
||
64 | * |
||
65 | * @access public |
||
66 | * @return string[] |
||
67 | * @static |
||
68 | */ |
||
69 | public static function getTypeLabels() |
||
78 | |||
79 | /** |
||
80 | * Push a new flash |
||
81 | * |
||
82 | * @access public |
||
83 | * |
||
84 | * @param int $type type id |
||
85 | * @param string $title title flash |
||
86 | * @param string $description description flash |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | public function push($type = FlashMessage::TYPE_SUCCESS, $title = '', $description = '') |
||
100 | |||
101 | /** |
||
102 | * Has flashes by type |
||
103 | * |
||
104 | * @access public |
||
105 | * |
||
106 | * @param int $type type of flash |
||
107 | * |
||
108 | * @return bool |
||
109 | */ |
||
110 | public function has($type = FlashMessage::TYPE_SUCCESS) |
||
120 | |||
121 | /** |
||
122 | * Get flash by type |
||
123 | * |
||
124 | * @access public |
||
125 | * |
||
126 | * @param int $type type of flash |
||
127 | * |
||
128 | * @return array|bool |
||
129 | */ |
||
130 | public function get($type = FlashMessage::TYPE_SUCCESS) |
||
143 | |||
144 | /** |
||
145 | * Get all flashes |
||
146 | * |
||
147 | * @access public |
||
148 | * |
||
149 | * @return mixed |
||
150 | */ |
||
151 | public function getAll() |
||
158 | } |
||
159 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: