src/Model/Media/Collection.php
public static function getArray() {
        $object = new \ReflectionClass( Collection::class );
        $properties = $object->getProperties(\ReflectionProperty::IS_PUBLIC);
        $array = array();

        foreach ($properties as $property) {
            $value = $property->getValue();
            if (!empty($value)) {
                $array[$property->getName()] = $value;
            }
        }
        return $array;
    }
public static function getArray() {
        $object = new \ReflectionClass( Collection::class );
        $properties = $object->getProperties(\ReflectionProperty::IS_PUBLIC);
        $array = array();

        foreach ($properties as $property) {
            $value = $property->getValue();
            if (!empty($value)) {
                $array[$property->getName()] = $value;
            }
        }
        return $array;
    }
Returns an array with object properties names as keys.
Empty property values are omitted

@return array of items in collection