You are here

class BrightcoveProxyInitSubscriber in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 modules/brightcove_proxy/src/EventSubscriber/BrightcoveProxyInitSubscriber.php \Drupal\brightcove_proxy\EventSubscriber\BrightcoveProxyInitSubscriber
  2. 3.x modules/brightcove_proxy/src/EventSubscriber/BrightcoveProxyInitSubscriber.php \Drupal\brightcove_proxy\EventSubscriber\BrightcoveProxyInitSubscriber

Subscribes to Drupal initialization event.

Hierarchy

  • class \Drupal\brightcove_proxy\EventSubscriber\BrightcoveProxyInitSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of BrightcoveProxyInitSubscriber

1 string reference to 'BrightcoveProxyInitSubscriber'
brightcove_proxy.services.yml in modules/brightcove_proxy/brightcove_proxy.services.yml
modules/brightcove_proxy/brightcove_proxy.services.yml
1 service uses BrightcoveProxyInitSubscriber
brightcove_proxy_init in modules/brightcove_proxy/brightcove_proxy.services.yml
Drupal\brightcove_proxy\EventSubscriber\BrightcoveProxyInitSubscriber

File

modules/brightcove_proxy/src/EventSubscriber/BrightcoveProxyInitSubscriber.php, line 14

Namespace

Drupal\brightcove_proxy\EventSubscriber
View source
class BrightcoveProxyInitSubscriber implements EventSubscriberInterface {

  /**
   * Brightcove proxy configuration.
   *
   * @var \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig
   */
  protected $config;

  /**
   * BrightcoveProxyInitSubscriber constructor.
   *
   * @param \Drupal\Core\Config\ConfigFactory $config
   *   Configuration object factory.
   */
  public function __construct(ConfigFactory $config) {
    $this->config = $config
      ->get('brightcove_proxy.config');
  }

  /**
   * Initialize Brightcove client proxy.
   *
   * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
   *   GET response event.
   */
  public function initializeBrightcoveClientProxy(GetResponseEvent $event) {

    // Initialize proxy config for Brightcove client if enabled.
    if ($this->config
      ->get('use_proxy')) {
      Client::$proxyUserPassword = "{$this->config->get('proxy_username')}:{$this->config->get('proxy_password')}";
      Client::$httpProxyTunnel = $this->config
        ->get('http_proxy_tunnel');
      Client::$proxyAuth = $this->config
        ->get('proxy_auth');
      Client::$proxyPort = $this->config
        ->get('proxy_port');
      Client::$proxyType = $this->config
        ->get('proxy_type');
      Client::$proxy = $this->config
        ->get('proxy');
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = [
      'initializeBrightcoveClientProxy',
    ];
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BrightcoveProxyInitSubscriber::$config protected property Brightcove proxy configuration.
BrightcoveProxyInitSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
BrightcoveProxyInitSubscriber::initializeBrightcoveClientProxy public function Initialize Brightcove client proxy.
BrightcoveProxyInitSubscriber::__construct public function BrightcoveProxyInitSubscriber constructor.