Completed
Push — develop ( 725207...6c2664 )
by
unknown
16:33 queued 08:34
created

ViewController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Cv\Controller;
12
13
use Cv\Repository\Cv as CvRepository;
14
use Zend\Mvc\Controller\AbstractActionController;
15
16
/**
17
 * ${CARET}
18
 * 
19
 * @author Mathias Gelhausen <[email protected]>
20
 * @todo write test 
21
 */
22
class ViewController extends AbstractActionController
23
{
24
25
    /**
26
     *
27
     *
28
     * @var \Cv\Repository\Cv
29
     */
30
    private $repository;
31
32
    public function __construct(CvRepository $repository)
33
    {
34
        $this->repository = $repository;
35
    }
36
37
    public function indexAction()
38
    {
39
        /** @var string|null $id */
40
        $id = $this->params('id');
41
        $resume = $this->repository->find($id);
42
43
        if (!$resume) {
44
            throw new \Exception('No resume found with id ' . $id);
45
        }
46
47
        /* @todo REMOVE THIS
48
         * @codeCoverageIgnoreStart */
49
        if (!$resume->getDateCreated()) {
50
            $resume->setDateCreated();
51
        }
52
        /* @codeCoverageIgnoreEnd */
53
54
        $this->acl($resume, 'view');
0 ignored issues
show
Documentation Bug introduced by
The method acl does not exist on object<Cv\Controller\ViewController>? 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...
55
56
        return [
57
            'resume' => $resume
58
        ];
59
    }
60
    
61
}