1 | <?php |
||
11 | class Connection |
||
12 | { |
||
13 | private $server; |
||
14 | private $resource; |
||
15 | private $mailboxes; |
||
16 | private $mailboxNames; |
||
17 | |||
18 | /** |
||
19 | * Constructor |
||
20 | * |
||
21 | * @param resource $resource |
||
22 | * @param string $server |
||
23 | * |
||
24 | * @throws \InvalidArgumentException |
||
25 | */ |
||
26 | public function __construct($resource, $server) |
||
35 | |||
36 | /** |
||
37 | * Get a list of mailboxes (also known as folders) |
||
38 | * |
||
39 | * @return Mailbox[] |
||
40 | */ |
||
41 | public function getMailboxes() |
||
51 | |||
52 | /** |
||
53 | * Check that a mailbox with the given name exists |
||
54 | * |
||
55 | * @param string $name Mailbox name |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function hasMailbox($name) |
||
63 | |||
64 | /** |
||
65 | * Get a mailbox by its name |
||
66 | * |
||
67 | * @param string $name Mailbox name |
||
68 | * |
||
69 | * @return Mailbox |
||
70 | * @throws MailboxDoesNotExistException If mailbox does not exist |
||
71 | */ |
||
72 | public function getMailbox($name) |
||
80 | |||
81 | /** |
||
82 | * Count number of messages not in any mailbox |
||
83 | * |
||
84 | * @return int |
||
85 | */ |
||
86 | public function count() |
||
90 | |||
91 | /** |
||
92 | * Create mailbox |
||
93 | * |
||
94 | * @param $name |
||
95 | * |
||
96 | * @return Mailbox |
||
97 | * @throws Exception |
||
98 | */ |
||
99 | public function createMailbox($name) |
||
109 | |||
110 | /** |
||
111 | * Close connection |
||
112 | * |
||
113 | * @param int $flag |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | public function close($flag = 0) |
||
121 | |||
122 | public function deleteMailbox(Mailbox $mailbox) |
||
133 | |||
134 | /** |
||
135 | * Get IMAP resource |
||
136 | * |
||
137 | * @return resource |
||
138 | */ |
||
139 | public function getResource() |
||
143 | |||
144 | /** |
||
145 | * Get mailbox names |
||
146 | * |
||
147 | * @return array |
||
148 | */ |
||
149 | private function getMailboxNames() |
||
160 | } |
||
161 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.