public function validate(CFDIReader $cfdi) { // reset issues $this->issues = new Issues(); foreach ($this->validators as $validator) { /* @var $validator \CFDIReader\PostValidations\ValidatorInterface */ // a new issues to be populated $issues = new Issues(); // ask the validator command to work $validator->validate($cfdi, $this->issues); // import all the issues found $this->issues->import($issues); } // return false if there are ERROR messages return !$this->issues->messages(IssuesTypes::ERROR)->count(); }
/** * Configure this helper class * @param CFDIReader $cfdi * @param Issues $issues */ protected function setup(CFDIReader $cfdi, Issues $issues) { $this->errors = $issues->messages(IssuesTypes::ERROR); $this->warnings = $issues->messages(IssuesTypes::WARNING); $this->comprobante = $cfdi->comprobante(); }