public function trigger($eventName, $arg1 = 'NULLPARAMETER')
    {
        $this->Logger->debug('Triggering event ['.$eventName.']');
        if(($event = $this->ApplicationContext->getEvent($eventName)) == false)
            return;

        $args = array();
        $stack = null;
        if($arg1 !== 'NULLPARAMETER')
        {
            if (PHP_VERSION_ID < 50205)
                $stack = debug_backtrace();
            else
                $stack = debug_backtrace(false);

            if (isset($stack[0]["args"]))
                for ($i=1; $i < count($stack[0]["args"]); $i++)
                    $args[] =& $stack[0]["args"][$i];
        }

        $count = 0;
        foreach ($event as $priority => $callbacks) {
            foreach ($callbacks as $callback) {
                list($objectIDorObj, $method, $isObject, $passContext) = $callback;

                if (!$isObject)
                    $objectIDorObj = $this->ApplicationContext->object($objectIDorObj);

                $this->Logger->debug('Calling ['.get_class($objectIDorObj).'::'.$method.']');

                if ($passContext) {
                    $newArgs = $args;
                    if(is_null($stack))
                    {
                        if (PHP_VERSION_ID < 50205)
                            $stack = debug_backtrace();
                        else
                            $stack = debug_backtrace(false);
                    }
                    $callingClass = $stack[1]["class"];
                    array_unshift($newArgs, array('priority'=> $priority, 'index'=>$count, 'name'=>$eventName, 'callingClass'=>$callingClass));
                    call_user_func_array(array($objectIDorObj, $method), $newArgs);
                } else {
                    call_user_func_array(array($objectIDorObj, $method), $args);
                }
                ++$count;
            }
        }
        return $count;
    }