Completed
Push — master ( f9eb6d...e149f7 )
by Andrii
07:39
created

Hidev::exec()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 4
nop 3
crap 12
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\helpers;
12
13
use Yii;
14
15
/**
16
 * Hidev helper.
17
 */
18
class Hidev
19
{
20
    public static function exec($route, array $args, $wait = false)
21
    {
22
        $path = dirname(__DIR__) . '/bin/hidev';
23
        $command = "$path $route";
24
        foreach ($args as $arg) {
25
            $command .= ' ' . escapeshellarg($arg);
26
        }
27
        $amp = $wait ? '' : '&';
28
29
        return exec("$command > /dev/null 2>&1 $amp");
30
    }
31
}
32