Normalize Openstack "StorageObject" object into an array

@param StorageObject $object
@return array
421066
protected function normalizeObject(StorageObject $object)
    {
        $name = $this->removePathPrefix($object->name);
        $mimetype = explode('; ', $object->contentType);

        if ($object->lastModified instanceof \DateTimeInterface) {
            $timestamp = $object->lastModified->getTimestamp();
        } else {
            $timestamp = strtotime($object->lastModified);
        }

        return [
            'type'      => 'file',
            'dirname'   => Util::dirname($name),
            'path'      => $name,
            'timestamp' => $timestamp,
            'mimetype'  => reset($mimetype),
            'size'      => $object->contentLength,
        ];
    }
1037621
public static function keys($object)
    {
        if ($object instanceof \stdClass)
            $object = (array)$object;

        if (is_array($object))
            return array_keys($object);

        $result = [];
        static::each($object, function ($item, $key) use (& $result) {
            $result[] = $key;
        });

        return $result;
    }
661192
public static function convertSumupObjectToArray($object)
    {
        $results = [];
        foreach ($object->_keys as $property) {
            $v = $object->{$property};
            if ($v instanceof SumupObject) {
                $results[$property] = $v->__toArray();
            } elseif (is_array($v)) {
                $results[$property] = self::convertSumupObjectToArray($v);
            } else {
                $results[$property] = $v;
            }
        }
        return $results;
    }
1285087
public static function serialize($object) : array
    {
        $serializer = new static();
        $data = $serializer->serializeObject($object);

        if (sizeof($serializer->referencesUsed)) {
            foreach ($serializer->referencesUsed as $index) {
                $data['@references'][$index] = $serializer->references[$index];
            }
        }

        return $data;
    }
1237806
protected function normalizeRawCollection($object, $format = null, array $context = []): array
    {
        $data = [];
        foreach ($object as $index => $obj) {
            $data[$index] = $this->normalizer->normalize($obj, $format, $context);
        }

        return $data;
    }
879337
protected function normalizeAsArray($objects) : array
    {
        $key = $this->relation;

        if (!is_array($objects) && !$objects instanceof Collection) {
            throw new MappingException("column '$key' should be of type array or collection");
        }

        if ($objects instanceof Collection) {
            $objects = $objects->all();
        }

        $normalizedObjects = [];

        foreach ($objects as $object) {
            $wrapper = $this->factory->make($object);
            $normalizedObjects[] = $wrapper->getEntityAttributes();
        }

        if ($this->asJson) {
            $normalizedObjects = json_encode($normalizedObjects);
        }

        return [$key => $normalizedObjects];
    }
778767
private function normalizeRawCollection(iterable $object, ?string $format, array $context): array
    {
        $data = [];
        foreach ($object as $index => $obj) {
            $data[$index] = $this->normalizer->normalize($obj, $format, $context);
        }

        return $data;
    }
914699
private function innerSerialize($object)
    {
        if (is_array($object)) {
            $serializedArray = [];
            foreach ($object as $key => $value) {
                $serializedArray[$key] = $this->innerSerialize($value);
            }

            return $serializedArray;
        } elseif (is_object($object)) {
            return $this->serializeObject($object);
        } else {
            return $object;
        }
    }
41406
public function persistObject($object) : array
    {
        $data = $this->preparePersistChangeSet($object);

        $class = $this->getClassMetadata();

        if (! isset($data[$class->getIdentifier()[0]])) {
            $data[$class->getIdentifier()[0]] = $this->generateNextId($class);
        }

        $this->objects[$data[$class->getIdentifier()[0]]] = $data;

        return $data;
    }
321804
protected function recurseToArray($object)
    {
        if (is_scalar($object)) {
            return $object;
        }
        $array = (array)$object;
        foreach ($array as &$value) {
            if (!is_scalar(($value))) {
                $value = $this->recurseToArray($value);
                continue;
            }
        }
        return $array;
    }
344664
public static function pairs($object)
    {
        $result = [];
        static::each($object, function ($item, $key) use (& $result) {
            $result[] = [$key, $item];
        });

        return $result;
    }
226001
public static function parseObjectToArray($object) {
        $array = array();
        if (is_object($object))
            $array = get_object_vars($object);
        elseif (is_array($object)) {
            foreach ($object as $k => &$value)
                $array[$k] = self::parseObjectToArray($value);
        } else
            $array = $object;

        return $array;
    }
548173
public function serialize($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('Argument must be an object');
        }

        $reflectedObject = new \ReflectionObject($object);
        $reflectedProperties = $reflectedObject->getProperties();

        $array = array();

        foreach ($reflectedProperties as $property) {
            $value = $this->getValue($object, $property);

            if (null !== $value) {
                if (!is_scalar($value)) {
                    $value = $this->normalize($value);
                }

                $array[$this->formatter->toMongoKey($property->getName())] = $value;
            }
        }

        return $array;
    }
923924
protected function optimizeObjectContent($object)
	{
		$object = $this->recordObject($object);
		$this->deduplicateConfigValues();

		return $object->getValue();
	}
382226
public static function wrap($object): array
    {
        if (null === $object) {
            return [];
        }

        if (is_array($object) && !self::isAssoc($object)) {
            return $object;
        }

        return [$object];
    }
622537
private function deserializeObject(array $serializedObject)
    {
        list($name, $payload) = $this->dataFormatter->getNameAndPayload($serializedObject);

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

        $objectFqcn = $this->classMapper->getClassName($name);

        foreach ($this->customSerializers as $customSerializer) {
            if ($customSerializer->canHandle($objectFqcn)) {
                return $customSerializer->deserialize($curatedPayload, $objectFqcn);
            }
        }

        $object = $this->instantiator->instantiate($objectFqcn);

        return $this->hydratorFactory
            ->getHydrator($objectFqcn)
            ->hydrate($curatedPayload, $object);
    }
1103067
public function toArray($object)
    {
        $this->assertObjectInstance($object);

        return array_map(
            function (Field $field) use ($object) {
                return $field->get($object);
            },
            $this->getFields()
        );
    }