Issues (480)

src/Service/Facade.php (1 issue)

1
<?php
2
/**
3
 *
4
 */
5
6
namespace Mvc5\Service;
7
8
trait Facade
9
{
10
    /**
11
     * @param callable|mixed $plugin
12
     * @param array $args
13
     * @param callable|null $callback
14
     * @return mixed
15
     * @throws \Throwable
16
     */
17 1
    protected static function call($plugin, array $args = [], callable $callback = null)
18
    {
19 1
        return static::service()->call($plugin, $args, $callback);
20
    }
21
22
    /**
23
     * @param array|string $name
24
     * @return mixed
25
     * @throws \Throwable
26
     */
27 1
    protected static function param($name)
28
    {
29 1
        return static::service()->param($name);
30
    }
31
32
    /**
33
     * @param string|mixed $plugin
34
     * @param array $args
35
     * @param callable|null $callback
36
     * @return mixed
37
     * @throws \Throwable
38
     */
39 1
    protected static function plugin($plugin, array $args = [], callable $callback = null)
40
    {
41 1
        return static::service()->plugin($plugin, $args, $callback);
42
    }
43
44
    /**
45
     * @return callable|Manager|Service
46
     * @throws \Throwable
47
     */
48 7
    protected static function service() : Service
49
    {
50 7
        return Context::service();
0 ignored issues
show
Bug Best Practice introduced by
The expression return Mvc5\Service\Context::service() could return the type callable which is incompatible with the type-hinted return Mvc5\Service\Service. Consider adding an additional type-check to rule them out.
Loading history...
51
    }
52
53
    /**
54
     * @param array|string $name
55
     * @param mixed $config
56
     * @return mixed
57
     * @throws \Throwable
58
     */
59 1
    protected static function shared($name, $config = null)
60
    {
61 1
        return static::service()->shared($name, $config);
62
    }
63
64
    /**
65
     * @param array|object|string|\Traversable $event
66
     * @param array $args
67
     * @param callable|null $callback
68
     * @return mixed
69
     * @throws \Throwable
70
     */
71 1
    protected static function trigger($event, array $args = [], callable $callback = null)
72
    {
73 1
        return static::service()->trigger($event, $args, $callback);
74
    }
75
}
76