original_string: public function set($entity, $entity_id, $created, $user_id = null)
      {
          if (!isset($user_id)) {
              $user_id = $this->user->getId(); // Current user
          }
  
          if ($this->exists($entity, $entity_id, $user_id)) {
              return true;
          }
  
          if ((GC_TIME - $created) >= $this->getLifespan()) {
              return true; // Expired and was removed
          }
  
          $data = array(
              'entity' => $entity,
              'user_id' => $user_id,
              'entity_id' => $entity_id
          );
  
          return $this->add($data);
      }
code: public function set($entity, $entity_id, $created, $user_id = null)
      {
          if (!isset($user_id)) {
              $user_id = $this->user->getId(); // Current user
          }
  
          if ($this->exists($entity, $entity_id, $user_id)) {
              return true;
          }
  
          if ((GC_TIME - $created) >= $this->getLifespan()) {
              return true; // Expired and was removed
          }
  
          $data = array(
              'entity' => $entity,
              'user_id' => $user_id,
              'entity_id' => $entity_id
          );
  
          return $this->add($data);
      }
code_tokens: public function set ( $ entity , $ entity_id , $ created , $ user_id = null ) { if ( ! isset ( $ user_id ) ) { $ user_id = $ this -> user -> getId ( ) ; // Current user } if ( $ this -> exists ( $ entity , $ entity_id , $ user_id ) ) { return true ; } if ( ( GC_TIME - $ created ) >= $ this -> getLifespan ( ) ) { return true ; // Expired and was removed } $ data = array ( 'entity' => $ entity , 'user_id' => $ user_id , 'entity_id' => $ entity_id ) ; return $ this -> add ( $ data ) ; }
docstring: Set a history record
  @param string $entity
  @param int $entity_id
  @param int $created
  @param null|int $user_id
  @return boolean
docstring_tokens: Set a history record