<?php declare(strict_types=1); namespace App\Plugin\Entrance\Hook; use…
- User
- Assistant
The given code is a PHP code snippet that defines a class named
Mainin the namespaceApp\Plugin\Entrance\Hook. The class extends theManagePluginclass and contains a constantENTRANCE_SESSION.The
Mainclass has a method namedentrance()which is annotated with the#[Hook(point: \App\Consts\Hook::KERNEL_INIT)]attribute. This method is executed when theKERNEL_INIThook is triggered.Inside the
entrance()method, it first retrieves the configuration for the "Entrance" plugin. If the "location" configuration is not set or is empty, the method returns.Next, it checks if the current route matches the configured entrance route. If it matches, it sets the
ENTRANCE_SESSIONsession variable totrueand redirects the client to the "/admin" route with a success message.If the route is "admin" and the
ENTRANCE_SESSIONsession variable is not set or is nottrue, it displays an error message indicating that the backend is accessed using the incorrect entrance.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.