Converts $object to make it compatible with eZTemplate API.

@param object $object

@throws \InvalidArgumentException If $object is actually not an object

@return mixed|\eZ\Publish\Core\MVC\Legacy\Templating\LegacyCompatible
422700
public function convert($object)
    {
        if (!\is_object($object)) {
            throw new \InvalidArgumentException('Transferred object must be a real object. Got ' . \gettype($object));
        }

        return $this->getLegacyKernel()->runCallback(
            static function () use ($object) {
                if ($object instanceof Content) {
                    return eZContentObject::fetch($object->getVersionInfo()->getContentInfo()->id);
                } elseif ($object instanceof Location) {
                    return eZContentObjectTreeNode::fetch($object->id);
                } elseif ($object instanceof VersionInfo) {
                    return eZContentObjectVersion::fetchVersion($object->versionNo, $object->getContentInfo()->id);
                }
            },
            false,
            false
        );
    }
47566
public static function objectToString($object): string {
        //TODO do type hinting when possible
        if (!\is_object($object)) {
            throw new InvalidKeyTypeException("key has to be an object, " . \gettype($object) . "given");
        }
        return \serialize($object);
    }
1315867
public function checkIsEntity($object)
    {
        if (!$object instanceof $this->entityName) {
            throw InvalidArgumentException::invalidEntityType(
                $this->getEntityName(),
                $object
            );
        }
    }
1022166
public function transform($object)
    {
        if (null === $object) {
            return '';
        }

        return current(array_values($this->om->getClassMetadata($this->entityName)->getIdentifierValues($object)));
    }
589883
public function equalsTo(Object $object)
    {
        if (!$this->sameTypeAs($object)) {
            throw new NotMatchTypeException($this);
        }

        return $this->getId()->id() === $object->getId()->id();
    }
960968
public static function from($object): self
    {
        if ($object instanceof self) {
            return $object;
        }

        if (\is_object($object)) {
            $object = \get_class($object);
        }

        if (! \is_string($object)) {
            throw new InvalidArgumentException('Cannot create a type from '.\gettype($object));
        }

        return new self($object);
    }
256044
public function unproxifyFilter($object) {
		if($this->hasDoctrineFunctions() && method_exists($this->doctrineFunctions, 'unproxifyFilter')) {
			return $this->doctrineFunctions->unproxifyFilter($object);
		}
		return $object;
	}
1277843
private function transform($object)
    {
        $class = trim(get_class($object), '\\');
        $transformer = array_key_exists($class, $this->transformers)
            ? $this->transformers[$class]
            : false;
        if (! $transformer) {
            return $this->convert($object);
        }

        return is_callable(($cb = $this->transformer($transformer)))
            ? $this->forceArray(call_user_func($cb, $object))
            : $this->convert($object);
    }
1340291
public static function getValue($object, $propertyName)
    {
        $classReflection = new \ReflectionClass(get_class($object));
        if (!$classReflection->hasProperty($propertyName)) {
            throw new \InvalidArgumentException(
                'The class "' . get_class($object) . '" does not have the property "' . $propertyName . '"'
            );
        }
        $propertyReflection = $classReflection->getProperty($propertyName);
        if ($propertyReflection->isPublic()) {
            return $propertyReflection->getValue($object);
        }

        if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
            $propertyReflection->setAccessible(true);
            $value = $propertyReflection->getValue($object);
            $propertyReflection->setAccessible(false);
            return $value;
        }

        throw new \InvalidArgumentException(
            'The property "' . $propertyName . '" of the class "' . get_class($object) . '" is not readable'
        );
    }
797681
public function extract($object)
    {
        if (! $object instanceof ConversionInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid object "%s" provided; must be an instance of "%s".',
                is_object($object) ? get_class($object) : gettype($object),
                ConversionInterface::CLASS
            ));
        }

        return $object->toArray();
    }
511339
protected function hydrateObjectForm($object)
    {
        $data = array(
            "id" => $object->getId(),
            "visible" => (bool) $object->getVisible(),
            "code" => $object->getCode(),
            "title" => $object->getTitle(),
            "type" => $object->getType(),
            "entity" => $object->getEntity(),
            "serialized_columns" => $object->getSerializedColumns(),
            "serialized_condition" => $object->getSerializedCondition(),
            "index_engine_driver_configuration_id" => $object->getIndexEngineDriverConfigurationId(),
        );

        return $this->getUpdateForm($data);
    }
321356
public function getDataTransferObject($object) {
		if ($object === NULL) {
			return NULL;
		}
		$identifier = $this->persistenceManager->getIdentifierByObject($object);
		$dto = $this->propertyMapper->convert($identifier, $this->getDataTransferObjectName($object));
		return $dto;
	}
260183
public function serialize($object)
    {
        if (!$this->canHandle(get_class($object))) {
            throw new \InvalidArgumentException();
        }

        return [ $object->getTimestamp(), $object->getTimezone() ];
    }
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;
    }
602484
protected function doValidateObject($object)
    {
        if ($object === null || (empty($object) && $object !==0 && $object !=='0') )
            throw new \InvalidArgumentException(sprintf(
                'Object can`t be empty, given: (%s).'
                , \Poirot\Std\flatten($object)
            ));
    }
258688
public function normalize($object, $format = null, array $context = []): array
    {
        if (!$object instanceof RelationInterface && !$object instanceof ActionInterface) {
            throw new \InvalidArgumentException(sprintf(
                'The normalizer support only "%s" or "%s" but "%s" given.',
                RelationInterface::class,
                ActionInterface::class,
                is_object($object) ? get_class($object) : gettype($object)
            ));
        }

        $data = [
            'href' => $object->getHref()->getPath(),
        ];

        if ($object->getHref()->isTemplated()) {
            $data['templated'] = true;
        }

        if (count($object->getAttributes())) {
            $data['attributes'] = $object->getAttributes();
        }

        return $data;
    }
921028
public function preparePersistChangeSet($object) : array
    {
        if (! $object instanceof PersistableInterface) {
            throw new InvalidArgumentException(
                sprintf('%s must implement PersistableInterface.', get_class($object))
            );
        }

        return $object->preparePersistChangeSet();
    }