Source

tdd-course-php / sources / Line_Item.php

<?php

require_once 'Product.php';

class Line_Item {

	public $product;
	# Note: the unit price of the product
	public $up;
	# Note: the quantity of the product item
	public $n;

	public static function for_product($a_product) {
		return new Line_Item($a_product);
	}
	
	function __construct($a_product) {
		$this->product = $a_product;
		$this->up = $a_product->price;
		$this->n = 1;	
	}
}

?>