Checks criteria for any major problems.

@return array A list containing status and an error message (if any).
432637
public function validate() {
        global $DB;
        $params = array_keys($this->params);
        $method = ($this->method == BADGE_CRITERIA_AGGREGATION_ALL);
        $singleparam = (count($params) == 1);

        foreach ($params as $param) {
            // Perform check if there only one parameter with any type of aggregation,
            // Or there are more than one parameter with aggregation ALL.
            if (($singleparam || $method) && !$DB->record_exists('cohort', array('id' => $param))) {
                return array(false, get_string('error:invalidparamcohort', 'badges'));
            }
        }

        return array(true, '');
    }
718507
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['weight_unit'] === null) {
            $invalidProperties[] = "'weight_unit' can't be null";
        }
        $allowedValues = $this->getWeightUnitAllowableValues();
        if (!is_null($this->container['weight_unit']) && !in_array($this->container['weight_unit'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'weight_unit', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['dimensions_unit'] === null) {
            $invalidProperties[] = "'dimensions_unit' can't be null";
        }
        $allowedValues = $this->getDimensionsUnitAllowableValues();
        if (!is_null($this->container['dimensions_unit']) && !in_array($this->container['dimensions_unit'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'dimensions_unit', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
198411
public function getStatusesHuman()
    {
        return [
            self::STATUS_PENDING          => 'Pending',
            self::STATUS_PROCESSING       => 'Processing',
            self::STATUS_COMPLETE         => 'Complete',
            self::STATUS_FAILED           => 'Failed',
            self::STATUS_REFUNDED         => 'Refunded',
            self::STATUS_REFUNDED_PARTIAL => 'Partially Refunded',
        ];
    }
1328270
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if (!is_null($this->container['sender']) && (strlen($this->container['sender']) > 11)) {
            $invalidProperties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11.";
        }

        return $invalidProperties;
    }
94084
public function isValid()
    {
        $statusList = \Genesis\Utils\Common::getClassConstants(__CLASS__);

        return in_array(strtolower($this->status), $statusList);
    }
57363
public function getAllowedStatuses()
    {
        return [
            self::STATUS_CLIENT_DELETE_PROHIBITED,
            self::STATUS_CLIENT_TRANSFER_PROHIBITED,
            self::STATUS_CLIENT_UPDATE_PROHIBITED,
            self::STATUS_LINKED,
            self::STATUS_OK,
            self::STATUS_PENDING_CREATE,
            self::STATUS_PENDING_DELETE,
            self::STATUS_PENDING_TRANSFER,
            self::STATUS_PENDING_UPDATE,
            self::STATUS_SERVER_DELETE_PROHIBITED,
            self::STATUS_SERVER_TRANSFER_PROHIBITED,
            self::STATUS_SERVER_UPDATE_PROHIBITED,
        ];
    }
500897
public function problems()
    {
        $rawProblems = $this->load('p');
        $problems = array();

        foreach ($rawProblems as $problem) {
            $problems[] = Helper\formatProblem($problem, false);
        }

        return $problems;
    }
11917
public function getErrors(): array
    {
        if ($this->errors === null) {
            $this->errors = $this->fetchErrors();
        }

        //Making sure that each error point to proper input origin
        return $this->mapper->mapErrors($this, $this->validateNested($this->errors));
    }
207468
public function performAllChecks() {
    $this->checkRequire();
    $this->checkBltRequireDev();
    if (!$this->getInspector()->isVmCli()) {
      $this->checkPrestissimo();
    }
    $this->checkComposerConfig();

    return $this->problems;
  }
203694
protected function getDefaultErrorMessages()
    {
        $messages = [
            'message' => '{attribute} is invalid.',
            'messageDNS' => 'DNS record corresponding to {attribute} not found.',
            'messageLabelNumberMin' =>
                '{attribute} should consist of at least {labelNumberMin, number} labels separated by ' .
                '{labelNumberMin, plural, =2{dot} other{dots}}.',
            'messageLabelTooShort' => 'Each label of {attribute} should contain at least 1 character.',
            'messageNotString' => '{attribute} must be a string.',
            'messageTooShort' => '{attribute} should contain at least 1 character.',
        ];
        if ($this->enableIDN) {
            $messages['messageLabelStartEnd'] =
                'Each label of {attribute} should start and end with letter or number.' .
                ' The rightmost label of {attribute} should start with letter.';
            $messages['messageLabelTooLong'] = 'Label of {attribute} is too long.';
            $messages['messageTooLong'] = '{attribute} is too long.';
            if ($this->allowUnderscore) {
                $messages['messageInvalidCharacter'] =
                    'Each label of {attribute} can consist of only letters, numbers, hyphens and underscores.';
            } else {
                $messages['messageInvalidCharacter'] =
                    'Each label of {attribute} can consist of only letters, numbers and hyphens.';
            }
        } else {
            $messages['messageLabelStartEnd'] =
                'Each label of {attribute} should start and end with latin letter or number.' .
                ' The rightmost label of {attribute} should start with latin letter.';
            $messages['messageLabelTooLong'] = 'Each label of {attribute} should contain at most 63 characters.';
            $messages['messageTooLong'] = '{attribute} should contain at most 253 characters.';
            if ($this->allowUnderscore) {
                $messages['messageInvalidCharacter'] =
                    'Each label of {attribute} can consist of only latin letters, numbers, hyphens and underscores.';
            } else {
                $messages['messageInvalidCharacter'] =
                    'Each label of {attribute} can consist of only latin letters, numbers and hyphens.';
            }
        }
        return $messages;
    }
1212240
public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getGradeAllowableValues();
        if (!in_array($this->container['grade'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'grade', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getSubjectAllowableValues();
        if (!in_array($this->container['subject'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'subject', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
544518
public function errorMessages()
    {
        $messages = array();

        // Loop over each field
        foreach ($this->errors as $field => $errors) {
            $messages[$field] = array();

            // Loop over the fields errors
            foreach ($errors as $validation => $error) {
                $vars = array_merge(
                    array('field' => Language::translate($field)),
                    $error
                );
                unset($vars['message']);
                $messages[$field][] = Language::translate($error['message'], $vars);
            }
        }

        return $messages;
    }
576574
public function getFailures(): array
    {
        $errors = [];

        foreach ($this->getActionExceptions() as $actionException) {
            $errors[] = $actionException->getMessage();
        }

        return $errors;
    }
1227080
public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getHighGradeAllowableValues();
        if (!in_array($this->container['high_grade'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'high_grade', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getLowGradeAllowableValues();
        if (!in_array($this->container['low_grade'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'low_grade', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
986041
public function getErrors()
    {
        if (empty( $this->_errors )) {
            $errorList = Array();

            foreach ($this->__get(self::$ERROR) as $error) {
                $errorCode       = $error[self::$ERROR_ERROR_CODE];
                $message         = $error[self::$ERROR_MESSAGE];
                $consumerMessage = $error[self::$ERROR_CONSUMER_MESSAGE];
                $paySysMessage   = $error[self::$ERROR_PAY_SYS_MESSAGE];

                $errorObject = new WirecardCEE_QMore_Error($errorCode, $message);
                $errorObject->setPaySysMessage($paySysMessage);
                $errorObject->setConsumerMessage($consumerMessage);

                array_push($errorList, $errorObject);
            }

            $this->_errors = $errorList;
        }

        return $this->_errors;
    }
1271718
public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getPhoneTypeAllowableValues();
        if (!in_array($this->container['phone_type'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'phone_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getRelationshipAllowableValues();
        if (!in_array($this->container['relationship'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'relationship', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getTypeAllowableValues();
        if (!in_array($this->container['type'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
181379
public function getValidationErrors()
    {
        $errors = $this->errors;

        if (isset($this->validator)) {
            $validator_errors = $this->validator->getErrors();
            $errors = array_merge($errors, $validator_errors);
        }

        return $errors;
    }