Completed
Push — master ( 1d9e5d...041fdc )
by ARCANEDEV
7s
created

helpers.php ➔ html()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
if ( ! function_exists('html')) {
4
    /**
5
     * Get the HTML Builder instance.
6
     *
7
     * @return \Arcanedev\LaravelHtml\Contracts\HtmlBuilderInterface
8
     */
9
    function html()
10
    {
11
        return app(\Arcanedev\LaravelHtml\Contracts\HtmlBuilderInterface::class);
12
    }
13
}
14
15
/* ------------------------------------------------------------------------------------------------
16
 |  Link Helpers
17
 | ------------------------------------------------------------------------------------------------
18
 */
19
if ( ! function_exists('link_to')) {
20
    /**
21
     * Generate a HTML link.
22
     *
23
     * @param  string  $url
24
     * @param  string  $title
25
     * @param  array   $attributes
26
     * @param  bool    $secure
27
     * @param  bool    $escaped
28
     *
29
     * @return string
30
     */
31
    function link_to($url, $title = null, $attributes = [], $secure = null, $escaped = true)
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...
32
    {
33
        return html()->link($url, $title, $attributes, $secure, $escaped);
34
    }
35
}
36
37
if ( ! function_exists('link_to_asset')) {
38
    /**
39
     * Generate a HTML link to an asset.
40
     *
41
     * @param  string  $url
42
     * @param  string  $title
43
     * @param  array   $attributes
44
     * @param  bool    $secure
45
     *
46
     * @return string
47
     */
48
    function link_to_asset($url, $title = null, $attributes = [], $secure = null)
49
    {
50
        return html()->linkAsset($url, $title, $attributes, $secure);
51
    }
52
}
53
54
if ( ! function_exists('link_to_route')) {
55
    /**
56
     * Generate a HTML link to a named route.
57
     *
58
     * @param  string  $name
59
     * @param  string  $title
60
     * @param  array   $params
61
     * @param  array   $attributes
62
     * @param  bool    $escaped
63
     *
64
     * @return string
65
     */
66
    function link_to_route($name, $title = null, $params = [], $attributes = [], $escaped = true)
67
    {
68
        return html()->linkRoute($name, $title, $params, $attributes, $escaped);
69
    }
70
}
71
72
if ( ! function_exists('link_to_action')) {
73
    /**
74
     * Generate a HTML link to a controller action.
75
     *
76
     * @param  string  $action
77
     * @param  string  $title
78
     * @param  array   $params
79
     * @param  array   $attributes
80
     * @param  bool    $escaped
81
     *
82
     * @return string
83
     */
84
    function link_to_action($action, $title = null, $params = [], $attributes = [], $escaped = true)
85
    {
86
        return html()->linkAction($action, $title, $params, $attributes, $escaped);
87
    }
88
}
89