@param mixed $subject

@return bool
778517
protected function supportSubject($subject)
    {
        if (is_object($subject)) {
            return $this->supportClasses(
                $subject,
                array(
                    'OpenOrchestra\ModelInterface\Model\SiteInterface',
                    'OpenOrchestra\ModelInterface\Model\RedirectionInterface',
                    'OpenOrchestra\LogBundle\Model\LogInterface',
                    'OpenOrchestra\UserBundle\Model\UserInterface',
                    'OpenOrchestra\Backoffice\Model\GroupInterface',
                    'OpenOrchestra\ModelInterface\Model\BlockInterface',
                )
            );
        }

        return in_array(
            $subject,
            array(
                SiteInterface::ENTITY_TYPE,
                RedirectionInterface::ENTITY_TYPE,
                LogInterface::ENTITY_TYPE,
                UserInterface::ENTITY_TYPE,
                GroupInterface::ENTITY_TYPE,
                BlockInterface::ENTITY_TYPE,
            )
        );
    }
949000
protected function isInPerimeter($subject, UserInterface $user)
    {
        return $this->isSubjectInPerimeter($subject->getContentType(), $user, ContentTypeInterface::ENTITY_TYPE);
    }
1291106
public function authenticate(array $subject)
    {
        $caller = $this->identifier->identify($subject);

        return $this->authenticator->authenticate($subject, $caller);
    }
409673
public function mapperFor($subject)
    {
        $class = $this->initialize($subject);

        if(!isset($this->_mappers[$class]))
            throw new Exception("No mapper registered for $class");

        return $this->_mappers[$class];
    }
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);
    }
500405
public function match($pattern, $subject)
    {
        if (! $this->validate($pattern)) {
            return false;
        }
        
        return $this->getInstance()->match($pattern, $subject);
    }
985103
public function getMatches($subject)
    {
        preg_match('/'.$this->pattern.'/',$subject,$matches);
        return count($matches) ? $matches : false;
    }
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));
    }
933289
protected function isMetadataMethod(string &$subject, int $key, string $pattern)
    {
        unset($key);
        if (!preg_match($pattern, $subject)) {
            $subject = false;
        }

        return;
    }
4259
public function getAssignmentForSubject(Subject $subject)
    {
        return $this->assignmentStorage->getAssignment($subject->getSubjectId(), $subject->getSubjectName());
    }
512000
protected function _save(Subject $subject)
    {
        $entity = $this->_table()->patchEntity(
            $subject->entity,
            $this->_request()->data,
            $this->saveOptions()
        );
        $subject->set(['entity' => $entity]);

        $this->_trigger('beforeSave', $subject);

        $success = call_user_func(
            [$this->_table(), $this->saveMethod()],
            $entity,
            $this->saveOptions()
        );

        $this->_trigger('afterSave', $subject);

        return $success;
    }
623837
public function validate($subject): bool
    {
        $propertyNames = \array_keys($subject);
        foreach ($propertyNames as $propertyName) {
            $nodeValidator = new NodeValidator($this->schema['propertyNames'], $this->rootSchema);
            if (!$nodeValidator->validate($propertyName)) {
                return false;
            }
        }
        return true;
    }
1025480
private function validateFormatUri(string $subject): bool
    {
        return \filter_var($subject, \FILTER_VALIDATE_URL, \FILTER_FLAG_SCHEME_REQUIRED | \FILTER_FLAG_HOST_REQUIRED)
            !== false;
    }
615033
public function validate($subject): bool
    {
        switch ($this->schema['format']) {
            case 'date-time':
                $validator = new FormatDateTimeValidator($this->schema, $this->rootSchema);
                return $validator->validate($subject);
            case 'email':
                return $this->validateFormatEmail($subject);
            case 'hostname':
                return $this->validateFormatHost($subject);
            case 'ipv4':
                return $this->validateFormatIPv4($subject);
            case 'ipv6':
                return $this->validateFormatIPv6($subject);
            case 'uri':
                return $this->validateFormatUri($subject);
        }
        return true;
    }
626716
public function dateISO8601Local($subject) : bool
    {
        // Ugly method name because \DateTime uses strict acronym camelCasing.

        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        return strlen($v) == 10 && !!preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $v);
    }
678188
public function empty($subject) : bool
    {
        if (!$subject) {
            // Stringed zero - '0' - is not empty.
            return $subject !== '0';
        }
        if (is_object($subject)) {
            if ($subject instanceof \Countable) {
                return !count($subject);
            }
            if ($subject instanceof \Traversable) {
                // No need to check/use ArrayObject|ArrayIterator, because
                // those are both Countable (checked before this check).

                // Have to iterate; horrible.
                foreach ($subject as $ignore) {
                    return false;
                }
                return true;
            }
            if ($subject instanceof \ArrayAccess) {
                return false;
            }
            return !get_object_vars($subject);
        }
        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;
    }