Issues (152)

app/Logic/Macros/HtmlMacros.php (3 issues)

Labels
Severity
1
<?php
2
3
HTML::macro('image_link', function ($url = '', $img = '', $alt = '', $link_name = '', $param = '', $active = true, $ssl = false) {
4
    $url = $ssl == true ? URL::to_secure($url) : URL::to($url);
5
    $img = HTML::image($img, $alt);
6
    $img .= $link_name;
7
    $link = $active == true ? HTML::link($url, '#', $param) : $img;
8
    $link = str_replace('#', $img, $link);
9
10
    return $link;
11
});
12
13
HTML::macro('icon_link', function ($url = '', $icon = '', $link_name = '', $param = '', $active = true, $ssl = false) {
14
    $url = $ssl == true ? URL::to_secure($url) : URL::to($url);
15
    $icon = '<i class="'.$icon.'" aria-hidden="true"></i>'.$link_name;
16
    $link = $active == true ? HTML::link($url, '#', $param) : $icon;
17
    $link = str_replace('#', $icon, $link);
18
19
    return $link;
20
});
21
22
HTML::macro('icon_btn', function ($url = '', $icon = '', $link_name = '', $param = '', $active = true, $ssl = false) {
23
    $url = $ssl == true ? URL::to_secure($url) : URL::to($url);
24
    $icon = $link_name.' <i class="'.$icon.'" aria-hidden="true"></i>';
25
    $link = $active == true ? HTML::link($url, '#', $param) : $icon;
26
    $link = str_replace('#', $icon, $link);
27
28
    return $link;
29
});
30
31
// SHOW USERNAME
32
HTML::macro('show_username', function () {
33
    $the_username = (Auth::user()->name === Auth::user()->email) ? ((is_null(Auth::user()->first_name)) ? (Auth::user()->name) : (Auth::user()->first_name)) : (((is_null(Auth::user()->name)) ? (Auth::user()->email) : (Auth::user()->name)));
0 ignored issues
show
Accessing name on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
Accessing first_name on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
Accessing email on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
34
35
    return $the_username;
36
});
37