Code Duplication    Length = 23-24 lines in 2 locations

class.AuthProvider.php 2 locations

@@ 327-349 (lines=23) @@
324
     *
325
     * @return boolean true if the user was successfully created. Otherwise false.
326
     */
327
    public function createPendingUser($user, $methodName = false)
328
    {
329
        if($methodName === false)
330
        {
331
            $count = count($this->methods);
332
            for($i = 0; $i < $count; $i++)
333
            {
334
                if($this->methods[$i]->pending === false)
335
                {
336
                    continue;
337
                }
338
339
                $ret = $this->methods[$i]->createPendingUser($user);
340
                if($ret !== false)
341
                {
342
                    return true;
343
                }
344
            }
345
            return false;
346
        }
347
        $auth = $this->getMethodByName($methodName);
348
        return $auth->createPendingUser($user);
349
    }
350
351
    /**
352
     * Convert a Auth\PendingUser into an Auth\User
@@ 362-385 (lines=24) @@
359
     *
360
     * @return boolean true if the user was successfully created. Otherwise false.
361
     */
362
    public function activatePendingUser($user, $methodName = false)
363
    {
364
        if($methodName === false)
365
        {
366
            $count = count($this->methods);
367
            for($i = 0; $i < $count; $i++)
368
            {
369
                if($this->methods[$i]->current === false)
370
                {
371
                    continue;
372
                }
373
374
                $ret = $this->methods[$i]->activatePendingUser($user);
375
                if($ret !== false)
376
                {
377
                    $this->impersonateUser($ret);
378
                    return true;
379
                }
380
            }
381
            return false;
382
        }
383
        $auth = $this->getMethodByName($methodName);
384
        return $auth->activatePendingUser($user);
385
    }
386
387
    /**
388
     * Get a current user by a password reset hash