Пример #1
0
 /**
  * Gets the semaphore for given profile.
  *
  * @param User $user The profile
  *
  * @return Semaphore
  */
 private function getSemaphore(User $user)
 {
     $key = 'api_' . $user->getHashCode();
     if (!isset($this->semaphores[$key])) {
         $this->semaphores[$key] = $this->factory->createSemaphore($key, $this->limit);
     }
     return $this->semaphores[$key];
 }