Code Duplication    Length = 18-18 lines in 2 locations

micro/cli/Threads.php 2 locations

@@ 90-107 (lines=18) @@
87
     * @return bool
88
     * @throws Exception
89
     */
90
    protected function createIPCSegment()
91
    {
92
        $this->fileIPC1 = '/tmp/' . mt_rand() . md5($this->getName()) . '.shm';
93
94
        touch($this->fileIPC1);
95
96
        $shm_key = ftok($this->fileIPC1, 't');
97
        if ($shm_key === -1) {
98
            throw new Exception('Fatal exception creating SHM segment (ftok)');
99
        }
100
101
        $this->internalIPCKey = @shmop_open($shm_key, 'c', 0644, 10240);
102
        if (!$this->internalIPCKey) {
103
            return false;
104
        }
105
106
        return true;
107
    }
108
109
    /**
110
     * get thread name
@@ 142-159 (lines=18) @@
139
     * @return bool
140
     * @throws Exception
141
     */
142
    protected function createIPCSemaphore()
143
    {
144
        $this->fileIPC2 = '/tmp/' . mt_rand() . md5($this->getName()) . '.sem';
145
146
        touch($this->fileIPC2);
147
148
        $sem_key = ftok($this->fileIPC2, 't');
149
        if ($sem_key === -1) {
150
            throw new Exception('Fatal exception creating semaphore (ftok)');
151
        }
152
153
        $this->internalSemaphoreKey = shmop_open($sem_key, 'c', 0644, 10);
154
        if (!$this->internalSemaphoreKey) {
155
            return false;
156
        }
157
158
        return true;
159
    }
160
161
    /**
162
     * Is running thread