UserlistModel   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 16
rs 10
c 2
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Saito - The Threaded Web Forum
7
 *
8
 * @copyright Copyright (c) the Saito Project Developers
9
 * @link https://github.com/Schlaefer/Saito
10
 * @license http://opensource.org/licenses/MIT
11
 */
12
13
namespace Saito\User\Userlist;
14
15
use App\Model\Table\UsersTable;
16
use Cake\ORM\TableRegistry;
17
use Saito\RememberTrait;
18
19
/**
20
 * Lazy load list of all users and cache
21
 */
22
class UserlistModel
23
{
24
    use RememberTrait;
25
26
    /**
27
     * Returns array with list of usernames
28
     *
29
     * @return array usernames
30
     */
31
    public function get(): array
32
    {
33
        return $this->remember('userlist', function () {
34
            /** @var UsersTable $users */
35
            $users = TableRegistry::get('Users');
0 ignored issues
show
Deprecated Code introduced by
The function Cake\ORM\TableRegistry::get() has been deprecated: 3.6.0 Use \Cake\ORM\Locator\TableLocator::get() instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

35
            $users = /** @scrutinizer ignore-deprecated */ TableRegistry::get('Users');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
36
37
            return $users->userlist();
38
        });
39
    }
40
}
41