class CaptchaImageGeneratorController in CAPTCHA 8
Controller which generates the image from defined settings.
Hierarchy
- class \Drupal\image_captcha\Controller\CaptchaImageGeneratorController implements ContainerInjectionInterface
Expanded class hierarchy of CaptchaImageGeneratorController
File
- image_captcha/
src/ Controller/ CaptchaImageGeneratorController.php, line 17
Namespace
Drupal\image_captcha\ControllerView source
class CaptchaImageGeneratorController implements ContainerInjectionInterface {
/**
* Connection container.
*
* @var \Drupal\Core\Database\Connection
*/
protected $connection;
/**
* Image Captcha config storage.
*
* @var \Drupal\Core\Config\Config
*/
protected $config;
/**
* File System Service.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* Watchdog logger channel for captcha.
*
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* Kill Switch for page caching.
*
* @var \Drupal\Core\PageCache\ResponsePolicy\KillSwitch
*/
protected $killSwitch;
/**
* {@inheritdoc}
*/
public function __construct(Config $config, LoggerInterface $logger, KillSwitch $kill_switch, Connection $connection, FileSystemInterface $file_system) {
$this->config = $config;
$this->logger = $logger;
$this->killSwitch = $kill_switch;
$this->connection = $connection;
$this->fileSystem = $file_system;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory')
->get('image_captcha.settings'), $container
->get('logger.factory')
->get('captcha'), $container
->get('page_cache_kill_switch'), $container
->get('database'), $container
->get('file_system'));
}
/**
* Main method that throw ImageResponse object to generate image.
*
* @return \Drupal\image_captcha\Response\CaptchaImageResponse
* Make a CaptchaImageResponse with the correct configuration and return it.
*/
public function image() {
$this->killSwitch
->trigger();
return new CaptchaImageResponse($this->config, $this->logger, $this->connection, $this->fileSystem);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CaptchaImageGeneratorController:: |
protected | property | Image Captcha config storage. | |
CaptchaImageGeneratorController:: |
protected | property | Connection container. | |
CaptchaImageGeneratorController:: |
protected | property | File System Service. | |
CaptchaImageGeneratorController:: |
protected | property | Kill Switch for page caching. | |
CaptchaImageGeneratorController:: |
protected | property | Watchdog logger channel for captcha. | |
CaptchaImageGeneratorController:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
CaptchaImageGeneratorController:: |
public | function | Main method that throw ImageResponse object to generate image. | |
CaptchaImageGeneratorController:: |
public | function |