Biblionet API Wrapper

Helper

A helper class that provides some static functions.

Tags
author

Panagiotis Pantazopoulos takispadaz@gmail.com

Table of Contents

compare()  : bool
Makes a comparison between two variables
getPercentage()  : float
Calculates and return a percentage of completion
isCli()  : bool
Checks if the script has been called through cli
isJson()  : bool
Checks if a string is json

Methods

compare()

Makes a comparison between two variables

public static compare(int|string $var1, int|string $var2, string $operator) : bool
Parameters
$var1 : int|string

The first of the variables to compare

$var2 : int|string

The second of the variables to compare

$operator : string

The oprator to use ==, !=, >=, <=, >, <

Return values
bool

The result of the comparison

getPercentage()

Calculates and return a percentage of completion

public static getPercentage(int $current, int $total) : float
Parameters
$current : int

the current iteration number

$total : int

the total number of items

Return values
float

the percentage

isCli()

Checks if the script has been called through cli

public static isCli() : bool
Return values
bool

isJson()

Checks if a string is json

public static isJson(string $str) : bool
Parameters
$str : string

the input string to check

Return values
bool

Search results