Permalink
Browse files

Update Dispatcher.php

Moved init $headerController upper than $Request->init();, because in $AssetType->init(); if file is not exists throw "NotFoundException" in src/Munee/Asset/Type.php:208 and in catch block $headerController is null.
  • Loading branch information...
Alexander
Alexander committed Apr 24, 2013
1 parent 3a4988c commit 796b5cd38b0d77b8043d15336be17338da7f3aa7
Showing with 12 additions and 12 deletions.
  1. +12 −12 src/Munee/Dispatcher.php
View
@@ -44,6 +44,17 @@ public static function run(Request $Request, $options = array())
* Merge in default options
*/
$options = array_merge(self::$defaultOptions, $options);
/**
* Set the header controller. Can be overwritten by the dispatcher options
*/
if (
isset($options['headerController']) &&
$options['headerController'] instanceof Asset\HeaderSetter
) {
$headerController = $options['headerController'];
} else {
$headerController = new Asset\HeaderSetter;
}
/**
* Initialise the Request
*/
@@ -60,17 +71,6 @@ public static function run(Request $Request, $options = array())
* Create a response
*/
$Response = new Response($AssetType);
/**
* Set the header controller. Can be overwritten by the dispatcher options
*/
if (
isset($options['headerController']) &&
$options['headerController'] instanceof Asset\HeaderSetter
) {
$headerController = $options['headerController'];
} else {
$headerController = new Asset\HeaderSetter;
}
$Response->setHeaderController($headerController);
/**
* Set the headers if told to do so
@@ -99,4 +99,4 @@ public static function run(Request $Request, $options = array())
return $errors;
}
}
}
}

0 comments on commit 796b5cd

Please sign in to comment.