示例#1
0
 private function buildParams(array $params = array())
 {
     $body = $this->request->getBody();
     if (is_array($body) === false) {
         $body = array();
     }
     if (array_key_exists(0, $body) === true) {
         $body = array(self::PARAM_REQUEST_BODY => $body);
     }
     return array_replace($this->request->params(), $body, $params);
 }
示例#2
0
 /**
  * 
  * @return 
  */
 public function get()
 {
     // Disable strictness on model
     $this->model->setStrict(BaseSchema::STRICT_NONE);
     // handle stubs, if requested
     if ($this->request->params('stub')) {
         $data = $this->model->stub($this->request->params('stubType'));
         foreach ($data as $key => $row) {
             $data[$key] = $this->model->filter($row);
         }
         return $this->model->filter($data);
     }
     // parse the query string
     $this->parseQueryString();
     // Extract the data from the parseResult.
     // Set as separate methods so that subclasses can selectively
     // override
     $conditions = $this->getFindConditions();
     $fields = $this->getFindFields();
     $sort = $this->getFindSort();
     $limit = $this->getFindLimit();
     $skip = $this->getFindSkip();
     $misc = $this->getFindMisc();
     $field = $this->request->params('distinctCount');
     // a field name
     if ($field) {
         return $this->handleDistinctCount($field, $conditions, $misc);
     }
     $findResult = $this->model->find($conditions, $fields, $sort, $limit, $skip, $misc);
     $metaResult = [];
     if ($this->request->params('count')) {
         $metaResult['_meta']['count'] = $this->model->count($conditions);
     }
     // Pass to model for processing
     return array_merge($findResult, $metaResult);
 }
示例#3
0
 /**
  * Bind a request
  *
  * @param Request $request Request
  *
  * @return array
  */
 public function bind(Request $request)
 {
     $params = array('rotate' => $request->params('r'), 'negate' => $request->params('n'), 'crop' => false, 'contrast' => $request->params('c'), 'brightness' => $request->params('b'));
     if ($request->params('h') !== null && $request->params('w') !== null && $request->params('x') !== null && $request->params('y') !== null) {
         $params['crop'] = array('x' => $request->params('x'), 'y' => $request->params('y'), 'w' => $request->params('w'), 'h' => $request->params('h'));
     }
     return $params;
 }
示例#4
0
 private function _getAction(Request $request)
 {
     $text = $request->params('text');
     $matches = explode(" ", $text);
     return "action" . $matches[1];
 }