| Conditions | 5 |
| Paths | 10 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 24 | public static function fetch($semaphoreID) |
||
| 25 | { |
||
| 26 | global $useSemaphores, $semaphoreModulus; |
||
| 27 | if (!isset($useSemaphores)) $useSemaphores = false; |
||
| 28 | if ($useSemaphores == false) return null; |
||
| 29 | if (!isset($semaphoreModulus)) $semaphoreModulus = 10; |
||
| 30 | |||
| 31 | $sem = sem_get($semaphoreID % $semaphoreModulus); |
||
| 32 | if (!sem_acquire($sem)) return null; |
||
| 33 | return $sem; |
||
| 34 | } |
||
| 35 | |||
| 44 |