src/Widgets/Reports/BaseReportGraphs.php
public function validate(array $data = []) : array
    {
        $validated = false;
        $errors = [];

        if (empty($this->requiredFields)) {
            $errors[] = "Missing requiredFields in the report object";
        }

        foreach ($this->requiredFields as $field) {
            if (!isset($data['info'][$field])) {
                $errors[] = "Required field [$field] must be set";
            }

            if (empty($data['info'][$field])) {
                $errors[] = "Required Field [$field] cannot be empty";
            }
        }

        if (empty($errors)) {
            $validated = true;
            $this->errors = [];
        } else {
            $this->errors = $errors;
        }

        return ['status' => $validated, 'messages' => $errors];
    }
public function validate(array $data = []) : array
    {
        $validated = false;
        $errors = [];

        if (empty($this->requiredFields)) {
            $errors[] = "Missing requiredFields in the report object";
        }

        foreach ($this->requiredFields as $field) {
            if (!isset($data['info'][$field])) {
                $errors[] = "Required field [$field] must be set";
            }

            if (empty($data['info'][$field])) {
                $errors[] = "Required Field [$field] cannot be empty";
            }
        }

        if (empty($errors)) {
            $validated = true;
            $this->errors = [];
        } else {
            $this->errors = $errors;
        }

        return ['status' => $validated, 'messages' => $errors];
    }
public function validate ( array $ data = [ ] ) : array { $ validated = false ; $ errors = [ ] ; if ( empty ( $ this -> requiredFields ) ) { $ errors [ ] = "Missing requiredFields in the report object" ; } foreach ( $ this -> requiredFields as $ field ) { if ( ! isset ( $ data [ 'info' ] [ $ field ] ) ) { $ errors [ ] = "Required field [$field] must be set" ; } if ( empty ( $ data [ 'info' ] [ $ field ] ) ) { $ errors [ ] = "Required Field [$field] cannot be empty" ; } } if ( empty ( $ errors ) ) { $ validated = true ; $ this -> errors = [ ] ; } else { $ this -> errors = $ errors ; } return [ 'status' => $ validated , 'messages' => $ errors ] ; }
validate method.

Checks all the required fields of the report if any.

@param array $data with report configuration
@return mixed[] result of validation
validate method .