\ElasticaUtil

Elastica tools.

Summary

Methods
Properties
Constants
replaceBooleanWordsAndEscapeTerm()
escapeTerm()
replaceBooleanWords()
toCamelCase()
toSnakeCase()
convertDate()
convertDateTimeObject()
getParamName()
convertRequestToCurlCommand()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

replaceBooleanWordsAndEscapeTerm()

replaceBooleanWordsAndEscapeTerm(string  $term) : string

Replace the following reserved words: AND OR NOT and escapes the following terms: + - && || ! ( ) { } [ ] ^ " ~ * ? : \.

Parameters

string $term

Query term to replace and escape

Returns

string —

Replaced and escaped query term

escapeTerm()

escapeTerm(string  $term) : string

Escapes the following terms (because part of the query language) + - && || ! ( ) { } [ ] ^ " ~ * ? : \ < >.

Parameters

string $term

Query term to escape

Returns

string —

Escaped query term

replaceBooleanWords()

replaceBooleanWords(string  $term) : string

Replace the following reserved words (because part of the query language) AND OR NOT.

Parameters

string $term

Query term to replace

Returns

string —

Replaced query term

toCamelCase()

toCamelCase(string  $string) : string

Converts a snake_case string to CamelCase.

For example: hello_world to HelloWorld

Parameters

string $string

snake_case string

Returns

string —

CamelCase string

toSnakeCase()

toSnakeCase(string  $string) : string

Converts a CamelCase string to snake_case.

For Example HelloWorld to hello_world

Parameters

string $string

CamelCase String to Convert

Returns

string —

SnakeCase string

convertDate()

convertDate(integer|string  $date) : string

Converts given time to format: 1995-12-31T23:59:59Z.

This is the lucene date format

Parameters

integer|string $date

Date input (could be string etc.) -> must be supported by strtotime

Returns

string —

Converted date string

convertDateTimeObject()

convertDateTimeObject(\DateTime  $dateTime, boolean  $includeTimezone = true) : string

Convert a \DateTime object to format: 1995-12-31T23:59:59Z+02:00.

Converts it to the lucene format, including the appropriate TimeZone

Parameters

\DateTime $dateTime
boolean $includeTimezone

Returns

string

getParamName()

getParamName(  $class) : string

Tries to guess the name of the param, based on its class Example: \Elastica\Filter\HasChildFilter => has_child.

Parameters

$class

Returns

string —

parameter name

convertRequestToCurlCommand()

convertRequestToCurlCommand(\Elastica\Request  $request) : string

Converts Request to Curl console command.

Parameters

\Elastica\Request $request

Returns

string