AbstractServiceCaller   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 0
dl 0
loc 38
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
call() 0 1 ?
hasHandler() 0 1 ?
A setHandlerMethod() 0 4 1
1
<?php
2
3
namespace BrightComponents\Services;
4
5
abstract class AbstractServiceCaller
6
{
7
    /**
8
     * The handler method to be called.
9
     *
10
     * @var string
11
     */
12
    public static $handlerMethod = 'run';
13
14
    /**
15
     * Call a service through its appropriate handler.
16
     *
17
     * @param  string  $service
18
     * @param  mixed  ...$params
19
     *
20
     * @return mixed
21
     */
22
    abstract public function call($service, ...$params);
23
24
    /**
25
     * Determine if the given service has a handler.
26
     *
27
     * @param  mixed  $service
28
     *
29
     * @return bool
30
     */
31
    abstract public function hasHandler($service);
32
33
    /**
34
     * Set the handler method name for services.
35
     *
36
     * @param  string  $method
37
     */
38
    public static function setHandlerMethod(string $method = 'run')
39
    {
40
        static::$handlerMethod = $method;
41
    }
42
}
43