aboutsummaryrefslogtreecommitdiff
path: root/app/model/Navigation.php
blob: d32546ba01db39daaa11050453218999a17aed6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

class Navigation
{
    public function requestContains($route)
    {
        return (bool) (strpos($_SERVER['REQUEST_URI'], $route) !== false);
    }

    public function isActiveHome()
    {
        return (bool) (strlen(strtok($_SERVER['REQUEST_URI'], '?')) === 1);
    }

    public function isActive($route)
    {
        return (bool) ($_SERVER['REQUEST_URI'] === $route || $this->requestContains($route));
    }
}