Passed
Push — master ( c053ab...9d353c )
by Caen
03:57 queued 16s
created

strip_newlines()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace {
6
    use Hyde\Foundation\HydeKernel;
7
8
    if (! function_exists('hyde')) {
9
        /**
10
         * Get the available HydeKernel instance.
11
         */
12
        function hyde(): HydeKernel
13
        {
14
            return app(HydeKernel::class);
15
        }
16
    }
17
18
    if (! function_exists('unslash')) {
19
        /**
20
         * Remove trailing slashes from the start and end of a string.
21
         */
22
        function unslash(string $string): string
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
        {
24
            return trim($string, '/\\');
25
        }
26
    }
27
}
28
29
namespace Hyde {
30
    use Hyde\Foundation\HydeKernel;
31
    use Illuminate\Support\HtmlString;
32
33
    if (! function_exists('\Hyde\hyde')) {
34
        /**
35
         * Get the available HydeKernel instance.
36
         */
37
        function hyde(): HydeKernel
38
        {
39
            return app(HydeKernel::class);
40
        }
41
    }
42
43
    if (! function_exists('\Hyde\unslash')) {
44
        /**
45
         * Remove trailing slashes from the start and end of a string.
46
         */
47
        function unslash(string $string): string
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
48
        {
49
            return trim($string, '/\\');
50
        }
51
    }
52
53
    if (! function_exists('\Hyde\make_title')) {
54
        function make_title(string $value): string
55
        {
56
            return Hyde::makeTitle($value);
57
        }
58
    }
59
60
    if (! function_exists('\Hyde\normalize_newlines')) {
61
        function normalize_newlines(string $string): string
62
        {
63
            return Hyde::normalizeNewlines($string);
64
        }
65
    }
66
67
    if (! function_exists('\Hyde\strip_newlines')) {
68
        function strip_newlines(string $string): string
69
        {
70
            return Hyde::stripNewlines($string);
71
        }
72
    }
73
74
    if (! function_exists('\Hyde\trim_slashes')) {
75
        function trim_slashes(string $string): string
76
        {
77
            return Hyde::trimSlashes($string);
78
        }
79
    }
80
81
    if (! function_exists('\Hyde\markdown')) {
82
        function markdown(string $text, bool $normalizeIndentation = false): HtmlString
83
        {
84
            return Hyde::markdown($text, $normalizeIndentation);
85
        }
86
    }
87
}
88