public function makeId($callback, array $args = array())
    {
        if (!is_callable($callback, true, $name)) {
            Zend_Cache::throwException('Invalid callback');
        }

        // functions, methods and classnames are case-insensitive
        $name = strtolower($name);

        // generate a unique id for object callbacks
        if (is_object($callback)) { // Closures & __invoke
            $object = $callback;
        } elseif (isset($callback[0])) { // array($object, 'method')
            $object = $callback[0];
        }
        if (isset($object)) {
            try {
                $tmp = @serialize($callback);
            } catch (Exception $e) {
                Zend_Cache::throwException($e->getMessage());
            }
            if (!$tmp) {
                $lastErr = error_get_last();
                Zend_Cache::throwException("Can't serialize callback object to generate id: {$lastErr['message']}");
            }
            $name.= '__' . $tmp;
        }

        // generate a unique id for arguments
        $argsStr = '';
        if ($args) {
            try {
                $argsStr = @serialize(array_values($args));
            } catch (Exception $e) {
                Zend_Cache::throwException($e->getMessage());
            }
            if (!$argsStr) {
                $lastErr = error_get_last();
                throw Zend_Cache::throwException("Can't serialize arguments to generate id: {$lastErr['message']}");
            }
        }

        return md5($name . $argsStr);
    }
public function makeId($callback, array $args = array())
    {
        if (!is_callable($callback, true, $name)) {
            Zend_Cache::throwException('Invalid callback');
        }

        // functions, methods and classnames are case-insensitive
        $name = strtolower($name);

        // generate a unique id for object callbacks
        if (is_object($callback)) { // Closures & __invoke
            $object = $callback;
        } elseif (isset($callback[0])) { // array($object, 'method')
            $object = $callback[0];
        }
        if (isset($object)) {
            try {
                $tmp = @serialize($callback);
            } catch (Exception $e) {
                Zend_Cache::throwException($e->getMessage());
            }
            if (!$tmp) {
                $lastErr = error_get_last();
                Zend_Cache::throwException("Can't serialize callback object to generate id: {$lastErr['message']}");
            }
            $name.= '__' . $tmp;
        }

        // generate a unique id for arguments
        $argsStr = '';
        if ($args) {
            try {
                $argsStr = @serialize(array_values($args));
            } catch (Exception $e) {
                Zend_Cache::throwException($e->getMessage());
            }
            if (!$argsStr) {
                $lastErr = error_get_last();
                throw Zend_Cache::throwException("Can't serialize arguments to generate id: {$lastErr['message']}");
            }
        }

        return md5($name . $argsStr);
    }
public function makeId ( $ callback , array $ args = array ( ) ) { if ( ! is_callable ( $ callback , true , $ name ) ) { Zend_Cache :: throwException ( 'Invalid callback' ) ; } // functions, methods and classnames are case-insensitive $ name = strtolower ( $ name ) ; // generate a unique id for object callbacks if ( is_object ( $ callback ) ) { // Closures & __invoke $ object = $ callback ; } elseif ( isset ( $ callback [ 0 ] ) ) { // array($object, 'method') $ object = $ callback [ 0 ] ; } if ( isset ( $ object ) ) { try { $ tmp = @ serialize ( $ callback ) ; } catch ( Exception $ e ) { Zend_Cache :: throwException ( $ e -> getMessage ( ) ) ; } if ( ! $ tmp ) { $ lastErr = error_get_last ( ) ; Zend_Cache :: throwException ( "Can't serialize callback object to generate id: {$lastErr['message']}" ) ; } $ name .= '__' . $ tmp ; } // generate a unique id for arguments $ argsStr = '' ; if ( $ args ) { try { $ argsStr = @ serialize ( array_values ( $ args ) ) ; } catch ( Exception $ e ) { Zend_Cache :: throwException ( $ e -> getMessage ( ) ) ; } if ( ! $ argsStr ) { $ lastErr = error_get_last ( ) ; throw Zend_Cache :: throwException ( "Can't serialize arguments to generate id: {$lastErr['message']}" ) ; } } return md5 ( $ name . $ argsStr ) ; }
Make a cache id from the function name and parameters

@param  callback $callback A valid callback
@param  array    $args     Function parameters
@throws Zend_Cache_Exception
@return string Cache id
Make a cache id from the function name and parameters