seblucas /
cops
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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
|
|||
| 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
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
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 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.