Returns a "200 Ok" response, containing a document in the body with the resource.
@param mixed $object
323566
public function ok(ResourceDocumentInterface $document, $object, array $additionalMeta = []): ResponseInterface
    {
        return $this->getResourceResponse($document, $object, 200, $additionalMeta);
    }
562434
protected function normalizeResponse(array $object, $path = null)
    {
        $result = ['path' => $path ?: $this->removePathPrefix(isset($object['Key']) ? $object['Key'] : $object['Prefix'])];
        $result['dirname'] = Util::dirname($result['path']);

        if (isset($object['LastModified'])) {
            $result['timestamp'] = strtotime($object['LastModified']);
        }

        if (substr($result['path'], -1) === '/') {
            $result['type'] = 'dir';
            $result['path'] = rtrim($result['path'], '/');

            return $result;
        }
        
        $result = array_merge($result, Util::map($object, static::$resultMap), ['type' => 'file']);

        return $result;
    }
1136567
public function canHandle($object)
    {
        if ((is_string($object)) || ($object instanceof Media && $object->getContentType() == self::CONTENT_TYPE)) {
            return true;
        }

        return false;
    }
103179
protected function getResponse( $key, $object )
    {
        $result = array(
            'jsonrpc'   => '2.0',
            $key        => $object,
        );

        if ( null !== $this->id )
        {
            $result['id'] = $this->id;
        }

        $this->response
             ->setContent( json_encode( $result ) );

        return $this->response;
    }
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.");
    }
557061
public function fill($object)
    {
        if ($this->screenIsComment()) {
            $this->model->setContext('comment');

            return parent::prepare($object->comment_ID);
        }

        return parent::prepare($object->ID);
    }
646212
public function getValue($object = null)
    {
        if (!is_object($object)) {
            throw new Exception('$object is of type ' . gettype($object) . ', instance of class ' . $this->class . ' expected.', 1210859212);
        }
        if ($this->isPublic()) {
            return parent::getValue($object);
        }

        parent::setAccessible(true);
        return parent::getValue($object);
    }
38802
public function extract($object)
    {
        $pdfConverterHydrator = new PdfConverterHydrator();

        return [
            'responseStatus' => $object->getResponseStatus(),
            'sourceContainer' => $pdfConverterHydrator->extract($object->getSourceContainer()),
            'url' => $object->getUrl(),
        ];
    }
1113762
public function save($object)
    {

        if (is_array($object)) {
            $objectData = $object;
            $newPassword = "";
            if (isset($object['id']) && $object['id'] > 0) {
                $object = $this->find($object['id']);
            } else {
                $object = new User();
            }
            if (isset($objectData['password'])) {
                $newPassword = $objectData['password'];
            }
            if (isset($objectData['enabled']) && $objectData['enabled']) {
                $object->enable();
            } else {
                $object->disable();
            }
            unset($objectData['enabled']);
            if (isset($objectData['groups'])) {
                $groups = $objectData['groups'];
                $groups = array_unique($groups);
                $object->setGroups(array());
                foreach ($groups as $groupId) {
                    $group = $this->groupManager->find($groupId);
                    $object->addGroup($group);
                }
                unset($objectData['groups']);
            }
            $this->assignArrayToObject($object, $objectData);
        } else if (!($object instanceof UserInterface)) {
            $this->addErrorMessage(self::ERROR_WRONG_OBJECT);
        }

        if (!$this->hasError()) {
            if (!empty($newPassword)) {
                $check = $this->userManager->changeUserPassword($object, $newPassword);
                if ($check !== true) {
                    foreach ($check as $pwError) {
                        $this->addErrorMessage($pwError);
                    }
                    $check = false;
                }
            } else {
                $check = $this->userManager->updateUser($object);
            }
            if ($check === true) {
                $this->addSuccessMessage(self::SUCCESS_SAVED);
            }
        }

        return $object;
    }
305708
public function index($object)
    {
        // create property accessor
        $accessor = PropertyAccess::createPropertyAccessor();

        // delete existing documents with same id
        foreach ($this->index->find('id:' . $accessor->getValue($object, 'id')) as $hit) {
            $this->index->delete($hit->id);
        }

        // create new Lucene document
        $doc = new Document();

        // add primary key to identify it in the search results
        $doc->addField(Field::keyword('id', $accessor->getValue($object, 'id')));

        // add entity class reference to identify it in the search results
        $doc->addField(Field::unIndexed('entityClass', get_class($object)));

        // analyze each property's annotations to see which ones must be add to the document
        $reflClass = new ReflectionClass($object);
        foreach ($reflClass->getProperties() as $property) {
            $reflProperty = new \ReflectionProperty($object, $property->name);
            $annotation = $this->reader->getPropertyAnnotation($reflProperty, '\Keratine\Lucene\Mapping\Annotation\DocumentField');
            if ($annotation) {
                $value = $accessor->getValue($object, $property->name);
                $value = $this->ensureString($value);
                // use the appropriate indexing strategy for the field
                switch ($annotation->type) {
                    case 'keyword':
                        $doc->addField(Field::keyword($property->name, $value, 'UTF-8'));
                        break;
                    case 'unIndexed':
                        $doc->addField(Field::unIndexed($property->name, $value, 'UTF-8'));
                        break;
                    case 'binary':
                        $doc->addField(Field::binary($property->name, $value));
                        break;
                    case 'text':
                        $doc->addField(Field::text($property->name, $value, 'UTF-8'));
                        break;
                    case 'unStored':
                    default:
                        $doc->addField(Field::unStored($property->name, $value, 'UTF-8'));
                        break;
                }
            }
        }

        // add the document to the index and commit it
        $this->index->addDocument($doc);
        $this->index->commit();
    }
951472
private function serializeObject($object)
    {
        $payload = $this->getPayload($object);

        $curatedPayload = [];
        foreach ($payload as $key => $value) {
            $curatedPayload[$key] = $this->innerSerialize($value);
        }

        return $this->dataFormatter->format($this->classMapper->extractName(get_class($object)), $curatedPayload);
    }
653590
public function getMetadataForObject($object)
    {
        if (!$object instanceof StructureBehavior) {
            return;
        }

        $documentMetadata = $this->metadataFactory->getMetadataForClass(get_class($object));
        $structure = $this->structureFactory->getStructureMetadata(
            $documentMetadata->getAlias(),
            $object->getStructureType()
        );

        return $this->getMetadata($documentMetadata, $structure);
    }
1131626
public function query($object) {
		$conditions = (array) $this->constraints();

		foreach ($this->key() as $from => $to) {
			if (!isset($object->{$from})) {
				return null;
			}
			$conditions[$to] = $object->{$from};

			if (is_object($conditions[$to]) && $conditions[$to] instanceof Countable) {
				$conditions[$to] = iterator_to_array($conditions[$to]);
			}
		}
		$fields = $this->fields();
		$fields = $fields === true ? null : $fields;
		return compact('conditions', 'fields');
	}
2590
protected function handleFiles($object)
    {
        $request = $this->getRequest();

        $rc = new \ReflectionClass($object);
        $className = $rc->getShortName();

        $repo = $this->manager->getRepository('LibrinfoMediaBundle:File');

        if ($remove = $request->get('remove_files')) {
            foreach ($remove as $key => $id) {
                $file = $repo->find($id);

                if ($file) {
                    if (method_exists($object, 'removeLibrinfoFile')) {
                        $object->removeLibrinfoFile($file);
                        $this->manager->remove($file);
                    } elseif (method_exists($object, 'setLibrinfoFile')) {
                        $object->setLibrinfoFile();
                        $this->manager->remove($file);
                    } else {
                        throw new \Exception('You must define ' . $className . '::removeLibrinfoFile() method or ' . $className . '::setFile() in case of a one to one');
                    }
                }
            }
        }

        if ($ids = $request->get('add_files')) {
            foreach ($ids as $key => $id) {
                $file = $repo->find($id);

                if ($file) {
                    if (method_exists($object, 'addLibrinfoFile')) {
                        $object->addLibrinfoFile($file);
                        $file->setOwned(true);
                    } elseif (method_exists($object, 'setLibrinfoFile')) {
                        $object->setLibrinfoFile($file);
                        $file->setOwned(true);
                    } else {
                        throw new \Exception('You must define ' . $className . '::addLibrinfoFile() method or ' . $className . '::setLibrinfoFile() in case of a one to one');
                    }
                }
            }
        }
    }
695793
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException('Resource has to be an object, "' . gettype($object) . '" given.');
        }

        if (! property_exists($object, 'type')) {
            throw new ValidationException('A resource object MUST contain a type');
        }

        if (! property_exists($object, 'id')) {
            throw new ValidationException('A resource object MUST contain an id');
        }

        if (is_object($object->type) or is_array($object->type)) {
            throw new ValidationException('Resource type cannot be an array or object');
        }

        if (is_object($object->id) or is_array($object->id)) {
            throw new ValidationException('Resource Id cannot be an array or object');
        }

        $this->set('type', strval($object->type));
        $this->set('id', strval($object->id));

        if (property_exists($object, 'meta')) {
            $this->set('meta', $this->create('Meta', $object->meta));
        }
    }
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();
    }
364253
public function assertResponseObject($object)
    {
        $responseObject = $this->getResponseObject();

        Assertion::assertTrue(
            $responseObject instanceof $object,
            "Expect body object to be an instance of '$object' but got a '" . get_class($responseObject) . "'"
        );
    }