From 5b6d211066837d189c396b6b9b537890e507b0f8 Mon Sep 17 00:00:00 2001 From: kitfbgh Date: Sat, 2 Apr 2022 10:47:06 +0800 Subject: [PATCH] Rename the property to be camel-cased --- php/src/GildedRose.php | 8 ++++---- php/src/Item.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/php/src/GildedRose.php b/php/src/GildedRose.php index cfb7f78a..07a4d747 100644 --- a/php/src/GildedRose.php +++ b/php/src/GildedRose.php @@ -29,12 +29,12 @@ final class GildedRose if ($item->quality < 50) { $item->quality = $item->quality + 1; if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') { - if ($item->sell_in < 11) { + if ($item->sellIn < 11) { if ($item->quality < 50) { $item->quality = $item->quality + 1; } } - if ($item->sell_in < 6) { + if ($item->sellIn < 6) { if ($item->quality < 50) { $item->quality = $item->quality + 1; } @@ -44,10 +44,10 @@ final class GildedRose } 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 != 'Backstage passes to a TAFKAL80ETC concert') { if ($item->quality > 0) { diff --git a/php/src/Item.php b/php/src/Item.php index 762a98e6..dbc3bc9e 100644 --- a/php/src/Item.php +++ b/php/src/Item.php @@ -14,22 +14,22 @@ final class Item /** * @var int */ - public $sell_in; + public $sellIn; /** * @var int */ 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->sell_in = $sell_in; + $this->sellIn = $sellIn; $this->quality = $quality; } public function __toString(): string { - return "{$this->name}, {$this->sell_in}, {$this->quality}"; + return "{$this->name}, {$this->sellIn}, {$this->quality}"; } }