Ejemplo n.º 1
0
 public function testPutData()
 {
     $inputParam = new InputParam(InputParam::TYPE_PUT, 'put');
     $this->assertEquals('', $inputParam->getValue());
 }
Ejemplo n.º 2
0
 private function getLabel(InputParam $param)
 {
     return ucfirst(str_replace('_', ' ', $param->getKey()));
 }
Ejemplo n.º 3
0
 /**
  * Process one param and returns value
  *
  * @param InputParam  $param   input param
  * @param string      $key     param key
  * @param string      $value   actual value from request
  *
  * @return string
  */
 private function processParam(InputParam $param, $key, $value)
 {
     if ($param->getKey() == $key) {
         $valueData = $value;
         if ($param->getType() == InputParam::TYPE_FILE) {
             if ($value->isOk()) {
                 $valueData = curl_file_create($value->getTemporaryFile(), $value->getContentType(), $value->getName());
             } else {
                 $valueData = false;
             }
         }
         if ($param->getType() == InputParam::TYPE_POST_RAW) {
             if (isset($HTTP_RAW_POST_DATA)) {
                 $valueData = $HTTP_RAW_POST_DATA;
             } else {
                 $valueData = file_get_contents('php://input');
             }
         }
         return $valueData;
     }
     return null;
 }