private function uniqueId($hookName, $function, $priority)
    {
        static $count = 0;
        if (is_string($function)) {
            return $function;
        }
        if (is_object($function)) {
            // Closures are currently implemented as objects
            $function = array($function, '');
        } elseif (!is_array($function)) {
            $function = array($function);
        }

        if (is_object($function[0])) {
            // Object Class Calling
            if (function_exists('spl_object_hash')) {
                return spl_object_hash($function[0]) . $function[1];
            } else {
                $object_id = get_class($function[0]).$function[1];
                if (!isset($function[0]->id)) {
                    if (false === $priority) {
                        return false;
                    }
                    $object_id .= isset($this->filters[$hookName][$priority])
                        ? count((array) $this->filters[$hookName][$priority])
                        : $count;
                    $function[0]->id = $count;
                    $count++;
                } else {
                    $object_id .= $function[0]->id;
                }
                return $object_id;
            }
        } elseif (is_string($function[0])) {
            // callas static
            return $function[0] . '::' . $function[1];
        }
        // unexpected result
        return null;
    }