Esempio n. 1
0
 private function init()
 {
     if (strstr($_SERVER['CONTENT_TYPE'], 'application/json')) {
         $transformer = 'json';
         $this->contentType = "application/json";
         if (!$this->is('get')) {
             $body = $this->getBody();
             if (preg_match(Request::RPC_MATCH, $body)) {
                 $transformer = 'jsonrpc';
             }
         }
     } elseif (strstr($_SERVER['CONTENT_TYPE'], 'application/xml')) {
         $transformer = 'xml';
         $this->contentType = "application/xml";
     } else {
         $transformer = 'html';
     }
     $this->transformer = Transformer::factory($transformer);
     if (!$this->is('get')) {
         $data = $this->getBody();
         $this->params = $this->transformer->decode($data);
     }
 }
Esempio n. 2
0
 public function setUp()
 {
     $this->transformer = Transformer::factory($this->getDriver());
 }