protected function enforceArrayOrString($requireArray, $value, $field)
    {
        $this->checkFieldIsAnArray($requireArray, $value, $field);

        if (!$requireArray && is_array($value)) {
            return $this->convertArrayToFlatValue($field, $value);
        }

        return $value;
    }
protected function enforceArrayOrString($requireArray, $value, $field)
    {
        $this->checkFieldIsAnArray($requireArray, $value, $field);

        if (!$requireArray && is_array($value)) {
            return $this->convertArrayToFlatValue($field, $value);
        }

        return $value;
    }
protected function enforceArrayOrString ( $ requireArray , $ value , $ field ) { $ this -> checkFieldIsAnArray ( $ requireArray , $ value , $ field ) ; if ( ! $ requireArray && is_array ( $ value ) ) { return $ this -> convertArrayToFlatValue ( $ field , $ value ) ; } return $ value ; }
Enforce whether the value for a given field is the correct type.

@param bool   $requireArray value must be an array
@param mixed  $value        the value we are checking against
@param string $field        the field that we are enforcing

@return mixed value after enforcement

@throws \Exception if value is not a correct type
Enforce whether the value for a given field is the correct type .