Update abstract base controller class

This commit is contained in:
Maarten 2020-01-07 10:06:26 +01:00
parent fe758fbebb
commit c564e3bd52
2 changed files with 26 additions and 15 deletions

View file

@ -2,10 +2,33 @@
namespace Runtime\Http\Controllers;
class Controller {
use BadMethodCallException;
use Runtime\Http\Response;
public function lol() {
return new ControllerExtractor();
abstract class Controller {
/**
* @param string $method
* @param array $parameters
* @return Response
*/
public function callAction($method, $parameters)
{
return call_user_func_array([$this, $method], $parameters);
}
/**
* @param string $method
* @param array $parameters
* @return mixed
*
* @throws \BadMethodCallException
*/
public function __call($method, $parameters)
{
throw new BadMethodCallException(sprintf(
'Method %s::%s does not exist.', static::class, $method
));
}
}

View file

@ -1,12 +0,0 @@
<?php
namespace Runtime\Http\Controllers;
class ControllerExtractor {
public function __toString()
{
return "Het werkt :)";
}
}