Rename the property to be camel-cased

This commit is contained in:
kitfbgh 2022-04-02 10:47:06 +08:00
parent aa3aeb7a00
commit 5b6d211066
2 changed files with 8 additions and 8 deletions

View File

@ -29,12 +29,12 @@ final class GildedRose
if ($item->quality < 50) { if ($item->quality < 50) {
$item->quality = $item->quality + 1; $item->quality = $item->quality + 1;
if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') { if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->sell_in < 11) { if ($item->sellIn < 11) {
if ($item->quality < 50) { if ($item->quality < 50) {
$item->quality = $item->quality + 1; $item->quality = $item->quality + 1;
} }
} }
if ($item->sell_in < 6) { if ($item->sellIn < 6) {
if ($item->quality < 50) { if ($item->quality < 50) {
$item->quality = $item->quality + 1; $item->quality = $item->quality + 1;
} }
@ -44,10 +44,10 @@ final class GildedRose
} }
if ($item->name != 'Sulfuras, Hand of Ragnaros') { if ($item->name != 'Sulfuras, Hand of Ragnaros') {
$item->sell_in = $item->sell_in - 1; $item->sellIn = $item->sellIn - 1;
} }
if ($item->sell_in < 0) { if ($item->sellIn < 0) {
if ($item->name != 'Aged Brie') { if ($item->name != 'Aged Brie') {
if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') { if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->quality > 0) { if ($item->quality > 0) {

View File

@ -14,22 +14,22 @@ final class Item
/** /**
* @var int * @var int
*/ */
public $sell_in; public $sellIn;
/** /**
* @var int * @var int
*/ */
public $quality; public $quality;
public function __construct(string $name, int $sell_in, int $quality) public function __construct(string $name, int $sellIn, int $quality)
{ {
$this->name = $name; $this->name = $name;
$this->sell_in = $sell_in; $this->sellIn = $sellIn;
$this->quality = $quality; $this->quality = $quality;
} }
public function __toString(): string public function __toString(): string
{ {
return "{$this->name}, {$this->sell_in}, {$this->quality}"; return "{$this->name}, {$this->sellIn}, {$this->quality}";
} }
} }