55use Pagerfanta \Adapter \AdapterInterface ;
66
77/**
8- * Class PagerFanta
8+ * Class PagerFanta.
9+ *
910 * @author Romain Richard
1011 */
1112class PagerFanta implements PagerInterface
@@ -22,7 +23,9 @@ class PagerFanta implements PagerInterface
2223
2324 /**
2425 * PagerFanta constructor.
26+ *
2527 * @param string $pagerStrategy
28+ *
2629 * @return PagerFanta
2730 */
2831 public function __construct ($ pagerStrategy )
@@ -31,7 +34,8 @@ public function __construct($pagerStrategy)
3134 }
3235
3336 /**
34- * @inheritdoc
37+ * {@inheritdoc}
38+ *
3539 * @return array
3640 */
3741 public function getCurrentPageResults ()
@@ -40,15 +44,16 @@ public function getCurrentPageResults()
4044 }
4145
4246 /**
43- * @inheritdoc
47+ * { @inheritdoc}
4448 */
4549 public function getPageCount ()
4650 {
4751 $ this ->pager ->getNbPages ();
4852 }
4953
5054 /**
51- * @inheritdoc
55+ * {@inheritdoc}
56+ *
5257 * @param mixed $results
5358 */
5459 public function setResults ($ results )
@@ -58,7 +63,8 @@ public function setResults($results)
5863 }
5964
6065 /**
61- * @inheritdoc
66+ * {@inheritdoc}
67+ *
6268 * @param int $max
6369 */
6470 public function setMaxPerPage ($ max )
@@ -67,7 +73,8 @@ public function setMaxPerPage($max)
6773 }
6874
6975 /**
70- * @inheritdoc
76+ * {@inheritdoc}
77+ *
7178 * @param int $page
7279 */
7380 public function setCurrentPage ($ page )
@@ -80,10 +87,11 @@ public function setCurrentPage($page)
8087 */
8188 public function setPagerStrategy ($ pagerStrategy )
8289 {
83- if (!class_exists ('Pagerfanta\Adapter \\' .$ pagerStrategy .'Adapter ' )) {
90+ $ pagerAdapter = sprintf ('%sAdapter ' , $ pagerStrategy );
91+ if (!class_exists (sprintf ('Pagerfanta\Adapter \\%s ' , $ pagerAdapter ))) {
8492 throw new \InvalidArgumentException (sprintf (
8593 'No adapter named %s found in %s namespace ' ,
86- $ pagerStrategy . ' Adapter ' ,
94+ $ pagerAdapter ,
8795 'Pagerfanta\Adapter '
8896 ));
8997 }
@@ -98,7 +106,7 @@ public function setPagerStrategy($pagerStrategy)
98106 */
99107 private function getPagerAdapter ($ results )
100108 {
101- $ adapterClassName = 'Pagerfanta\Adapter \\' . $ this ->pagerStrategy . ' Adapter ' ;
109+ $ adapterClassName = sprintf ( 'Pagerfanta\Adapter \\%sAdapter ' , $ this ->pagerStrategy ) ;
102110
103111 return new $ adapterClassName (...$ results );
104112 }
0 commit comments