Elastica\Util::getParamName PHP Method

getParamName() public static method

Tries to guess the name of the param, based on its class Example: \Elastica\Filter\HasChildFilter => has_child.
public static getParamName ( $class ) : string
return string parameter name
    public static function getParamName($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }
        $parts = explode('\\', $class);
        $last = array_pop($parts);
        $last = preg_replace('/(Query|Filter)$/', '', $last);
        $name = self::toSnakeCase($last);
        return $name;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Param's name
  * Picks the last part of the class name and makes it snake_case
  * You can override this method if you want to change the name.
  *
  * @return string name
  */
 protected function _getBaseName()
 {
     return Util::getParamName($this);
 }
All Usage Examples Of Elastica\Util::getParamName