ExecutesCommands   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
A executeFrom() 0 4 1
A executeFromArray() 0 4 1
1
<?php
2
3
namespace TillKruss\LaravelTactician;
4
5
use App;
6
use ArrayAccess;
7
use TillKruss\LaravelTactician\Contracts\Executer as ExecuterContract;
8
9
trait ExecutesCommands
10
{
11
    /**
12
     * Executes a command in the command bus.
13
     *
14
     * @param  object  $command
15
     * @return mixed
16
     */
17
    protected function execute($command)
18
    {
19
        return App::make(ExecuterContract::class)->execute($command);
20
    }
21
22
    /**
23
     * Marshal a command from the given object and execute it in the command bus.
24
     *
25
     * @param  string       $command
26
     * @param  ArrayAccess  $source
27
     * @param  array        $extras
28
     * @return mixed
29
     */
30
    protected function executeFrom($command, ArrayAccess $source, array $extras = [])
31
    {
32
        return App::make(ExecuterContract::class)->executeFrom($command, $source, $extras);
33
    }
34
35
    /**
36
     * Marshal a command from the given array and execute it in the command bus.
37
     *
38
     * @param  string  $command
39
     * @param  array   $array
40
     * @return mixed
41
     */
42
    protected function executeFromArray($command, array $array)
43
    {
44
        return App::make(ExecuterContract::class)->executeFromArray($command, $array);
45
    }
46
}
47