Validates subject against oneOf

@param $subject
@return bool
354474
public function validate($subject): bool
    {
        $validatedCount = 0;
        foreach ($this->schema['oneOf'] as $schema) {
            $nodeValidator = new NodeValidator($schema, $this->rootSchema);
            if ($nodeValidator->validate($subject)) {
                $validatedCount++;
            }
        }
        return $validatedCount === 1;
    }
824442
protected function & match ($pattern, & $subject) {
		// add UTF-8 modifier to pattern if subject string contains higher chars than ASCII
		if (preg_match('#[^\x20-\x7f]#', $subject)) {
			$lastHashPos = mb_strrpos($pattern, '#');
			if (mb_strpos($pattern, 'u', $lastHashPos + 1) === FALSE)
				$pattern .= 'u';
		}
		preg_match_all($pattern, $subject, $matchedValues);
		return $matchedValues;
	}
993791
private function validateAdditionalItems(array $subject, array $schema): bool
    {
        $subject = \array_slice($subject, count($schema['items']));

        if (\is_bool($schema['additionalItems'])) {
            return $this->validateAdditionalItemsSchemaBoolean($subject, $schema);
        }
        if (\is_int(\array_keys($schema['additionalItems'])[0])) {
            return $this->validateAdditionalItemsSchemaArray($subject, $schema);
        }
        return $this->validateAdditionalItemsSchemaObject($subject, $schema);
    }
775185
public function validate($subject): bool
    {
        // Validation with "additionalProperties" applies only to the child values of instance names that do
        // not match any names in "properties", and do not match any regular expression in "patternProperties".
        $subject = $this->removePropertiesFromSubject($subject, $this->schema);
        $subject = $this->removePatternPropertiesFromSubject($subject, $this->schema);
        // The value of "additionalProperties" MUST be a valid JSON Schema (including boolean false)
        if (\is_bool($this->schema['additionalProperties']) && $this->schema['additionalProperties'] === false) {
            if (count($subject) > 0) {
                return false;
            }
        } elseif (\is_array($this->schema['additionalProperties'])) {
            foreach ($subject as $propertyValue) {
                $nodeValidator = new NodeValidator($this->schema['additionalProperties'], $this->rootSchema);
                if (!$nodeValidator->validate($propertyValue)) {
                    return false;
                }
            }
        }
        return true;
    }
910784
public function contains($subject)
    {
        if (isset($this->found[$subject])) {
            return true;
        }
        foreach ($this->serializers as $i => $serializer) {
            if ( ! $serializer->accepts($subject)) {
                continue;
            }
            $this->found[$subject] = $i;
            return true;
        }
        return false;
    }
337320
public function setSubject($subject)
    {
        if ($subject === '') {
            throw new \InvalidArgumentException('$subject must not be empty.', 1331488802);
        }

        if ((strpos($subject, CR) !== false) || (strpos($subject, LF) !== false)) {
            throw new \InvalidArgumentException(
                '$subject must not contain any line breaks or carriage returns.',
                1331488817
            );
        }

        $this->setAsString('subject', $subject);
    }
859856
private function matches($pattern, $subject)
    {
        if (preg_match($pattern, $subject, $matches)) {
            $args = array();

            foreach ($matches as $key => $value) {
                if (!is_int($key)) {
                    $args[$key] = $value;
                }
            }

            return $args;
        }

        return false;
    }
165807
public function validate($subject): bool
    {
        // This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST
        // be an array or a valid JSON Schema.
        if (\is_array($this->schema['dependencies']) && count($this->schema['dependencies']) > 0) {
            foreach ($this->schema['dependencies'] as $propertyName => $dependentProperties) {
                // If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST
                // be unique. If the dependency key is a property in the instance, each of the items in the
                // dependency value must be a property that exists in the instance.
                if (\is_int(\array_keys($dependentProperties)[0])) {
                    if (!$this->validateClassicDependencies($subject, $propertyName, $dependentProperties)) {
                        return false;
                    }
                    // If the dependency value is a subschema, and the dependency key is a property in the instance,
                    // the entire instance must validate against the dependency value.
                } elseif (\is_string(\array_keys($dependentProperties)[0])) {
                    if (!$this->validateSchemaDependencies($subject, $propertyName, $dependentProperties)) {
                        return false;
                    }
                }

            }
        }
        return true;
    }
455518
public function validate($subject): bool
    {
        if (\is_int($this->schema['minProperties']) && $this->schema['minProperties'] >= 0) {
            if (\count($subject) < $this->schema['minProperties']) {
                return false;
            }
        }
        return true;
    }
856649
public function plainText($subject) : bool
    {
        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        return $v === '' ? true : !strcmp($v, strip_tags($v));
    }
809217
private function getMessage($subject)
    {
        if (method_exists($subject, 'getMessage')) {
            $message = $subject->getMessage();
        } else {
            $message = $this->useReflectionToGetMessage($subject);
        }

        return $message;
    }
35685
public function validate($subject): bool
    {
        if (\is_string($this->schema['pattern'])) {
            if (!\preg_match(sprintf('/%s/i', $this->schema['pattern']), $subject)) {
                return false;
            }
        }
        return true;
    }
674960
private function useReflectionToGetMessage($subject)
    {
        $reflection = new \ReflectionClass($subject);
        $property   = $reflection->getProperty('_message');
        $property->setAccessible(true);
        $message = $property->getValue($subject);

        return $message;
    }
1175869
public function subject($subject)
    {
        $name = Config::get('name');
        $subject = '[' . $name . '] ' . $subject;
        /**
         * strange subject encode error
         * occurred when there's both chinese and english
         * solution see: https://github.com/swiftmailer/swiftmailer/issues/665
         */
        $subject = '=?utf-8?B?'.base64_encode($subject).'?=';
        $this->message->setSubject($subject);
        return $this;
    }
871993
public static function getSubjectIdentity($subject)
    {
        if ($subject instanceof SubjectIdentityInterface) {
            return $subject;
        }

        if (\is_string($subject)) {
            return SubjectIdentity::fromClassname($subject);
        }

        if (\is_object($subject)) {
            return SubjectIdentity::fromObject($subject);
        }

        throw new UnexpectedTypeException($subject, SubjectIdentityInterface::class.'|object|string');
    }
179200
protected function _stopped(Subject $subject)
    {
        $subject->set(['success' => false]);
        $this->setFlash('error', $subject);

        return $this->_redirect($subject, ['action' => 'index']);
    }
198647
public function validate($subject): bool
    {
        if (isset($this->schema['items']) && \is_array($this->schema['items'])) {
            $schemaFirstKey = \array_keys($this->schema['items'])[0];
            $schemaType = \is_int($schemaFirstKey) ? 'array' : 'object';

            if ($schemaType === 'array') {
                if (!$this->validateAdditionalItems($subject, $this->schema)) {
                    return false;
                }
            }
        }
        return true;
    }