Passed
Push — master ( 6c88e4...6ca2b3 )
by Gabriel
04:27
created

mvc_section_url()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
/**
4
 * @return \Nip\Mvc\Modules
5
 */
6
function mvc_modules()
7
{
8
    if (!function_exists('app')) {
9
        return null;
10
    }
11
    return app('mvc.modules');
12
}
13
14
/**
15
 * @return \Nip\Mvc\Sections\SectionsManager
16
 */
17
function mvc_sections()
18
{
19
    if (!function_exists('app')) {
20
        return null;
21
    }
22
    return app('mvc.sections');
23
}
24
25
/**
26
 * @param $section
27
 * @param $url
28
 * @return string
29
 */
30
function mvc_section_url($section, $url = false): string
31
{
32
    $section = mvc_sections()->getOne($section);
33
    return $section->getURL($url);
34
}
35