initial commit

This commit is contained in:
Robin Appelman 2012-12-10 00:18:54 +01:00
commit e324e70050
21 changed files with 1410 additions and 0 deletions

72
src/connection.php Normal file
View file

@ -0,0 +1,72 @@
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace SMB;
class Connection {
/**
* @var string $host
*/
private $host;
/**
* @var string $user
*/
private $user;
/**
* @var string $password
*/
private $password;
/**
* @param string $host
* @param string $user
* @param string $password
*/
public function __construct($host, $user, $password) {
$this->host = $host;
$this->user = $user;
$this->password = $password;
}
/**
* @return string
*/
public function getAuthString() {
return $this->user . '%' . $this->password;
}
/**
* return string
*/
public function getHost() {
return $this->host;
}
/**
* @return Share[]
*/
public function listShares() {
$cmd = new Command\ListShares($this);
$shareNames = $cmd->run(null);
$shares = array();
foreach ($shareNames as $name => $description) {
$shares[] = new Share($this, $name);
}
return $shares;
}
/**
* @param string $name
* @return Share
*/
public function getShare($name) {
return new Share($this, $name);
}
}