Robmoen has submitted this change and it was merged.
Change subject: Hygiene: Remove suffix from stores names
......................................................................
Hygiene: Remove suffix from stores names
Since they are properly namespaced now
Change-Id: Iae4bad27c3c3d3ae7827691f528fe3372cedddb3
---
M Gather.php
M includes/models/Collection.php
M includes/specials/SpecialGather.php
R includes/stores/Collection.php
R includes/stores/CollectionsList.php
R includes/stores/DumbWatchlistOnlyCollectionsList.php
R includes/stores/ItemExtracts.php
R includes/stores/ItemImages.php
R includes/stores/WatchlistCollection.php
M includes/views/CollectionView.php
10 files changed, 39 insertions(+), 39 deletions(-)
Approvals:
Robmoen: Verified; Looks good to me, approved
diff --git a/Gather.php b/Gather.php
index 98bf321..518fbc5 100644
--- a/Gather.php
+++ b/Gather.php
@@ -45,12 +45,12 @@
'Gather\models\CollectionItem' => 'models/CollectionItem',
'Gather\models\Collection' => 'models/Collection',
- 'Gather\stores\CollectionStore' => 'stores/CollectionStore',
- 'Gather\stores\WatchlistCollectionStore' =>
'stores/WatchlistCollectionStore',
- 'Gather\stores\CollectionsListStore' => 'stores/CollectionsListStore',
- 'Gather\stores\DumbWatchlistOnlyCollectionsListStore' =>
'stores/DumbWatchlistOnlyCollectionsListStore',
- 'Gather\stores\ItemExtractsStore' => 'stores/ItemExtractsStore',
- 'Gather\stores\ItemImagesStore' => 'stores/ItemImagesStore',
+ 'Gather\stores\Collection' => 'stores/Collection',
+ 'Gather\stores\WatchlistCollection' => 'stores/WatchlistCollection',
+ 'Gather\stores\CollectionsList' => 'stores/CollectionsList',
+ 'Gather\stores\DumbWatchlistOnlyCollectionsList' =>
'stores/DumbWatchlistOnlyCollectionsList',
+ 'Gather\stores\ItemExtracts' => 'stores/ItemExtracts',
+ 'Gather\stores\ItemImages' => 'stores/ItemImages',
'Gather\views\View' => 'views/View',
'Gather\views\UserNotFoundView' => 'views/UserNotFoundView',
diff --git a/includes/models/Collection.php b/includes/models/Collection.php
index 671fe03..5cb14f3 100644
--- a/includes/models/Collection.php
+++ b/includes/models/Collection.php
@@ -6,7 +6,7 @@
namespace Gather\models;
-use Gather\stores\CollectionStore;
+use Gather\stores;
use \User;
use \Title;
use \IteratorAggregate;
@@ -164,9 +164,9 @@
/**
* Adds an array of titles to the collection
*
- * @param CollectionStore $store
+ * @param stores\Collection $store
*/
- public function load( CollectionStore $store ) {
+ public function load( stores\Collection $store ) {
$this->id = $store->getId();
$items = $store->getItems();
foreach ( $items as $item ) {
diff --git a/includes/specials/SpecialGather.php
b/includes/specials/SpecialGather.php
index 6198ddb..b519467 100644
--- a/includes/specials/SpecialGather.php
+++ b/includes/specials/SpecialGather.php
@@ -5,9 +5,9 @@
namespace Gather;
-use Gather\models\Collection;
-use Gather\stores as stores;
-use Gather\views as views;
+use Gather\models;
+use Gather\stores;
+use Gather\views;
use \User;
use \SpecialPage;
@@ -70,7 +70,7 @@
* @param int $id collection id
*/
public function renderUserCollection( User $user, $id ) {
- $collection = new Collection(
+ $collection = new models\Collection(
$user,
$this->msg( 'gather-watchlist-title' ),
$this->msg( 'gather-watchlist-description' )
@@ -80,7 +80,7 @@
// Watchlist is private
$collection->setPublic( false );
if ( $this->isOwner( $user ) ) {
- $collection->load( new
stores\WatchlistCollectionStore( $user ) );
+ $collection->load( new
stores\WatchlistCollection( $user ) );
}
}
// FIXME: For empty-collection and not-allowed-to-see-this we
are doing the
@@ -95,7 +95,7 @@
*/
public function renderUserCollectionsList( User $user ) {
// FIXME: Substitute with proper storage class
- $collectionsListStore = new
stores\DumbWatchlistOnlyCollectionsListStore(
+ $collectionsListStore = new
stores\DumbWatchlistOnlyCollectionsList(
$user, $this->isOwner( $user )
);
$this->render( new views\CollectionsListView(
$collectionsListStore->getLists() ) );
diff --git a/includes/stores/CollectionStore.php
b/includes/stores/Collection.php
similarity index 91%
rename from includes/stores/CollectionStore.php
rename to includes/stores/Collection.php
index f28be20..a3f46c8 100644
--- a/includes/stores/CollectionStore.php
+++ b/includes/stores/Collection.php
@@ -5,7 +5,7 @@
/**
* Abstraction for collection storage.
*/
-interface CollectionStore {
+interface Collection {
/**
* Get CollectionItem of all pages in the current collection.
*
diff --git a/includes/stores/CollectionsListStore.php
b/includes/stores/CollectionsList.php
similarity index 83%
rename from includes/stores/CollectionsListStore.php
rename to includes/stores/CollectionsList.php
index ed25ce9..8d5bee4 100644
--- a/includes/stores/CollectionsListStore.php
+++ b/includes/stores/CollectionsList.php
@@ -1,19 +1,19 @@
<?php
/**
- * CollectionsListStore.php
+ * CollectionsList.php
*/
namespace Gather\stores;
-use Gather\models\Collection;
+use Gather\models;
use \User;
/**
* Abstract class for a store that loads the collections of a user.
* Extend it and implement loadCollections.
*/
-abstract class CollectionsListStore {
+abstract class CollectionsList {
/**
* @var User Owner of the collections
@@ -21,7 +21,7 @@
protected $user;
/**
- * @var Collection[] Internal list of collections.
+ * @var models\Collection[] Internal list of collections.
*/
protected $lists = array();
@@ -57,9 +57,9 @@
* If the collection to add is private, and this collection list does
not include
* private items, the collection won't be added
*
- * @param Collection $collection
+ * @param models\Collection $collection
*/
- public function add( Collection $collection ) {
+ public function add( models\Collection $collection ) {
if ( $this->includePrivate ||
( !$this->includePrivate && $collection->isPublic() ) )
{
$this->lists[] = $collection;
@@ -69,7 +69,7 @@
/**
* Returns the list of collections
*
- * @return Collection[]
+ * @return models\Collection[]
*/
public function getLists() {
return $this->lists;
diff --git a/includes/stores/DumbWatchlistOnlyCollectionsListStore.php
b/includes/stores/DumbWatchlistOnlyCollectionsList.php
similarity index 73%
rename from includes/stores/DumbWatchlistOnlyCollectionsListStore.php
rename to includes/stores/DumbWatchlistOnlyCollectionsList.php
index b381cd2..d67f661 100644
--- a/includes/stores/DumbWatchlistOnlyCollectionsListStore.php
+++ b/includes/stores/DumbWatchlistOnlyCollectionsList.php
@@ -1,12 +1,12 @@
<?php
/**
- * DumbOnlyWatchlistCollectionsListStore.php
+ * DumbOnlyWatchlistCollectionsList.php
*/
namespace Gather\stores;
-use Gather\models\Collection;
+use Gather\models;
/**
* Dumb collections list store that only knows to return the watchlist.
@@ -14,7 +14,7 @@
* FIXME: This class will be substituted when we actually load collections
list from
* somewhere else.
*/
-class DumbWatchlistOnlyCollectionsListStore extends CollectionsListStore {
+class DumbWatchlistOnlyCollectionsList extends CollectionsList {
/**
* @inherit
*/
@@ -24,13 +24,13 @@
// Get watchlist collection (private)
// Directly avoid adding if no privates
if ( $this->includePrivate ) {
- $watchlist = new Collection(
+ $watchlist = new models\Collection(
$this->user,
wfMessage( 'gather-watchlist-title' ),
wfMessage( 'gather-watchlist-description' ),
false
);
- $watchlist->load( new WatchlistCollectionStore(
$this->user ) );
+ $watchlist->load( new WatchlistCollection( $this->user
) );
$collections[] = $watchlist;
}
return $collections;
diff --git a/includes/stores/ItemExtractsStore.php
b/includes/stores/ItemExtracts.php
similarity index 90%
rename from includes/stores/ItemExtractsStore.php
rename to includes/stores/ItemExtracts.php
index e456304..752dbce 100644
--- a/includes/stores/ItemExtractsStore.php
+++ b/includes/stores/ItemExtracts.php
@@ -9,7 +9,7 @@
/**
* Loading extracts for titles
*/
-class ItemExtractsStore {
+class ItemExtracts {
const CHAR_LIMIT=140;
/**
@@ -24,7 +24,7 @@
'prop' => 'extracts',
'explaintext' => true,
'exintro' => true,
- 'exchars' => ItemExtractsStore::CHAR_LIMIT,
+ 'exchars' => ItemExtracts::CHAR_LIMIT,
'titles' => implode( '|', $titles ),
'exlimit' => count( $titles ),
) ) );
diff --git a/includes/stores/ItemImagesStore.php
b/includes/stores/ItemImages.php
similarity index 93%
rename from includes/stores/ItemImagesStore.php
rename to includes/stores/ItemImages.php
index 7662f14..80c7e45 100644
--- a/includes/stores/ItemImagesStore.php
+++ b/includes/stores/ItemImages.php
@@ -7,7 +7,7 @@
/**
* Loading page images for titles
*/
-class ItemImagesStore {
+class ItemImages {
/**
* Load images for a collection of titles
diff --git a/includes/stores/WatchlistCollectionStore.php
b/includes/stores/WatchlistCollection.php
similarity index 77%
rename from includes/stores/WatchlistCollectionStore.php
rename to includes/stores/WatchlistCollection.php
index 45fe20f..35602a4 100644
--- a/includes/stores/WatchlistCollectionStore.php
+++ b/includes/stores/WatchlistCollection.php
@@ -2,7 +2,7 @@
namespace Gather\stores;
-use Gather\models\CollectionItem;
+use Gather\models;
use \User;
use \Title;
@@ -12,9 +12,9 @@
* Abstraction for watchlist storage.
* FIXME: This should live in core and power Special:EditWatchlist
*/
-class WatchlistCollectionStore implements CollectionStore {
+class WatchlistCollection implements Collection {
/**
- * @var CollectionItem[]
+ * @var models\CollectionItem[]
*/
protected $items = array();
@@ -34,17 +34,17 @@
}
/**
- * Initialise WatchlistCollectionStore from database
+ * Initialise WatchlistCollection from database
*
* @param User $user to lookup watchlist members for
*/
public function __construct( User $user ) {
$titles = $this->loadTitles( $user );
- $extracts = ItemExtractsStore::loadExtracts( $titles );
- $images = ItemImagesStore::loadImages( $titles );
+ $extracts = ItemExtracts::loadExtracts( $titles );
+ $images = ItemImages::loadImages( $titles );
foreach ( $titles as $key=>$title ) {
- $this->items[] = new CollectionItem( $title,
$images[$key], $extracts[$key] );
+ $this->items[] = new models\CollectionItem( $title,
$images[$key], $extracts[$key] );
}
}
diff --git a/includes/views/CollectionView.php
b/includes/views/CollectionView.php
index 2df06f1..ccdbeb4 100644
--- a/includes/views/CollectionView.php
+++ b/includes/views/CollectionView.php
@@ -99,7 +99,7 @@
$html .= $view->getHtml();
}
}
- // FIXME: Pagination(??) Note the WatchlistCollectionStore
+ // FIXME: Pagination(??) Note the stores\WatchlistCollection
// limits the size of the collection to 50.
// Pagination may or may not be needed.
$html .= Html::closeElement( 'div' );
--
To view, visit https://gerrit.wikimedia.org/r/190250
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iae4bad27c3c3d3ae7827691f528fe3372cedddb3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits