1 | <?php |
||
10 | class NativeServer extends Server { |
||
11 | /** |
||
12 | * @var \Icewind\SMB\NativeState |
||
13 | */ |
||
14 | protected $state; |
||
15 | |||
16 | /** |
||
17 | * @param string $host |
||
18 | * @param string $user |
||
19 | * @param string $password |
||
20 | */ |
||
21 | 508 | public function __construct($host, $user, $password) { |
|
25 | |||
26 | 2 | protected function connect() { |
|
29 | |||
30 | /** |
||
31 | * @return \Icewind\SMB\IShare[] |
||
32 | * @throws \Icewind\SMB\Exception\AuthenticationException |
||
33 | * @throws \Icewind\SMB\Exception\InvalidHostException |
||
34 | */ |
||
35 | 2 | public function listShares() { |
|
36 | 2 | $this->connect(); |
|
37 | 2 | $shares = array(); |
|
38 | 2 | $dh = $this->state->opendir('smb://' . $this->getHost()); |
|
39 | 2 | while ($share = $this->state->readdir($dh)) { |
|
40 | 2 | if ($share['type'] === 'file share') { |
|
41 | 2 | $shares[] = $this->getShare($share['name']); |
|
42 | 2 | } |
|
43 | 2 | } |
|
44 | $this->state->closedir($dh); |
||
45 | return $shares; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param string $name |
||
50 | * @return \Icewind\SMB\IShare |
||
51 | */ |
||
52 | 508 | public function getShare($name) { |
|
55 | } |
||
56 |