Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: Refactor Pager Class #1

Closed
taufik-nurrohman opened this issue Oct 30, 2022 · 2 comments
Closed

TODO: Refactor Pager Class #1

taufik-nurrohman opened this issue Oct 30, 2022 · 2 comments

Comments

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Oct 30, 2022

Inherit to Page class should be fine.

class Page extends File {
    public function pages() {}
}
class Pager extends Page {
    public function __construct(string $path = null, array $lot = []) {}
    public function next() {}
    public function parent() {}
    public function prev() {}
}
namespace Pager {
    class Page extends \Pager {
        public function __construct(string $path = null, array $lot = []) {}
        public function next() {}
        public function parent() {}
        public function prev() {}
    }
    class Pages extends \Pager {
        public function __construct(string $path = null, array $lot = []) {}
        public function next() {}
        public function parent() {}
        public function prev() {}
    }
}
@taufik-nurrohman
Copy link
Member Author

taufik-nurrohman commented Oct 31, 2022

class Pager extends Genome {
    public $path;
    public function __construct(string $path = null, array $lot = []) {
        if (is_dir($path)) {} // Pagination for pages
        if (is_file($path)) {} // Pagination for page
    }
}
// Pagination for page
$pager = new Pager('.\lot\page\article\lorem-ipsum.page');

// Pagination for pages
$pager = new Pager('.\lot\page\article', [
    'part' => 1,
    'route' => $url->path
]);

@taufik-nurrohman
Copy link
Member Author

taufik-nurrohman commented Nov 6, 2022

We have removed the pagination for single page as well 😈 This is how you would use the Pager class along with Pages class:

$pager = Pager::from($pages = Pages::from($folder));

$pager = $pager->chunk(25, 0);
$pages = $pages->chunk(25, 0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant