Completed
Pull Request — master (#67)
by ARCANEDEV
10:57
created

helpers.php ➔ extract_date()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
if ( ! function_exists('log_viewer')) {
4
    /**
5
     * Get the LogViewer instance.
6
     *
7
     * @return \Arcanedev\LogViewer\Contracts\LogViewerInterface
8
     */
9
    function log_viewer() {
10
        return app('arcanedev.log-viewer');
11
    }
12
}
13
14
if ( ! function_exists('log_levels')) {
15
    /**
16
     * Get the LogLevels instance.
17
     *
18
     * @return \Arcanedev\LogViewer\Contracts\LogLevelsInterface
19
     */
20
    function log_levels() {
21
        return app('arcanedev.log-viewer.levels');
22
    }
23
}
24
25
if ( ! function_exists('log_menu')) {
26
    /**
27
     * Get the LogMenu instance.
28
     *
29
     * @return \Arcanedev\LogViewer\Contracts\LogMenuInterface
30
     */
31
    function log_menu() {
32
        return app('arcanedev.log-viewer.menu');
33
    }
34
}
35
36
if ( ! function_exists('log_styler')) {
37
    /**
38
     * Get the LogStyler instance.
39
     *
40
     * @return \Arcanedev\LogViewer\Contracts\LogStylerInterface
41
     */
42
    function log_styler() {
43
        return app('arcanedev.log-viewer.styler');
44
    }
45
}
46
47
if ( ! function_exists('extract_date')) {
48
    /**
49
     * Extract date from string (format : YYYY-MM-DD).
50
     *
51
     * @param  string  $string
52
     *
53
     * @return string
54
     */
55
    function extract_date($string) {
56
        return preg_replace(
57
            '/.*(' . REGEX_DATE_PATTERN . ').*/', '$1', $string
58
        );
59
    }
60
}
61