Skip to content

Commit

Permalink
Remove Renderable
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza committed Aug 17, 2023
1 parent ca76245 commit 87d6a06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
17 changes: 3 additions & 14 deletions src/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Support\Traits\Macroable;
use JsonSerializable;
use ReflectionMethod;
Expand Down Expand Up @@ -37,7 +36,7 @@
* @method static Money sum(Money|\Money\Money $first, Money|\Money\Money ...$collection)
* @method static Money avg(Money|\Money\Money $first, Money|\Money\Money ...$collection)
*/
class Money implements Arrayable, Jsonable, JsonSerializable, Renderable
class Money implements Arrayable, Jsonable, JsonSerializable
{
use CurrenciesTrait;
use LocaleTrait;
Expand Down Expand Up @@ -149,7 +148,7 @@ public function jsonSerialize()
return array_merge(
$this->attributes,
$this->money->jsonSerialize(),
['formatted' => $this->render()]
['formatted' => $this->format()]
);
}

Expand All @@ -174,24 +173,14 @@ public function toJson($options = 0)
return json_encode($this->toArray(), $options);
}

/**
* Get the evaluated contents of the object.
*
* @return string
*/
public function render()
{
return $this->format();
}

/**
* __toString.
*
* @return string
*/
public function __toString()
{
return $this->render();
return $this->format();
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/MoneyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public function testGetters()
static::assertJson($money->toJson());
static::assertEquals($money->toArray(), $actual);
static::assertEquals($money->jsonSerialize(), $actual);
static::assertEquals('$1.00', $money->render());
static::assertEquals('$1.00', $money);
}

Expand Down

0 comments on commit 87d6a06

Please sign in to comment.