original_string: public function add(array $data)
      {
          $result = null;
          $this->hook->attach('user.add.before', $data, $result, $this);
  
          if (isset($result)) {
              return (int) $result;
          }
  
          if (empty($data['name'])) {
              $data['name'] = strtok($data['email'], '@');
          }
  
          $data['created'] = $data['modified'] = GC_TIME;
          $data['hash'] = gplcart_string_hash($data['password']);
          $result = $data['user_id'] = $this->db->insert('user', $data);
  
          $this->setAddress($data);
  
          $this->hook->attach('user.add.after', $data, $result, $this);
          return (int) $result;
      }
code: public function add(array $data)
      {
          $result = null;
          $this->hook->attach('user.add.before', $data, $result, $this);
  
          if (isset($result)) {
              return (int) $result;
          }
  
          if (empty($data['name'])) {
              $data['name'] = strtok($data['email'], '@');
          }
  
          $data['created'] = $data['modified'] = GC_TIME;
          $data['hash'] = gplcart_string_hash($data['password']);
          $result = $data['user_id'] = $this->db->insert('user', $data);
  
          $this->setAddress($data);
  
          $this->hook->attach('user.add.after', $data, $result, $this);
          return (int) $result;
      }
code_tokens: public function add ( array $ data ) { $ result = null ; $ this -> hook -> attach ( 'user.add.before' , $ data , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( int ) $ result ; } if ( empty ( $ data [ 'name' ] ) ) { $ data [ 'name' ] = strtok ( $ data [ 'email' ] , '@' ) ; } $ data [ 'created' ] = $ data [ 'modified' ] = GC_TIME ; $ data [ 'hash' ] = gplcart_string_hash ( $ data [ 'password' ] ) ; $ result = $ data [ 'user_id' ] = $ this -> db -> insert ( 'user' , $ data ) ; $ this -> setAddress ( $ data ) ; $ this -> hook -> attach ( 'user.add.after' , $ data , $ result , $ this ) ; return ( int ) $ result ; }
docstring: Adds a user
  @param array $data
  @return integer
docstring_tokens: Adds a user