Skip to content

Commit

Permalink
Remove unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jan 9, 2025
1 parent c766fcb commit e279a75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
20 changes: 1 addition & 19 deletions src/Model/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,14 @@ public function __construct()

public function __toString(): string
{
$name = (string) $this->getName();

if ('' === $name) {
return (string) $this->getId();
}

return $name;
return (string) ($this->getName() ?? $this->getCode() ?? $this->getId());
}

public function getMultiplier(): float
{
return 1 - $this->getDiscount();
}

public function getChannelCodes(): array
{
return $this->channels->map(static function (BaseChannelInterface $channel): string {
return (string) $channel->getCode();
})->toArray();
}

public function getId(): ?int
{
return $this->id;
Expand Down Expand Up @@ -211,11 +198,6 @@ public function getDiscount(): float
return (float) $this->discount;
}

public function getDisplayableDiscount(): float
{
return $this->getDiscount() * 100;
}

public function setDiscount(float $discount): void
{
$this->discount = (string) $discount;
Expand Down
11 changes: 1 addition & 10 deletions src/Model/PromotionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Model\TimestampableInterface;

interface PromotionInterface extends ChannelsAwareInterface, CodeAwareInterface, TimestampableInterface, ResourceInterface
interface PromotionInterface extends ChannelsAwareInterface, CodeAwareInterface, TimestampableInterface, ResourceInterface, \Stringable
{
public function getId(): ?int;

public function __toString(): string;

public function getMultiplier(): float;

/**
* @return string[]
*/
public function getChannelCodes(): array;

public function getName(): ?string;

public function setName(?string $name): void;
Expand Down Expand Up @@ -72,7 +65,5 @@ public function removeRule(PromotionRuleInterface $rule): void;

public function getDiscount(): float;

public function getDisplayableDiscount(): float;

public function setDiscount(float $discount): void;
}

0 comments on commit e279a75

Please sign in to comment.