/** * Add a product to the basket * * @param string $sku * @param string $name * @param Money $price * @param Closure $action * @return void */ public function add($sku, $name, Money $price, Closure $action = null) { $product = new Product($sku, $name, $price, $this->rate); if ($action) { $product->action($action); } $this->products->add($sku, $product); }
/** @test */ public function should_add_item() { $this->collection->add(5, 'Snowball II'); $this->assertEquals('Snowball II', $this->collection->get(5)); }
/** * Add a attribute * * @param string $key * @param mixed $value * * @return void */ public function attributes($key, $value) { $this->attributes->add($key, $value); }