vendor/php-flasher/flasher/Stamp/PriorityStamp.php line 10

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the PHPFlasher package.
  4.  * (c) Younes KHOUBZA <younes.khoubza@gmail.com>
  5.  */
  6. namespace Flasher\Prime\Stamp;
  7. final class PriorityStamp implements StampInterfaceOrderableStampInterfacePresentableStampInterface
  8. {
  9.     /**
  10.      * @var int
  11.      */
  12.     private $priority;
  13.     /**
  14.      * @param int $priority
  15.      */
  16.     public function __construct($priority)
  17.     {
  18.         $this->priority $priority;
  19.     }
  20.     /**
  21.      * @return int
  22.      */
  23.     public function getPriority()
  24.     {
  25.         return $this->priority;
  26.     }
  27.     /**
  28.      * {@inheritdoc}
  29.      */
  30.     public function compare($orderable)
  31.     {
  32.         if (!$orderable instanceof self) {
  33.             return 1;
  34.         }
  35.         return $this->priority $orderable->priority;
  36.     }
  37.     /**
  38.      * {@inheritdoc}
  39.      */
  40.     public function toArray()
  41.     {
  42.         return array('priority' => $this->getPriority());
  43.     }
  44. }