com\setasign\SetaFramework\Helper

FilesystemHelper Class FilesystemHelper

File: /SetaFramework/src/Helper/FilesystemHelper.php

Class hierarchy

Summary

Static Methods

chmod()

public static FilesystemHelper::chmod (
string $filename,
int $permissions
): void

Change file permission. This method ignores the umask!

Parameters
$filename : string
 
$permissions : int
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

cleanupPath()

public static FilesystemHelper::cleanupPath (
string $path
): string

Resolves '..' in paths without relying on the existance of the path like realpath(). This method will not remove ".." at the beginning of the string.

DIRECTORY_SEPARATOR at the end of the string will be replaced

The input path and the output path should technically be the same.

Parameters
$path : string
 

createResponseByFile()

public static FilesystemHelper::createResponseByFile (
\com\setasign\SetaFramework\Http\HttpFactoryInterface $httpFactory,
\com\setasign\SetaFramework\FileSystem\File $file,
bool $inline = true,
array $headers = array ( )
): \Psr\Http\Message\ResponseInterface

Creates a response by a file

Parameters
$httpFactory : \com\setasign\SetaFramework\Http\HttpFactoryInterface
 
$file : \com\setasign\SetaFramework\FileSystem\File
 
$inline : bool

If true then the content-disposition is set to inline otherwise to attachment

$headers : array

Additional HttpHeaders Content-Type, Content-Length and Content-Disposition cannot be used

Exceptions

Throws \com\setasign\SetaFramework\FileSystem\ReadException

dirIsEmpty()

public static FilesystemHelper::dirIsEmpty (
string $path
): bool
Parameters
$path : string
 

getMaxFileUploadSize()

public static FilesystemHelper::getMaxFileUploadSize (
void
): float

getReadableMaxFileUploadSize()

public static FilesystemHelper::getReadableMaxFileUploadSize (
int $precision = 0
): string
Parameters
$precision : int
 

md5Files()

public static FilesystemHelper::md5Files (
iterable $files
): string
Parameters
$files : iterable
 

mkdir()

public static FilesystemHelper::mkdir (
string $dirName,
int $permission = 509
): void

Create a directory. This method ignores the umask!

Parameters
$dirName : string
 
$permission : int
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

parseSize()

private static FilesystemHelper::parseSize (
string $size
): float
Parameters
$size : string
 

recursiveGlob()

public static FilesystemHelper::recursiveGlob (
string $pattern,
int $flags = 0
): array
Parameters
$pattern : string
 
$flags : int
 

recursiveGlobAsGenerator()

public static FilesystemHelper::recursiveGlobAsGenerator (
string $pattern,
int $flags = 0
): \Generator
Parameters
$pattern : string
 
$flags : int
 

unlinkRecursive()

public static FilesystemHelper::unlinkRecursive (
string $dir
): void

Removes the content from the directory.

The directory itself will not be unlinked.

Parameters
$dir : string