Class rex_file
Class for handling files.
Methods summary
public static
mixed
|
#
get( string $file, mixed $default = null )
Returns the content of a file.
Returns the content of a file.
Parameters
- $file
- Path to the file
- $default
- Default value
Returns
mixed Content of the file or default value if the file isn't readable
|
|
public static
mixed
|
#
getConfig( string $file, mixed $default = [] )
Returns the content of a config file.
Returns the content of a config file.
Parameters
- $file
- Path to the file
- $default
- Default value
Returns
mixed Content of the file or default value if the file isn't readable
|
|
public static
mixed
|
#
getCache( string $file, mixed $default = [] )
Returns the content of a cache file.
Returns the content of a cache file.
Parameters
- $file
- Path to the file
- $default
- Default value
Returns
mixed Content of the file or default value if the file isn't readable
|
|
public static
boolean
|
#
put( string $file, string $content )
Puts content in a file.
Parameters
- $file
- Path to the file
- $content
- Content for the file
Returns
boolean TRUE on success, FALSE on failure
|
|
public static
boolean
|
#
putConfig( string $file, mixed $content, integer $inline = 3 )
Puts content in a config file.
Puts content in a config file.
Parameters
- $file
- Path to the file
- $content
- Content for the file
- $inline
- The level where you switch to inline YAML
Returns
boolean TRUE on success, FALSE on failure
|
|
public static
boolean
|
#
putCache( string $file, mixed $content )
Puts content in a cache file.
Puts content in a cache file.
Parameters
- $file
- Path to the file
- $content
- Content for the file
Returns
boolean TRUE on success, FALSE on failure
|
|
public static
boolean
|
#
copy( string $srcfile, string $dstfile )
Copies a file.
Parameters
- $srcfile
- Path of the source file
- $dstfile
- Path of the destination file or directory
Returns
boolean TRUE on success, FALSE on failure
|
|
public static
boolean
|
#
delete( string $file )
Deletes a file.
Parameters
Returns
boolean TRUE on success, FALSE on failure
|
|
public static
string
|
#
extension( string $filename )
Extracts the extension of the given filename.
Extracts the extension of the given filename.
Parameters
Returns
string Extension of $filename
|
|
public static
string
|
#
formattedSize( string $file, array $format = [] )
Formates the filesize of the given file into a userfriendly form.
Formates the filesize of the given file into a userfriendly form.
Parameters
- $file
- Path to the file
- $format
Returns
string Formatted filesize
|
|
public static
string
|
#
getOutput( string $file )
Gets executed content of given file.
Gets executed content of given file.
Parameters
Returns
string executed Content
|
|