lib/Lime/App.php
public function bind($path, $callback, $condition = true) {

        if (!$condition) return;

        if (!isset($this->routes[$path])) {
            $this->routes[$path] = [];
        }

        // make $this available in closures
        if (\is_object($callback) && $callback instanceof \Closure) {
            $callback = $callback->bindTo($this, $this);
        }

        // autou-register for /route/* also /route
        if (\substr($path, -2) == '/*' && !isset($this->routes[\substr($path, 0, -2)])) {
            $this->bind(\substr($path, 0, -2), $callback, $condition);
        }

        $this->routes[$path] = $callback;
    }
public function bind($path, $callback, $condition = true) {

        if (!$condition) return;

        if (!isset($this->routes[$path])) {
            $this->routes[$path] = [];
        }

        // make $this available in closures
        if (\is_object($callback) && $callback instanceof \Closure) {
            $callback = $callback->bindTo($this, $this);
        }

        // autou-register for /route/* also /route
        if (\substr($path, -2) == '/*' && !isset($this->routes[\substr($path, 0, -2)])) {
            $this->bind(\substr($path, 0, -2), $callback, $condition);
        }

        $this->routes[$path] = $callback;
    }
public function bind ( $ path , $ callback , $ condition = true ) { if ( ! $ condition ) return ; if ( ! isset ( $ this -> routes [ $ path ] ) ) { $ this -> routes [ $ path ] = [ ] ; } // make $this available in closures if ( \ is_object ( $ callback ) && $ callback instanceof \ Closure ) { $ callback = $ callback -> bindTo ( $ this , $ this ) ; } // autou-register for /route/* also /route if ( \ substr ( $ path , - 2 ) == '/*' && ! isset ( $ this -> routes [ \ substr ( $ path , 0 , - 2 ) ] ) ) { $ this -> bind ( \ substr ( $ path , 0 , - 2 ) , $ callback , $ condition ) ; } $ this -> routes [ $ path ] = $ callback ; }
Bind request to route
@param  String  $path
@param  \Closure  $callback
@param  Boolean $condition
@return void
Bind request to route