\ElasticaUtil

Elastica tools.

Summary

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

Properties

$dateMathSymbols

$dateMathSymbols : array

Type

array

$escapedDateMathSymbols

$escapedDateMathSymbols : array

Type

array

Methods

isDateMathEscaped()

isDateMathEscaped(string  $requestUri) : boolean

Checks if date math is already escaped within request URI.

Parameters

string $requestUri

Returns

boolean

escapeDateMath()

escapeDateMath(string  $requestUri) : string

Escapes date math symbols within request URI.

Parameters

string $requestUri

Returns

string

replaceBooleanWordsAndEscapeTerm()

replaceBooleanWordsAndEscapeTerm(string  $term) : string

Replace known reserved words (e.g. AND OR NOT) and escape known special characters (e.g. + - && || ! ( ) { } [ ] ^ " ~ * ? : etc.).

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\Query\MatchAll => match_all.

Parameters

$class

Returns

string —

parameter name

convertRequestToCurlCommand()

convertRequestToCurlCommand(\Elastica\Request  $request) : string

Converts Request to Curl console command.

Parameters

\Elastica\Request $request

Returns

string