Exemple #1
0
 /**
  * reads super-globals to create itself
  * @return Request
  */
 public function importFromGlobals()
 {
     $word = new Word();
     $this->setUri(explode('?', $_SERVER['REQUEST_URI'], 2)[0]);
     $this->setPort($_SERVER['SERVER_PORT']);
     $this->setMethod($_SERVER['REQUEST_METHOD']);
     $this->setParameters(new PublicObject($_REQUEST));
     foreach ($_SERVER as $key => $val) {
         if (strpos($key, self::HEADER_SERVER_PREFIX) === 0) {
             $key = str_replace(self::HEADER_SERVER_PREFIX, '', $key);
             $key = strtolower($key);
             $key = $word->humanCase($key);
             $key = ucwords($key);
             $key = str_replace(' ', '-', $key);
             $this->header->{$key} = $val;
         }
     }
     return $this;
 }
Exemple #2
0
 /**
  * @dataProvider dataProviderStrings
  */
 public function testConvertingToHumanCase($str)
 {
     $this->assertEquals('property name', $this->word->humanCase($str));
 }