original_string: public function set(array $job)
      {
          $result = null;
          $this->hook->attach('job.set.before', $job, $result, $this);
  
          if (isset($result)) {
              return (array) $result;
          }
  
          $default = $this->getDefault();
          $result = gplcart_array_merge($default, $job);
          $existing = $this->getSession($result['id']);
  
          if (!empty($existing)) {
              return (array) $existing;
          }
  
          $this->setSession($result);
          $this->hook->attach('job.set.after', $job, $result, $this);
          return (array) $result;
      }
code: public function set(array $job)
      {
          $result = null;
          $this->hook->attach('job.set.before', $job, $result, $this);
  
          if (isset($result)) {
              return (array) $result;
          }
  
          $default = $this->getDefault();
          $result = gplcart_array_merge($default, $job);
          $existing = $this->getSession($result['id']);
  
          if (!empty($existing)) {
              return (array) $existing;
          }
  
          $this->setSession($result);
          $this->hook->attach('job.set.after', $job, $result, $this);
          return (array) $result;
      }
code_tokens: public function set ( array $ job ) { $ result = null ; $ this -> hook -> attach ( 'job.set.before' , $ job , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( array ) $ result ; } $ default = $ this -> getDefault ( ) ; $ result = gplcart_array_merge ( $ default , $ job ) ; $ existing = $ this -> getSession ( $ result [ 'id' ] ) ; if ( ! empty ( $ existing ) ) { return ( array ) $ existing ; } $ this -> setSession ( $ result ) ; $ this -> hook -> attach ( 'job.set.after' , $ job , $ result , $ this ) ; return ( array ) $ result ; }
docstring: Sets a job to the session
  @param array $job
  @return array
docstring_tokens: Sets a job to the session