-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBackstagePass.php
More file actions
38 lines (32 loc) · 924 Bytes
/
BackstagePass.php
File metadata and controls
38 lines (32 loc) · 924 Bytes
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
<?php
namespace App;
class BackstagePass extends Item
{
public function __construct($quality, $sellIn)
{
parent::__construct('Backstage passes to a TAFKAL80ETC concert', $quality, $sellIn);
}
/**
* Update quality and sellIn values the item to the next day
*/
public function nextDay()
{
if ($this->quality < 50) {
$this->quality = $this->quality + 1;
if ($this->sellIn < 11) {
if ($this->quality < 50) {
$this->quality = $this->quality + 1;
}
}
if ($this->sellIn < 6) {
if ($this->quality < 50) {
$this->quality = $this->quality + 1;
}
}
}
$this->sellIn = $this->sellIn - 1;
if ($this->sellIn < 0) {
$this->quality = $this->quality - $this->quality;
}
}
}