Documentation

Utils
in package

Provides few utility functions.

Table of Contents

addColumn()  : mixed
Add column to existing table.
checkFileAccess()  : mixed
Function to check the file access is made within web root directory.
checkFileAccessForInclusion()  : mixed
Function to check the file access is made within web root directory as well as is safe for php inclusion.
checkTable()  : mixed
Check if table is present in database.
implodestr()  : mixed
Implode the prefix and suffix as string for given number of times.
isCreateSql()  : mixed
Check if the given SQL is a CREATE statement.
isDestructiveSql()  : mixed
Check if the given SQL is destructive (DELETE's DATA).
isNumber()  : mixed
Check if given value is a number or not.

Methods

addColumn()

Add column to existing table.

public static addColumn(string $tableName, string $columnName, array<string|int, mixed>|string $criteria) : mixed
Parameters
$tableName : string

to alter

$columnName : string

to add

$criteria : array<string|int, mixed>|string

([\yii\db\Schema::TYPE_STRING, 1024] | string(1024))

Return values
mixed

checkFileAccess()

Function to check the file access is made within web root directory.

public static checkFileAccess(mixed $filepath[, mixed $dieOnFail = true ]) : mixed
Parameters
$filepath : mixed
$dieOnFail : mixed = true
Return values
mixed

checkFileAccessForInclusion()

Function to check the file access is made within web root directory as well as is safe for php inclusion.

public static checkFileAccessForInclusion(mixed $filepath[, mixed $dieOnFail = true ]) : mixed
Parameters
$filepath : mixed
$dieOnFail : mixed = true
Return values
mixed

checkTable()

Check if table is present in database.

public static checkTable(mixed $tableName) : mixed
Parameters
$tableName : mixed
Return values
mixed

implodestr()

Implode the prefix and suffix as string for given number of times.

public static implodestr(mixed $prefix, mixed $count[, mixed $suffix = false ]) : mixed
Parameters
$prefix : mixed
$count : mixed
$suffix : mixed = false
Return values
mixed

isCreateSql()

Check if the given SQL is a CREATE statement.

public static isCreateSql(mixed $sql) : mixed
Parameters
$sql : mixed
Return values
mixed

isDestructiveSql()

Check if the given SQL is destructive (DELETE's DATA).

public static isDestructiveSql(mixed $sql) : mixed
Parameters
$sql : mixed
Return values
mixed

isNumber()

Check if given value is a number or not.

public static isNumber(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

        

Search results