You are here

public function Context::__construct in Commerce Core 8.2

Constructs a new Context object.

Parameters

\Drupal\Core\Session\AccountInterface $customer: The customer.

\Drupal\commerce_store\Entity\StoreInterface $store: The store.

int|null $time: The unix timestamp, or NULL to use the current time.

array $data: The data.

File

src/Context.php, line 58

Class

Context
Contains known global information (customer, store, time).

Namespace

Drupal\commerce

Code

public function __construct(AccountInterface $customer, StoreInterface $store, int $time = NULL, array $data = []) {
  $this->customer = $customer;
  $this->store = $store;
  $this->time = $time ?: time();
  $this->data = $data;
}