-
Notifications
You must be signed in to change notification settings - Fork 1
/
Movie.php
59 lines (49 loc) · 1.19 KB
/
Movie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Created by JetBrains PhpStorm.
* User: merklik
* Date: 4/27/13
* Time: 7:12 AM
* To change this template use File | Settings | File Templates.
*/
namespace Refactoring;
require_once ('Price.php');
class Movie
{
const CHILDRENS = 2;
const REGULAR = 0;
const NEW_RELEASE = 1;
private $_title;
private $_price;
function __construct($title, $priceCode)
{
$this->_title = $title;
$this->setPriceCode($priceCode);
}
public function setPriceCode($arg)
{
switch ($arg) {
case Movie::REGULAR:
$this->_price = new RegularPrice();
break;
case Movie::NEW_RELEASE:
$this->_price = new NewRelasePrice();
break;
case Movie::CHILDRENS:
$this->_price = new ChilderPrice();
break;
}
}
public function getTitle()
{
return $this->_title;
}
public function getFrequentRenterPoints($daysRented)
{
return $this->_price->getFrequentRenterPoints($daysRented);
}
public function getCharge($daysRented)
{
return $this->_price->getCharge($daysRented);
}
}