Set the required fields conditional

@return void
1075
protected function setRequiredFieldsConditional()
    {
        $requiredFieldsConditional = [
            'currency' => [
                'IDR' => ['bank_code'],
                'CNY' => ['bank_branch', 'bank_name'],
                'THB' => ['bank_name']
            ]
        ];

        $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);

        $requiredFieldValuesConditional = [
            'currency' => [
                'CNY' => [
                    [
                        'bank_account_number' => new RegexValidator('/^[0-9]{19}$/')
                    ]
                ]
            ]
        ];

        $this->requiredFieldValuesConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldValuesConditional);
    }
234849
public function validate() : void
    {
        $this->value = null;
        $value = $this->filter($this->raw_value);
        if (true === $this->checkValidity($value)) {
            $this->is_valid = true;
        } else {
            $this->is_valid = false;
            $this->reportError($this->error_message);
            $error_message = sprintf($this->error_message, $this->field_name);
            $this->the_message = $error_message;
        }
        // If no issues have been found, check the constraints.
        if ($this->is_valid) {
            foreach ($this->constraints as $constraint) {
                if (false === $constraint->check($value)) {
                    $this->is_valid = false;
                    $this->the_message = sprintf($constraint->getErrorMessage(), $this->field_name);
                }
            }
        }
        // Set the value for retrieval
        if ($this->is_valid) {
            $this->value = $value;
        }
    }
314935
def _set_fields(self):
        
        self.fields = []
        self.required_input = []
        for member_name, member_object in inspect.getmembers(self.__class__):
            if inspect.isdatadescriptor(member_object) and not member_name.startswith("__"):
                self.fields.append(member_name)
                if member_object.required_input:
                    self.required_input.append(member_name)
430740
protected function setField($values)
    {
        foreach ($values as $name => $field) {
            $this->fields[$name] = $field;
        }
    }
515658
protected function setRequiredFieldValuesConditional()
    {
        $requiredFieldValuesConditional = [
            'payment_type' => [
                PaymentMethods::EPS        => [
                    [
                        'billing_country' => 'AT',
                        'currency'        => 'EUR'
                    ]
                ],
                PaymentMethods::SAFETY_PAY => [
                    [
                        'billing_country' => [
                            'AT', 'BE', 'BR', 'CL', 'CO', 'CR', 'DE', 'EC', 'ES', 'MX', 'NL', 'PE', 'PR'
                        ],
                        'currency'        => ['EUR', 'USD']
                    ]
                ],
                PaymentMethods::TRUST_PAY  => [
                    [
                        'billing_country' => 'CZ',
                        'currency'        => 'CZK'
                    ],
                    [
                        'billing_country' => ['CZ', 'SK'],
                        'currency'        => 'EUR'
                    ]
                ],
                PaymentMethods::PRZELEWY24 => [
                    [
                        'billing_country' => 'PL',
                        'currency'        => 'PLN'
                    ]
                ],
                PaymentMethods::IDEAL      => [
                    [
                        'billing_country' => 'NL',
                        'currency'        => 'EUR'
                    ]
                ],
                PaymentMethods::QIWI       => [
                    [
                        'billing_country' => 'RU',
                        'currency'        => ['EUR', 'RUB']
                    ]
                ],
                PaymentMethods::GIRO_PAY   => [
                    [
                        'billing_country' => 'DE',
                        'currency'        => 'EUR'
                    ]
                ],
                PaymentMethods::BCMC       => [
                    [
                        'billing_country' => 'BE',
                        'currency'        => 'EUR'
                    ]
                ],
                PaymentMethods::MYBANK     => [
                    [
                        'billing_country' => ['BE', 'FR', 'IT', 'LU'],
                        'currency'        => 'EUR'
                    ]
                ]
            ]
        ];

        $this->requiredFieldValuesConditional = CommonUtils::createArrayObject($requiredFieldValuesConditional);
    }
632798
public function setFields( $fields )
	{
		if( is_array( $fields ) && count( $fields ) )
			$this->fields = $fields;
		else
			trigger_error( 'Field Array of Table Definition must no be empty.', E_USER_ERROR );
	}
712777
public function validateRequired()
    {
        $this->validator_attributes[] = 'data-parsley-required';

        $this->field_required = true;

        $this->validator_checks['required'] = true;

        return $this;
    }
1371538
public function required($required = null) {

		if(false === is_bool($required) && null !== $required) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($required)), E_USER_ERROR);
		}

		if(null === $required) {
			$required = true;
		}

		foreach($this -> getFieldnames() as $field) {
			$this -> required[$field] = $required;
		}

		return $this;
	}
1242673
protected function setRequiredFields()
    {
        $requiredFields = [
            'transaction_id',
            'payment_type',
            'remote_ip',
            'amount',
            'currency',
            'return_success_url',
            'return_failure_url',
            'customer_email',
            'billing_country'
        ];

        $this->requiredFields = CommonUtils::createArrayObject($requiredFields);

        $requiredFieldValues = [
            'payment_type'    => PaymentMethods::getMethods(),
            'billing_country' => \Genesis\Utils\Country::getList(),
            'currency'        => \Genesis\Utils\Currency::getList()
        ];

        $this->requiredFieldValues = CommonUtils::createArrayObject($requiredFieldValues);

        $requiredFieldsConditional = [
            'payment_type' => [
                PaymentMethods::GIRO_PAY   => [
                    'bic',
                    'iban'
                ],
                PaymentMethods::PRZELEWY24 => [
                    'customer_email'
                ],
                PaymentMethods::QIWI       => [
                    'account_phone'
                ]
            ]
        ];

        $this->requiredFieldsConditional = CommonUtils::createArrayObject($requiredFieldsConditional);

        $this->setRequiredFieldValuesConditional();
    }
82135
final protected function checkRequiredFields()
    {
        foreach ($this->getRequiredFields() as $requiredField) {
            $value = $this->getAttribute($requiredField);
            if (empty($value)) {
                throw new RequiredFieldException($requiredField);
            }
        }
    }
196252
public function registerDefaultConditions()
    {
        if (false === $this->defaultConditionsWereRegistered) {
            $this->defaultConditionsWereRegistered = true;

            $this->registerCondition(
                FieldHasValueCondition::CONDITION_NAME,
                FieldHasValueCondition::class
            )->registerCondition(
                FieldHasErrorCondition::CONDITION_NAME,
                FieldHasErrorCondition::class
            )->registerCondition(
                FieldIsValidCondition::CONDITION_NAME,
                FieldIsValidCondition::class
            )->registerCondition(
                FieldIsEmptyCondition::CONDITION_NAME,
                FieldIsEmptyCondition::class
            )->registerCondition(
                FieldIsFilledCondition::CONDITION_IDENTIFIER,
                FieldIsFilledCondition::class
            )->registerCondition(
                FieldCountValuesCondition::CONDITION_IDENTIFIER,
                FieldCountValuesCondition::class
            );
        }
    }
76926
protected function setFields($fields) 
    {
    	foreach ($fields as $name => $value) {
            $property = '_' . $name;
            if (property_exists($this, $property)) $this->$property = $value;
        }
    }
583810
def validate_fields
      self.class.required_fields.each do |field|
        value = public_send(field)
        if value.nil? || value.respond_to?(:empty?) && value.empty?
          raise Outbox::MissingRequiredFieldError, "Missing required field: #{field}"
        end
      end
    end
677379
public function setRequired($required)
    {
        if (is_bool($required) === true) {
            $this->required = $required;
        } else {
            $msg = "The 'required' argument must be a boolean value, '" . gettype($required) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
629100
public function ApplyRules($Fields) {
      foreach ($Fields as $Index => $Row) {
         $Validation = GetValue('Validation', $Row);
         if (!$Validation)
            continue;
         
         $FieldName = GetValue('Name', $Row, $Index);
         if (is_string($Validation)) {
            $this->ApplyRule($FieldName, $Validation);
         } elseif (is_array($Validation)) {
            foreach ($Validation as $Rule) {
               if (is_array($Rule)) {
                  $this->ApplyRule($FieldName, $Rule[0], $Rule[1]);
               } else {
                  $this->ApplyRule($FieldName, $Rule);
               }
            }
         }
      }
   }
1046293
private function AddRequiredField()
    {
        $field = new Fields\Checkbox('Required', '1', $this->textarea->GetRequired());
        $this->AddField($field);
    }
1227690
private function validateFields()
    {
        $fields = (array) $this->fields;

        if (empty($fields)) {
            throw new Exception\InvalidArgumentException('Provided fields list was empty!');
        }

        foreach ($fields as $key => $field) {
            if (! is_string($field)) {
                throw new Exception\InvalidArgumentException(
                    sprintf('Provided fields must be strings, %s provided for key %s', gettype($field), $key)
                );
            }
        }

        $this->fields = array_values($fields);
    }