Teapot \ HttpException (404)
The service cannot be found. Teapot\HttpException thrown with message "The service cannot be found." Stacktrace: #3 Teapot\HttpException in /var/www/gbtt.uk/src/Controllers/ServiceController.php:61 #2 Metroapps\NationalRailTimetable\Controllers\ServiceController:run in /var/www/gbtt.uk/vendor/miklcct/thin_php_app/src/Controller/Application.php:48 #1 Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/gbtt.uk/vendor/miklcct/thin_php_app/src/Controller/Application.php:42$13:handle in /var/www/gbtt.uk/vendor/miklcct/thin_php_app/src/Controller/Application.php:54 #0 Miklcct\ThinPhpApp\Controller\Application:handle in /var/www/gbtt.uk/public_html/service.php:11
Stack frames (4)
3
Teapot\HttpException
/src/Controllers/ServiceController.php61
2
Metroapps\NationalRailTimetable\Controllers\ServiceController run
/vendor/miklcct/thin_php_app/src/Controller/Application.php48
1
Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/gbtt.uk/vendor/miklcct/thin_php_app/src/Controller/Application.php:42$13 handle
/vendor/miklcct/thin_php_app/src/Controller/Application.php54
0
Miklcct\ThinPhpApp\Controller\Application handle
/public_html/service.php11
            sscanf($query['date'], '%d-%d-%d', $year, $month, $day);
            $date = new Date($year, $month, $day);
        } else {
            $date = Date::today();
        }
        if (count(array_intersect_key(['uid' => null, 'rsid' => null], $query)) !== 1) {
            throw new LogicException('Either the UID or the RSID but not both must be specfified.');
        }
        $permanent_only = !empty($query['permanent_only']);
        $service = null;
        $service_repository = ($this->serviceRepositoryFactory)($permanent_only);
        if (isset($query['uid'])) {
            $service = $service_repository->getService($query['uid'], $date);
        }
        if (isset($query['rsid'])) {
            $service = $service_repository->getServiceByRsid($query['rsid'], $date)[0] ?? null;
        }
 
        if ($service === null) {
            throw new HttpException('The service cannot be found.', Http::NOT_FOUND);
        }
        if ($service->service instanceof ServiceCancellation) {
            throw new HttpException('The service has been STP cancelled.', Http::NOT_FOUND);
        }
        $service = $service_repository->getFullService($service);
 
        $response = ($this->viewResponseFactory)(
            new ServiceView(
                $this->streamFactory
                , $service
                , $permanent_only
                , $service_repository->getGeneratedDate()
                , $query['from'] ?? null === 'board' ? ViewMode::BOARD : ViewMode::TIMETABLE
            )
        )->withAddedHeader('Cache-Control', ['public', 'max-age=7200']);
        return !empty($query['date'])
            ? $response
            : $response->withAddedHeader(
                'Expires',
                str_replace(
    /**
     * Handle a request and return a response.
     *
     * The application will first pass the request through the defined middlewares sequentially.
     * The {@link run()} method is only called from the innermost middleware.
     *
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
    public function handle(ServerRequestInterface $request) : ResponseInterface {
        $handle = Closure::fromCallable([$this, 'run']);
        return MiddlewareApplication::bindMultiple(
            $this->getMiddlewares()
            , new class($handle) implements RequestHandlerInterface {
                public function __construct(callable $handle) {
                    $this->handle = $handle;
                }
 
                public function handle(ServerRequestInterface $request) : ResponseInterface {
                    return ($this->handle)($request);
                }
 
                /** @var callable */
                private $handle;
            }
        )->handle($request);
    }
 
    /**
     * Process the request after passed through the middlewares
     *
     * This the main controller. The request processed by the middlewares before it reaches this method,
     * and the response is processed by the middlewares before it is send out.
     *
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
    abstract protected function run(ServerRequestInterface $request) : ResponseInterface;
 
    /**
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
    public function handle(ServerRequestInterface $request) : ResponseInterface {
        $handle = Closure::fromCallable([$this, 'run']);
        return MiddlewareApplication::bindMultiple(
            $this->getMiddlewares()
            , new class($handle) implements RequestHandlerInterface {
                public function __construct(callable $handle) {
                    $this->handle = $handle;
                }
 
                public function handle(ServerRequestInterface $request) : ResponseInterface {
                    return ($this->handle)($request);
                }
 
                /** @var callable */
                private $handle;
            }
        )->handle($request);
    }
 
    /**
     * Process the request after passed through the middlewares
     *
     * This the main controller. The request processed by the middlewares before it reaches this method,
     * and the response is processed by the middlewares before it is send out.
     *
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
    abstract protected function run(ServerRequestInterface $request) : ResponseInterface;
 
    /**
     * Get the middlewares for this application.
     *
     * The middlewares must be sorted from the outermost to the innermost order, i.e. the beginning middleware
     * will process the initial request and create the final response.
     *
     * To disable middlewares of an existing application, override this method to return an empty array.
<?php
declare(strict_types=1);
 
use GuzzleHttp\Psr7\ServerRequest;
use Metroapps\NationalRailTimetable\Controllers\ServiceController;
 
use function Http\Response\send;
 
require_once __DIR__ . '/../initialise.php';
 
send(get_container()->get(ServiceController::class)->handle(ServerRequest::fromGlobals()));

Environment & details:

empty
empty
empty
empty
empty
Key Value
REDIRECT_HTTPS on
REDIRECT_SSL_TLS_SNI gbtt.uk
REDIRECT_STATUS 200
HTTPS on
SSL_TLS_SNI gbtt.uk
HTTP_ACCEPT */*
HTTP_USER_AGENT claudebot
HTTP_HOST gbtt.uk
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SERVER_SIGNATURE <address>Apache/2.4.59 (Debian) Server at gbtt.uk Port 443</address>
SERVER_SOFTWARE Apache/2.4.59 (Debian)
SERVER_NAME gbtt.uk
SERVER_ADDR 107.155.122.66
SERVER_PORT 443
REMOTE_ADDR 18.227.48.131
DOCUMENT_ROOT /var/www/gbtt.uk/public_html
REQUEST_SCHEME https
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT /var/www/gbtt.uk/public_html
SERVER_ADMIN [no address given]
SCRIPT_FILENAME /var/www/gbtt.uk/public_html/service.php
REMOTE_PORT 39231
REDIRECT_URL /service/Y42893/2023-03-27
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /service/Y42893/2023-03-27
SCRIPT_NAME /service.php
PATH_INFO /Y42893/2023-03-27
PATH_TRANSLATED /var/www/gbtt.uk/public_html/Y42893/2023-03-27
PHP_SELF /service.php/Y42893/2023-03-27
REQUEST_TIME_FLOAT 1713460042.8207
REQUEST_TIME 1713460042
empty
0. Whoops\Handler\PrettyPageHandler
1. Whoops\Handler\Handler@anonymous/var/www/gbtt.uk/initialise.php:102$0