src/AssetManager/Module.php
public function onDispatch(MvcEvent $event)
    {
        /* @var $response \Zend\Http\Response */
        $response = $event->getResponse();
        if (!method_exists($response, 'getStatusCode') || $response->getStatusCode() !== 404) {
            return;
        }
        $request        = $event->getRequest();
        $serviceManager = $event->getApplication()->getServiceManager();
        $assetManager   = $serviceManager->get(__NAMESPACE__ . '\Service\AssetManager');

        if (!$assetManager->resolvesToAsset($request)) {
            return;
        }

        $response->setStatusCode(200);

        return $assetManager->setAssetOnResponse($response);
    }
public function onDispatch(MvcEvent $event)
    {
        /* @var $response \Zend\Http\Response */
        $response = $event->getResponse();
        if (!method_exists($response, 'getStatusCode') || $response->getStatusCode() !== 404) {
            return;
        }
        $request        = $event->getRequest();
        $serviceManager = $event->getApplication()->getServiceManager();
        $assetManager   = $serviceManager->get(__NAMESPACE__ . '\Service\AssetManager');

        if (!$assetManager->resolvesToAsset($request)) {
            return;
        }

        $response->setStatusCode(200);

        return $assetManager->setAssetOnResponse($response);
    }
public function onDispatch ( MvcEvent $ event ) { /* @var $response \Zend\Http\Response */ $ response = $ event -> getResponse ( ) ; if ( ! method_exists ( $ response , 'getStatusCode' ) || $ response -> getStatusCode ( ) !== 404 ) { return ; } $ request = $ event -> getRequest ( ) ; $ serviceManager = $ event -> getApplication ( ) -> getServiceManager ( ) ; $ assetManager = $ serviceManager -> get ( __NAMESPACE__ . '\Service\AssetManager' ) ; if ( ! $ assetManager -> resolvesToAsset ( $ request ) ) { return ; } $ response -> setStatusCode ( 200 ) ; return $ assetManager -> setAssetOnResponse ( $ response ) ; }
Callback method for dispatch and dispatch.error events.

@param MvcEvent $event
Callback method for dispatch and dispatch . error events .