Passed
Push — master ( e047bd...480ec5 )
by Korotkov
07:04 queued 14s
created

data()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 6
c 1
b 0
f 1
nc 3
nop 1
dl 0
loc 12
rs 10
1
<?php
2
3
use Rudra\Container\Facades\Rudra;
4
5
if (!function_exists('data')) {
6
    /**
7
     * @param  $data
8
     * @return string
9
     */
10
    function data($data = null): string
11
    {
12
        if (is_array($data)) {
13
            Rudra::data()->set($data);
14
            return;
0 ignored issues
show
Bug Best Practice introduced by
The expression return returns the type null which is incompatible with the type-hinted return string.
Loading history...
15
        }
16
17
        if (empty($data)) {
18
            return Rudra::data()->get();
19
        }
20
21
        return Rudra::data()->get();
22
    }
23
}