original_string: public function validate() {
          foreach ($this->requiredfields as $key) {
              if (empty($this->{$key})) {
                  throw new portfolio_format_leap2a_exception('leap2a_missingfield', 'portfolio', '', $key);
              }
          }
          if ($this->type == 'selection') {
              if (count($this->links) == 0) {
                  throw new portfolio_format_leap2a_exception('leap2a_emptyselection', 'portfolio');
              }
              //TODO make sure we have a category with a scheme 'selection_type'
          }
      }
code: public function validate() {
          foreach ($this->requiredfields as $key) {
              if (empty($this->{$key})) {
                  throw new portfolio_format_leap2a_exception('leap2a_missingfield', 'portfolio', '', $key);
              }
          }
          if ($this->type == 'selection') {
              if (count($this->links) == 0) {
                  throw new portfolio_format_leap2a_exception('leap2a_emptyselection', 'portfolio');
              }
              //TODO make sure we have a category with a scheme 'selection_type'
          }
      }
code_tokens: public function validate ( ) { foreach ( $ this -> requiredfields as $ key ) { if ( empty ( $ this -> { $ key } ) ) { throw new portfolio_format_leap2a_exception ( 'leap2a_missingfield' , 'portfolio' , '' , $ key ) ; } } if ( $ this -> type == 'selection' ) { if ( count ( $ this -> links ) == 0 ) { throw new portfolio_format_leap2a_exception ( 'leap2a_emptyselection' , 'portfolio' ) ; } //TODO make sure we have a category with a scheme 'selection_type' } }
docstring: Validate this entry.
  At the moment this just makes sure required fields exist
  but it could also check things against a list, for example
  
  @todo MDL-31303 - add category with a scheme 'selection_type'
docstring_tokens: Validate this entry . At the moment this just makes sure required fields exist but it could also check things against a list for example