예제 #1
0
 public function testTokenizePartialLang()
 {
     $httpField = 'es-*;q=0.7,es-ES;q=0.9,es-CO;q=0.8';
     $expected = array('es-*', ';', 'q', '=', '0.7', ',', 'es-ES', ';', 'q', '=', '0.9', ',', 'es-CO', ';', 'q', '=', '0.8');
     $tokenizer = new FieldTokenizer();
     $real = $tokenizer->tokenize($httpField, PreferenceInterface::MIME);
     $this->assertEquals($expected, $real);
 }
예제 #2
0
 /**
  * Parse client preferences and return an array of Preference instances
  *
  * @param bool $serverField
  * @param string $field
  * @param string $fromField
  *
  * @return PreferenceInterface[]
  */
 private function parsePreferences($serverField, $field, $fromField)
 {
     $tokenList = $this->tokenizer->tokenize($field, $fromField);
     return $this->parser->parse($tokenList, $serverField, $fromField);
 }