You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
42 lines
710 B
PHP
42 lines
710 B
PHP
<?php
|
|
|
|
namespace Flasher\Prime\Stamp;
|
|
|
|
final class PriorityStamp implements StampInterface, OrderableStampInterface
|
|
{
|
|
/**
|
|
* @var int
|
|
*/
|
|
private $priority;
|
|
|
|
/**
|
|
* @param int $priority
|
|
*/
|
|
public function __construct($priority)
|
|
{
|
|
$this->priority = $priority;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getPriority()
|
|
{
|
|
return $this->priority;
|
|
}
|
|
|
|
/**
|
|
* @param OrderableStampInterface $orderable
|
|
*
|
|
* @return int
|
|
*/
|
|
public function compare($orderable)
|
|
{
|
|
if (!$orderable instanceof PriorityStamp) {
|
|
return 0;
|
|
}
|
|
|
|
return $this->priority > $orderable->priority;
|
|
}
|
|
}
|