\Utilities

Provides some useful utilities.

Summary

Methods
Properties
Constants
isValidAuthCode()
isValidId()
isValidUserName()
isValidNonce()
randomString()
isMarkdownFile()
No public properties found
DEFAULT_ALPHABET
STATISTICS
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

DEFAULT_ALPHABET

DEFAULT_ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890' : 

String containing small letters, capital letters as well as digits.

STATISTICS

STATISTICS = array('TOTALREAD', 'AVERAGEREAD', 'LASTYEARREAD') : 

Array containing the name for all available statistics.

Methods

isValidAuthCode()

isValidAuthCode(string  $authCode) : bool

Checks whether a given authentication code is valid.

Parameters

string $authCode

The authentication code to verify.

Returns

bool —

True if the given authentication code is valid, else false.

isValidId()

isValidId(string  $id) : bool

Checks whether a given id is valid.

Parameters

string $id

The id to verify.

Returns

bool —

True if the given id is valid, else false.

isValidUserName()

isValidUserName(string  $user) : bool

Checks whether a given user name is valid.

Parameters

string $user

The user name to verify.

Returns

bool —

True if the given user name is valid, else false.

isValidNonce()

isValidNonce(string  $nonce) : bool

Checks whether a given nonce is valid.

Parameters

string $nonce

The nonce to verify.

Returns

bool —

True if the given nonce is valid, else false.

randomString()

randomString(int  $length, string  $alphabet) : string

Generates a random string for a given length and a given alphabet.

Parameters

int $length

The length for the random string.

string $alphabet

A list of allowed characters to choose from as a string.

Returns

string —

The generated random string.

isMarkdownFile()

isMarkdownFile(string  $filepath) : bool

Checks whether a given file is a markdown file.

Parameters

string $filepath

The full path to the file to check.

Returns

bool —

True if the file is a markdown file, else false.