Esempio n. 1
0
 /**
  * Initialize Shield instance and perform authorization.
  * @param  array        $config    Configuration
  * @param  ShieldPanel  $panel     Tracy's ShieldPanel
  * @param  Response     $response  Http response
  */
 public function __construct(array $config, ShieldPanel $panel, Response $response)
 {
     // Store provided properties
     $this->config = array_merge($this->config, $config);
     $this->response = $response;
     // If Tracy panel is enabled
     if ($this->config['debugger']) {
         // Set Shield instance to panel
         $panel->setShield($this);
     }
     // If automatic mode is disabled or user is authorized
     if (!$this->isAutorun() || $this->isAuthorized()) {
         return null;
     }
     // User is unauthorized
     return $this->onUnauthorized();
 }