PHP Class Webiny\Component\Storage\Driver\Local\LocalHelper

Inheritance: use trait Webiny\Component\StdLib\SingletonTrait
Show file Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
buildPath ( $key, $directory, $create ) : mixed Build absolute path by given $key and $directory
ensureDirectoryExists ( string $directory, boolean $create = false ) Make sure the target directory exists
getKey ( string $path, string $directory ) : string Gets the key using file $path and storage $directory
normalizeDirectoryPath ( $path ) : string Normalize path (strip '.', '.

Protected Methods

Method Description
createDirectory ( string $directory ) Create directory
getAbsolutePrefix ( string $path ) : string Returns the absolute prefix of the given path
normalizePath ( string $path ) : string Normalizes the given path

Method Details

buildPath() public method

Build absolute path by given $key and $directory
public buildPath ( $key, $directory, $create ) : mixed
$key
$directory
$create
return mixed

createDirectory() protected method

Create directory
protected createDirectory ( string $directory )
$directory string Directory path to create

ensureDirectoryExists() public method

Make sure the target directory exists
public ensureDirectoryExists ( string $directory, boolean $create = false )
$directory string Path to check
$create boolean (Optional) Create path if doesn't exist

getAbsolutePrefix() protected method

Returns the absolute prefix of the given path
protected getAbsolutePrefix ( string $path ) : string
$path string A normalized path
return string

getKey() public method

Gets the key using file $path and storage $directory
public getKey ( string $path, string $directory ) : string
$path string Path to extract file key from
$directory string Directory of the storage
return string

normalizeDirectoryPath() public method

.' and make sure it's not a symlink)
public normalizeDirectoryPath ( $path ) : string
$path
return string

normalizePath() protected method

Normalizes the given path
protected normalizePath ( string $path ) : string
$path string
return string