Returns true if the given subject matches the given frame.

@param stdClass $subject the subject to check.
@param stdClass $frame the frame to check.
@param assoc $flags the frame flags.

@return bool true if the subject matches, false if not.
558686
protected function _filterSubject($subject, $frame, $flags) {
    // check @type (object value means 'any' type, fall through to ducktyping)
    if(property_exists($frame, '@type') &&
      !(count($frame->{'@type'}) === 1 && is_object($frame->{'@type'}[0]))) {
      $types = $frame->{'@type'};
      foreach($types as $type) {
        // any matching @type is a match
        if(self::hasValue($subject, '@type', $type)) {
          return true;
        }
      }
      return false;
    }

    // check ducktype
    $wildcard = true;
    $matches_some = false;
    foreach($frame as $k => $v) {
      if(self::_isKeyword($k)) {
        // skip non-@id and non-@type
        if($k !== '@id' && $k !== '@type') {
          continue;
        }
        $wildcard = false;

        // check @id for a specific @id value
        if($k === '@id' && is_string($v)) {
          if(!property_exists($subject, $k) || $subject->{$k} !== $v) {
            return false;
          }
          $matches_some = true;
          continue;
        }
      }

      $wildcard = false;

      if(property_exists($subject, $k)) {
        // $v === [] means do not match if property is present
        if(is_array($v) && count($v) === 0) {
          return false;
        }
        $matches_some = true;
        continue;
      }

      // all properties must match to be a duck unless a @default is specified
      $has_default = (is_array($v) && count($v) === 1 && is_object($v[0]) &&
        property_exists($v[0], '@default'));
      if($flags['requireAll'] && !$has_default) {
        return false;
      }
    }

    // return true if wildcard or subject matches some properties
    return $wildcard || $matches_some;
  }
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;
    }
820118
public function regex($subject, string $pattern) : bool
    {
        if (!$pattern) {
            throw new InvalidArgumentException('Arg pattern is empty.');
        }
        if ($subject === null) {
            return false;
        }
        return !!preg_match($pattern, '' . $subject);
    }
992802
protected function _stopped(Subject $subject)
    {
        if (!isset($subject->success)) {
            $subject->success = false;
        }

        if ($subject->success) {
            return $this->_success($subject);
        }

        $subject->set(['success' => false]);
        $this->setFlash('error', $subject);

        return $this->_redirect($subject, ['action' => 'index']);
    }
853568
protected function _success(Subject $subject, array $user)
    {
        $subject->set(['success' => true, 'user' => $user]);

        $this->_trigger('afterLogin', $subject);
        $this->_controller()->Auth->setUser($subject->user);
        $this->setFlash('success', $subject);

        return $this->_redirect(
            $subject,
            $this->_controller()->Auth->redirectUrl()
        );
    }
759665
function _filterSubject(subject, frame) {
  // check @type (object value means 'any' type, fall through to ducktyping)
  if('@type' in frame &&
    !(frame['@type'].length === 1 && _isObject(frame['@type'][0]))) {
    var types = frame['@type'];
    for(var i = 0; i < types.length; ++i) {
      // any matching @type is a match
      if(jsonld.hasValue(subject, '@type', types[i])) {
        return true;
      }
    }
    return false;
  }

  // check ducktype
  for(var key in frame) {
    // only not a duck if @id or non-keyword isn't in subject
    if((key === '@id' || !_isKeyword(key)) && !(key in subject)) {
      return false;
    }
  }
  return true;
}
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;
	}
737368
public function isValidFor($mixed, $subject = null, ArrayAccess $error = null)
    {
        $valid = true;
        foreach ($this->getValidators() as $validator) {
            if ($validator instanceof ValidatorForSubjectInterface) {
                if (!$validator->isValidFor($mixed, $subject, $error)) {
                    $valid = false;
                }
            } elseif (!$validator->isValid($mixed, $error)) {
                $valid = false;
            }
        }

        return $valid;
    }
951894
public function equals(Frame $frame)
    {
        if (!$this->getFile() || $this->getFile() === 'Unknown' || !$this->getLine()) {
            return false;
        }
        return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine();
    }
32312
public function match(Subject $subject, string $verb): bool
    {
        return $this->subject->getType() == $subject->getType() &&
            $this->subject->getId() === $subject->getId() &&
            ($this->verbs === null || in_array($verb, $this->verbs, true));
    }
91625
function match($subject, &$match) {
            if (count($this->_patterns) == 0) {
                return false;
            }
            if (!preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
                $match = "";
                return false;
            }
            $match = $matches[0];
            for ($i = 1; $i < count($matches); $i++) {
                if ($matches[$i]) {
                    return $this->_labels[$i - 1];
                }
            }
            return true;
        }
462194
public function isSatisfiedBy($subject)
    {
        return $this->spec1->isSatisfiedBy($subject)
            && $this->spec2->isSatisfiedBy($subject);
    }
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;
    }
1077325
protected function _validate($subject)
    {
        $errors = $this->_getValidationErrors($subject);

        if (!$this->_countIterable($errors)) {
            return;
        }

        throw $this->_throwValidationFailedException($this->__('Validation failed'), null, null, true, $subject, $errors);
    }
116123
public function match($subject, $seed = '')
	{
		if (!empty($seed))
		{
			$this->addSeed($seed);
		}

		return preg_match($this->compile(), $subject);
	}
522012
protected function isSubjectSupported($subject)
    {
        if (null === $subject || \is_string($subject) || $subject instanceof FieldVote || \is_object($subject)) {
            return true;
        }

        return \is_array($subject)
            && isset($subject[0], $subject[1])

            && (\is_string($subject[0]) || \is_object($subject[0]))
            && \is_string($subject[1]);
    }
985103
public function getMatches($subject)
    {
        preg_match('/'.$this->pattern.'/',$subject,$matches);
        return count($matches) ? $matches : false;
    }