Skip to content

Instantly share code, notes, and snippets.

@sotarok
Last active August 29, 2015 14:19
Show Gist options
  • Save sotarok/c953b43fb54f70dba5c3 to your computer and use it in GitHub Desktop.
Save sotarok/c953b43fb54f70dba5c3 to your computer and use it in GitHub Desktop.
--- ../../aura/web_kernel/src/WebKernelDispatcher.php 2015-04-15 23:49:27.434448733 +0900
+++ vendor/aura/web-kernel/src/WebKernelDispatcher.php 2015-04-17 14:10:07.467050507 +0900
@@ -79,9 +79,16 @@
*/
public function __invoke()
{
- $action = $this->request->params->get('action');
- $this->logControllerValue($action);
- $this->checkForMissingController($action);
+ $object = $this->dispatcher->getObjectParam()
+ ? $this->request->params->get($this->dispatcher->getObjectParam())
+ : null;
+
+ $method = $this->dispatcher->getMethodParam()
+ ? $this->request->params->get($this->dispatcher->getMethodParam())
+ : null;
+
+ $this->logControllerValue($object, $method);
+ $this->checkForMissingController($object, $method);
try {
$this->dispatcher->__invoke($this->request->params->get());
} catch (Exception $e) {
@@ -98,13 +105,17 @@
* @return null
*
*/
- protected function logControllerValue($action)
+ protected function logControllerValue($object, $method)
{
$message = __METHOD__ . ' to ';
- if (is_object($action)) {
- $message .= 'object';
+ if (is_object($object)) {
+ $message .= get_class($object);
} else {
- $message .= $action;
+ $message .= $object;
+ }
+
+ if ($method) {
+ $message .= "::$method";
}
$this->logger->debug($message);
}
@@ -118,17 +129,17 @@
* @return null
*
*/
- protected function checkForMissingController($action)
+ protected function checkForMissingController($object, $method)
{
- $exists = is_object($action)
- || $this->dispatcher->hasObject($action);
+ $exists = is_object($object)
+ || $this->dispatcher->hasObject($object);
if ($exists) {
return;
}
- $this->logger->debug(__METHOD__ . " missing action '$action'");
+ $this->logger->debug(__METHOD__ . " missing action '$object'");
$this->request->params['action'] = 'aura.web_kernel.missing_action';
- $this->request->params['missing_action'] = $action;
+ $this->request->params['missing_action'] = $object;
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment