Shorthand for a route accessed using OPTIONS.

@param string $pattern A route pattern such as /home/system
@param object $func    The handling function to be executed

@return bool
486774
public function options(string $pattern, $func)
    {
        if (is_array($func)) {
            if ($this->isPatternMatches($pattern)) {
                $this->middleware = $func['middleware'];
            }
            $func = end($func);
        }

        return $this->match(strtoupper(__FUNCTION__), $pattern, $func);
    }
1081011
public function options($pattern, $action)
    {
        self::$rules[self::REQUEST_METHOD_OPTIONS . self::patternFactory($pattern)] = $action;
        return $this;
    }
851105
public function callback($callback, $func, $args=array())
	{
		// Make sure the callback is set (this is protecting us when running in non-interactive mode and callbacks aren't set)
		if (!isset($this->callbacks[$callback]))
		{
			return false;
		}

		// Call function
		return call_user_func_array(array($this->callbacks[$callback], $func), $args);
	}
754121
protected function findConfiguration($value, \Closure $func)
    {
        /** @var AbstractPageRouteConfiguration $configuration */
        foreach ($this->all() as $configuration) {
            if ($func($configuration, $value)) {
                return $configuration;
            }
        }

        return null;
    }
1029789
public function addRoute($pattern, $endpoint) {
        if(is_object($endpoint) && $endpoint instanceof \Fubber\Reactor\EndpointInterface) {
            // All is fine and dandy
        } elseif (is_callable($endpoint)) {
            // Make a CallbackController
            return $this->addRoute($pattern, new CallbackController($endpoint));
        } else {
            $this->notice('Host::addRoute(): Expects a callback or a controller');
            return FALSE;
        }

        $count = substr_count($pattern, '*');

        if ($count === 0) {
            // This is merely a direct route
            $this->extraRoutes[$pattern] = $this->routes[$pattern] = $endpoint;
        } else {
            // Add this route to the $this->searchRoutes and sort it again
            $this->extraRoutes[$pattern] = $endpoint;
            $this->searchRoutes[] = array($pattern, $endpoint);
        }
    }
1318584
public function All( $Func )
	{

		$result = true;

		$Func = new Expression( $Func );

		foreach ( $this->repository as $item )
			$result &= $Func->execute( $item );

		return (boolean)$result;

	}
452574
public function Where( $Func )
	{

		if ( $Func != null ){

			$repo = array();

			$Func = new Expression( $Func );

			foreach ( $this->repository as $item )
				if ( $Func->execute( $item ) )
					$repo[] = $item;

		} else {

			$repo = $this->repository;

		}

		return $this->getClone()->setRepository( $repo );

	}
744839
public function offsetSet($pattern, $value)
    {
        if (empty($pattern)) {
            throw new \BadMethodCallException("Unable to append a Route without a pattern");
        }
        
        $route = $this->createRoute($value);
        parent::offsetSet($pattern, $route);
    }
556985
function route($pattern,$handler,$ttl=0,$kbps=0) {
		$types=['sync','ajax','cli'];
		$alias=null;
		if (is_array($pattern)) {
			foreach ($pattern as $item)
				$this->route($item,$handler,$ttl,$kbps);
			return;
		}
		preg_match('/([\|\w]+)\h+(?:(?:@?(.+?)\h*:\h*)?(@(\w+)|[^\h]+))'.
			'(?:\h+\[('.implode('|',$types).')\])?/u',$pattern,$parts);
		if (isset($parts[2]) && $parts[2])
			$this->hive['ALIASES'][$alias=$parts[2]]=$parts[3];
		elseif (!empty($parts[4])) {
			if (empty($this->hive['ALIASES'][$parts[4]]))
				user_error(sprintf(self::E_Named,$parts[4]),E_USER_ERROR);
			$parts[3]=$this->hive['ALIASES'][$alias=$parts[4]];
		}
		if (empty($parts[3]))
			user_error(sprintf(self::E_Pattern,$pattern),E_USER_ERROR);
		$type=empty($parts[5])?0:constant('self::REQ_'.strtoupper($parts[5]));
		foreach ($this->split($parts[1]) as $verb) {
			if (!preg_match('/'.self::VERBS.'/',$verb))
				$this->error(501,$verb.' '.$this->hive['URI']);
			$this->hive['ROUTES'][$parts[3]][$type][strtoupper($verb)]=
				[$handler,$ttl,$kbps,$alias];
		}
	}
931204
public function uriNotMatch($pattern, callable $handler)
    {
        if (!preg_match($pattern, $this->getCleanUri(), $matches)) {
            return $handler($this->getCleanUri(), $matches);
        }
    }
1027347
public function addRoute($methods, string $pattern, string $handler)
    {
        if (is_string($methods)) {
            $methods = (array) $methods;
        }

        $methods = array_map('strtoupper', $methods);

        $this->routes[] = [
            $methods,
            $pattern,
            $handler
        ];
    }
1372103
private function usingDirective($pattern, $control = false, $capture = false)
	{
		if ($control) {
			switch ($this->__engine) {
				case 'blade':
					return "/\@$pattern\((.*?)\)/";
					break;

				case 'modulus':
					return $capture == true ? "/\{\% $pattern\((.*?)\) \%\}/" : "/\{\% $pattern (.*?) \%\}/";
					break;

				default:
					return '';
					break;
			}

			return;
		}

		switch ($this->__engine) {
			case 'blade':
				return "/\@$pattern/";
				break;

			case 'modulus':
				return "/\{\% $pattern \%\}/";
				break;

			default:
				return '';
				break;
		}
	}
447332
public function post($pattern, $handler)
    {

        return $this->addRoute(
            new Route([Method::POST], $pattern, $handler)
        );
    }
1086363
public function setPath($pattern)
    {
        if (false !== strpbrk($pattern, '?<')) {
            $pattern = preg_replace_callback('#\{(\w++)(<.*?>)?(\?[^\}]*+)?\}#', function ($m) {
                if (isset($m[3][0])) {
                    $this->setDefault($m[1], '?' !== $m[3] ? substr($m[3], 1) : null);
                }
                if (isset($m[2][0])) {
                    $this->setRequirement($m[1], substr($m[2], 1, -1));
                }

                return '{'.$m[1].'}';
            }, $pattern);
        }

        // A pattern must start with a slash and must not have multiple slashes at the beginning because the
        // generated path for this route would be confused with a network path, e.g. '//domain.com/path'.
        $this->path = '/'.ltrim(trim($pattern), '/');
        $this->compiled = null;

        return $this;
    }
256594
private function addRoute($method, $pattern, $action)
    {

        if (is_array($method)) {
            foreach ($method as $verb) {
                $this->routes[$verb . $pattern] = ['method' => $verb, 'uri' => self::patternFactory($pattern), 'action' => $action];
            }
        } else {
            $this->routes[$method . $pattern] = ['method' => $method, 'uri' => self::patternFactory($pattern), 'action' => $action];
        }
    }
122228
public function on($event,$pattern,$handler) {
		$bak = $this->f3->ROUTES;
		$this->f3->ROUTES=array();
		$this->f3->route($pattern,$handler);
		$this->routes[$event] = (isset($this->routes[$event]))
			? $this->f3->extend('ROUTES',$this->routes[$event]) : $this->f3->ROUTES;
		$this->f3->ROUTES=$bak;
	}
45689
public function mount($pattern, $mux, array $options = array())
    {
        // Save the mount path in options array
        $options['mount_path'] = $pattern;

        if ($mux instanceof Expandable) {

            $mux = $mux->expand($options);

        } else if ($mux instanceof Closure) {

            // we pass the newly created Mux object to the builder closure to initialize routes.
            if ($ret = $mux($mux = new Mux())) {
                if ($ret instanceof Mux) {
                    $mux = $ret;
                } else {
                    throw new LogicException('Invalid object returned from Closure.');
                }
            }
        } elseif ((!is_object($mux) || !($mux instanceof self)) && is_callable($mux)) {
            $mux($mux = new self());
        }

        // Save the constructed mux object in options array, so we can fetch
        // the expanded mux object in controller object later.
        $mux->setParent($this);
        $options['mux'] = $mux;


        if ($this->expand) {
            $pcre = strpos($pattern,':') !== false;

            // rewrite submux routes
            foreach ($mux->routes as $route) {
                // process for pcre
                if ($route[0] || $pcre) {
                    $newPattern = $pattern . ( $route[0] ? $route[3]['pattern'] : $route[1] );
                    $routeArgs = PatternCompiler::compile($newPattern, 
                        array_replace_recursive($options, $route[3]) );
                    $this->appendPCRERoute( $routeArgs, $route[2] );
                } else {
                    $this->routes[] = array(
                        false,
                        $pattern . $route[1],
                        $route[2],
                        isset($route[3]) ? array_replace_recursive($options, $route[3]) : $options,
                    );
                }
            }
        } else {

            $muxId = $mux->getId();
            $this->add($pattern, $muxId, $options);
            $this->submux[ $muxId ] = $mux;

        }
    }