public static function readAttributes($object)
    {
        // Bail out if a non-object was passed.
        if (!is_object($object)) {
            throw self::getInvalidArgumentException(1, 'object');
        }

        $reflector = new ReflectionObject($object);
        $result    = [];

        // Iterate over the attributes of the object.
        foreach ($reflector->getProperties() as $attribute) {
            $attribute->setAccessible(true);
            $result[$attribute->getName()] = $attribute->getValue($object);
        }

        return $result;
    }