Code Duplication    Length = 23-24 lines in 2 locations

class.AuthProvider.php 2 locations

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