Jhernandez has uploaded a new change for review.
https://gerrit.wikimedia.org/r/190244
Change subject: Hygiene: namespace php classes
......................................................................
Hygiene: namespace php classes
Properly namespace files mirroring the folder structure.
Change-Id: I068c01651ee6643811895c17d435faed18823914
---
M Gather.php
M includes/models/Collection.php
M includes/models/CollectionItem.php
M includes/specials/SpecialGather.php
M includes/stores/CollectionStore.php
M includes/stores/CollectionsListStore.php
M includes/stores/DumbWatchlistOnlyCollectionsListStore.php
M includes/stores/ItemExtractsStore.php
M includes/stores/ItemImagesStore.php
M includes/stores/WatchlistCollectionStore.php
M includes/views/CollectionItemCardView.php
M includes/views/CollectionView.php
M includes/views/CollectionsListItemCardView.php
M includes/views/CollectionsListView.php
M includes/views/ItemImageView.php
M includes/views/UserNotFoundView.php
M includes/views/View.php
17 files changed, 49 insertions(+), 36 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather
refs/changes/44/190244/1
diff --git a/Gather.php b/Gather.php
index 1b3c8ad..ff3bc79 100644
--- a/Gather.php
+++ b/Gather.php
@@ -39,26 +39,26 @@
}
// autoload extension classes
-$autoloadClasses = array (
+$autoloadClasses = array(
'Gather\Hooks' => 'Gather.hooks',
- 'Gather\CollectionItem' => 'models/CollectionItem',
- 'Gather\Collection' => 'models/Collection',
+ 'Gather\models\CollectionItem' => 'models/CollectionItem',
+ 'Gather\models\Collection' => 'models/Collection',
- 'Gather\CollectionStore' => 'stores/CollectionStore',
- 'Gather\WatchlistCollectionStore' => 'stores/WatchlistCollectionStore',
- 'Gather\CollectionsListStore' => 'stores/CollectionsListStore',
- 'Gather\DumbWatchlistOnlyCollectionsListStore' =>
'stores/DumbWatchlistOnlyCollectionsListStore',
- 'Gather\ItemExtractsStore' => 'stores/ItemExtractsStore',
- 'Gather\ItemImagesStore' => 'stores/ItemImagesStore',
+ '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\View' => 'views/View',
- 'Gather\UserNotFoundView' => 'views/UserNotFoundView',
- 'Gather\CollectionView' => 'views/CollectionView',
- 'Gather\CollectionItemCardView' => 'views/CollectionItemCardView',
- 'Gather\ItemImageView' => 'views/ItemImageView',
- 'Gather\CollectionsListView' => 'views/CollectionsListView',
- 'Gather\CollectionsListItemCardView' =>
'views/CollectionsListItemCardView',
+ 'Gather\views\View' => 'views/View',
+ 'Gather\views\UserNotFoundView' => 'views/UserNotFoundView',
+ 'Gather\views\CollectionView' => 'views/CollectionView',
+ 'Gather\views\CollectionItemCardView' => 'views/CollectionItemCardView',
+ 'Gather\views\ItemImageView' => 'views/ItemImageView',
+ 'Gather\views\CollectionsListView' => 'views/CollectionsListView',
+ 'Gather\views\CollectionsListItemCardView' =>
'views/CollectionsListItemCardView',
'Gather\views\helpers\CSS' => 'views/helpers/CSS',
diff --git a/includes/models/Collection.php b/includes/models/Collection.php
index 71e8ee4..671fe03 100644
--- a/includes/models/Collection.php
+++ b/includes/models/Collection.php
@@ -4,8 +4,9 @@
* Collection.php
*/
-namespace Gather;
+namespace Gather\models;
+use Gather\stores\CollectionStore;
use \User;
use \Title;
use \IteratorAggregate;
diff --git a/includes/models/CollectionItem.php
b/includes/models/CollectionItem.php
index 204db1e..1f29559 100644
--- a/includes/models/CollectionItem.php
+++ b/includes/models/CollectionItem.php
@@ -4,7 +4,7 @@
* CollectionItem.php
*/
-namespace Gather;
+namespace Gather\models;
use \Title;
diff --git a/includes/specials/SpecialGather.php
b/includes/specials/SpecialGather.php
index d94756a..6198ddb 100644
--- a/includes/specials/SpecialGather.php
+++ b/includes/specials/SpecialGather.php
@@ -5,6 +5,9 @@
namespace Gather;
+use Gather\models\Collection;
+use Gather\stores as stores;
+use Gather\views as views;
use \User;
use \SpecialPage;
@@ -57,7 +60,7 @@
* Render an error when the user was not found
*/
public function renderUserNotFoundError() {
- $this->render( new UserNotFoundView() );
+ $this->render( new views\UserNotFoundView() );
}
/**
@@ -77,12 +80,12 @@
// Watchlist is private
$collection->setPublic( false );
if ( $this->isOwner( $user ) ) {
- $collection->load( new
WatchlistCollectionStore( $user ) );
+ $collection->load( new
stores\WatchlistCollectionStore( $user ) );
}
}
// FIXME: For empty-collection and not-allowed-to-see-this we
are doing the
// same thing right now.
- $this->render( new CollectionView( $collection ) );
+ $this->render( new views\CollectionView( $collection ) );
}
/**
@@ -92,10 +95,10 @@
*/
public function renderUserCollectionsList( User $user ) {
// FIXME: Substitute with proper storage class
- $collectionsListStore = new
DumbWatchlistOnlyCollectionsListStore(
+ $collectionsListStore = new
stores\DumbWatchlistOnlyCollectionsListStore(
$user, $this->isOwner( $user )
);
- $this->render( new CollectionsListView(
$collectionsListStore->getLists() ) );
+ $this->render( new views\CollectionsListView(
$collectionsListStore->getLists() ) );
}
/**
diff --git a/includes/stores/CollectionStore.php
b/includes/stores/CollectionStore.php
index 97b0092..f28be20 100644
--- a/includes/stores/CollectionStore.php
+++ b/includes/stores/CollectionStore.php
@@ -1,6 +1,6 @@
<?php
-namespace Gather;
+namespace Gather\stores;
/**
* Abstraction for collection storage.
diff --git a/includes/stores/CollectionsListStore.php
b/includes/stores/CollectionsListStore.php
index ec18a1f..ed25ce9 100644
--- a/includes/stores/CollectionsListStore.php
+++ b/includes/stores/CollectionsListStore.php
@@ -4,8 +4,9 @@
* CollectionsListStore.php
*/
-namespace Gather;
+namespace Gather\stores;
+use Gather\models\Collection;
use \User;
/**
diff --git a/includes/stores/DumbWatchlistOnlyCollectionsListStore.php
b/includes/stores/DumbWatchlistOnlyCollectionsListStore.php
index d0d8007..b381cd2 100644
--- a/includes/stores/DumbWatchlistOnlyCollectionsListStore.php
+++ b/includes/stores/DumbWatchlistOnlyCollectionsListStore.php
@@ -4,7 +4,9 @@
* DumbOnlyWatchlistCollectionsListStore.php
*/
-namespace Gather;
+namespace Gather\stores;
+
+use Gather\models\Collection;
/**
* Dumb collections list store that only knows to return the watchlist.
diff --git a/includes/stores/ItemExtractsStore.php
b/includes/stores/ItemExtractsStore.php
index 3fcdfcc..e456304 100644
--- a/includes/stores/ItemExtractsStore.php
+++ b/includes/stores/ItemExtractsStore.php
@@ -1,6 +1,6 @@
<?php
-namespace Gather;
+namespace Gather\stores;
use \ApiQuery;
use \ApiMain;
diff --git a/includes/stores/ItemImagesStore.php
b/includes/stores/ItemImagesStore.php
index 27894d1..7662f14 100644
--- a/includes/stores/ItemImagesStore.php
+++ b/includes/stores/ItemImagesStore.php
@@ -1,6 +1,6 @@
<?php
-namespace Gather;
+namespace Gather\stores;
use \PageImages;
diff --git a/includes/stores/WatchlistCollectionStore.php
b/includes/stores/WatchlistCollectionStore.php
index e8d7198..45fe20f 100644
--- a/includes/stores/WatchlistCollectionStore.php
+++ b/includes/stores/WatchlistCollectionStore.php
@@ -1,6 +1,8 @@
<?php
-namespace Gather;
+namespace Gather\stores;
+
+use Gather\models\CollectionItem;
use \User;
use \Title;
diff --git a/includes/views/CollectionItemCardView.php
b/includes/views/CollectionItemCardView.php
index b82aaec..5f7d198 100644
--- a/includes/views/CollectionItemCardView.php
+++ b/includes/views/CollectionItemCardView.php
@@ -3,8 +3,9 @@
* CollectionItemCardView.php
*/
-namespace Gather;
+namespace Gather\views;
+use Gather\models\CollectionItem;
use Gather\views\helpers\CSS;
use \Html;
diff --git a/includes/views/CollectionView.php
b/includes/views/CollectionView.php
index 4675fd1..2df06f1 100644
--- a/includes/views/CollectionView.php
+++ b/includes/views/CollectionView.php
@@ -3,12 +3,13 @@
* CollectionView.php
*/
-namespace Gather;
+namespace Gather\views;
use \Html;
use \User;
use \SpecialPage;
use Gather\views\helpers\CSS;
+use Gather\models\Collection;
/**
* Render a mobile card.
diff --git a/includes/views/CollectionsListItemCardView.php
b/includes/views/CollectionsListItemCardView.php
index 30d58e2..a15deeb 100644
--- a/includes/views/CollectionsListItemCardView.php
+++ b/includes/views/CollectionsListItemCardView.php
@@ -3,8 +3,9 @@
* CollectionsListItemCardView.php
*/
-namespace Gather;
+namespace Gather\views;
+use Gather\models\Collection;
use \Html;
/**
diff --git a/includes/views/CollectionsListView.php
b/includes/views/CollectionsListView.php
index d9ce18b..ead99a1 100644
--- a/includes/views/CollectionsListView.php
+++ b/includes/views/CollectionsListView.php
@@ -3,7 +3,7 @@
* CollectionsListView.php
*/
-namespace Gather;
+namespace Gather\views;
use \Html;
diff --git a/includes/views/ItemImageView.php b/includes/views/ItemImageView.php
index e672d63..fecdae3 100644
--- a/includes/views/ItemImageView.php
+++ b/includes/views/ItemImageView.php
@@ -3,8 +3,9 @@
* ItemImageView.php
*/
-namespace Gather;
+namespace Gather\views;
+use Gather\models\CollectionItem;
use Gather\views\helpers\CSS;
use \Html;
diff --git a/includes/views/UserNotFoundView.php
b/includes/views/UserNotFoundView.php
index 5b8c256..404aa8e 100644
--- a/includes/views/UserNotFoundView.php
+++ b/includes/views/UserNotFoundView.php
@@ -3,7 +3,7 @@
* UserNotFoundView.php
*/
-namespace Gather;
+namespace Gather\views;
use \Html;
diff --git a/includes/views/View.php b/includes/views/View.php
index 56af0c4..22da237 100644
--- a/includes/views/View.php
+++ b/includes/views/View.php
@@ -3,7 +3,7 @@
* View.php
*/
-namespace Gather;
+namespace Gather\views;
use \OutputPage;
--
To view, visit https://gerrit.wikimedia.org/r/190244
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I068c01651ee6643811895c17d435faed18823914
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits