/** * Validates a file over registered rules and returns an array of errors * * @return array */ public function validate() { if ($this->errors !== null) { return $this->errors; } $this->errors = array(); if (!$this->needs_validation()) { return $this->errors; } foreach (local_moodlecheck_registry::get_enabled_rules() as $code => $rule) { $ruleerrors = $rule->validatefile($this); if (count($ruleerrors)) { $this->errors = array_merge($this->errors, $ruleerrors); } } $this->clear_memory(); return $this->errors; }