Documentation

FileInfo extends SplFileInfo

Table of Contents

getHash()  : string
Generates a hash using the contents of the file.
getHmac()  : string
Generates a HMAC using the contents of the file.
getMineEncoding()  : string|null
Returns the MIME encoding of the file.
getMineType()  : string|null
Returns the MIME type of the file.
validateHash()  : bool
Returns TRUE if the file matches the provided hash and FALSE if not.
validateHmac()  : bool
Returns TRUE if the file matches the provided HMAC and FALSE if not.
getMine()  : string|null
Returns the MIME type|encoding of the file.

Methods

getHash()

Generates a hash using the contents of the file.

public getHash([string $algorithm = 'sha256' ][, bool $raw = false ]) : string
Parameters
$algorithm : string = 'sha256'

Hashing algorithm

$raw : bool = false

Output raw binary data?

Tags
since
1.0.0
Return values
string

getHmac()

Generates a HMAC using the contents of the file.

public getHmac(string $key[, string $algorithm = 'sha256' ][, bool $raw = false ]) : string
Parameters
$key : string

Shared secret key

$algorithm : string = 'sha256'

Hashing algorithm

$raw : bool = false

Output raw binary data?

Tags
since
1.0.0
Return values
string

getMineEncoding()

Returns the MIME encoding of the file.

public getMineEncoding() : string|null
Tags
since
1.0.0
Return values
string|null

getMineType()

Returns the MIME type of the file.

public getMineType() : string|null
Tags
since
1.0.0
Return values
string|null

validateHash()

Returns TRUE if the file matches the provided hash and FALSE if not.

public validateHash(string $hash[, string $algorithm = 'sha256' ][, bool $raw = false ]) : bool
Parameters
$hash : string

Hash

$algorithm : string = 'sha256'

Hashing algorithm

$raw : bool = false

Is the provided hash raw?

Tags
since
1.0.0
Return values
bool

validateHmac()

Returns TRUE if the file matches the provided HMAC and FALSE if not.

public validateHmac(string $hmac, string $key[, string $algorithm = 'sha256' ][, bool $raw = false ]) : bool
Parameters
$hmac : string

HMAC

$key : string

Key

$algorithm : string = 'sha256'

Hashing algorithm

$raw : bool = false

Is the provided HMAC raw?

Tags
since
1.0.0
Return values
bool

getMine()

Returns the MIME type|encoding of the file.

private getMine(int $mine) : string|null
Parameters
$mine : int

Mine type or Mine encoding.

Tags
since
1.0.0
Return values
string|null

Search results