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 | require_once('base.php'); |
||
| 10 | |||
| 11 | class language extends Base { |
||
| 12 | const ALL_LANGUAGES_ID = "cops:languages"; |
||
| 13 | |||
| 14 | public $id; |
||
| 15 | public $lang_code; |
||
| 16 | |||
| 17 | 3 | public function __construct($pid, $plang_code) { |
|
| 18 | 3 | $this->id = $pid; |
|
| 19 | 3 | $this->lang_code = $plang_code; |
|
| 20 | 3 | } |
|
| 21 | |||
| 22 | 2 | public function getUri () { |
|
| 23 | 2 | return "?page=".parent::PAGE_LANGUAGE_DETAIL."&id=$this->id"; |
|
| 24 | } |
||
| 25 | |||
| 26 | 3 | public function getEntryId () { |
|
| 27 | 3 | return self::ALL_LANGUAGES_ID.":".$this->id; |
|
| 28 | } |
||
| 29 | |||
| 30 | 12 | public static function getLanguageString ($code) { |
|
| 31 | 12 | $string = localize("languages.".$code); |
|
| 32 | 12 | if (preg_match ("/^languages/", $string)) { |
|
| 33 | return $code; |
||
| 34 | } |
||
| 35 | 12 | return $string; |
|
| 36 | } |
||
| 37 | |||
| 38 | 7 | public static function getCount() { |
|
| 39 | // str_format (localize("languages.alphabetical", count(array)) |
||
| 40 | 7 | return parent::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, parent::PAGE_ALL_LANGUAGES); |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | public static function getLanguageById ($languageId) { |
|
| 44 | 1 | $result = parent::getDb ()->prepare('select id, lang_code from languages where id = ?'); |
|
| 45 | 1 | $result->execute (array ($languageId)); |
|
| 46 | 1 | if ($post = $result->fetchObject ()) { |
|
| 47 | 1 | return new Language ($post->id, Language::getLanguageString ($post->lang_code)); |
|
| 48 | } |
||
| 49 | return NULL; |
||
| 50 | } |
||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | 2 | public static function getAllLanguages() { |
|
| 55 | 2 | $result = parent::getDb ()->query('select languages.id as id, languages.lang_code as lang_code, count(*) as count |
|
|
0 ignored issues
–
show
|
|||
| 56 | from languages, books_languages_link |
||
| 57 | where languages.id = books_languages_link.lang_code |
||
| 58 | group by languages.id, books_languages_link.lang_code |
||
| 59 | 2 | order by languages.lang_code'); |
|
| 60 | 2 | $entryArray = array(); |
|
| 61 | 2 | while ($post = $result->fetchObject ()) |
|
| 62 | { |
||
| 63 | 2 | $language = new Language ($post->id, $post->lang_code); |
|
| 64 | 2 | array_push ($entryArray, new Entry (Language::getLanguageString ($language->lang_code), $language->getEntryId (), |
|
| 65 | 2 | str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 66 | 2 | array ( new LinkNavigation ($language->getUri ())), "", $post->count)); |
|
| 67 | 2 | } |
|
| 68 | 2 | return $entryArray; |
|
| 69 | } |
||
| 70 | } |
||
| 71 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.