Movie   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 25
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A movie() 0 16 2
1
<?php
2
3
namespace mQueue\View\Helper;
4
5
use mQueue\Model\User;
6
use Zend_View_Helper_Abstract;
7
8
class Movie extends Zend_View_Helper_Abstract
9
{
10
    /**
11
     * Returns a string for a movie. It is composed of a link to IMDb and the movie title which links to the movie page.
12
     *
13
     * @param \mQueue\Model\Movie $movie
14
     *
15
     * @return string
16
     */
17
    public function movie(\mQueue\Model\Movie $movie): string
18
    {
19
        $result = $this->view->link($movie);
20
21
        $user = User::getCurrent();
22
        if ($user) {
0 ignored issues
show
introduced by
$user is of type mQueue\Model\User, thus it always evaluated to true.
Loading history...
23
            $status = $movie->getStatus($user);
24
            $title = $this->view->translate('Your rating is : %s', [$status->getName()]);
25
        } else {
26
            $title = $this->view->translate('You are not logged in');
27
        }
28
29
        $movieUrl = $this->view->url(['controller' => 'movie', 'action' => 'view', 'id' => $movie->id], 'singleid', true);
30
        $result .= ' <a title="' . $title . '" href="' . $movieUrl . '">' . $this->view->escape($movie->getTitle()) . '</a>';
31
32
        return $result;
33
    }
34
}
35