original_string: public function put_post($data)
      {
          $m = $this->model;
  
          if ($m->loaded()) {
              if (!$this->allow_edit) {
                  throw $this->exception('Editing is not allowed');
              }
              $data = $this->_input($data, $this->allow_edit);
          } else {
              if (!$this->allow_add) {
                  throw $this->exception('Adding is not allowed');
              }
              $data = $this->_input($data, $this->allow_add);
          }
  
          return $this->outputOne($m->set($data)->save()->get());
      }
code: public function put_post($data)
      {
          $m = $this->model;
  
          if ($m->loaded()) {
              if (!$this->allow_edit) {
                  throw $this->exception('Editing is not allowed');
              }
              $data = $this->_input($data, $this->allow_edit);
          } else {
              if (!$this->allow_add) {
                  throw $this->exception('Adding is not allowed');
              }
              $data = $this->_input($data, $this->allow_add);
          }
  
          return $this->outputOne($m->set($data)->save()->get());
      }
code_tokens: public function put_post ( $ data ) { $ m = $ this -> model ; if ( $ m -> loaded ( ) ) { if ( ! $ this -> allow_edit ) { throw $ this -> exception ( 'Editing is not allowed' ) ; } $ data = $ this -> _input ( $ data , $ this -> allow_edit ) ; } else { if ( ! $ this -> allow_add ) { throw $ this -> exception ( 'Adding is not allowed' ) ; } $ data = $ this -> _input ( $ data , $ this -> allow_add ) ; } return $ this -> outputOne ( $ m -> set ( $ data ) -> save ( ) -> get ( ) ) ; }
docstring: Because it's not really defined which of the two is used for updating
  the resource, Agile Toolkit will support put_post identically. Both
  of the requests are idempotent.
  
  As you extend this class and redefine methods, you should properly
  use POST or PUT. See http://stackoverflow.com/a/2691891/204819
  
  @param array $data
  
  @return array
docstring_tokens: Because it s not really defined which of the two is used for updating the resource Agile Toolkit will support put_post identically . Both of the requests are idempotent .