DuskProcessFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 4 1
A binary() 0 4 1
A arguments() 0 4 1
1
<?php
2
3
namespace BeyondCode\DuskDashboard;
4
5
use Symfony\Component\Process\Process;
6
7
class DuskProcessFactory
8
{
9
    /**
10
     * Create new process to run Dusk, passing the same arguments Dashboard command received.
11
     *
12
     * @return \Symfony\Component\Process\Process
13
     */
14
    public static function make()
15
    {
16
        return new Process(array_merge(self::binary(), self::arguments()), base_path());
17
    }
18
19
    /**
20
     * Dusk command represented as array.
21
     *
22
     * @return array
23
     */
24
    protected static function binary()
25
    {
26
        return [PHP_BINARY, 'artisan', 'dusk'];
27
    }
28
29
    /**
30
     * Arguments that were given to dusk:dashboard.
31
     *
32
     * @return array
33
     */
34
    protected static function arguments()
35
    {
36
        return array_slice($_SERVER['argv'], 2);
37
    }
38
}
39