Test Failed
Push — master ( 76a834...03a979 )
by Бабичев
01:47
created

global.php ➔ builder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
if (!function_exists('builder'))
4
{
5
    /**
6
     * @return \Bavix\Builder\Builder
7
     */
8
    function builder()
9
    {
10
        global $builder;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
11
12
        return $builder;
13
    }
14
}
15
16
if (!function_exists('config'))
17
{
18
    /**
19
     * @param string $name
20
     *
21
     * @return \Bavix\Slice\Slice
22
     */
23
    function config(string $name)
24
    {
25
        global $builder;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
26
27
        return $builder->config()->get($name);
28
    }
29
}
30
31
if (!function_exists('factory'))
32
{
33
    /**
34
     * @return \Bavix\Processors\Factory
35
     */
36
    function factory()
37
    {
38
        global $builder;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
39
40
        return $builder->factory();
41
    }
42
}
43