/** * @param PayPal $payPal * @param Session $session */ public function __construct(PayPal $payPal, Session $session) { parent::__construct(); $this->payPal = $payPal; $this->session = $session->getSection('PayPalExpress'); $this->session->setExpiration('+10 minutes'); if (empty($this->session->token)) { $this->session->token = $this->_ec = Strings::random(6); } }
public function __construct(Nette\Http\SessionSection $shopCart, Trejjam\Utils\Labels\Labels $labels, Nette\Security\User $user) { $this->shopCart = $shopCart; $this->shopCart->setExpiration('14 days'); $this->labels = $labels; $this->user = $user; if (isset($this->shopCart->_userId) && $this->shopCart->_userId != $this->user->getId()) { $this->cartClear(); } if (!isset($this->shopCart->_userId)) { $this->shopCart->_userId = $this->user->getId(); } }
/** * Optional, if you set Session than enable automatic language dection. * * @param Http\Session $session * @return self */ public function setSession(Http\Session $session, $live = '+1 week') { $this->section = $session->getSection(__CLASS__); if (!isset($this->section->language)) { $this->setLanguage($this->detectLanguage()); $this->section->setExpiration($live); } return $this; }