src/Genesis/API/Request.php
protected function verifyFieldValuesRequirements()
    {
        if (!isset($this->requiredFieldValues)) {
            return;
        }

        $iterator = $this->requiredFieldValues->getArrayCopy();

        foreach ($iterator as $fieldName => $validator) {
            if ($validator instanceof RequestValidator) {
                $validator->run($this, $fieldName);

                continue;
            }

            if (CommonUtils::isValidArray($validator)) {
                if (!in_array($this->$fieldName, $validator)) {
                    throw new \Genesis\Exceptions\ErrorParameter(
                        sprintf(
                            'Required parameter %s is set to %s, but expected to be one of (%s)',
                            $fieldName,
                            $this->$fieldName,
                            implode(
                                ', ',
                                CommonUtils::getSortedArrayByValue($validator)
                            )
                        )
                    );
                }

                continue;
            }

            if ($this->$fieldName !== $validator) {
                throw new \Genesis\Exceptions\ErrorParameter(
                    sprintf(
                        'Required parameter %s is set to %s, but expected to be %s',
                        $fieldName,
                        $this->$fieldName,
                        $validator
                    )
                );
            }
        }
    }
protected function verifyFieldValuesRequirements()
    {
        if (!isset($this->requiredFieldValues)) {
            return;
        }

        $iterator = $this->requiredFieldValues->getArrayCopy();

        foreach ($iterator as $fieldName => $validator) {
            if ($validator instanceof RequestValidator) {
                $validator->run($this, $fieldName);

                continue;
            }

            if (CommonUtils::isValidArray($validator)) {
                if (!in_array($this->$fieldName, $validator)) {
                    throw new \Genesis\Exceptions\ErrorParameter(
                        sprintf(
                            'Required parameter %s is set to %s, but expected to be one of (%s)',
                            $fieldName,
                            $this->$fieldName,
                            implode(
                                ', ',
                                CommonUtils::getSortedArrayByValue($validator)
                            )
                        )
                    );
                }

                continue;
            }

            if ($this->$fieldName !== $validator) {
                throw new \Genesis\Exceptions\ErrorParameter(
                    sprintf(
                        'Required parameter %s is set to %s, but expected to be %s',
                        $fieldName,
                        $this->$fieldName,
                        $validator
                    )
                );
            }
        }
    }
protected function verifyFieldValuesRequirements ( ) { if ( ! isset ( $ this -> requiredFieldValues ) ) { return ; } $ iterator = $ this -> requiredFieldValues -> getArrayCopy ( ) ; foreach ( $ iterator as $ fieldName => $ validator ) { if ( $ validator instanceof RequestValidator ) { $ validator -> run ( $ this , $ fieldName ) ; continue ; } if ( CommonUtils :: isValidArray ( $ validator ) ) { if ( ! in_array ( $ this -> $ fieldName , $ validator ) ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Required parameter %s is set to %s, but expected to be one of (%s)' , $ fieldName , $ this -> $ fieldName , implode ( ', ' , CommonUtils :: getSortedArrayByValue ( $ validator ) ) ) ) ; } continue ; } if ( $ this -> $ fieldName !== $ validator ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Required parameter %s is set to %s, but expected to be %s' , $ fieldName , $ this -> $ fieldName , $ validator ) ) ; } } }
Verify that all required fields are populated with expected values

@throws \Genesis\Exceptions\ErrorParameter
Verify that all required fields are populated with expected values