Retrieve the required role for the current request (if any).

@param mixed $object The object passed to the voter.

@return string|null
551794
private function getRequiredRole($object)
    {
        if (!(($request = $object) instanceof Request)) {
            $request = $this->requestStack->getCurrentRequest();
        }

        $routes = $this->getRouteRoles();

        if (isset($routes[$request->get('_route')])) {
            return $routes[$request->get('_route')];
        }

        return null;
    }
233226
protected function getProperty($object, $key)
    {
        if (isset($object->{$key}) &&
            (
                (is_int($object->{$key}) && $object->{$key} != 0) ||
                (is_string($object->{$key}) && $object->{$key} != '')
            )
        ) {
            return $object->{$key};
        }

        return null;
    }
246559
public function getObjectAcl($bucket, $object)
    {
        $options = array();
        $this->precheckCommon($bucket, $object, $options, true);
        $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_OBJECT] = $object;
        $options[self::OSS_SUB_RESOURCE] = 'acl';
        $response = $this->auth($options);
        $result = new AclResult($response);
        return $result->getData();
    }
1088821
public function get_edit_link( $object ) {
		return $this->field->options( 'query_users' )
			? get_edit_user_link( $object->ID )
			: get_edit_post_link( $object );
	}
274252
public static function getFromObject($object, string $key)
    {
        if ($object == null) {
            return null;
        }
        if (!isset ($object->{$key})) {
            return null;
        }
        return $object->{$key};
    }
45939
public function getIdValue($object)
    {
        if (!$object) {
            return;
        }

        if (!$this->om->contains($object)) {
            throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', \get_class($object)));
        }

        $this->om->initializeObject($object);

        $idValue = current($this->classMetadata->getIdentifierValues($object));

        if ($this->associationIdReader) {
            $idValue = $this->associationIdReader->getIdValue($idValue);
        }

        return $idValue;
    }
245882
private function isGranted($role, $object = null): bool
    {
        if (null === $this->securityChecker) {
            return false;
        }

        try {
            return $this->securityChecker->isGranted($role, $object);
        } catch (AuthenticationCredentialsNotFoundException $e) {
            return false;
        }
    }
1026854
public static function object2array($object)
    {
        $result = null;
        if (is_object($object)) {
            $objectData = get_object_vars($object);
            if (is_array($objectData) && count($objectData)) {
                $result = array_map('self::object2array', $objectData);
            }
        } else {
            if (is_array($object)) {
                foreach ($object as $item => $value) {
                    $result[$item] = self::object2array($value);
                }
            } else {
                $result = $object;
            }
        }

        return $result;
    }
242552
public function extract($object)
    {
        if (!$object instanceof SecretQuestion) {
            throw new \Exception('$object must be an instance of SecretQuestion');
        }
        /* @var $object SecretQuestion */
        $data = parent::extract($object);

        return $data;
    }
1070678
protected function getValue($object, $property)
    {
        if (isset($object->{$property})) {
            return $object->{$property};
        }

        $reflectionClass = new ReflectionClass($object);

        if (!$reflectionClass->hasProperty($property)) {
            return null;
        }

        $reflectionProperty = $reflectionClass->getProperty($property);
        $reflectionProperty->setAccessible(true);

        return $reflectionProperty->getValue($object);
    }
221516
private function getClass($object): string
    {
        if (interface_exists('Doctrine\Common\Persistence\Proxy') && $object instanceof Proxy) {
            if (!$object->__isInitialized()) {
                $object->__load();
            }

            $reflectionParentClass = (new \ReflectionObject($object))->getParentClass();
            if ($reflectionParentClass instanceof \ReflectionClass) {
                return $reflectionParentClass->getName();
            }
        }

        return get_class($object);
    }
622740
public static function getMeta($object): Contracts\QueryEntity
    {
        if ($object instanceof Contracts\QueryEntityAware) {
            return $object->getQueryEntity();
        }
        if ($object instanceof Contracts\QueryEntity) {
            return $object;
        }
        $class = get_class($object);

        throw new RuntimeException("Object {$class} not have meta.");
    }
1472
public function get($object)
    {
        $hash = spl_object_hash($object);

        if (isset($this->data[$hash])) {
            return $this->data[$hash];
        }

        return null;
    }
927234
protected function getIdentifierFromObject($object)
    {
        $class = get_class($object);
        $meta = $this->entityMetadataFactory->getMetadataFor($class);
        $values = $meta->getIdentifierValues($object);

        $values = array_map(
            function ($value) {
                if (is_object($value)) {
                    return $this->getIdentifierFromObject($value);
                }

                return $value;
            },
            $values
        );

        return $values;
    }
580997
public static function getObjectClass($object)
    {
        if(is_object($object))
        {
            if($object instanceof IBean)
            {
                return get_parent_class($object);
            }
            else
            {
                return get_class($object);
            }
        }
        else
        {
            return (string)$object;
        }
    }
1363054
public static function getFirstId($object)
    {
        $tableAnnotation = static::getAnnotation($object, Table::class);
        if(null !== $tableAnnotation)
        {
            if(is_array($tableAnnotation->id))
            {
                return reset($tableAnnotation->id);
            }
            else
            {
                return $tableAnnotation->id;
            }
        }
        else
        {
            return null;
        }
    }
507732
public function isGrantedAffirmative($role, $object = null, $field = null)
    {
        if (null === $this->securityChecker) {
            return false;
        }

        if (null !== $field) {
            $object = new FieldVote($object, $field);
        }

        if (!\is_array($role)) {
            $role = [$role];
        }

        foreach ($role as $oneRole) {
            try {
                if ($this->securityChecker->isGranted($oneRole, $object)) {
                    return true;
                }
            } catch (AuthenticationCredentialsNotFoundException $e) {
                // empty on purpose
            }
        }

        return false;
    }