Build the wrapper corresponding to the object's type.

@param mixed $object

@throws \Analogue\ORM\Exceptions\MappingException

@return ObjectWrapper
325766
public function make($object)
    {
        $manager = Manager::getInstance();

        // Instantiate hydrator
        // TODO: We'll need to optimize this and allow pre-generation
        //       of these hydrators, and get it, ideally, from the entityMap or
        //       the Mapper class, so it's only instantiated once
        $config = new Configuration(get_class($object));

        $hydratorClass = $config->createFactory()->getHydratorClass();
        $hydrator = new $hydratorClass();

        if ($manager->isValueObject($object)) {
            $entityMap = $manager->getValueMap($object);
        } else {
            $entityMap = $manager->mapper($object)->getEntityMap();
        }

        // Build Wrapper
        return new ObjectWrapper($object, $entityMap, $hydrator);
    }
535942
public function offsetGet($object)
    {
        if (!$object instanceof AnObjectHandlable) {
            throw new InvalidArgumentException('Object needs to implement AnObjectHandlable');
        }

        return $this->_object_set->offsetGet($object->getHandle());
    }
183621
protected function instantiateRowWrapperObject($row)
    {
        if ($this->row_wrapper_class === null) {
            $object = $row;
        } else {
            $object = new $this->row_wrapper_class(
                $row,
                $this->getOption('read_only')
            );
        }

        return $object;
    }
1254601
public static function makeFromObject( $object )
    {
        // inistante object without going via constructer to allow us to
        $refl = new \ReflectionClass( __CLASS__ );
        $obj = $refl->newInstanceWithoutConstructor();
        $obj->isValid = true;
        $obj->decoded = $object;
        return $obj;
    }
688127
private function normalizeObject($object) : Expr\FuncCall
    {
        if ($object instanceof InjectorInterface) {
            return new Expr\FuncCall(new Expr\Variable('injector'));
        }
        $serialize = new Scalar\String_(\serialize($object));

        return new Expr\FuncCall(new Node\Name('unserialize'), [new Arg($serialize)]);
    }
240817
private function getPayload($object)
    {
        $fqcn = get_class($object);

        foreach ($this->customSerializers as $customSerializer) {
            if ($customSerializer->canHandle($fqcn)) {
                return $customSerializer->serialize($object);
            }
        }

        return $this->hydratorFactory->getHydrator($fqcn)->extract($object);
    }
231226
public function serialize($object)
    {
        $pageNumber = $object->getPageNumber();
        if ($object instanceof ArticlePageDocument) {
            // resolve proxy to ensure that this will also be serialized
            $object = $object->getParent();

            $object->getTitle();
        }

        $result = $this->serializer->serialize(
            $object,
            'json',
            SerializationContext::create()
                ->setSerializeNull(true)
                ->setGroups(['preview'])
        );

        return json_encode(['pageNumber' => $pageNumber, 'object' => $result]);
    }
444824
public function withInitialValuesFrom($object) : FormWithBinding
    {
        $form = $this->binding->getForm($object);

        return new self(
            $form->getSections(),
            $form->getProcessors(),
            $this->binding->getObjectType(),
            $this->binding->getFieldBindings()
        );
    }
892794
protected function encodeObject($object)
	{
		foreach ($this->objectEncoders as $className => $callback)
		{
			if ($object instanceof $className)
			{
				return $callback($object);
			}
		}

		throw new RuntimeException('Cannot encode instance of ' . get_class($object));
	}
339279
public function extend($object=null) {
    $args = self::_wrapArgs(func_get_args(), 1);
    
    $num_args = func_num_args();
    if($num_args === 1) return $object;
    
    $is_object = is_object($object);
    $array = (array) $object;
    $__ = new self;
    $extensions = $__->rest(func_get_args());
    foreach($extensions as $extension) {
      $extension = (array) $extension;
      $array = array_merge($array, $extension);
    }
    return self::_wrap(($is_object) ? (object) $array : $array);
  }
508560
public function prePersist($object)
    {
        /* @var $object MetaTagContent */
        $path = $this->getForm()->get('path')->getData();
        if (strpos('/', $path) !== false) {
            $path = '/'.$path;
        }
        try {
            $key = $this->keyGenerator->generateMetaTagKeyFromRelativePath($path, $this->getRouter(), $this->translator->getLocale());
            $object->setKeyword($key);
        } catch (\Exception $e) {
        }
    }
1199709
public function formatter($object)
    {
        $interfaces = class_implements($object);

        foreach ($interfaces as $interface) {
            $class = $this->getClassName($interface);

            if (isset($this->formatters[$class])) {
                return $this->formatters[$class];
            }
        }

        $class = $this->getClassName(get_class($object));

        return $this->formatters[$class];
    }
922030
protected function objectToArray($object)
    {
        $class = get_class($object);
        $info = new \ReflectionClass($object);

        $this->commentMap[$class] = [];

        $methods = [];
        foreach ($info->getMethods() as $method) {
            if (!$method->isPublic()) {
                continue; // Only public
            }
            if ($method->class != $class) {
                continue; // Only locals
            }
            $name = $method->getName();
            if (in_array($name, $this->blockMethods)) {
                continue; // Blocked methods
            }
            if (preg_match('/^on[A-Z]{1}[\w+]*$/', $name)) {
                continue; // AJAX methods
            }
            if (preg_match('/^get[A-Z]{1}[\w+]*Options$/', $name)) {
                continue; // getSomethingOptions
            }
            if (substr($name, 0, 1) == '_') {
                continue; // Magic/hidden method
            }
            $name .= '()';
            $methods[$name] = '___METHOD___|'.$name;
            $this->commentMap[$name] = $this->evalDocBlock($method);
        }

        $vars = [];
        foreach ($info->getProperties() as $property) {
            if ($property->isStatic()) {
                continue; // Only non-static
            }
            if (!$property->isPublic()) {
                continue; // Only public
            }
            if ($property->class != $class) {
                continue; // Only locals
            }
            $name = $property->getName();
            $vars[$name] = $object->{$name};
            $this->commentMap[$name] = $this->evalDocBlock($property);
        }

        return $methods + $vars;
    }
436355
public function prePersist($object)
    {
        /** @var ContentInterface $contentObject */
        if ($contentObject = $object->getContent()) {
            try {
                $this->getModelManager()->create($contentObject);
                $object->setObjectId($contentObject->getId());
                $this->autoPageDraft($object->getPage());
            } catch (ModelManagerException $e) {
                throw new ModelManagerException($this->trans('Cannot create content, object is invalid', [], 'validators'));
            }
        }
    }
986558
protected function normalize($object)
    {
        // If its a paginator instance, create a collection with its items.
        if ($object instanceof Paginator) {
            return collect($object->items());
        } elseif (is_array($object)) {
            // If its an array, package it in a collection.
            return collect($object);
        }

        return $object;
    }
978364
protected function recordObjectContent($object)
	{
		foreach ($object as $k => $v)
		{
			if ($this->canDeduplicate($v) && !$this->shouldPreserve($v))
			{
				$object[$k] = $this->recordObject($v);
			}
		}

		return $object;
	}
725587
private function initializeFromHardcodedObject($object)
    {
        //Typecast arrays to objects
        if (is_array($object)) $object = (object)$object;

        if (!empty($object->path)) {
            $this->path = $object->path;
        }

        if (!empty($object->name)) {
            $this->name = $object->name;
        }

        if (!empty($object->class)) {
            $this->class = $object->class;
        }

        if (!empty($object->priority)) {
            $this->priority = $object->priority;
        }

        if (!empty($object->pattern)) {
            if ($object->pattern instanceof Pattern)
            {
                $this->patternString = $object->pattern->getPatternString();
                $this->pattern = $object->pattern;
            }
            else
            {
                $this->patternString = $object->pattern;
                $this->pattern = new Pattern($this->path, $this->patternString);
            }
        }

        if (!empty($object->parameters)) {
            if (is_array($object->parameters)) {
                $this->parameters = (object)$object->parameters;
            } else {
                $this->parameters = $object->parameters;
            }
        }
    }