AdminltePresenter::getDividerWrapper()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Menus\Presenters;
6
7
use Rinvex\Menus\Models\MenuItem;
8
9
class AdminltePresenter extends BasePresenter
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function getOpenTagWrapper(): string
15
    {
16
        return '<ul class="sidebar-menu tree" data-widget="tree">';
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function getCloseTagWrapper(): string
23
    {
24
        return '</ul>';
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getDividerWrapper(): string
31
    {
32
        return '<li class="divider"></li>';
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getHeaderWrapper(MenuItem $item): string
39
    {
40
        return '<li class="header">'.($item->icon ? '<i class="'.$item->icon.'"></i> ' : '').$item->title.'</li>';
0 ignored issues
show
Documentation introduced by
The property icon does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property title does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getMenuWithoutDropdownWrapper(MenuItem $item): string
47
    {
48
        return '<li class="'.($item->isActive() ? 'active' : '').'">
49
                    <a href="'.$item->getUrl().'" '.$item->getAttributes().'>
50
                        '.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').'
0 ignored issues
show
Documentation introduced by
The property icon does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
51
                        <span>'.$item->title.'</span>
0 ignored issues
show
Documentation introduced by
The property title does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
52
                    </a>
53
                </li>';
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getMenuWithDropDownWrapper(MenuItem $item, bool $specialSidebar = false): string
60
    {
61
        return $specialSidebar
62
            ? $this->getHeaderWrapper($item).$this->getChildMenuItems($item)
63
            : '<li class="treeview'.($item->hasActiveOnChild() ? ' active' : '').'">
64
                    <a href="#">
65
                        '.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').'
0 ignored issues
show
Documentation introduced by
The property icon does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
66
                        <span>'.$item->title.'</span>
0 ignored issues
show
Documentation introduced by
The property title does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
67
                        <span class="pull-right-container">
68
                            <i class="fa fa-angle-left pull-right"></i>
69
                        </span>
70
                    </a>
71
                    <ul class="treeview-menu">
72
                        '.$this->getChildMenuItems($item).'
73
                    </ul>
74
                </li>';
75
    }
76
77
    /**
78
     * Get multilevel menu wrapper.
79
     *
80
     * @param \Rinvex\Menus\Models\MenuItem $item
81
     *
82
     * @return string`
0 ignored issues
show
Documentation introduced by
The doc-type string` could not be parsed: Unknown type name "string`" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
83
     */
84
    public function getMultiLevelDropdownWrapper(MenuItem $item): string
85
    {
86
        return '<li class="treeview'.($item->hasActiveOnChild() ? ' active' : '').'">
87
                    <a href="#">
88
                        '.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').'
0 ignored issues
show
Documentation introduced by
The property icon does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
89
                        <span>'.$item->title.'</span>
0 ignored issues
show
Documentation introduced by
The property title does not exist on object<Rinvex\Menus\Models\MenuItem>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
90
                        <span class="pull-right-container">
91
                            <i class="fa fa-angle-left pull-right"></i>
92
                        </span>
93
                    </a>
94
                    <ul class="treeview-menu">
95
                        '.$this->getChildMenuItems($item).'
96
                    </ul>
97
                </li>';
98
    }
99
}
100