Completed
Push — develop ( e3afa3...5fb421 )
by
unknown
07:45
created

UsersController::listAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 15
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
/** Auth controller */
11
namespace Auth\Controller;
12
13
use Auth\AuthenticationService;
14
use Auth\Repository\User;
15
use Auth\Service\Exception;
16
use Auth\Options\ModuleOptions;
17
use Zend\Mvc\Controller\AbstractActionController;
18
use Zend\View\Model\ViewModel;
19
20
21
/**
22
 * List registered users
23
 */
24
class UsersController extends AbstractActionController
25
{
26
27
28
    /**
29
     * @var  User $userRepository
30
     */
31
    private $userRepository;
0 ignored issues
show
Unused Code introduced by
The property $userRepository is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
32
33
    /**
34
     * Login with username and password
35
     *
36
     * @return \Zend\Http\Response|ViewModel
0 ignored issues
show
Documentation introduced by
Should the return type not be array?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
37
     */
38
    public function listAction()
39
    {
40
        /* @var \Zend\Http\Request $request */
41
        $request          = $this->getRequest();
42
        $params           = $request->getQuery();
43
44
        $paginator = $this->paginator('Auth/User', $params);
0 ignored issues
show
Documentation Bug introduced by
The method paginator does not exist on object<Auth\Controller\UsersController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
45
46
        $return = array(
47
            'by' => $params['by'],
48
            'users' => $paginator,
49
        );
50
51
        return $return;
52
    }
53
}