PHP Class Marcelgwerder\ApiHandler\Parser

Afficher le fichier Open project: marcelgwerder/laravel-api-handler Class Usage Examples

Méthodes publiques

Свойство Type Description
$builder mixed The builder Instance.
$envelope boolean If the response should be in an envelope or not
$meta array The parsed meta information
$mode string The mode for the response (count,default)
$multiple boolean If the parser works on multiple datasets
$originalBuilder mixed The original builder Instance.

Protected Properties

Свойство Type Description
$additionalFields array All fields that belong to a relation
$additionalSorts array All sorts that belong to a relation
$functionalParams All functional params
$functions array Predefined functions
$isEloquentBuilder boolean If builder is an eloquent builder or not
$isQueryBuilder boolean If builder is an query builder or not
$originalQuery Illuminate\Database\Query\Builder The original query builder instance.
$params array The http query params.
$query Illuminate\Database\Query\Builder The base query builder instance.

Méthodes publiques

Méthode Description
__construct ( mixed $builder, array $params ) Instantiate the Parser class
parse ( mixed $options, boolean $multiple = false ) : void Parse the query parameters with the given options.
setConfigHandler ( mixed $config ) Set the config object

Méthodes protégées

Méthode Description
getFilterParams ( ) : array | boolean Get the relevant filter parameters
getParam ( string $param ) : string | boolean Get a parameter
getRelationType ( Illuminate\Database\Eloquent\Relations\Relation $relation ) : string Determine the type of the Eloquent relation
isRelation ( Illuminate\Database\Eloquent\Model $model, string $relationName ) : boolean Check if there exists a method marked with the "@Relation" annotation on the given model.
parseConfig ( $configParam ) : void Parse the meta parameter and prepare an array of meta provider objects.
parseFields ( string $fieldsParam ) : void Parse the fields parameter and return an array of fields
parseFilter ( array $filterParams ) : void Parse the remaining filter params
parseFullTextSearch ( string $qParam, array $fullTextSearchColumns ) : void Parse the fulltext search parameter q
parseSort ( string $sortParam ) : void Parse the sort param and determine whether the sorting is ascending or descending.
parseWith ( string $withParam ) : void Parse the with parameter

Method Details

__construct() public méthode

Instantiate the Parser class
public __construct ( mixed $builder, array $params )
$builder mixed
$params array

getFilterParams() protected méthode

Get the relevant filter parameters
protected getFilterParams ( ) : array | boolean
Résultat array | boolean

getParam() protected méthode

Get a parameter
protected getParam ( string $param ) : string | boolean
$param string
Résultat string | boolean

getRelationType() protected méthode

Determine the type of the Eloquent relation
protected getRelationType ( Illuminate\Database\Eloquent\Relations\Relation $relation ) : string
$relation Illuminate\Database\Eloquent\Relations\Relation
Résultat string

isRelation() protected méthode

Check if there exists a method marked with the "@Relation" annotation on the given model.
protected isRelation ( Illuminate\Database\Eloquent\Model $model, string $relationName ) : boolean
$model Illuminate\Database\Eloquent\Model
$relationName string
Résultat boolean

parse() public méthode

Either for a single dataset or multiple.
public parse ( mixed $options, boolean $multiple = false ) : void
$options mixed
$multiple boolean
Résultat void

parseConfig() protected méthode

Parse the meta parameter and prepare an array of meta provider objects.
protected parseConfig ( $configParam ) : void
Résultat void

parseFields() protected méthode

Parse the fields parameter and return an array of fields
protected parseFields ( string $fieldsParam ) : void
$fieldsParam string
Résultat void

parseFilter() protected méthode

Parse the remaining filter params
protected parseFilter ( array $filterParams ) : void
$filterParams array
Résultat void

parseFullTextSearch() protected méthode

Parse the fulltext search parameter q
protected parseFullTextSearch ( string $qParam, array $fullTextSearchColumns ) : void
$qParam string
$fullTextSearchColumns array
Résultat void

parseSort() protected méthode

A descending sort has a leading "-". Apply it to the query.
protected parseSort ( string $sortParam ) : void
$sortParam string
Résultat void

parseWith() protected méthode

Parse the with parameter
protected parseWith ( string $withParam ) : void
$withParam string
Résultat void

setConfigHandler() public méthode

Set the config object
public setConfigHandler ( mixed $config )
$config mixed

Property Details

$additionalFields protected_oe property

All fields that belong to a relation
protected array $additionalFields
Résultat array

$additionalSorts protected_oe property

All sorts that belong to a relation
protected array $additionalSorts
Résultat array

$builder public_oe property

The builder Instance.
public mixed $builder
Résultat mixed

$envelope public_oe property

If the response should be in an envelope or not
public bool $envelope
Résultat boolean

$functionalParams protected_oe property

All functional params
protected $functionalParams

$functions protected_oe property

Predefined functions
protected array $functions
Résultat array

$isEloquentBuilder protected_oe property

If builder is an eloquent builder or not
protected bool $isEloquentBuilder
Résultat boolean

$isQueryBuilder protected_oe property

If builder is an query builder or not
protected bool $isQueryBuilder
Résultat boolean

$meta public_oe property

The parsed meta information
public array $meta
Résultat array

$mode public_oe property

The mode for the response (count,default)
public string $mode
Résultat string

$multiple public_oe property

If the parser works on multiple datasets
public bool $multiple
Résultat boolean

$originalBuilder public_oe property

The original builder Instance.
public mixed $originalBuilder
Résultat mixed

$originalQuery protected_oe property

The original query builder instance.
protected Builder,Illuminate\Database\Query $originalQuery
Résultat Illuminate\Database\Query\Builder

$params protected_oe property

The http query params.
protected array $params
Résultat array

$query protected_oe property

The base query builder instance.
protected Builder,Illuminate\Database\Query $query
Résultat Illuminate\Database\Query\Builder