Filesystem Uses InjectableTrait
Manipulador de arquivos e diretórios
Table of Contents
- DS = DIRECTORY_SEPARATOR
- $tempFile : array<string|int, string>|null
- children() : array<string|int, string>
- Retorna array com arquivos e diretórios
- count() : int
- Retorna total de items
- create() : mixed
- Cria o diretório
- delete() : bool
- Exclui o arquivo/diretório
- exists() : bool
- Retorna TRUE se o arquivo existe
- generateName() : mixed
- Gera um novo nome, mantendo a extensão
- instance() : static
- Cria instância da classe via DI
- move() : mixed
- Move o arquivo
- read() : string
- Retorna o conteúdo do arquivo
- receiveFile() : mixed
- Prepara o upload
- rename() : bool
- Renomeia o arquivo
- upload() : string
- Faz o upload para o diretório final
- write() : bool
- Salva o conteúdo no arquivo
Constants
DS
public
mixed
DS
= DIRECTORY_SEPARATOR
Properties
$tempFile
protected
array<string|int, string>|null
$tempFile
Methods
children()
Retorna array com arquivos e diretórios
public
children([string $path = '' ]) : array<string|int, string>
Parameters
- $path : string = ''
Return values
array<string|int, string> —count()
Retorna total de items
public
count(string $path) : int
Parameters
- $path : string
Return values
int —create()
Cria o diretório
public
create(string $folderPath[, int $chmod = 0755 ]) : mixed
Parameters
- $folderPath : string
- $chmod : int = 0755
-
Permissão (base 8)
Return values
mixed —delete()
Exclui o arquivo/diretório
public
delete(string $path) : bool
Parameters
- $path : string
-
Caminho do arquivo/diretório
Return values
bool —exists()
Retorna TRUE se o arquivo existe
public
exists(string $filePath) : bool
Parameters
- $filePath : string
Return values
bool —generateName()
Gera um novo nome, mantendo a extensão
public
generateName(string $originalName[, string $newName = null ]) : mixed
Parameters
- $originalName : string
- $newName : string = null
Return values
mixed —instance()
Cria instância da classe via DI
public
static instance() : static
Return values
static —move()
Move o arquivo
public
move(string $filePath, mixed $newFilePath) : mixed
Parameters
- $filePath : string
- $newFilePath : mixed
Return values
mixed —read()
Retorna o conteúdo do arquivo
public
read(mixed $filePath) : string
Parameters
- $filePath : mixed
Return values
string —receiveFile()
Prepara o upload
public
receiveFile(mixed $tempFileFile[, array<string|int, string> $extensions = ['csv', 'doc', 'docx', 'gif', 'jpeg', 'jpg', 'md', 'mp3', 'mp4', 'mpeg', 'pdf', 'png', 'svg', 'txt', 'wav', 'xls', 'xlsx', 'zip'] ]) : mixed
Parameters
- $tempFileFile : mixed
- $extensions : array<string|int, string> = ['csv', 'doc', 'docx', 'gif', 'jpeg', 'jpg', 'md', 'mp3', 'mp4', 'mpeg', 'pdf', 'png', 'svg', 'txt', 'wav', 'xls', 'xlsx', 'zip']
Return values
mixed —rename()
Renomeia o arquivo
public
rename(string $filePath, string $newFilePath) : bool
Parameters
- $filePath : string
- $newFilePath : string
Return values
bool —upload()
Faz o upload para o diretório final
public
upload(string $directoryPath[, string $newName = null ]) : string
Parameters
- $directoryPath : string
- $newName : string = null
Return values
string —write()
Salva o conteúdo no arquivo
public
write(mixed $filePath, string $content[, string $mode = 'w' ]) : bool
Parameters
- $filePath : mixed
- $content : string
- $mode : string = 'w'