mbirth /
cops
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
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 Page |
||
|
0 ignored issues
–
show
|
|||
| 10 | { |
||
| 11 | public $title; |
||
| 12 | public $subtitle = ""; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 13 | public $authorName = ""; |
||
| 14 | public $authorUri = ""; |
||
| 15 | public $authorEmail = ""; |
||
| 16 | public $idPage; |
||
| 17 | public $idGet; |
||
| 18 | public $query; |
||
| 19 | public $favicon; |
||
| 20 | public $n; |
||
| 21 | public $book; |
||
| 22 | public $totalNumber = -1; |
||
| 23 | |||
| 24 | /* @var Entry[] */ |
||
| 25 | public $entryArray = array(); |
||
| 26 | |||
| 27 | 102 | public static function getPage ($pageId, $id, $query, $n) |
|
| 28 | { |
||
| 29 | switch ($pageId) { |
||
| 30 | 102 | case Base::PAGE_ALL_AUTHORS : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 31 | 3 | return new PageAllAuthors ($id, $query, $n); |
|
| 32 | 99 | case Base::PAGE_AUTHORS_FIRST_LETTER : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 33 | 1 | return new PageAllAuthorsLetter ($id, $query, $n); |
|
| 34 | 98 | case Base::PAGE_AUTHOR_DETAIL : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 35 | 7 | return new PageAuthorDetail ($id, $query, $n); |
|
| 36 | 91 | case Base::PAGE_ALL_TAGS : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 37 | 2 | return new PageAllTags ($id, $query, $n); |
|
| 38 | 89 | case Base::PAGE_TAG_DETAIL : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 39 | 1 | return new PageTagDetail ($id, $query, $n); |
|
| 40 | 88 | case Base::PAGE_ALL_LANGUAGES : |
|
| 41 | 2 | return new PageAllLanguages ($id, $query, $n); |
|
| 42 | 86 | case Base::PAGE_LANGUAGE_DETAIL : |
|
| 43 | 1 | return new PageLanguageDetail ($id, $query, $n); |
|
| 44 | 85 | case Base::PAGE_ALL_CUSTOMS : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 45 | 12 | return new PageAllCustoms ($id, $query, $n); |
|
| 46 | 73 | case Base::PAGE_CUSTOM_DETAIL : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 47 | 4 | return new PageCustomDetail ($id, $query, $n); |
|
| 48 | 69 | case Base::PAGE_ALL_RATINGS : |
|
| 49 | 1 | return new PageAllRating ($id, $query, $n); |
|
| 50 | 68 | case Base::PAGE_RATING_DETAIL : |
|
| 51 | 1 | return new PageRatingDetail ($id, $query, $n); |
|
| 52 | 67 | case Base::PAGE_ALL_SERIES : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 53 | 2 | return new PageAllSeries ($id, $query, $n); |
|
| 54 | 65 | case Base::PAGE_ALL_BOOKS : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 55 | 3 | return new PageAllBooks ($id, $query, $n); |
|
| 56 | 62 | case Base::PAGE_ALL_BOOKS_LETTER: |
|
| 57 | 1 | return new PageAllBooksLetter ($id, $query, $n); |
|
| 58 | 61 | case Base::PAGE_ALL_RECENT_BOOKS : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 59 | 4 | return new PageRecentBooks ($id, $query, $n); |
|
| 60 | 57 | case Base::PAGE_SERIE_DETAIL : |
|
| 61 | 1 | return new PageSerieDetail ($id, $query, $n); |
|
| 62 | 56 | case Base::PAGE_OPENSEARCH_QUERY : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 63 | 31 | return new PageQueryResult ($id, $query, $n); |
|
| 64 | 25 | case Base::PAGE_BOOK_DETAIL : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 65 | 1 | return new PageBookDetail ($id, $query, $n); |
|
| 66 | 24 | case Base::PAGE_ALL_PUBLISHERS: |
|
| 67 | 2 | return new PageAllPublishers ($id, $query, $n); |
|
| 68 | 22 | case Base::PAGE_PUBLISHER_DETAIL : |
|
| 69 | 1 | return new PagePublisherDetail ($id, $query, $n); |
|
| 70 | 21 | case Base::PAGE_ABOUT : |
|
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 71 | return new PageAbout ($id, $query, $n); |
||
| 72 | 21 | case Base::PAGE_CUSTOMIZE : |
|
| 73 | return new PageCustomize ($id, $query, $n); |
||
| 74 | 21 | default: |
|
| 75 | 21 | $page = new Page ($id, $query, $n); |
|
| 76 | 21 | $page->idPage = "cops:catalog"; |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
cops:catalog does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 77 | 21 | return $page; |
|
| 78 | 21 | } |
|
| 79 | } |
||
| 80 | |||
| 81 | 102 | public function __construct($pid, $pquery, $pn) { |
|
| 82 | 102 | global $config; |
|
| 83 | |||
| 84 | 102 | $this->idGet = $pid; |
|
| 85 | 102 | $this->query = $pquery; |
|
| 86 | 102 | $this->n = $pn; |
|
| 87 | 102 | $this->favicon = $config['cops_icon']; |
|
| 88 | 102 | $this->authorName = empty($config['cops_author_name']) ? utf8_encode('Sébastien Lucas') : $config['cops_author_name']; |
|
| 89 | 102 | $this->authorUri = empty($config['cops_author_uri']) ? 'http://blog.slucas.fr' : $config['cops_author_uri']; |
|
| 90 | 102 | $this->authorEmail = empty($config['cops_author_email']) ? '[email protected]' : $config['cops_author_email']; |
|
| 91 | 102 | } |
|
| 92 | |||
| 93 | 21 | public function InitializeContent () |
|
| 94 | { |
||
| 95 | 21 | global $config; |
|
| 96 | 21 | $this->title = $config['cops_title_default']; |
|
| 97 | 21 | $this->subtitle = $config['cops_subtitle_default']; |
|
| 98 | 21 | if (Base::noDatabaseSelected ()) { |
|
| 99 | 2 | $i = 0; |
|
| 100 | 2 | foreach (Base::getDbNameList () as $key) { |
|
| 101 | 2 | $nBooks = Book::getBookCount ($i); |
|
| 102 | 2 | array_push ($this->entryArray, new Entry ($key, "cops:{$i}:catalog", |
|
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $i instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 103 | 2 | str_format (localize ("bookword", $nBooks), $nBooks), "text", |
|
| 104 | 2 | array ( new LinkNavigation ("?" . DB . "={$i}")), "", $nBooks)); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
? does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
As per coding-style, please use concatenation or
sprintf for the variable $i instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 105 | 2 | $i++; |
|
| 106 | 2 | Base::clearDb (); |
|
| 107 | 2 | } |
|
| 108 | 2 | } else { |
|
| 109 | 19 | if (!in_array (PageQueryResult::SCOPE_AUTHOR, getCurrentOption ('ignored_categories'))) { |
|
| 110 | 18 | array_push ($this->entryArray, Author::getCount()); |
|
| 111 | 18 | } |
|
| 112 | 19 | View Code Duplication | if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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...
|
|||
| 113 | 18 | $series = Serie::getCount(); |
|
| 114 | 18 | if (!is_null ($series)) array_push ($this->entryArray, $series); |
|
| 115 | 18 | } |
|
| 116 | 19 | View Code Duplication | if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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...
|
|||
| 117 | 18 | $publisher = Publisher::getCount(); |
|
| 118 | 18 | if (!is_null ($publisher)) array_push ($this->entryArray, $publisher); |
|
| 119 | 18 | } |
|
| 120 | 19 | View Code Duplication | if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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...
|
|||
| 121 | 18 | $tags = Tag::getCount(); |
|
| 122 | 18 | if (!is_null ($tags)) array_push ($this->entryArray, $tags); |
|
| 123 | 18 | } |
|
| 124 | 19 | View Code Duplication | if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) { |
| 125 | 19 | $rating = Rating::getCount(); |
|
| 126 | 19 | if (!is_null ($rating)) array_push ($this->entryArray, $rating); |
|
| 127 | 19 | } |
|
| 128 | 19 | View Code Duplication | if (!in_array ("language", getCurrentOption ('ignored_categories'))) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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...
Coding Style
Comprehensibility
introduced
by
The string literal
language does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 129 | 18 | $languages = Language::getCount(); |
|
| 130 | 18 | if (!is_null ($languages)) array_push ($this->entryArray, $languages); |
|
| 131 | 18 | } |
|
| 132 | 19 | foreach ($config['cops_calibre_custom_column'] as $lookup) { |
|
| 133 | 15 | $customColumn = CustomColumnType::createByLookup($lookup); |
|
| 134 | 15 | if (!is_null ($customColumn) && $customColumn->isSearchable()) { |
|
| 135 | 14 | array_push ($this->entryArray, $customColumn->getCount()); |
|
| 136 | 14 | } |
|
| 137 | 19 | } |
|
| 138 | 19 | $this->entryArray = array_merge ($this->entryArray, Book::getCount()); |
|
| 139 | |||
| 140 | 19 | if (Base::isMultipleDatabaseEnabled ()) $this->title = Base::getDbName (); |
|
| 141 | } |
||
| 142 | 21 | } |
|
| 143 | |||
| 144 | 17 | public function isPaginated () |
|
| 145 | { |
||
| 146 | 17 | return (getCurrentOption ("max_item_per_page") != -1 && |
|
| 147 | 17 | $this->totalNumber != -1 && |
|
| 148 | 17 | $this->totalNumber > getCurrentOption ("max_item_per_page")); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
max_item_per_page does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 149 | } |
||
| 150 | |||
| 151 | 2 | View Code Duplication | public function getNextLink () |
|
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...
|
|||
| 152 | { |
||
| 153 | 2 | $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); |
|
| 154 | 2 | if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) { |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
max_item_per_page does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 155 | 1 | return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate")); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
&n= does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
next does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
paging.next.alternate does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 156 | } |
||
| 157 | 1 | return NULL; |
|
| 158 | } |
||
| 159 | |||
| 160 | 2 | View Code Duplication | public function getPrevLink () |
|
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...
|
|||
| 161 | { |
||
| 162 | 2 | $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
/\&n=.*?$/ does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
? does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 163 | 2 | if ($this->n > 1) { |
|
| 164 | 1 | return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate")); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
&n= does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
previous does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
paging.previous.alternate does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 165 | } |
||
| 166 | 2 | return NULL; |
|
| 167 | } |
||
| 168 | |||
| 169 | 2 | public function getMaxPage () |
|
| 170 | { |
||
| 171 | 2 | return ceil ($this->totalNumber / getCurrentOption ("max_item_per_page")); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
max_item_per_page does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 172 | } |
||
| 173 | |||
| 174 | 70 | public function containsBook () |
|
| 175 | { |
||
| 176 | 70 | if (count ($this->entryArray) == 0) return false; |
|
| 177 | 68 | if (get_class ($this->entryArray [0]) == "EntryBook") return true; |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
EntryBook does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 178 | 46 | return false; |
|
| 179 | } |
||
| 180 | } |
||
| 181 |
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.