JsonQueriable
Table of Contents
Properties
- $_baseContents : array<string|int, mixed>
- Stores base contents.
- $_conditions : array<string|int, mixed>
- Stores all conditions.
- $_except : array<string|int, mixed>
- contains column names for except
- $_isProcessed : bool
- $_map : mixed
- contain prepared data for process
- $_node : string|array<string|int, mixed>
- store node path
- $_rulesMap : array<string|int, mixed>
- map all conditions with methods
- $_select : array<string|int, mixed>
- contains column names
Methods
- import() : bool
- import data from file
- isJson() : bool|array<string|int, mixed>
- Check given value is valid JSON
- macro() : bool
- make macro for custom where clause
- orWhere() : $this
- make WHERE clause with OR
- reProcess() : $this
- Our system will cache processed data and prevend multiple time processing. If you want to reprocess this method can help you
- takeColumn() : mixed
- where() : $this
- make WHERE clause
- whereBool() : $this
- make WHERE Boolean clause
- whereContains() : $this
- make WHERE CONTAINS clause
- whereDate() : $this
- make WHERE DATE clause
- whereEndsWith() : $this
- make WHERE ENDS WITH clause
- whereIn() : $this
- make WHERE IN clause
- whereMatch() : $this
- make WHERE MATCH clause
- whereMonth() : $this
- make WHERE month clause
- whereNotIn() : $this
- make WHERE NOT IN clause
- whereNotNull() : $this
- make WHERE NOT NULL clause
- whereNull() : $this
- make WHERE NULL clause
- whereStartsWith() : $this
- make WHERE START WITH clause
- whereYear() : $this
- make WHERE Year clause
- exceptColumn() : array<string|int, mixed>
- selecting specific column
- getData() : mixed
- get data from node path
- getDataFromFile() : bool|string|array<string|int, mixed>
- Read JSON data from file
- getFromNested() : bool|array<string|int, mixed>|mixed
- Get data from nested array
- isMultiArray() : bool
- Check given value is multidimensional array
- makeWhere() : $this
- generator for AND and OR where
- objectToArray() : array<string|int, mixed>|mixed
- Parse object to array
- prepare() : $this
- Prepare data from desire conditions
- prepareResult() : array<string|int, mixed>|mixed
- Prepare data for result
- processConditions() : array<string|int, mixed>|string|object
- process AND and OR conditions
- selectColumn() : array<string|int, mixed>
- selecting specific column
Properties
$_baseContents
Stores base contents.
protected
array<string|int, mixed>
$_baseContents
= []
$_conditions
Stores all conditions.
protected
array<string|int, mixed>
$_conditions
= []
$_except
contains column names for except
protected
array<string|int, mixed>
$_except
= []
$_isProcessed
protected
bool
$_isProcessed
= false
$_map
contain prepared data for process
protected
mixed
$_map
$_node
store node path
protected
string|array<string|int, mixed>
$_node
= ''
$_rulesMap
map all conditions with methods
protected
static array<string|int, mixed>
$_rulesMap
= ['=' => 'equal', 'eq' => 'equal', '==' => 'strictEqual', 'seq' => 'strictEqual', '!=' => 'notEqual', 'neq' => 'notEqual', '!==' => 'strictNotEqual', 'sneq' => 'strictNotEqual', '>' => 'greaterThan', 'gt' => 'greaterThan', '<' => 'lessThan', 'lt' => 'lessThan', '>=' => 'greaterThanOrEqual', 'gte' => 'greaterThanOrEqual', '<=' => 'lessThanOrEqual', 'lte' => 'lessThanOrEqual', 'in' => 'in', 'notin' => 'notIn', 'null' => 'isNull', 'notnull' => 'isNotNull', 'startswith' => 'startWith', 'endswith' => 'endWith', 'match' => 'match', 'contains' => 'contains', 'dates' => 'dateEqual', 'month' => 'monthEqual', 'year' => 'yearEqual']
$_select
contains column names
protected
array<string|int, mixed>
$_select
= []
Methods
import()
import data from file
public
import([string|null $file = null ]) : bool
Parameters
- $file : string|null = null
Tags
Return values
boolisJson()
Check given value is valid JSON
public
isJson(string $value[, bool $isReturnMap = false ]) : bool|array<string|int, mixed>
Parameters
- $value : string
- $isReturnMap : bool = false
Return values
bool|array<string|int, mixed>macro()
make macro for custom where clause
public
static macro(string $name, callable $fn) : bool
Parameters
- $name : string
- $fn : callable
Return values
boolorWhere()
make WHERE clause with OR
public
orWhere([string $key = null ][, string $condition = null ][, mixed $value = null ]) : $this
Parameters
- $key : string = null
- $condition : string = null
- $value : mixed = null
Return values
$thisreProcess()
Our system will cache processed data and prevend multiple time processing. If you want to reprocess this method can help you
public
reProcess() : $this
Return values
$thistakeColumn()
public
takeColumn(mixed $array) : mixed
Parameters
- $array : mixed
where()
make WHERE clause
public
where(string $key[, string $condition = null ][, mixed $value = null ]) : $this
Parameters
- $key : string
- $condition : string = null
- $value : mixed = null
Return values
$thiswhereBool()
make WHERE Boolean clause
public
whereBool(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$thiswhereContains()
make WHERE CONTAINS clause
public
whereContains(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thiswhereDate()
make WHERE DATE clause
public
whereDate(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thiswhereEndsWith()
make WHERE ENDS WITH clause
public
whereEndsWith(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thiswhereIn()
make WHERE IN clause
public
whereIn([string $key = null ][, array<string|int, mixed> $value = [] ]) : $this
Parameters
- $key : string = null
- $value : array<string|int, mixed> = []
Return values
$thiswhereMatch()
make WHERE MATCH clause
public
whereMatch(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thiswhereMonth()
make WHERE month clause
public
whereMonth(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thiswhereNotIn()
make WHERE NOT IN clause
public
whereNotIn([string $key = null ][, mixed $value = [] ]) : $this
Parameters
- $key : string = null
- $value : mixed = []
Return values
$thiswhereNotNull()
make WHERE NOT NULL clause
public
whereNotNull([string $key = null ]) : $this
Parameters
- $key : string = null
Return values
$thiswhereNull()
make WHERE NULL clause
public
whereNull([string $key = null ]) : $this
Parameters
- $key : string = null
Return values
$thiswhereStartsWith()
make WHERE START WITH clause
public
whereStartsWith(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thiswhereYear()
make WHERE Year clause
public
whereYear(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$thisexceptColumn()
selecting specific column
protected
exceptColumn(mixed $array) : array<string|int, mixed>
Parameters
- $array : mixed
Return values
array<string|int, mixed>getData()
get data from node path
protected
getData() : mixed
getDataFromFile()
Read JSON data from file
protected
getDataFromFile(string $file[, string $type = 'application/json' ]) : bool|string|array<string|int, mixed>
Parameters
- $file : string
- $type : string = 'application/json'
Tags
Return values
bool|string|array<string|int, mixed>getFromNested()
Get data from nested array
protected
getFromNested(mixed $map, mixed $node) : bool|array<string|int, mixed>|mixed
Parameters
- $map : mixed
-
array
- $node : mixed
-
string
Return values
bool|array<string|int, mixed>|mixedisMultiArray()
Check given value is multidimensional array
protected
isMultiArray(array<string|int, mixed> $arr) : bool
Parameters
- $arr : array<string|int, mixed>
Return values
boolmakeWhere()
generator for AND and OR where
protected
makeWhere(string $key[, string $condition = null ][, mixed $value = null ]) : $this
Parameters
- $key : string
- $condition : string = null
- $value : mixed = null
Return values
$thisobjectToArray()
Parse object to array
protected
objectToArray(object $obj) : array<string|int, mixed>|mixed
Parameters
- $obj : object
Return values
array<string|int, mixed>|mixedprepare()
Prepare data from desire conditions
protected
prepare() : $this
Tags
Return values
$thisprepareResult()
Prepare data for result
protected
prepareResult(mixed $data, bool $isObject) : array<string|int, mixed>|mixed
Parameters
- $data : mixed
- $isObject : bool
Return values
array<string|int, mixed>|mixedprocessConditions()
process AND and OR conditions
protected
processConditions() : array<string|int, mixed>|string|object
Tags
Return values
array<string|int, mixed>|string|objectselectColumn()
selecting specific column
protected
selectColumn(mixed $array) : array<string|int, mixed>
Parameters
- $array : mixed