Completed
Push — master ( 97f2e9...a6bde0 )
by Marcel
02:00
created

DuskProcessFactory::binary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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