Skip to content

Commit

Permalink
Merge pull request #1 from gavD/add-exists-method
Browse files Browse the repository at this point in the history
Add exists method to Filesystem
  • Loading branch information
Gavin Davies committed Dec 22, 2014
2 parents 0eb4840 + 4af1879 commit 4fec217
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions extensions/storage/FileSystem.php
Expand Up @@ -111,6 +111,27 @@ public static function read($name, $filename, array $options = array()) {
return static::_filter(__FUNCTION__, $params, $method, $settings[$name]['filters']);
}

/**
* Determines whether a file exists for a specified filesystem configuration
*
* @param string $name Configuration to be used for reading
* @param mixed $filename a full path with filename and extension to be retrieved
* @param mixed $options Options for the method and strategies.
* @return bool true if exists, else false
* @filter This method may be filtered.
*/
public static function exists($name, $filename, array $options = array()) {
$settings = static::config();

if (!isset($settings[$name])) {
return false;
}

$method = static::adapter($name)->exists($filename, $options);
$params = compact('filename');
return static::_filter(__FUNCTION__, $params, $method, $settings[$name]['filters']);
}

/**
* Deletes file from the specified filesystem configuration
*
Expand Down

0 comments on commit 4fec217

Please sign in to comment.