original_string: public function add_all(array $items) : array {
          global $DB;
          $time = time();
          foreach ($items as $item) {
              $this->validate($item);
              $favourite = (array)$item;
              $favourite['timecreated'] = $time;
              $favourite['timemodified'] = $time;
              $ids[] = $DB->insert_record($this->favouritetable, $favourite);
          }
          list($insql, $params) = $DB->get_in_or_equal($ids);
          $records = $DB->get_records_select($this->favouritetable, "id $insql", $params);
          return $this->get_list_of_favourites_from_records($records);
      }
code: public function add_all(array $items) : array {
          global $DB;
          $time = time();
          foreach ($items as $item) {
              $this->validate($item);
              $favourite = (array)$item;
              $favourite['timecreated'] = $time;
              $favourite['timemodified'] = $time;
              $ids[] = $DB->insert_record($this->favouritetable, $favourite);
          }
          list($insql, $params) = $DB->get_in_or_equal($ids);
          $records = $DB->get_records_select($this->favouritetable, "id $insql", $params);
          return $this->get_list_of_favourites_from_records($records);
      }
code_tokens: public function add_all ( array $ items ) : array { global $ DB ; $ time = time ( ) ; foreach ( $ items as $ item ) { $ this -> validate ( $ item ) ; $ favourite = ( array ) $ item ; $ favourite [ 'timecreated' ] = $ time ; $ favourite [ 'timemodified' ] = $ time ; $ ids [ ] = $ DB -> insert_record ( $ this -> favouritetable , $ favourite ) ; } list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ ids ) ; $ records = $ DB -> get_records_select ( $ this -> favouritetable , "id $insql" , $ params ) ; return $ this -> get_list_of_favourites_from_records ( $ records ) ; }
docstring: Add a collection of favourites to the repository.
  
  @param array $items the list of favourites to add.
  @return array the list of favourites which have been stored.
  @throws \dml_exception if any database errors are encountered.
  @throws \moodle_exception if any of the favourites have missing or invalid properties.
docstring_tokens: Add a collection of favourites to the repository .