Skip to content

Commit

Permalink
Initial Molajo Interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyStephen committed Nov 23, 2013
1 parent 09b80b3 commit f2cb164
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea/
composer.phar
composer.lock
vendor
38 changes: 38 additions & 0 deletions ConnectionInterface.php
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();
}
201 changes: 201 additions & 0 deletions FilesystemInterface.php
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);
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 Api
Copyright (c) 2013 Common Api - Amy Stephen

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down

0 comments on commit f2cb164

Please sign in to comment.