public function filterEnum($value, $enumName)
    {
        if (!isset($this->enums[$enumName])) {
            throw new InvalidParamException("The '$enumName' enum has not been registered in the current formatter");
        }
        if ($value === null) {
            return null;
        }
        return ($key = array_search($value, $this->enums[$enumName])) !== null ? $key : null;
    }
public function filterEnum($value, $enumName)
    {
        if (!isset($this->enums[$enumName])) {
            throw new InvalidParamException("The '$enumName' enum has not been registered in the current formatter");
        }
        if ($value === null) {
            return null;
        }
        return ($key = array_search($value, $this->enums[$enumName])) !== null ? $key : null;
    }
public function filterEnum ( $ value , $ enumName ) { if ( ! isset ( $ this -> enums [ $ enumName ] ) ) { throw new InvalidParamException ( "The '$enumName' enum has not been registered in the current formatter" ) ; } if ( $ value === null ) { return null ; } return ( $ key = array_search ( $ value , $ this -> enums [ $ enumName ] ) ) !== null ? $ key : null ; }
Filters the value to the ones contained in the enum and returns its key.
Note, the value is searched using exact comparison so it may need to be trimmed.
@param string $value the value to be filtered
@param string $enumName
@return string if the value is not found, returns null
Filters the value to the ones contained in the enum and returns its key . Note the value is searched using exact comparison so it may need to be trimmed .