azure-storage-common/src/Common/Internal/Utilities.php
public static function getEntityId($entity, $type, $method = 'getId')
    {
        if (is_string($entity)) {
            return $entity;
        } else {
            Validate::isA($entity, $type, 'entity');
            Validate::methodExists($entity, $method, $type);

            return $entity->$method();
        }
    }
public static function getEntityId($entity, $type, $method = 'getId')
    {
        if (is_string($entity)) {
            return $entity;
        } else {
            Validate::isA($entity, $type, 'entity');
            Validate::methodExists($entity, $method, $type);

            return $entity->$method();
        }
    }
Get id from entity object or string.
If entity is object than validate type and return $entity->$method()
If entity is string than return this string

@param object|string $entity Entity with id property
@param string        $type   Entity type to validate
@param string        $method Methods that gets id (getId by default)

@return string