|
1
|
|
|
<?php |
|
2
|
|
|
// phpcs:ignoreFile |
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of phpDocumentor. |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
* |
|
9
|
|
|
* @copyright 2010-2018 Mike van Riel<[email protected]> |
|
10
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
|
11
|
|
|
* @link http://phpdoc.org |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
namespace Luigi; |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
class Pizza extends \Pizza |
|
19
|
|
|
{ |
|
20
|
|
|
const |
|
21
|
|
|
/** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ |
|
22
|
|
|
DELIVERY = 'delivery', |
|
23
|
|
|
/** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ |
|
24
|
|
|
PICKUP = 'pickup'; |
|
25
|
|
|
|
|
26
|
|
|
/** @var static contains the active instance for this Pizza. */ |
|
27
|
|
|
static private $instance; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var Pizza\Style $style |
|
31
|
|
|
* @var Pizza\Sauce|null $sauce |
|
32
|
|
|
* @var Pizza\Topping[] $toppings |
|
33
|
|
|
*/ |
|
34
|
|
|
private $style, $sauce, $toppings; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* The size of the pizza in centimeters, defaults to 20cm. |
|
38
|
|
|
* |
|
39
|
|
|
* @var int |
|
40
|
|
|
*/ |
|
41
|
|
|
public $size = \Luigi\Pizza\SIZE_20CM; |
|
42
|
|
|
|
|
43
|
|
|
var $legacy; // don't use this anymore! |
|
44
|
|
|
|
|
45
|
|
|
protected |
|
46
|
|
|
/** @var string $packaging The type of packaging for this Pizza */ |
|
47
|
|
|
$packaging = self::PACKAGING, |
|
48
|
|
|
/** @var string $deliveryMethod Is the customer picking this pizza up or must it be delivered? */ |
|
49
|
|
|
$deliveryMethod; |
|
50
|
|
|
|
|
51
|
|
|
private function __construct(Pizza\Style $style) |
|
52
|
|
|
{ |
|
53
|
|
|
$this->style = $style; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Creates a new instance of a Pizza. |
|
58
|
|
|
* |
|
59
|
|
|
* This method can be used to instantiate a new object of this class which can then be retrieved using |
|
60
|
|
|
* {@see self::getInstance()}. |
|
61
|
|
|
* |
|
62
|
|
|
* @param Pizza\Style $style |
|
63
|
|
|
* |
|
64
|
|
|
* @see self::getInstance to retrieve the pizza object. |
|
65
|
|
|
* |
|
66
|
|
|
* @return void |
|
67
|
|
|
*/ |
|
68
|
|
|
public static function createInstance(Pizza\Style $style) |
|
69
|
|
|
{ |
|
70
|
|
|
self::$instance = new static($style); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @return self |
|
75
|
|
|
*/ |
|
76
|
|
|
static function getInstance() |
|
77
|
|
|
{ |
|
78
|
|
|
return self::$instance; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
final public function setSauce(Pizza\Sauce $sauce) |
|
82
|
|
|
{ |
|
83
|
|
|
$this->sauce = $sauce; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
final public function addTopping(Pizza\Topping $topping) |
|
87
|
|
|
{ |
|
88
|
|
|
$this->toppings[] = $topping; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function setSize(&$size = \Luigi\Pizza\SIZE_20CM) |
|
92
|
|
|
{ |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function getPrice() |
|
96
|
|
|
{ |
|
97
|
|
|
} |
|
98
|
|
|
} |
|
99
|
|
|
|