Passed
Push — master ( 3db12d...858816 )
by Sébastien
03:31
created

EntryBook::getCover()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 3
nop 0
dl 9
loc 9
ccs 0
cts 5
cp 0
crap 12
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * COPS (Calibre OPDS PHP Server) class file
4
 *
5
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6
 * @author     Sébastien Lucas <[email protected]>
7
 */
8
9
class EntryBook extends Entry
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
{
11
    public $book;
12
13
    /**
14
     * EntryBook constructor.
15
     * @param string $ptitle
16
     * @param integer $pid
17
     * @param string $pcontent
18
     * @param string $pcontentType
19
     * @param array $plinkArray
20
     * @param Book $pbook
21
     */
22 41
    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
23 41
        parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
24 41
        $this->book = $pbook;
25 41
        $this->localUpdated = $pbook->timestamp;
26 41
    }
27
28 View Code Duplication
    public function getCoverThumbnail () {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
        foreach ($this->linkArray as $link) {
30
            /* @var $link LinkNavigation */
31
32
            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
33
                return $link->hrefXhtml ();
34
        }
35
        return null;
36
    }
37
38 View Code Duplication
    public function getCover () {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
        foreach ($this->linkArray as $link) {
40
            /* @var $link LinkNavigation */
41
42
            if ($link->rel == Link::OPDS_IMAGE_TYPE)
43
                return $link->hrefXhtml ();
44
        }
45
        return null;
46
    }
47
}
48