Completed
Push — develop ( da6f13...3df636 )
by
unknown
07:00
created

ApiJobListByChannelController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A listAction() 0 21 1
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
/** Export controller */
11
namespace Jobs\Controller;
12
13
use Zend\Mvc\Controller\AbstractActionController;
14
use Zend\Paginator\Paginator;
15
use Zend\View\Model\ViewModel;
16
17
/**
18
 * Export jobs as XML feed
19
 *
20
 * @method \Core\Controller\Plugin\CreatePaginator pagination()
21
 */
22
class ApiJobListByChannelController extends AbstractActionController
23
{
24
25
    /**
26
     * List Jobs
27
     *
28
     * @return \Zend\Http\Response|ViewModel
29
     */
30
    public function listAction()
31
    {
32
33
        $channel = $this->params()->fromRoute('channel','default');
34
35
        /* @var Paginator $paginator */
36
        $paginator = $this->paginator('Jobs/Job', ['channel' => $channel ]);
0 ignored issues
show
Documentation Bug introduced by
The method paginator does not exist on object<Jobs\Controller\A...istByChannelController>? 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...
37
38
        $viewModel=new ViewModel();
39
        $viewModel->setVariables(
40
            [
41
                'jobs' => $paginator,
42
                'channel' => $channel
43
            ]
44
        );
45
46
        $viewModel->setTemplate('jobs/export/feed');
47
48
        return $viewModel;
49
50
    }
51
52
}
53