Clean the properties for only remaining valid rules for Symfony Validation Constraints

@return PHPClass[]
504655
public function getTypes()
    {
        $classes = parent::getTypes();

        foreach ($classes as $k => &$definition) {

            if (empty($definition[$k]['properties'])) {
                unset($classes[$k]);
                continue;
            }

            $properties = array_filter(array_map(function ($property) {

                if (!empty($property['validation'])) {


                    foreach ($property['validation'] as &$rule){
                        foreach ($rule as $type => &$item) {

                            if ($type === 'Valid') {
                                continue;
                            } else {
                                if (!is_array($item)){
                                    $item = [];
                                }
                                $item['groups'] = ['xsd_rules'];
                            }

                        }
                        unset($item);
                    }
                    unset($rule);

                    return $property['validation'];
                }


                return null;
            }, $definition[$k]['properties']));

            if (empty($properties)) {
                unset($classes[$k]);
                continue;
            }

            $definition[$k] = [
                'properties' => $properties
            ];
        }

        return $classes;
    }
572267
public function listInvalidProperties()
    {
        $invalidProperties = [];

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

        if (!is_null($this->container['division']) && ($this->container['division'] < 1)) {
            $invalidProperties[] = "invalid value for 'division', must be bigger than or equal to 1.";
        }

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

        return $invalidProperties;
    }
985432
protected function processProperties() {

		$ret = '';

		if ($this->required and (!isset($this->type) or (isset($this->type) and 'bool' != $this->type))) {
			$ret .= ' required';
		}

		if ($this->disabled) {
			$ret .= ' disabled';
		}

		if ($this->readonly) {
			$ret .= ' readonly';
		}

		if ($this->placeholder) {
			$ret .= ' placeholder="' . $this->placeholder . '"';
		}
		
		// CSS classes
		if (count($this->class)) {
			$ret .= ' class="' . implode(' ', $this->class) . '"';
		}
		
		// misc tag attributes
		foreach ($this->attributes as $attr=>$val) {
			$ret .= ' ' . $attr . '="' . addslashes($val) . '"';
		}
		
		return $ret;

	}
550515
public function getValidAttribs()
    {
        return array_combine(
            array_keys($this->validAttribs),
            array_map(function ($ref) {
                return $ref['attrib'];
            }, array_values($this->validAttribs))
        );
    }
1180411
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['name'] === null) {
            $invalidProperties[] = "'name' can't be null";
        }
        if ((strlen($this->container['name']) > 40)) {
            $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 40.";
        }

        if ((strlen($this->container['name']) < 1)) {
            $invalidProperties[] = "invalid value for 'name', the character length must be bigger than or equal to 1.";
        }

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

        return $invalidProperties;
    }
1074674
public static function getValidatedFields()
    {
        $fields = [];

        foreach (static::getRulesGroups() as $groupName) {
            $fields = array_merge($fields, array_keys(static::getRulesGroup($groupName)));
        }

        return array_values(array_unique($fields));
    }
676401
public static function get_mandatory_properties() {
        $properties = self::define_properties();
        $mandatoryproperties = array_filter($properties, function($property) {
            return empty($property['optional']);
        });
        return array_keys($mandatoryproperties);
    }
835268
public function rules()
    {

        $allowed_registration = implode(',', Seat::$options['registration']);
        $allowed_cleanup = implode(',', Seat::$options['cleanup_data']);
        $allowed_tracking = implode(',', Seat::$options['allow_tracking']);

        return [
            'registration'   => 'required|in:' . $allowed_registration,
            'cleanup_data'   => 'required|in:' . $allowed_cleanup,
            'admin_contact'  => 'required|email',
            'allow_tracking' => 'required|in:' . $allowed_tracking,
        ];
    }
413580
protected function getBoundRules()
    {
        if ($this->bypass === true) {
            return [];
        }

        $rules = $this->getRules();

        foreach ($rules as $key => $value) {
            if ($binding = array_get($this->bindings, $key)) {
                $rules[$key] = str_replace('{'.$key.'}', $binding, $value);
            }
        }

        return $rules;
    }
578694
public function rules()
    {
        $validationRule = [];
        $validationRule['name'] = 'required|max:255';

        if (null !== $this->request->get('dropdown-options')) {
            foreach ($this->request->get('dropdown-options') as $key => $val) {
                if ($key == '__RANDOM_STRING__') {
                    continue;
                }
                $validationRule['dropdown-options.' . $key . '.display_text'] = 'required';
            }
        }

        if ($this->getMethod() == 'POST') {
            $validationRule['identifier'] = 'required|max:255|alpha_dash|unique:attributes';
        }
        if ($this->getMethod() == 'PUT') {
            $validationRule['identifier'] = 'required|max:255|alpha_dash';
        }

        return $validationRule;
    }
1113830
public function filterableValidationRules() : array
    {
        $key = md5(vsprintf('%s', ['features_validationRules']));

        return Cache::remember($key, $this->remembering, function () {
            return $this->next->filterableValidationRules();
        });
    }
115052
public function listInvalidProperties()
    {
        $invalid_properties = array();
        if ($this->container['transcoderWatermark'] === null) {
            $invalid_properties[] = "'transcoderWatermark' can't be null";
        }
        if ($this->container['serverVersion'] === null) {
            $invalid_properties[] = "'serverVersion' can't be null";
        }
        if ($this->container['gpuAcceleration'] === null) {
            $invalid_properties[] = "'gpuAcceleration' can't be null";
        }
        if ($this->container['wseName'] === null) {
            $invalid_properties[] = "'wseName' can't be null";
        }
        if ($this->container['transcoderLicensed'] === null) {
            $invalid_properties[] = "'transcoderLicensed' can't be null";
        }
        if ($this->container['javaMaxHeapSize'] === null) {
            $invalid_properties[] = "'javaMaxHeapSize' can't be null";
        }
        if ($this->container['transcoderLicensesInUse'] === null) {
            $invalid_properties[] = "'transcoderLicensesInUse' can't be null";
        }
        if ($this->container['javaVersion'] === null) {
            $invalid_properties[] = "'javaVersion' can't be null";
        }
        if ($this->container['httpOriginAvailable'] === null) {
            $invalid_properties[] = "'httpOriginAvailable' can't be null";
        }
        if ($this->container['serverName'] === null) {
            $invalid_properties[] = "'serverName' can't be null";
        }
        if ($this->container['osArchitecture'] === null) {
            $invalid_properties[] = "'osArchitecture' can't be null";
        }
        if ($this->container['drmApplications'] === null) {
            $invalid_properties[] = "'drmApplications' can't be null";
        }
        if ($this->container['javaVMVersion'] === null) {
            $invalid_properties[] = "'javaVMVersion' can't be null";
        }
        if ($this->container['transcoderLicenses'] === null) {
            $invalid_properties[] = "'transcoderLicenses' can't be null";
        }
        if ($this->container['timeRunning'] === null) {
            $invalid_properties[] = "'timeRunning' can't be null";
        }
        if ($this->container['licenseType'] === null) {
            $invalid_properties[] = "'licenseType' can't be null";
        }
        if ($this->container['osBitness'] === null) {
            $invalid_properties[] = "'osBitness' can't be null";
        }
        if ($this->container['dvrApplications'] === null) {
            $invalid_properties[] = "'dvrApplications' can't be null";
        }
        if ($this->container['osVersion'] === null) {
            $invalid_properties[] = "'osVersion' can't be null";
        }
        if ($this->container['serverBuild'] === null) {
            $invalid_properties[] = "'serverBuild' can't be null";
        }
        if ($this->container['javaName'] === null) {
            $invalid_properties[] = "'javaName' can't be null";
        }
        if ($this->container['maxConnections'] === null) {
            $invalid_properties[] = "'maxConnections' can't be null";
        }
        if ($this->container['dvrLicensed'] === null) {
            $invalid_properties[] = "'dvrLicensed' can't be null";
        }
        if ($this->container['serverMode'] === null) {
            $invalid_properties[] = "'serverMode' can't be null";
        }
        if ($this->container['javaBitness'] === null) {
            $invalid_properties[] = "'javaBitness' can't be null";
        }
        if ($this->container['currentConnections'] === null) {
            $invalid_properties[] = "'currentConnections' can't be null";
        }
        if ($this->container['drmLicensed'] === null) {
            $invalid_properties[] = "'drmLicensed' can't be null";
        }
        if ($this->container['javaVendor'] === null) {
            $invalid_properties[] = "'javaVendor' can't be null";
        }
        if ($this->container['osName'] === null) {
            $invalid_properties[] = "'osName' can't be null";
        }
        if ($this->container['version'] === null) {
            $invalid_properties[] = "'version' can't be null";
        }
        if ($this->container['transcoderApplications'] === null) {
            $invalid_properties[] = "'transcoderApplications' can't be null";
        }
        if ($this->container['transcoderAvailable'] === null) {
            $invalid_properties[] = "'transcoderAvailable' can't be null";
        }
        if ($this->container['javaHome'] === null) {
            $invalid_properties[] = "'javaHome' can't be null";
        }
        if ($this->container['maxIncommingStreams'] === null) {
            $invalid_properties[] = "'maxIncommingStreams' can't be null";
        }
        if ($this->container['totalMemory'] === null) {
            $invalid_properties[] = "'totalMemory' can't be null";
        }
        if ($this->container['availableMemory'] === null) {
            $invalid_properties[] = "'availableMemory' can't be null";
        }
        if ($this->container['nativeBase'] === null) {
            $invalid_properties[] = "'nativeBase' can't be null";
        }
        if ($this->container['dvrInUse'] === null) {
            $invalid_properties[] = "'dvrInUse' can't be null";
        }
        if ($this->container['drmInUse'] === null) {
            $invalid_properties[] = "'drmInUse' can't be null";
        }
        if ($this->container['licenseExpireDate'] === null) {
            $invalid_properties[] = "'licenseExpireDate' can't be null";
        }
        if ($this->container['processorCores'] === null) {
            $invalid_properties[] = "'processorCores' can't be null";
        }
        if ($this->container['restAPIAvailable'] === null) {
            $invalid_properties[] = "'restAPIAvailable' can't be null";
        }
        return $invalid_properties;
    }
914515
public function getFlattenValidators()
    {
        if (!$this->exists) {
            return [];
        }

        $validators = $this->validators;
        $return     = [];
        if (!empty($validators)) {
            foreach ($validators as $validator) {
                $return[$validator->validator_id] = $validator->value;
            }
        }
        return $return;
    }
101287
public function clear()
    {
        $this->defaults = [];
        $this->types = [];
        $this->requires = [];
        $this->notNullables = [];

        return $this;
    }
1025410
private static function _processValidators()
    {
        foreach ($_SESSION['__KWF']['VALID'] as $validator_name => $valid_data) {
            $validator = new $validator_name;
            if ($validator->validate() === false) {
                $_SESSION = array();
                Zend_Session::regenerateId();
                break;
            }
        }
    }
705401
public function cleanFields($exclude = [])
    {
        $errors = [];

        /** @var $field Field */
        foreach ($this->getMeta()->getConcreteFields() as $field) {
            if (in_array($field->getName(), $exclude)) {
                continue;
            }
            $value = $this->{$field->getAttrName()};
            // Skip validation for empty fields with blank=True. The developer
            // is responsible for making sure they have a valid value.
            if ($field->formBlank && empty($value)) {
                continue;
            }

            try {
                $this->{$field->getAttrName()} = $field->clean($this, $value);
            } catch (ValidationError $error) {
                $errors[$field->getName()] = $error->getErrorList();
            }
        }

        if (!empty($errors)) {
            throw new ValidationError($errors);
        }
    }
448820
public function getValidationRules(Property $property)
    {
        $key = $property->key;
        if (true === $property->canTranslate()) {
            return [
                [$key, ValuesValidator::class, 'skipOnEmpty' => true],
            ];
        } else {
            $rule = Property::dataTypeValidator($property->data_type) ?: 'safe';
            if ($property->allow_multiple_values) {
                return [
                    [$key, 'each', 'rule' => [$rule]],
                ];
            } else {
                return [
                    [$key, $rule],
                ];
            }
        }
    }