File tree Expand file tree Collapse file tree 14 files changed +43
-59
lines changed Expand file tree Collapse file tree 14 files changed +43
-59
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class Item extends Model implements Product
6262 return true;
6363 }
6464
65- public function getAmountProduct(): int
65+ public function getAmountProduct(Customer $customer ): int
6666 {
6767 return 100;
6868 }
@@ -71,8 +71,7 @@ class Item extends Model implements Product
7171 {
7272 return [
7373 'title' => $this->title,
74- 'description' => 'Purchase of Product #' . $this->id,
75- 'price' => $this->getAmountProduct(),
74+ 'description' => 'Purchase of Product #' . $this->id,
7675 ];
7776 }
7877
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return round($this->price * 100);
4242 }
@@ -46,7 +46,6 @@ class Item extends Model implements Product
4646 return [
4747 'title' => $this->title,
4848 'description' => 'Purchase of Product #' . $this->getUniqueId(),
49- 'price' => $this->getAmountProduct(),
5049 ];
5150 }
5251
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return 100;
4242 }
@@ -45,8 +45,7 @@ class Item extends Model implements Product
4545 {
4646 return [
4747 'title' => $this->title,
48- 'description' => 'Purchase of Product #' . $this->id,
49- 'price' => $this->getAmountProduct(),
48+ 'description' => 'Purchase of Product #' . $this->id,
5049 ];
5150 }
5251
@@ -75,7 +74,7 @@ Find the product.
7574
7675``` php
7776$item = Item::first();
78- $item->getAmountProduct(); // int(100)
77+ $item->getAmountProduct($first ); // int(100)
7978$item->balance; // int(0)
8079```
8180
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return 100;
4242 }
@@ -45,8 +45,7 @@ class Item extends Model implements Product
4545 {
4646 return [
4747 'title' => $this->title,
48- 'description' => 'Purchase of Product #' . $this->id,
49- 'price' => $this->getAmountProduct(),
48+ 'description' => 'Purchase of Product #' . $this->id,
5049 ];
5150 }
5251
@@ -70,7 +69,7 @@ Find the goods and check the cost.
7069
7170``` php
7271$item = Item::first();
73- $item->getAmountProduct(); // int(100)
72+ $item->getAmountProduct($user ); // int(100)
7473$item->balance; // int(0)
7574```
7675
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return 100;
4242 }
@@ -45,8 +45,7 @@ class Item extends Model implements Product
4545 {
4646 return [
4747 'title' => $this->title,
48- 'description' => 'Purchase of Product #' . $this->id,
49- 'price' => $this->getAmountProduct(),
48+ 'description' => 'Purchase of Product #' . $this->id,
5049 ];
5150 }
5251
@@ -70,7 +69,7 @@ Find the goods and check the cost.
7069
7170``` php
7271$item = Item::first();
73- $item->getAmountProduct(); // int(100)
72+ $item->getAmountProduct($user ); // int(100)
7473```
7574
7675The user can buy a product, buy...
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return 100;
4242 }
@@ -45,8 +45,7 @@ class Item extends Model implements Product
4545 {
4646 return [
4747 'title' => $this->title,
48- 'description' => 'Purchase of Product #' . $this->id,
49- 'price' => $this->getAmountProduct(),
48+ 'description' => 'Purchase of Product #' . $this->id,
5049 ];
5150 }
5251
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class Item extends Model implements Product
6565 return true;
6666 }
6767
68- public function getAmountProduct(): int
68+ public function getAmountProduct(Customer $customer ): int
6969 {
7070 return 100;
7171 }
@@ -74,8 +74,7 @@ class Item extends Model implements Product
7474 {
7575 return [
7676 'title' => $this->title,
77- 'description' => 'Purchase of Product #' . $this->id,
78- 'price' => $this->getAmountProduct(),
77+ 'description' => 'Purchase of Product #' . $this->id,
7978 ];
8079 }
8180}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return round($this->price * 100);
4242 }
@@ -45,8 +45,7 @@ class Item extends Model implements Product
4545 {
4646 return [
4747 'title' => $this->title,
48- 'description' => 'Purchase of Product #' . $this->getUniqueId(),
49- 'price' => $this->getAmountProduct(),
48+ 'description' => 'Purchase of Product #' . $this->getUniqueId(),
5049 ];
5150 }
5251
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Item extends Model implements Product
3636 return true;
3737 }
3838
39- public function getAmountProduct(): int
39+ public function getAmountProduct(Customer $customer ): int
4040 {
4141 return 100;
4242 }
@@ -45,8 +45,7 @@ class Item extends Model implements Product
4545 {
4646 return [
4747 'title' => $this->title,
48- 'description' => 'Purchase of Product #' . $this->id,
49- 'price' => $this->getAmountProduct(),
48+ 'description' => 'Purchase of Product #' . $this->id,
5049 ];
5150 }
5251
@@ -75,7 +74,7 @@ $last->balance; // int(0)
7574
7675``` php
7776$item = Item::first();
78- $item->getAmountProduct(); // int(100)
77+ $item->getAmountProduct($first ); // int(100)
7978$item->balance; // int(0)
8079```
8180
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class Item extends Model implements Product
4343 return true;
4444 }
4545
46- public function getAmountProduct(): int
46+ public function getAmountProduct(Customer $customer ): int
4747 {
4848 return 100;
4949 }
@@ -52,8 +52,7 @@ class Item extends Model implements Product
5252 {
5353 return [
5454 'title' => $this->title,
55- 'description' => 'Purchase of Product #' . $this->id,
56- 'price' => $this->getAmountProduct(),
55+ 'description' => 'Purchase of Product #' . $this->id,
5756 ];
5857 }
5958
@@ -77,7 +76,7 @@ $user->balance; // int(100)
7776
7877``` php
7978$item = Item::first();
80- $item->getAmountProduct(); // int(100)
79+ $item->getAmountProduct($user ); // int(100)
8180$item->balance; // int(0)
8281```
8382
You can’t perform that action at this time.
0 commit comments