\LobbyFS

FileSystem of Lobby Retreive, modify & write files inside Lobby It only works for paths inside Lobby

Summary

Methods
Properties
Constants
__constructStatic()
loc()
rel()
exists()
get()
write()
remove()
normalizeSize()
getSize()
getTempFile()
$fs
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$fs

$fs : 

symfony/filesystem object

Type

Methods

__constructStatic()

__constructStatic() 

Set up class

loc()

loc(string  $path) : string

Make relative path of Lobby to absolute path

Parameters

string $path

Relative or absolute path

Returns

string —

Absolute path to file

rel()

rel(string  $path) : string

Make absolute path to relative path

Parameters

string $path

Absolute path to file

Returns

string —

Relative path to file

exists()

exists(string  $path) : boolean

Check if a file or directory exists

Parameters

string $path

Path to file/folder

Returns

boolean —

Whether the location exists

get()

get(string  $file) : string

Get the file contents

Parameters

string $file

Path to file

Returns

string —

Contents of file

write()

write(string  $path, string  $content, string  $type = "w") : string

Write Contents to a file. There are 2 types of writing :

Parameters

string $path

Path to file

string $content

What to write in file

string $type

How should it be written ?

"a" for append
"w" for overwrite

Returns

string

remove()

remove(string  $path, array  $exclude = array(), boolean  $removeParent = true) 

Recursively remove a directory or remove a file

Parameters

string $path

Path to delete

array $exclude

Files (relative paths) to exclude from deletion

boolean $removeParent

Whether the main directory along with it's contents should be removed

normalizeSize()

normalizeSize(integer  $size) 

Human Readable Size Convertor.

Convert bytes to KB, MB, GB or TB. Base used to calculate size is 1000

Parameters

integer $size

The size in bytes

getSize()

getSize(  $path,   $normalizeSize = false) : integer

Get the size of a file

Parameters

$path

Path to file

$normalizeSize

Whether to run self::normalizeSize() on return value

Returns

integer —

Filesize

getTempFile()

getTempFile() : string

Create a temporary file in contents/extra

Returns

string —

Path to temporary file