Update abstract base controller class
This commit is contained in:
parent
fe758fbebb
commit
c564e3bd52
2 changed files with 26 additions and 15 deletions
|
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Runtime\Http\Controllers;
|
||||
|
||||
class ControllerExtractor {
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return "Het werkt :)";
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue