/** * Build a callable url * * @return string * @param array|bool $path * @param array $options Query parameter options to pass */ protected function buildUrl($path = false, array $options = []) { $isAbsolute = (Arrays::is($path) ? $path[0][0] : $path[0]) === '/'; $url = $isAbsolute ? '' : "/" . $this->index; if ($path && Arrays::i($path) && count($path) > 0) { $url .= "/" . implode("/", array_filter($path)); } if (substr($url, -1) == "/") { $url = substr($url, 0, -1); } if (count($options) > 0) { $url .= "?" . http_build_query($options, '', '&'); } return $url; }