final private function uniqueId($function)
    {
        if (is_string($function)) {
            return $function;
        }

        if (is_object($function)) {
            // Closures are currently implemented as objects
            $function = [ $function, '' ];
        } elseif (!is_array($function)) {
            $function = [ $function ];
        }

        $function = array_values($function);
        if (is_object($function[0])) {
            return \spl_object_hash($function[0]) . $function[1];
        } elseif (count($function) > 1 || is_string($function[0])) {
            // call as static
            return $function[0] . '::' . $function[1];
        }

        // unexpected result
        return null;
    }