Test Setup Failed
Pull Request — master (#490)
by
unknown
02:08
created
lib/Author.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,69 +25,69 @@
 block discarded – undo
25 25
         $this->sort = $post->sort;
26 26
     }
27 27
 
28
-    public function getUri () {
29
-        return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id";
28
+    public function getUri() {
29
+        return "?page=" . parent::PAGE_AUTHOR_DETAIL . "&id=$this->id";
30 30
     }
31 31
 
32
-    public function getEntryId () {
33
-        return self::ALL_AUTHORS_ID.":".$this->id;
32
+    public function getEntryId() {
33
+        return self::ALL_AUTHORS_ID . ":" . $this->id;
34 34
     }
35 35
 
36
-    public static function getEntryIdByLetter ($startingLetter) {
37
-        return self::ALL_AUTHORS_ID.":letter:".$startingLetter;
36
+    public static function getEntryIdByLetter($startingLetter) {
37
+        return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter;
38 38
     }
39 39
 
40 40
     public static function getCount() {
41 41
         // str_format (localize("authors.alphabetical", count(array))
42
-        return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
42
+        return parent::getCountGeneric("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
43 43
     }
44 44
 
45 45
     public static function getAllAuthorsByFirstLetter() {
46
-        list (, $result) = parent::executeQuery ("select {0}
46
+        list (, $result) = parent::executeQuery("select {0}
47 47
 from authors
48 48
 group by substr (upper (sort), 1, 1)
49
-order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1);
49
+order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array(), -1);
50 50
         $entryArray = array();
51
-        while ($post = $result->fetchObject ())
51
+        while ($post = $result->fetchObject())
52 52
         {
53
-            array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
54
-                str_format (localize("authorword", $post->count), $post->count), "text",
55
-                array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count));
53
+            array_push($entryArray, new Entry($post->title, Author::getEntryIdByLetter($post->title),
54
+                str_format(localize("authorword", $post->count), $post->count), "text",
55
+                array(new LinkNavigation("?page=" . parent::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))), "", $post->count));
56 56
         }
57 57
         return $entryArray;
58 58
     }
59 59
 
60 60
     public static function getAuthorsByStartingLetter($letter) {
61
-        return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));
61
+        return self::getEntryArray(self::SQL_AUTHORS_BY_FIRST_LETTER, array($letter . "%"));
62 62
     }
63 63
 
64 64
     public static function getAuthorsForSearch($query) {
65
-        return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%"));
65
+        return self::getEntryArray(self::SQL_AUTHORS_FOR_SEARCH, array($query . "%", $query . "%"));
66 66
     }
67 67
 
68 68
     public static function getAllAuthors() {
69
-        return self::getEntryArray (self::SQL_ALL_AUTHORS, array ());
69
+        return self::getEntryArray(self::SQL_ALL_AUTHORS, array());
70 70
     }
71 71
 
72
-    public static function getEntryArray ($query, $params) {
73
-        return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author");
72
+    public static function getEntryArray($query, $params) {
73
+        return Base::getEntryArrayWithBookNumber($query, self::AUTHOR_COLUMNS, $params, "Author");
74 74
     }
75 75
 
76
-    public static function getAuthorById ($authorId) {
77
-        $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78
-        $result->execute (array ($authorId));
79
-        $post = $result->fetchObject ();
80
-        return new Author ($post);
76
+    public static function getAuthorById($authorId) {
77
+        $result = parent::getDb()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78
+        $result->execute(array($authorId));
79
+        $post = $result->fetchObject();
80
+        return new Author($post);
81 81
     }
82 82
 
83
-    public static function getAuthorByBookId ($bookId) {
84
-        $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
83
+    public static function getAuthorByBookId($bookId) {
84
+        $result = parent::getDb()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
85 85
 where author = authors.id
86 86
 and book = ? order by books_authors_link.id');
87
-        $result->execute (array ($bookId));
88
-        $authorArray = array ();
89
-        while ($post = $result->fetchObject ()) {
90
-            array_push ($authorArray, new Author ($post));
87
+        $result->execute(array($bookId));
88
+        $authorArray = array();
89
+        while ($post = $result->fetchObject()) {
90
+            array_push($authorArray, new Author($post));
91 91
         }
92 92
         return $authorArray;
93 93
     }
Please login to merge, or discard this patch.
Braces   +25 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,37 +19,42 @@  discard block
 block discarded – undo
19 19
     public $name;
20 20
     public $sort;
21 21
 
22
-    public function __construct($post) {
22
+    public function __construct($post)
23
+    {
23 24
         $this->id = $post->id;
24 25
         $this->name = str_replace("|", ",", $post->name);
25 26
         $this->sort = $post->sort;
26 27
     }
27 28
 
28
-    public function getUri () {
29
+    public function getUri ()
30
+    {
29 31
         return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id";
30 32
     }
31 33
 
32
-    public function getEntryId () {
34
+    public function getEntryId ()
35
+    {
33 36
         return self::ALL_AUTHORS_ID.":".$this->id;
34 37
     }
35 38
 
36
-    public static function getEntryIdByLetter ($startingLetter) {
39
+    public static function getEntryIdByLetter ($startingLetter)
40
+    {
37 41
         return self::ALL_AUTHORS_ID.":letter:".$startingLetter;
38 42
     }
39 43
 
40
-    public static function getCount() {
44
+    public static function getCount()
45
+    {
41 46
         // str_format (localize("authors.alphabetical", count(array))
42 47
         return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
43 48
     }
44 49
 
45
-    public static function getAllAuthorsByFirstLetter() {
50
+    public static function getAllAuthorsByFirstLetter()
51
+    {
46 52
         list (, $result) = parent::executeQuery ("select {0}
47 53
 from authors
48 54
 group by substr (upper (sort), 1, 1)
49 55
 order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1);
50 56
         $entryArray = array();
51
-        while ($post = $result->fetchObject ())
52
-        {
57
+        while ($post = $result->fetchObject ()) {
53 58
             array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
54 59
                 str_format (localize("authorword", $post->count), $post->count), "text",
55 60
                 array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count));
@@ -57,30 +62,36 @@  discard block
 block discarded – undo
57 62
         return $entryArray;
58 63
     }
59 64
 
60
-    public static function getAuthorsByStartingLetter($letter) {
65
+    public static function getAuthorsByStartingLetter($letter)
66
+    {
61 67
         return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));
62 68
     }
63 69
 
64
-    public static function getAuthorsForSearch($query) {
70
+    public static function getAuthorsForSearch($query)
71
+    {
65 72
         return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%"));
66 73
     }
67 74
 
68
-    public static function getAllAuthors() {
75
+    public static function getAllAuthors()
76
+    {
69 77
         return self::getEntryArray (self::SQL_ALL_AUTHORS, array ());
70 78
     }
71 79
 
72
-    public static function getEntryArray ($query, $params) {
80
+    public static function getEntryArray ($query, $params)
81
+    {
73 82
         return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author");
74 83
     }
75 84
 
76
-    public static function getAuthorById ($authorId) {
85
+    public static function getAuthorById ($authorId)
86
+    {
77 87
         $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78 88
         $result->execute (array ($authorId));
79 89
         $post = $result->fetchObject ();
80 90
         return new Author ($post);
81 91
     }
82 92
 
83
-    public static function getAuthorByBookId ($bookId) {
93
+    public static function getAuthorByBookId ($bookId)
94
+    {
84 95
         $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
85 96
 where author = authors.id
86 97
 and book = ? order by books_authors_link.id');
Please login to merge, or discard this patch.