src/Router.php
private function addRoute($uri, $method, $callback, $settings)
    {
        $groupItem = count($this->groups) - 1;
        $group = '';
        if ($groupItem > -1) {
            foreach ($this->groups as $key => $value) {
                $group .= $value['route'];
            }
        }

        $page = dirname($_SERVER['PHP_SELF']);
        $page = $page === '/' ? '' : $page;
        if (strstr($page, 'index.php')) {
            $data = implode('/', explode('/', $page));
            $page = str_replace($data, '', $page);
        }

        $route = $page . $group . '/' . trim($uri, '/');
        $route = rtrim($route, '/');
        if ($route === $page) {
            $route .= '/';
        }

        $data = [
            'route' => str_replace('//', '/', $route),
            'method' => strtoupper($method),
            'callback' => $callback,
            'name' => (isset($settings['name'])
                ? $settings['name']
                : null
            ),
            'before' => (isset($settings['before'])
                ? $settings['before']
                : null
            ),
            'after' => (isset($settings['after'])
                ? $settings['after']
                : null
            ),
            'group' => ($groupItem === -1) ? null : $this->groups[$groupItem]
        ];
        array_push($this->routes, $data);
    }
private function addRoute($uri, $method, $callback, $settings)
    {
        $groupItem = count($this->groups) - 1;
        $group = '';
        if ($groupItem > -1) {
            foreach ($this->groups as $key => $value) {
                $group .= $value['route'];
            }
        }

        $page = dirname($_SERVER['PHP_SELF']);
        $page = $page === '/' ? '' : $page;
        if (strstr($page, 'index.php')) {
            $data = implode('/', explode('/', $page));
            $page = str_replace($data, '', $page);
        }

        $route = $page . $group . '/' . trim($uri, '/');
        $route = rtrim($route, '/');
        if ($route === $page) {
            $route .= '/';
        }

        $data = [
            'route' => str_replace('//', '/', $route),
            'method' => strtoupper($method),
            'callback' => $callback,
            'name' => (isset($settings['name'])
                ? $settings['name']
                : null
            ),
            'before' => (isset($settings['before'])
                ? $settings['before']
                : null
            ),
            'after' => (isset($settings['after'])
                ? $settings['after']
                : null
            ),
            'group' => ($groupItem === -1) ? null : $this->groups[$groupItem]
        ];
        array_push($this->routes, $data);
    }
private function addRoute ( $ uri , $ method , $ callback , $ settings ) { $ groupItem = count ( $ this -> groups ) - 1 ; $ group = '' ; if ( $ groupItem > - 1 ) { foreach ( $ this -> groups as $ key => $ value ) { $ group .= $ value [ 'route' ] ; } } $ page = dirname ( $ _SERVER [ 'PHP_SELF' ] ) ; $ page = $ page === '/' ? '' : $ page ; if ( strstr ( $ page , 'index.php' ) ) { $ data = implode ( '/' , explode ( '/' , $ page ) ) ; $ page = str_replace ( $ data , '' , $ page ) ; } $ route = $ page . $ group . '/' . trim ( $ uri , '/' ) ; $ route = rtrim ( $ route , '/' ) ; if ( $ route === $ page ) { $ route .= '/' ; } $ data = [ 'route' => str_replace ( '//' , '/' , $ route ) , 'method' => strtoupper ( $ method ) , 'callback' => $ callback , 'name' => ( isset ( $ settings [ 'name' ] ) ? $ settings [ 'name' ] : null ) , 'before' => ( isset ( $ settings [ 'before' ] ) ? $ settings [ 'before' ] : null ) , 'after' => ( isset ( $ settings [ 'after' ] ) ? $ settings [ 'after' ] : null ) , 'group' => ( $ groupItem === - 1 ) ? null : $ this -> groups [ $ groupItem ] ] ; array_push ( $ this -> routes , $ data ) ; }
Add new Route and it's settings

@param $uri
@param $method
@param $callback
@param $settings

@return void
Add new Route and it s settings