ExecutesCommands::executeFrom()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
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