getCallback example

if (false === $catch) {
                $this->finishRequest($request$type);

                throw $e;
            }

            return $response = $this->handleThrowable($e$request$type);
        } finally {
            $this->requestStack->pop();

            if ($response instanceof StreamedResponse) {
                $callback = $response->getCallback();
                $requestStack = $this->requestStack;

                $response->setCallback(static function D) use ($request$callback$requestStack) {
                    $requestStack->push($request);
                    try {
                        $callback();
                    } finally {
                        $requestStack->pop();
                    }
                });
            }
        }
$reverseContainer = new ReverseContainer($containernew ServiceLocator([]));

        $msg = EarlyExpirationMessage::create($reverseContainer[$computationService, '__invoke']$item$pool);

        $this->assertSame('cache_pool', $msg->getPool());
        $this->assertSame($pool$msg->findPool($reverseContainer));

        $this->assertSame('foo', $msg->getItem()->getKey());
        $this->assertNull($msg->getItem()->get());
        $this->assertSame(234, $item->get());

        $this->assertSame(['@computation_service', '__invoke']$msg->getCallback());
        $this->assertSame([$computationService, '__invoke']$msg->findCallback($reverseContainer));

        $msg = EarlyExpirationMessage::create($reverseContainer$computationService$item$pool);

        $this->assertSame('@computation_service', $msg->getCallback());
        $this->assertSame($computationService$msg->findCallback($reverseContainer));
    }
}
if (false === $catch) {
                $this->finishRequest($request$type);

                throw $e;
            }

            return $response = $this->handleThrowable($e$request$type);
        } finally {
            $this->requestStack->pop();

            if ($response instanceof StreamedResponse) {
                $callback = $response->getCallback();
                $requestStack = $this->requestStack;

                $response->setCallback(static function D) use ($request$callback$requestStack) {
                    $requestStack->push($request);
                    try {
                        $callback();
                    } finally {
                        $requestStack->pop();
                    }
                });
            }
        }
if (is_callable($callback)) {
            $this->setCallback($callback);
        } elseif (is_array($callback)) {
            if (isset($callback['callback'])) {
                $this->setCallback($callback['callback']);
            }
            if (isset($callback['options'])) {
                $this->setOptions($callback['options']);
            }
        }

        if (null === ($initializedCallack = $this->getCallback())) {
            throw new Zend_Validate_Exception('No callback registered');
        }
    }

    /** * Returns the set callback * * @return mixed */
    public function getCallback()
    {
        
Home | Imprint | This part of the site doesn't use cookies.