You are here

class GetLocationEvent in Smart IP 8.2

Same name and namespace in other branches
  1. 8.4 src/GetLocationEvent.php \Drupal\smart_ip\GetLocationEvent
  2. 8.3 src/GetLocationEvent.php \Drupal\smart_ip\GetLocationEvent

Provides Smart IP query location override event for event listeners.

@package Drupal\smart_ip

Hierarchy

  • class \Drupal\smart_ip\GetLocationEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of GetLocationEvent

1 file declares its use of GetLocationEvent
SmartIpEventSubscriber.php in modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php
Contains \Drupal\smart_ip_ipinfodb_web_service\EventSubscriber\SmartIpEventSubscriber.
1 string reference to 'GetLocationEvent'
smart_ip.services.yml in ./smart_ip.services.yml
smart_ip.services.yml
1 service uses GetLocationEvent
smart_ip.get_location_event in ./smart_ip.services.yml
Drupal\smart_ip\GetLocationEvent

File

src/GetLocationEvent.php, line 16
Contains \Drupal\smart_ip\GetLocationEvent.

Namespace

Drupal\smart_ip
View source
class GetLocationEvent extends Event {

  /**
   * Contains user's location
   *
   * @var \Drupal\smart_ip\SmartIpLocationInterface
   */
  protected $location;

  /**
   * Contains Smart IP data source info
   *
   * @var string
   */
  protected $dataSource;

  /**
   * Constructs a Smart IP event.
   *
   * @param \Drupal\smart_ip\SmartIpLocationInterface $location
   */
  public function __construct(SmartIpLocationInterface $location) {
    $this
      ->setLocation($location);
    $this->dataSource = \Drupal::config('smart_ip.settings')
      ->get('data_source');
  }

  /**
   * @return \Drupal\smart_ip\SmartIpLocationInterface
   */
  public function getLocation() {
    return $this->location;
  }

  /**
   * @param \Drupal\smart_ip\SmartIpLocationInterface $location
   */
  public function setLocation(SmartIpLocationInterface $location) {
    $this->location = $location;
  }

  /**
   * @return string
   */
  public function getDataSource() {
    return $this->dataSource;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GetLocationEvent::$dataSource protected property Contains Smart IP data source info
GetLocationEvent::$location protected property Contains user's location
GetLocationEvent::getDataSource public function
GetLocationEvent::getLocation public function
GetLocationEvent::setLocation public function
GetLocationEvent::__construct public function Constructs a Smart IP event.