Extract share interface

This commit is contained in:
Robin Appelman 2014-07-12 15:51:31 +02:00
commit cc376a4b31
3 changed files with 104 additions and 3 deletions

101
src/IShare.php Normal file
View file

@ -0,0 +1,101 @@
<?php
/**
* Copyright (c) 2014 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 Icewind\SMB;
interface IShare {
public function connect();
/**
* Create a folder on the share
*
* @param string $path
* @return bool
*/
public function mkdir($path);
/**
* Download a remote file
*
* @param string $source remove file
* @param string $target local file
* @return bool
*/
public function get($source, $target);
/**
* Rename a remote file
*
* @param string $from
* @param string $to
* @return bool
*/
public function rename($from, $to);
/**
* Get the name of the share
*
* @return string
*/
public function getName();
/**
* Upload a local file
*
* @param string $source local file
* @param string $target remove file
* @return bool
*/
public function put($source, $target);
/**
* @return Server
*/
public function getServer();
/**
* List the content of a remote folder
*
* Returns a nested array in the format of
* [
* $name => [
* 'size' => $size,
* 'type' => $type,
* 'time' => $mtime
* ],
* ...
* ]
*
* @param $path
* @return array[]
*/
public function dir($path);
/**
* Remove a folder on the share
*
* @param string $path
* @return bool
*/
public function rmdir($path);
/**
* Delete a file on the share
*
* @param string $path
* @return bool
*/
public function del($path);
/**
* Open a readable stream top a remote file
*
* @param string $source
* @return resource a read only stream with the contents of the remote file
*/
public function read($source);
}