-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09b80b3
commit f2cb164
Showing
4 changed files
with
244 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea/ | ||
composer.phar | ||
composer.lock | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Filesystem Connection Interface | ||
* | ||
* @package Filesystem | ||
* @copyright 2013 Common Api. All rights reserved. | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
*/ | ||
namespace Api\Filesystem; | ||
|
||
/** | ||
* Filesystem Connection Interface | ||
* | ||
* @package Filesystem | ||
* @copyright 2013 Common Api. All rights reserved. | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @since 1.0 | ||
*/ | ||
interface ConnectionInterface | ||
{ | ||
/** | ||
* Connect to the Filesystem | ||
* | ||
* @param array $options | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function connect($options = array()); | ||
|
||
/** | ||
* Close the Connection | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
<?php | ||
/** | ||
* Filesystem Adapter Interface | ||
* | ||
* @package Filesystem | ||
* @copyright 2013 Common Api. All rights reserved. | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
*/ | ||
namespace Api\Filesystem; | ||
|
||
/** | ||
* Filesystem Adapter Interface | ||
* | ||
* @package Filesystem | ||
* @copyright 2013 Common Api. All rights reserved. | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @since 1.0 | ||
*/ | ||
interface FilesystemInterface | ||
{ | ||
/** | ||
* Determines if file or folder identified in path exists | ||
* | ||
* @param string $path | ||
* | ||
* @return bool | ||
* @since 1.0 | ||
*/ | ||
public function exists($path); | ||
|
||
/** | ||
* Returns an associative array of metadata for the file or folder specified in path | ||
* | ||
* @param string $path | ||
* | ||
* @return mixed | ||
* @since 1.0 | ||
*/ | ||
public function getMetadata($path); | ||
|
||
/** | ||
* Returns the contents of the file identified in path | ||
* | ||
* @param string $path | ||
* | ||
* @return null|string | ||
* @since 1.0 | ||
*/ | ||
public function read($path); | ||
|
||
/** | ||
* Returns a list of file and folder names located at path directory, optionally recursively, | ||
* optionally filtered by a list of file extension values, filename mask, and inclusion or exclusion | ||
* of files and/or folders | ||
* | ||
* @param string $path | ||
* @param bool $recursive | ||
* @param string $extension_list | ||
* @param bool $include_files | ||
* @param bool $include_folders | ||
* @param null $filename_mask | ||
* | ||
* @return mixed | ||
* @since 1.0 | ||
*/ | ||
public function getList( | ||
$path, | ||
$recursive = false, | ||
$extension_list = '', | ||
$include_files = false, | ||
$include_folders = false, | ||
$filename_mask = null | ||
); | ||
|
||
/** | ||
* Creates (or replaces) the file or creates the directory identified in path; | ||
* | ||
* @param string $path | ||
* @param string $data (file, only) | ||
* @param bool $replace (file, only) | ||
* @param bool $append (file, only) | ||
* @param bool $truncate (file, only) | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function write($path, $data = '', $replace = true, $append = false, $truncate = false); | ||
|
||
/** | ||
* Deletes the file or folder identified in path, optionally deletes recursively | ||
* | ||
* @param string $path | ||
* @param bool $recursive | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function delete($path, $recursive = false); | ||
|
||
/** | ||
* Copies the file/folder in $path to the target_directory (optionally target_name), | ||
* replacing content, if indicated. Can copy to target_handler. | ||
* | ||
* @param string $path | ||
* @param string $target_directory | ||
* @param string $target_name | ||
* @param bool $replace | ||
* @param string $target_handler | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function copy( | ||
$path, | ||
$target_directory, | ||
$target_name = '', | ||
$replace = true, | ||
$target_handler = '' | ||
); | ||
|
||
/** | ||
* Moves the file/folder in $path to the target_directory (optionally target_name), | ||
* replacing content, if indicated. Can move to target_handler. | ||
* | ||
* @param string $path | ||
* @param string $target_directory | ||
* @param string $target_name | ||
* @param bool $replace | ||
* @param string $target_handler | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function move( | ||
$path, | ||
$target_directory, | ||
$target_name = '', | ||
$replace = true, | ||
$target_handler = '' | ||
); | ||
|
||
/** | ||
* Rename file or folder identified in path | ||
* | ||
* @param string $path | ||
* @param string $new_name | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function rename($path, $new_name); | ||
|
||
/** | ||
* Change owner for file or folder identified in path | ||
* | ||
* @param string $path | ||
* @param string $user_name | ||
* @param bool $recursive | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function changeOwner($path, $user_name, $recursive = false); | ||
|
||
/** | ||
* Change group for file or folder identified in path | ||
* | ||
* @param string $path | ||
* @param string $group_id | ||
* @param bool $recursive | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function changeGroup($path, $group_id, $recursive = false); | ||
|
||
/** | ||
* Change permissions for file or folder identified in path | ||
* | ||
* @param string $path | ||
* @param int $permission | ||
* @param bool $recursive | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function changePermission($path, $permission, $recursive = false); | ||
|
||
/** | ||
* Update the modification time and access time (touch) for the directory or file identified in the path | ||
* | ||
* @param string $path | ||
* @param int $modification_time | ||
* @param int $access_time | ||
* @param bool $recursive | ||
* | ||
* @return $this | ||
* @since 1.0 | ||
*/ | ||
public function touch($path, $modification_time = null, $access_time = null, $recursive = false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters