Code Duplication    Length = 9-10 lines in 2 locations

src/WAMP.php 2 locations

@@ 158-166 (lines=9) @@
155
     *
156
     * @author Donii Sergii <[email protected]>
157
     */
158
    public function getClient($realm = null)
159
    {
160
        $realm = $realm ?? $this->realm;
161
        if (!isset($this->clients[$realm])) {
162
            $this->clients[$realm] = new Client($realm);
163
        }
164
165
        return $this->clients[$realm];
166
    }
167
168
    /**
169
     * Create and get client with new realm.
@@ 177-186 (lines=10) @@
174
     *
175
     * @author Donii Sergii <[email protected]>
176
     */
177
    public function createClient($realm = null)
178
    {
179
        $realm = $realm ?? $this->realm;
180
181
        if ($realm === $this->realm && isset($this->clients[$realm])) {
182
            return $this->clients[$realm];
183
        }
184
185
        return $this->clients[$realm] = new Client($realm);
186
    }
187
188
    /**
189
     * Get value from config.