public function testNegotiatesEncodingBasics()
 {
     $this->request->setHeader('Accept-Encoding', 'gzip;q=1.0, identity; q=0.4, compress;q=0.5');
     $this->assertEquals('gzip', $this->negotiate->encoding(['gzip', 'compress']));
     $this->assertEquals('compress', $this->negotiate->encoding(['compress']));
     $this->assertEquals('identity', $this->negotiate->encoding());
 }
 /**
  * Provides a convenient way to work with the Negotiate class
  * for content negotiation.
  *
  * @param string $type
  * @param array  $supported
  * @param bool   $strictMatch
  *
  * @return mixed
  */
 public function negotiate(string $type, array $supported, bool $strictMatch = false)
 {
     if (is_null($this->negotiate)) {
         $this->negotiate = Services::negotiator($this, true);
     }
     switch (strtolower($type)) {
         case 'media':
             return $this->negotiate->media($supported, $strictMatch);
             break;
         case 'charset':
             return $this->negotiate->charset($supported);
             break;
         case 'encoding':
             return $this->negotiate->encoding($supported);
             break;
         case 'language':
             return $this->negotiate->language($supported);
             break;
     }
     throw new \InvalidArgumentException($type . ' is not a valid negotiation type.');
 }