/** * Escapes characters in string that hold meaning in Sphinx; except starting and ending double quotes * * @param string $string * * @return string */ private function escape($string) { $s = '%s'; if ($this->isPhrase) { $string = rtrim(ltrim($string, '"'), '"'); $s = '"%s"'; } return sprintf($s, Utils::escapeQueryString($string)); }
public function testPrepareAttributeValueReturnsIntegerValueIfNoEntryInMap() { $attributeMap = ['gender' => ['male' => 1, 'female' => 2, 'undisclosed' => 3, 'transgendered' => 4], 'age_range' => ['0_18' => 101, '18_30' => 102]]; $this->assertInternalType('int', Utils::prepareAttributeValue('male', 'bob', $attributeMap)); }