/**
  * @param string $queueName
  * @param Priority $priority
  *
  * @return string
  */
 private function getQueueNameWithPrioritySuffix($queueName, Priority $priority)
 {
     $prioritySuffix = '';
     if ('' !== $priority->getName()) {
         $prioritySuffix = static::PRIORITY_SEPARATOR . $priority->getName();
     }
     return $queueName . $prioritySuffix;
 }
 /**
  * @inheritdoc
  *
  * @throws PriorityLevelException
  */
 public function getAfter(Priority $priority)
 {
     /** @var Priority $searchPriority*/
     $searchPriority = reset($this->priorities);
     if ($searchPriority->getLevel() === $priority->getLevel()) {
         $nextPriority = next($this->priorities);
         if (false === $nextPriority) {
             return $searchPriority;
         }
         return $nextPriority;
     }
     while ($searchPriority = next($this->priorities)) {
         if ($searchPriority->getLevel() === $priority->getLevel()) {
             $nextPriority = next($this->priorities);
             if (false === $nextPriority) {
                 return $searchPriority;
             }
             return $nextPriority;
         }
     }
     throw new PriorityLevelException('Level ' . $priority->getLevel() . ' doesn\'t exist.');
 }
 /**
  * @param string $queueName
  * @param Priority $priority
  *
  * @return string
  */
 private function getQueuePath($queueName, Priority $priority)
 {
     $prioritySuffix = '';
     if ('' !== $priority->getName()) {
         $prioritySuffix = static::PRIORITY_SEPARATOR . $priority->getName();
     }
     return rtrim($this->repository, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $queueName . $prioritySuffix . '.' . static::QUEUE_FILE_EXTENSION;
 }