Invocation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 2
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/laravel-async
4
 *
5
 * @copyright (c) Vuong Xuong Minh
6
 * @license [MIT](https://opensource.org/licenses/MIT)
7
 */
8
9
namespace VXM\Async;
10
11
use RuntimeException;
12
13
/**
14
 * @author Vuong Minh <[email protected]>
15
 * @since 1.0.0
16
 */
17
trait Invocation
18
{
19
    /**
20
     * Handle method name.
21
     *
22
     * @var string
23
     */
24
    protected $handleMethod = 'handle';
25
26
    /**
27
     * Call this class.
28
     */
29
    public function __invoke()
30
    {
31
        if (! method_exists($this, $this->handleMethod)) {
32
            throw new RuntimeException(sprintf('`handle` method must be define in (%s)', __CLASS__));
33
        }
34
35
        return app()->call([$this, $this->handleMethod]);
36
    }
37
}
38