From a293f82701dc41b015a38c390f5218b861aba31d Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Wed, 14 Jul 2021 23:12:17 +0200 Subject: [PATCH] Use a more common naming convention for abstract classes --- .../{Repository.php => AbstractRepository.php} | 8 ++++---- .../<%= slug %>/app/Repositories/PostRepository.php | 6 +++--- .../<%= slug %>/app/Repositories/TermRepository.php | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) rename template/web/wp-content/themes/<%= slug %>/app/Repositories/{Repository.php => AbstractRepository.php} (93%) diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/AbstractRepository.php similarity index 93% rename from template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php rename to template/web/wp-content/themes/<%= slug %>/app/Repositories/AbstractRepository.php index 92e78b0..161dd4a 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/AbstractRepository.php @@ -9,7 +9,7 @@ namespace Studiometa\Repositories; /** Class */ -abstract class Repository { +abstract class AbstractRepository { /** * List of posts. * @@ -42,7 +42,7 @@ public function first() { * * @param array $params Query params. * - * @return Repository + * @return AbstractRepository */ protected function query( array $params ) { // Clear old result sets. @@ -81,7 +81,7 @@ abstract protected function do_query( $params ); /** * Clears the current result set. * - * @return Repository + * @return AbstractRepository */ protected function reset() { $this->result_set = array(); @@ -93,7 +93,7 @@ protected function reset() { * * @param array $result_set Result set. * - * @return Repository + * @return AbstractRepository */ protected function result_set( $result_set = array() ) { $this->result_set = $result_set; diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php index 288ba16..181950e 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php @@ -10,7 +10,7 @@ use Timber\PostQuery; /** Class */ -class PostRepository extends Repository { +class PostRepository extends AbstractRepository { const CLASS_TYPE = '\Timber\Post'; const POST_TYPES = array( 'post' ); // Main post types. @@ -33,7 +33,7 @@ public function do_query( $params ) { * @param array $exclude Posts to exclude (optional). * @param integer $paged Enable pagination (optional). * - * @return Repository + * @return AbstractRepository */ public function posts_by_category_slug( $slug, $limit = 10, $exclude = array(), $paged = 0 ) { @@ -77,7 +77,7 @@ public function posts_by_category_slug( $slug, $limit = 10, $exclude = array(), * @param array $exclude IDs of posts to exclude. * @param integer $paged Enable pagination. * - * @return Repository + * @return AbstractRepository */ public function latest_posts( $limit = 10, array $exclude = array(), $paged = 0 ) { diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php index 00b1026..42604f4 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php @@ -10,7 +10,7 @@ use Timber\TermGetter; /** Class */ -final class TermRepository extends Repository { +final class TermRepository extends AbstractRepository { const CLASS_TYPE = '\Timber\Term'; /** @@ -30,7 +30,7 @@ public function do_query( $params ) { * @param array $exclude IDs of posts to exclude. * @param int $limit Number of maximum results. * - * @return Repository + * @return AbstractRepository */ public function top_level_terms( $taxonomy, $exclude = array(), $limit = 100 ) { // Set sane defaults so we don't do full table scans.