TwigExtension/Callback.php
public function callbackFunction($route = null, $parameters = [])
    {
        if ($route === null || ! is_string($route)) {
            // Gets URI from current request
            $uri = $this->request->getUri();
        } else {
            // Generates URI from '_route'
            $uri = $this->router->generate(
                $route,
                $parameters,
                Router::ABSOLUTE_URL
            );
        }

        $result = parse_url($uri);

        // When uri contains query string
        if (isset($result['query'])) {

            parse_str($result['query'], $query);

            // Remove callback from query
            $query = array_diff_key($query, ['callback' => null]);
        } else {
            // Return unchanged uri
            return $uri;
        }

        return $result['scheme'].'://'.
               (isset($result['user']) ? $result['user'] : '').
               (isset($result['pass']) ? ':'.$result['pass'].'@' : '').
               $result['host'].
               (isset($result['port']) ? ':'.$result['port'] : '').
               (isset($result['path']) ? $result['path'] : '').
               ($query != [] ? '?'.http_build_query($query) : '').
               (isset($result['fragment']) ? '#'.$result['fragment'] : '');
    }
public function callbackFunction($route = null, $parameters = [])
    {
        if ($route === null || ! is_string($route)) {
            // Gets URI from current request
            $uri = $this->request->getUri();
        } else {
            // Generates URI from '_route'
            $uri = $this->router->generate(
                $route,
                $parameters,
                Router::ABSOLUTE_URL
            );
        }

        $result = parse_url($uri);

        // When uri contains query string
        if (isset($result['query'])) {

            parse_str($result['query'], $query);

            // Remove callback from query
            $query = array_diff_key($query, ['callback' => null]);
        } else {
            // Return unchanged uri
            return $uri;
        }

        return $result['scheme'].'://'.
               (isset($result['user']) ? $result['user'] : '').
               (isset($result['pass']) ? ':'.$result['pass'].'@' : '').
               $result['host'].
               (isset($result['port']) ? ':'.$result['port'] : '').
               (isset($result['path']) ? $result['path'] : '').
               ($query != [] ? '?'.http_build_query($query) : '').
               (isset($result['fragment']) ? '#'.$result['fragment'] : '');
    }
public function callbackFunction ( $ route = null , $ parameters = [ ] ) { if ( $ route === null || ! is_string ( $ route ) ) { // Gets URI from current request $ uri = $ this -> request -> getUri ( ) ; } else { // Generates URI from '_route' $ uri = $ this -> router -> generate ( $ route , $ parameters , Router :: ABSOLUTE_URL ) ; } $ result = parse_url ( $ uri ) ; // When uri contains query string if ( isset ( $ result [ 'query' ] ) ) { parse_str ( $ result [ 'query' ] , $ query ) ; // Remove callback from query $ query = array_diff_key ( $ query , [ 'callback' => null ] ) ; } else { // Return unchanged uri return $ uri ; } return $ result [ 'scheme' ] . '://' . ( isset ( $ result [ 'user' ] ) ? $ result [ 'user' ] : '' ) . ( isset ( $ result [ 'pass' ] ) ? ':' . $ result [ 'pass' ] . '@' : '' ) . $ result [ 'host' ] . ( isset ( $ result [ 'port' ] ) ? ':' . $ result [ 'port' ] : '' ) . ( isset ( $ result [ 'path' ] ) ? $ result [ 'path' ] : '' ) . ( $ query != [ ] ? '?' . http_build_query ( $ query ) : '' ) . ( isset ( $ result [ 'fragment' ] ) ? '#' . $ result [ 'fragment' ] : '' ) ; }
Removes callbacks from query

@param string $route
@param array  $parameters

@return string
Removes callbacks from query