Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adjusted pricing context to use Pimple

  • Loading branch information...
commit e11377adc1829cac66760d1a91d78b74f5fe0d98 1 parent 0ae4adf
@inspiran inspiran authored iampersistent committed
Showing with 7 additions and 60 deletions.
  1. +6 −2 composer.json
  2. +1 −58 lib/Vespolina/Entity/Pricing/PricingContext.php
View
8 composer.json
@@ -1,13 +1,17 @@
{
"name": "vespolina/core",
"type": "entities",
- "description": "Core code for the various Vespolina bundles, but not specific to Vespolina",
- "keywords": ["ecommerce"],
+ "description": "Core entities for the Vespolina Project",
+ "keywords": ["ecommerce, shop"],
"homepage": "https://github.com/vespolina/VespolinaCore",
"license": "MIT",
"require": {
"php": ">=5.3.2"
},
+ "require": {
+ "php": ">=5.3.2",
+ "pimple/pimple": "*"
+ },
"autoload": {
"psr-0": { "Vespolina": "lib/" }
},
View
59 lib/Vespolina/Entity/Pricing/PricingContext.php
@@ -16,64 +16,7 @@
use Vespolina\Entity\Pricing\PricingContextInterface;
-class PricingContext implements PricingContextInterface
+class PricingContext extends \Pimple //implements PricingContextInterface
{
- protected $data;
- protected $entities;
-
- public function __construct($data = array())
- {
- $this->data = $data;
- $this->entities = array();
- if ($this->getQuantity() === null) {
- $this->setQuantity(1);
- }
- }
-
- public function addEntity($entity)
- {
- $this->entities[] = $entity;
- }
-
- public function getEntities()
- {
- return $this->entities;
- }
-
- public function setEntities($entities)
- {
- $this->entities = $entities;
- }
-
- public function get($key, $default = null)
- {
- if (array_key_exists($key, $this->data)) {
- return $this->data[$key];
- } elseif ($default) {
- return $default;
- } else {
- return null;
- }
- }
-
- public function set($key, $value)
- {
- $this->data[$key] = $value;
- }
-
- public function getData()
- {
- return $this->data;
- }
-
- public function getQuantity()
- {
- return $this->get('quantity');
- }
-
- public function setQuantity($quantity)
- {
- $this->set('quantity', $quantity);
- }
}
Please sign in to comment.
Something went wrong with that request. Please try again.