original_string: public function add($idSite, $date, $note, $starred = 0)
      {
          $this->checkUserCanAddNotesFor($idSite);
          $this->checkSingleIdSite($idSite, $extraMessage = "Note: Cannot add one note to multiple sites.");
          $this->checkDateIsValid($date);
  
          // add, save & return a new annotation
          $annotations = new AnnotationList($idSite);
  
          $newAnnotation = $annotations->add($idSite, $date, $note, $starred);
          $annotations->save($idSite);
  
          return $newAnnotation;
      }
code: public function add($idSite, $date, $note, $starred = 0)
      {
          $this->checkUserCanAddNotesFor($idSite);
          $this->checkSingleIdSite($idSite, $extraMessage = "Note: Cannot add one note to multiple sites.");
          $this->checkDateIsValid($date);
  
          // add, save & return a new annotation
          $annotations = new AnnotationList($idSite);
  
          $newAnnotation = $annotations->add($idSite, $date, $note, $starred);
          $annotations->save($idSite);
  
          return $newAnnotation;
      }
code_tokens: public function add ( $ idSite , $ date , $ note , $ starred = 0 ) { $ this -> checkUserCanAddNotesFor ( $ idSite ) ; $ this -> checkSingleIdSite ( $ idSite , $ extraMessage = "Note: Cannot add one note to multiple sites." ) ; $ this -> checkDateIsValid ( $ date ) ; // add, save & return a new annotation $ annotations = new AnnotationList ( $ idSite ) ; $ newAnnotation = $ annotations -> add ( $ idSite , $ date , $ note , $ starred ) ; $ annotations -> save ( $ idSite ) ; return $ newAnnotation ; }
docstring: Create a new annotation for a site.
  
  @param string $idSite The site ID to add the annotation to.
  @param string $date The date the annotation is attached to.
  @param string $note The text of the annotation.
  @param int $starred Either 0 or 1. Whether the annotation should be starred.
  @return array Returns an array of two elements. The first element (indexed by
  'annotation') is the new annotation. The second element (indexed
  by 'idNote' is the new note's ID).
docstring_tokens: Create a new annotation for a site .