Created
June 25, 2014 10:37
-
-
Save lukeholder/a6e6956e787213e7604e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CellarSession implements \Cartalyst\Cart\Storage\StorageInterface | |
{ | |
public function getKey() | |
{ | |
return "cellar"; | |
} | |
public function identify() | |
{ | |
return "main_cart"; | |
} | |
public function get() | |
{ | |
craft()->httpSession->get($this->getSessionKey()); | |
} | |
public function put($value) | |
{ | |
craft()->httpSession->add($this->getSessionKey(), $value); | |
} | |
public function has() | |
{ | |
craft()->httpSession->contains($this->getSessionKey()); | |
} | |
public function forget() | |
{ | |
craft()->httpSession->remove($this->getSessionKey()); | |
} | |
protected function getSessionKey() | |
{ | |
return "{$this->getKey()}.{$this->identify()}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment