public function checkOutputForProblems()
    {
        if (!$this->isStarted()) {
            throw new \LogicException(sprintf('Process must be started before calling %s.', __FUNCTION__));
        }
        if ($this->isOutputDisabled()) {
            throw new \LogicException('Output has been disabled, cannot verify if Moodle script ran without problems');
        }
        if ($this->hasPhpErrorMessages($this->getErrorOutput())) {
            throw new MoodlePhpException($this);
        }
        if ($this->hasDebuggingMessages($this->getOutput())) {
            throw new MoodleDebugException($this);
        }
    }