Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Routing;
4
 
5
use BadMethodCallException;
6
 
7
abstract class Controller
8
{
9
    /**
10
     * The middleware registered on the controller.
11
     *
12
     * @var array
13
     */
14
    protected $middleware = [];
15
 
16
    /**
17
     * Register middleware on the controller.
18
     *
19
     * @param  \Closure|array|string  $middleware
20
     * @param  array  $options
21
     * @return \Illuminate\Routing\ControllerMiddlewareOptions
22
     */
23
    public function middleware($middleware, array $options = [])
24
    {
25
        foreach ((array) $middleware as $m) {
26
            $this->middleware[] = [
27
                'middleware' => $m,
28
                'options' => &$options,
29
            ];
30
        }
31
 
32
        return new ControllerMiddlewareOptions($options);
33
    }
34
 
35
    /**
36
     * Get the middleware assigned to the controller.
37
     *
38
     * @return array
39
     */
40
    public function getMiddleware()
41
    {
42
        return $this->middleware;
43
    }
44
 
45
    /**
46
     * Execute an action on the controller.
47
     *
48
     * @param  string  $method
49
     * @param  array  $parameters
50
     * @return \Symfony\Component\HttpFoundation\Response
51
     */
52
    public function callAction($method, $parameters)
53
    {
54
        return $this->{$method}(...array_values($parameters));
55
    }
56
 
57
    /**
58
     * Handle calls to missing methods on the controller.
59
     *
60
     * @param  string  $method
61
     * @param  array  $parameters
62
     * @return mixed
63
     *
64
     * @throws \BadMethodCallException
65
     */
66
    public function __call($method, $parameters)
67
    {
68
        throw new BadMethodCallException(sprintf(
69
            'Method %s::%s does not exist.', static::class, $method
70
        ));
71
    }
72
}