r58727 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58726‎ | r58727 | r58728 >
Date:18:19, 7 November 2009
Author:ashley
Status:deferred
Tags:
Comment:
DataCenter:
*coding style cleanup for remaining files
*doxygen tweaks
*added version number into $wgExtensionCredits
Modified paths:
  • /trunk/extensions/DataCenter/DataCenter.db.php (modified) (history)
  • /trunk/extensions/DataCenter/DataCenter.js (modified) (history)
  • /trunk/extensions/DataCenter/DataCenter.page.php (modified) (history)
  • /trunk/extensions/DataCenter/DataCenter.php (modified) (history)
  • /trunk/extensions/DataCenter/DataCenter.ui.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataCenter/DataCenter.php
@@ -18,8 +18,8 @@
1919
2020 // Check environment
2121 if ( !defined( 'MEDIAWIKI' ) ) {
22 - echo ( "This is a MediaWiki extension and cannot be run standalone.\n" );
23 - die ( 1 );
 22+ echo( "This is a MediaWiki extension and cannot be run standalone.\n" );
 23+ die( 1 );
2424 }
2525
2626 /* Configuration */
@@ -35,6 +35,7 @@
3636 $wgExtensionCredits['other'][] = array(
3737 'path' => __FILE__,
3838 'name' => 'DataCenter',
 39+ 'version' => '0.1.0',
3940 'author' => 'Trevor Parscal',
4041 'url' => 'http://www.mediawiki.org/wiki/Extension:DataCenter',
4142 'description' => 'DataCenter Planning and Asset Tracking System',
Index: trunk/extensions/DataCenter/DataCenter.db.php
@@ -139,73 +139,58 @@
140140
141141 /**
142142 * Checks if type exists in any of the type categories
143 - * @param category String of category to look up type in
144 - * @param type String of type to check for
 143+ * @param $category String: category to look up type in
 144+ * @param $type String: type to check for
145145 */
146 - public static function isType(
147 - $category,
148 - $type
149 - ) {
 146+ public static function isType( $category, $type ) {
150147 return isset( self::$types[$category][$type] );
151148 }
152149
153150 /**
154151 * Checks if type exists in the facility category
155 - * @param type String of asset type to check for
 152+ * @param $type String: asset type to check for
156153 */
157 - public static function isFacilityType(
158 - $type
159 - ) {
 154+ public static function isFacilityType( $type ) {
160155 return isset( self::$types['facility'][$type] );
161156 }
162157
163158 /**
164159 * Checks if type exists in the link category
165 - * @param type String of asset type to check for
 160+ * @param $type String: asset type to check for
166161 */
167 - public static function isLinkType(
168 - $type
169 - ) {
 162+ public static function isLinkType( $type ) {
170163 return isset( self::$types['link'][$type] );
171164 }
172165
173166 /**
174167 * Checks if type exists in the asset category
175 - * @param type String of asset type to check for
 168+ * @param $type String: asset type to check for
176169 */
177 - public static function isAssetType(
178 - $type
179 - ) {
 170+ public static function isAssetType( $type ) {
180171 return isset( self::$types['asset'][$type] );
181172 }
182173
183174 /**
184175 * Checks if type exists in the model category
185 - * @param type String of model type to check for
 176+ * @param $type String: model type to check for
186177 */
187 - public static function isModelType(
188 - $type
189 - ) {
 178+ public static function isModelType( $type ) {
190179 return isset( self::$types['model'][$type] );
191180 }
192181
193182 /**
194183 * Checks if type exists in the asset category
195 - * @param type String of meta type to check for
 184+ * @param $type String: meta type to check for
196185 */
197 - public static function isMetaType(
198 - $type
199 - ) {
 186+ public static function isMetaType( $type ) {
200187 return isset( self::$types['meta'][$type] );
201188 }
202189
203190 /**
204191 * Checks if class is or is subclass of DataCenterDBRow
205 - * @param rowClass String of name of class to check
 192+ * @param $rowClass String: name of class to check
206193 */
207 - public static function isRowClass(
208 - $class
209 - ) {
 194+ public static function isRowClass( $class ) {
210195 return (
211196 class_exists( $class ) &&
212197 (
@@ -217,15 +202,11 @@
218203
219204 /**
220205 * Checks if a column name belongs to a specific type
221 - * @param category String of category to look up type in
222 - * @param type String of type to check for
223 - * @param columnName String of column to look up
 206+ * @param $category String: category to look up type in
 207+ * @param $type String: type to check for
 208+ * @param $columnName String: column to look up
224209 */
225 - public static function isColumnOfType(
226 - $category,
227 - $type,
228 - $columnName
229 - ) {
 210+ public static function isColumnOfType( $category, $type, $columnName ) {
230211 return (
231212 strpos( $columnName, self::$types[$category][$type]['prefix'] ) !==
232213 false
@@ -234,15 +215,11 @@
235216
236217 /**
237218 * Gets fully prefixed column name from simplified field name
238 - * @param category String of category to look up type in
239 - * @param type String of type to check for
240 - * @param fieldName String of field to look up
 219+ * @param $category String: category to look up type in
 220+ * @param $type String: type to check for
 221+ * @param $fieldName String: field to look up
241222 */
242 - public static function getColumnName(
243 - $category,
244 - $type,
245 - $fieldName
246 - ) {
 223+ public static function getColumnName( $category, $type, $fieldName ) {
247224 return isset( self::$types[$category][$type] ) ?
248225 self::$types[$category][$type]['prefix'] . $fieldName :
249226 null;
@@ -250,15 +227,11 @@
251228
252229 /**
253230 * Gets simplified field name from fully prefixed column name
254 - * @param category String of category to look up type in
255 - * @param type String of type to check for
256 - * @param columnName String of column to look up
 231+ * @param $category String: category to look up type in
 232+ * @param $type String: type to check for
 233+ * @param $columnName String: column to look up
257234 */
258 - public static function getFieldName(
259 - $category,
260 - $type,
261 - $columnName
262 - ) {
 235+ public static function getFieldName( $category, $type, $columnName ) {
263236 return isset( self::$types[$category][$type]['prefix'] ) ?
264237 substr(
265238 $columnName, strlen( self::$types[$category][$type]['prefix'] )
@@ -268,13 +241,10 @@
269242
270243 /**
271244 * Gets table name from category and type
272 - * @param category String of category to look up type in
273 - * @param type String of type look up table in
 245+ * @param $category String: category to look up type in
 246+ * @param $type String: type look up table in
274247 */
275 - public static function getTableName(
276 - $category,
277 - $type
278 - ) {
 248+ public static function getTableName( $category, $type ) {
279249 return isset( self::$types[$category][$type]['table'] ) ?
280250 self::$types[$category][$type]['table'] :
281251 null;
@@ -282,13 +252,10 @@
283253
284254 /**
285255 * Gets row defaults from category and type
286 - * @param category String of category to look up type in
287 - * @param type String of type look up defaults in
 256+ * @param $category String: category to look up type in
 257+ * @param $type String: type look up defaults in
288258 */
289 - public static function getRowDefaults(
290 - $category,
291 - $type
292 - ) {
 259+ public static function getRowDefaults( $category, $type ) {
293260 return isset( self::$types[$category][$type]['defaults'] ) ?
294261 self::$types[$category][$type]['defaults'] :
295262 array();
@@ -592,15 +559,11 @@
593560
594561 /**
595562 * Gets list of valid enum values for a specific field
596 - * @param category String of category to look up type in
597 - * @param type String of type to look up field in
598 - * @param field String of field to look up values for
 563+ * @param $category String: category to look up type in
 564+ * @param $type String: type to look up field in
 565+ * @param $field String: field to look up values for
599566 */
600 - public static function getEnum(
601 - $category,
602 - $type,
603 - $field
604 - ){
 567+ public static function getEnum( $category, $type, $field ) {
605568 if ( !self::isType( $category, $type ) ) {
606569 throw new MWException(
607570 $category . '/' . $type . ' is not a valid type'
@@ -629,11 +592,9 @@
630593
631594 /**
632595 * Checks that a row object represents an existing row in the database
633 - * @param object Subclass of DataCenterDBRow to check
 596+ * @param $object Object: subclass of DataCenterDBRow to check
634597 */
635 - public static function rowExists(
636 - DataCenterDBRow $object
637 - ) {
 598+ public static function rowExists( DataCenterDBRow $object ) {
638599 if ( !$object instanceof DataCenterDBRow ) {
639600 throw new MWException(
640601 'Object is not an instance of DataCenterDBRow'
@@ -658,11 +619,9 @@
659620
660621 /**
661622 * Inserts a row in the database based on the contents of a row object
662 - * @param rowObject Subclass of DataCenterDBRow to insert
 623+ * @param $object Object: subclass of DataCenterDBRow to insert
663624 */
664 - public static function insertRow(
665 - $object
666 - ) {
 625+ public static function insertRow( $object ) {
667626 if ( !$object instanceof DataCenterDBRow ) {
668627 throw new MWException(
669628 'Object is not an instance of DataCenterDBRow'
@@ -689,11 +648,9 @@
690649
691650 /**
692651 * Updates a row in the database based on the contents of a row object
693 - * @param object Subclass of DataCenterDBRow to update
 652+ * @param $object Object: Subclass of DataCenterDBRow to update
694653 */
695 - public static function updateRow(
696 - $object
697 - ) {
 654+ public static function updateRow( $object ) {
698655 if ( !$object instanceof DataCenterDBRow ) {
699656 throw new MWException(
700657 'Object is not an instance of DataCenterDBRow'
@@ -719,11 +676,9 @@
720677
721678 /**
722679 * Deletes a row from the database
723 - * @param rowObject Subclass of DataCenterDBRow to delete
 680+ * @param $object Object: subclass of DataCenterDBRow to delete
724681 */
725 - public static function deleteRow(
726 - $object
727 - ) {
 682+ public static function deleteRow( $object ) {
728683 if ( !$object instanceof DataCenterDBRow ) {
729684 throw new MWException(
730685 'Object is not an instance of DataCenterDBRow'
@@ -754,10 +709,7 @@
755710 * - class as DataCenterDBAsset
756711 * - category as asset
757712 */
758 - public static function getAssets(
759 - $type,
760 - array $options = array()
761 - ) {
 713+ public static function getAssets( $type, array $options = array() ) {
762714 return self::getRows( 'DataCenterDBAsset', 'asset', $type, $options );
763715 }
764716
@@ -766,10 +718,7 @@
767719 * - class as DataCenterDBAsset
768720 * - category as asset
769721 */
770 - public static function getAsset(
771 - $type,
772 - $id
773 - ) {
 722+ public static function getAsset( $type, $id ) {
774723 return self::getRow( 'DataCenterDBAsset', 'asset', $type, $id );
775724 }
776725
@@ -777,10 +726,7 @@
778727 * Wraps self::numRows specializing...
779728 * - category as asset
780729 */
781 - public static function numAssets(
782 - $type,
783 - array $options = array()
784 - ) {
 730+ public static function numAssets( $type, array $options = array() ) {
785731 return self::numRows( 'asset', $type, $options );
786732 }
787733
@@ -791,10 +737,7 @@
792738 * - class as DataCenterDBModel
793739 * - category as model
794740 */
795 - public static function getModels(
796 - $type,
797 - array $options = array()
798 - ) {
 741+ public static function getModels( $type, array $options = array() ) {
799742 return self::getRows( 'DataCenterDBModel', 'model', $type, $options );
800743 }
801744
@@ -803,10 +746,7 @@
804747 * - class as DataCenterDBModel
805748 * - category as model
806749 */
807 - public static function getModel(
808 - $type,
809 - $id
810 - ) {
 750+ public static function getModel( $type, $id ) {
811751 return self::getRow( 'DataCenterDBModel', 'model', $type, $id );
812752 }
813753
@@ -814,10 +754,7 @@
815755 * Wraps self::numRows specializing...
816756 * - category as model
817757 */
818 - public static function numModels(
819 - $type,
820 - array $options = array()
821 - ) {
 758+ public static function numModels( $type, array $options = array() ) {
822759 return self::numRows( 'model', $type, $options );
823760 }
824761
@@ -828,10 +765,7 @@
829766 * - class as DataCenterDBLink
830767 * - category as link
831768 */
832 - public static function getLinks(
833 - $type,
834 - array $options = array()
835 - ) {
 769+ public static function getLinks( $type, array $options = array() ) {
836770 return self::getRows( 'DataCenterDBLink', 'link', $type, $options );
837771 }
838772
@@ -840,10 +774,7 @@
841775 * - class as DataCenterDBLink
842776 * - category as link
843777 */
844 - public static function getLink(
845 - $type,
846 - $id
847 - ) {
 778+ public static function getLink( $type, $id ) {
848779 return self::getRow( 'DataCenterDBLink', 'link', $type, $id );
849780 }
850781
@@ -851,10 +782,7 @@
852783 * Wraps self::numRows specializing...
853784 * - category as link
854785 */
855 - public static function numLinks(
856 - $type,
857 - array $options = array()
858 - ) {
 786+ public static function numLinks( $type, array $options = array() ) {
859787 return self::numRows( 'link', $type, $options );
860788 }
861789
@@ -864,9 +792,7 @@
865793 * - category as link
866794 * - type as asset
867795 */
868 - public static function getAssetLinks(
869 - array $options = array()
870 - ) {
 796+ public static function getAssetLinks( array $options = array() ) {
871797 return self::getRows(
872798 'DataCenterDBAssetLink', 'link', 'asset', $options
873799 );
@@ -878,9 +804,7 @@
879805 * - category as link
880806 * - type as asset
881807 */
882 - public static function getAssetLink(
883 - $id
884 - ) {
 808+ public static function getAssetLink( $id ) {
885809 return self::getRow( 'DataCenterDBAssetLink', 'link', 'asset', $id );
886810 }
887811
@@ -889,9 +813,7 @@
890814 * - category as link
891815 * - type as asset
892816 */
893 - public static function numAssetLinks(
894 - array $options = array()
895 - ) {
 817+ public static function numAssetLinks( array $options = array() ) {
896818 return self::numRows( 'link', 'asset', $options );
897819 }
898820
@@ -901,9 +823,7 @@
902824 * - category as link
903825 * - type as model
904826 */
905 - public static function getModelLinks(
906 - array $options = array()
907 - ) {
 827+ public static function getModelLinks( array $options = array() ) {
908828 return self::getRows(
909829 'DataCenterDBModelLink', 'link', 'model', $options
910830 );
@@ -915,9 +835,7 @@
916836 * - category as link
917837 * - type as model
918838 */
919 - public static function getModelLink(
920 - $id
921 - ) {
 839+ public static function getModelLink( $id ) {
922840 return self::getRow( 'DataCenterDBModelLink', 'link', 'model', $id );
923841 }
924842
@@ -926,9 +844,7 @@
927845 * - category as link
928846 * - type as model
929847 */
930 - public static function numModelLinks(
931 - array $options = array()
932 - ) {
 848+ public static function numModelLinks( array $options = array() ) {
933849 return self::numRows( 'link', 'model', $options );
934850 }
935851
@@ -938,9 +854,7 @@
939855 * - category as link
940856 * - type as field
941857 */
942 - public static function getMetaFieldLinks(
943 - array $options = array()
944 - ) {
 858+ public static function getMetaFieldLinks( array $options = array() ) {
945859 return self::getRows( 'DataCenterDBMetaFieldLink', 'link', 'field', $options );
946860 }
947861
@@ -950,9 +864,7 @@
951865 * - category as link
952866 * - type as field
953867 */
954 - public static function getMetaFieldLink(
955 - $id
956 - ) {
 868+ public static function getMetaFieldLink( $id ) {
957869 return self::getRow( 'DataCenterDBMetaFieldLink', 'link', 'field', $id );
958870 }
959871
@@ -961,9 +873,7 @@
962874 * - category as link
963875 * - type as field
964876 */
965 - public static function numMetaFieldLinks(
966 - array $options = array()
967 - ) {
 877+ public static function numMetaFieldLinks( array $options = array() ) {
968878 return self::numRows( 'link', 'field', $options );
969879 }
970880
@@ -975,9 +885,7 @@
976886 * - category as facility
977887 * - type as location
978888 */
979 - public static function getLocations(
980 - array $options = array()
981 - ) {
 889+ public static function getLocations( array $options = array() ) {
982890 return self::getRows(
983891 'DataCenterDBLocation', 'facility', 'location', $options
984892 );
@@ -989,9 +897,7 @@
990898 * - category as facility
991899 * - type as location
992900 */
993 - public static function getLocation(
994 - $id
995 - ) {
 901+ public static function getLocation( $id ) {
996902 return self::getRow(
997903 'DataCenterDBLocation', 'facility', 'location', $id
998904 );
@@ -1002,9 +908,7 @@
1003909 * - category as facility
1004910 * - type as location
1005911 */
1006 - public static function numLocations(
1007 - array $options = array()
1008 - ) {
 912+ public static function numLocations( array $options = array() ) {
1009913 return self::numRows( 'facility', 'location', $options );
1010914 }
1011915
@@ -1014,9 +918,7 @@
1015919 * - category as facility
1016920 * - type as space
1017921 */
1018 - public static function getSpaces(
1019 - array $options = array()
1020 - ) {
 922+ public static function getSpaces( array $options = array() ) {
1021923 return self::getRows(
1022924 'DataCenterDBSpace', 'facility', 'space', $options
1023925 );
@@ -1028,9 +930,7 @@
1029931 * - category as facility
1030932 * - type as space
1031933 */
1032 - public static function getSpace(
1033 - $id
1034 - ) {
 934+ public static function getSpace( $id ) {
1035935 return self::getRow(
1036936 'DataCenterDBSpace', 'facility', 'space', $id
1037937 );
@@ -1041,9 +941,7 @@
1042942 * - category as facility
1043943 * - type as space
1044944 */
1045 - public static function numSpaces(
1046 - array $options = array()
1047 - ) {
 945+ public static function numSpaces( array $options = array() ) {
1048946 return self::numRows( 'facility', 'space', $options );
1049947 }
1050948
@@ -1055,9 +953,7 @@
1056954 * - category as meta
1057955 * - type as plan
1058956 */
1059 - public static function getPlans(
1060 - array $options = array()
1061 - ) {
 957+ public static function getPlans( array $options = array() ) {
1062958 return self::getRows(
1063959 'DataCenterDBPlan',
1064960 'meta',
@@ -1079,9 +975,7 @@
1080976 * - category as meta
1081977 * - type as plan
1082978 */
1083 - public static function getPlan(
1084 - $id
1085 - ) {
 979+ public static function getPlan( $id ) {
1086980 return self::getRow(
1087981 'DataCenterDBPlan',
1088982 'meta',
@@ -1100,9 +994,7 @@
1101995 * - category as meta
1102996 * - type as plan
1103997 */
1104 - public static function numPlans(
1105 - array $options = array()
1106 - ) {
 998+ public static function numPlans( array $options = array() ) {
1107999 return self::numRows( 'meta', 'plan', $options );
11081000 }
11091001
@@ -1112,9 +1004,7 @@
11131005 * - category as meta
11141006 * - type as change
11151007 */
1116 - public static function getChanges(
1117 - array $options = array()
1118 - ) {
 1008+ public static function getChanges( array $options = array() ) {
11191009 return self::getRows(
11201010 'DataCenterDBChange',
11211011 'meta',
@@ -1149,10 +1039,7 @@
11501040 * - category as meta
11511041 * - type as change
11521042 */
1153 - public static function getChange(
1154 - $id,
1155 - array $options = array()
1156 - ) {
 1043+ public static function getChange( $id, array $options = array() ) {
11571044 return self::getRow(
11581045 'DataCenterDBChange',
11591046 'meta',
@@ -1187,9 +1074,7 @@
11881075 * - category as meta
11891076 * - type as change
11901077 */
1191 - public static function numChanges(
1192 - array $options = array()
1193 - ) {
 1078+ public static function numChanges( array $options = array() ) {
11941079 return self::numRows( 'meta', 'change', $options );
11951080 }
11961081
@@ -1199,9 +1084,7 @@
12001085 * - category as meta
12011086 * - type as field
12021087 */
1203 - public static function getMetaFields(
1204 - array $options = array()
1205 - ) {
 1088+ public static function getMetaFields( array $options = array() ) {
12061089 return self::getRows(
12071090 'DataCenterDBMetaField', 'meta', 'field', $options
12081091 );
@@ -1213,9 +1096,7 @@
12141097 * - category as meta
12151098 * - type as field
12161099 */
1217 - public static function getMetaField(
1218 - $id
1219 - ) {
 1100+ public static function getMetaField( $id ) {
12201101 return self::getRow(
12211102 'DataCenterDBMetaField', 'meta', 'field', $id
12221103 );
@@ -1226,9 +1107,7 @@
12271108 * - category as meta
12281109 * - type as field
12291110 */
1230 - public static function numMetaFields(
1231 - array $options = array()
1232 - ) {
 1111+ public static function numMetaFields( array $options = array() ) {
12331112 return self::numRows( 'meta', 'field', $options );
12341113 }
12351114
@@ -1238,9 +1117,7 @@
12391118 * - category as meta
12401119 * - type as value
12411120 */
1242 - public static function getMetaValues(
1243 - array $options = array()
1244 - ) {
 1121+ public static function getMetaValues( array $options = array() ) {
12451122 return self::getRows(
12461123 'DataCenterDBMetaValue', 'meta', 'value', $options
12471124 );
@@ -1252,9 +1129,7 @@
12531130 * - category as meta
12541131 * - type as value
12551132 */
1256 - public static function getMetaValue(
1257 - $id
1258 - ) {
 1133+ public static function getMetaValue( $id ) {
12591134 return self::getRow(
12601135 'DataCenterDBMetaValue', 'meta', 'value', $id
12611136 );
@@ -1265,9 +1140,7 @@
12661141 * - category as meta
12671142 * - type as value
12681143 */
1269 - public static function numMetaValues(
1270 - array $options = array()
1271 - ) {
 1144+ public static function numMetaValues( array $options = array() ) {
12721145 return self::numRows( 'meta', 'value', $options );
12731146 }
12741147
@@ -1275,15 +1148,11 @@
12761149
12771150 /**
12781151 * Builds array of options which specify fields to sort results by
1279 - * @param category String of category to lookup type in
1280 - * @param type String of category to lookup fields in
1281 - * @param fields String or Array of Strings of fields to sort by
 1152+ * @param $category String: category to lookup type in
 1153+ * @param $type String: category to lookup fields in
 1154+ * @param $fields String or Array of Strings of fields to sort by
12821155 */
1283 - public static function buildSort(
1284 - $category,
1285 - $type,
1286 - $fields
1287 - ) {
 1156+ public static function buildSort( $category, $type, $fields ) {
12881157 $columns = array();
12891158 if ( !is_array( $fields ) ) {
12901159 $fields = array( $fields );
@@ -1382,11 +1251,9 @@
13831252
13841253 /**
13851254 * Builds array of options which specify limit and offset
1386 - * @param path Array of link parameters
 1255+ * @param $path Array: array of link parameters
13871256 */
1388 - public static function buildRange(
1389 - $path
1390 - ) {
 1257+ public static function buildRange( $path ) {
13911258 if ( !isset( $path['limit'] ) || $path['limit'] == null ) {
13921259 $path['limit'] = 10;
13931260 }
@@ -1404,17 +1271,12 @@
14051272 /**
14061273 * Builds array of options which match a query against a number of fields
14071274 * using case-insensitive partial matching
1408 - * @param category String of category to lookup type in
1409 - * @param type String of category to lookup fields in
1410 - * @param fields String of field to match query with
1411 - * @param value String of query to match to field value
 1275+ * @param $category String: category to lookup type in
 1276+ * @param $type String: category to lookup fields in
 1277+ * @param $fields String: field to match query with
 1278+ * @param $query String: query to match to field value
14121279 */
1413 - public static function buildMatch(
1414 - $category,
1415 - $type,
1416 - $fields,
1417 - $query
1418 - ) {
 1280+ public static function buildMatch( $category, $type, $fields, $query ) {
14191281 $dbr = wfGetDB( DB_SLAVE );
14201282 $conditions = array();
14211283 if ( !is_array( $fields ) ) {
@@ -1433,13 +1295,10 @@
14341296 /**
14351297 * Creates and returns an associative array of rows keyed by a specific
14361298 * field, for use as a lookup table or to divide rows into groups
1437 - * @param field String of name of field to use as key
1438 - * @param rows Array of DataCenterDBRow objects to process
 1299+ * @param $field String: name of field to use as key
 1300+ * @param $rows Array: DataCenterDBRow objects to process
14391301 */
1440 - public static function buildLookupTable(
1441 - $field,
1442 - array $rows
1443 - ) {
 1302+ public static function buildLookupTable( $field, array $rows ) {
14441303 if ( !is_scalar( $field ) && $field !== null ) {
14451304 throw new MWException(
14461305 $field . ' is not a field for table keys to be made from'
@@ -1515,11 +1374,7 @@
15161375 * @param row Optional Associative Array of column and value
15171376 * pairs to use as initial data overriding defaults
15181377 */
1519 - public function __construct(
1520 - $category,
1521 - $type,
1522 - array $row = array()
1523 - ) {
 1378+ public function __construct( $category, $type, array $row = array() ) {
15241379 $this->category = $category;
15251380 $this->type = $type;
15261381 $this->set( DataCenterDB::getRowDefaults( $category, $type ) );
@@ -1537,9 +1392,7 @@
15381393 /**
15391394 * Sets row data from an Associative Array of column and value pairs
15401395 */
1541 - public function setRow(
1542 - array $row = array()
1543 - ) {
 1396+ public function setRow( array $row = array() ) {
15441397 $this->row = count( $row ) > 0 ? $row : null;
15451398 }
15461399
@@ -1578,9 +1431,7 @@
15791432 * Gets fully prefixed column name from simplified field name
15801433 * @param fieldName String of name of field to lookup
15811434 */
1582 - public function getColumnName(
1583 - $fieldName
1584 - ) {
 1435+ public function getColumnName( $fieldName ) {
15851436 return DataCenterDB::getColumnName(
15861437 $this->category, $this->type, $fieldName
15871438 );
@@ -1590,9 +1441,7 @@
15911442 * Gets simplified field name from fully prefixed column name
15921443 * @param columnName String of name of column to lookup
15931444 */
1594 - public function getFieldName(
1595 - $columnName
1596 - ) {
 1445+ public function getFieldName( $columnName ) {
15971446 return DataCenterDB::getFieldName(
15981447 $this->category, $this->type, $columnName
15991448 );
@@ -1622,11 +1471,7 @@
16231472 * passed, all fields will be returned as an Associative
16241473 * Array.
16251474 */
1626 - public function get(
1627 - $category = null,
1628 - $type = null,
1629 - $field = null
1630 - ) {
 1475+ public function get( $category = null, $type = null, $field = null ) {
16311476 if ( $category === null && $type === null && $field === null ) {
16321477 $category = $this->category;
16331478 $type = $this->type;
@@ -1653,7 +1498,7 @@
16541499 }
16551500 }
16561501 return $results;
1657 - } else if ( is_array( $field ) ) {
 1502+ } elseif ( is_array( $field ) ) {
16581503 $results = array();
16591504 foreach ( $field as $fieldName ) {
16601505 $columnName = DataCenterDB::getColumnName(
@@ -1687,10 +1532,7 @@
16881533 * Array of field and value pairs
16891534 * @param value Optional Scalar of value to set
16901535 */
1691 - public function set(
1692 - $column,
1693 - $value = null
1694 - ) {
 1536+ public function set( $column, $value = null ) {
16951537 if ( is_array( $column ) ) {
16961538 foreach ( $column as $name => $value ) {
16971539 $columnName = $this->getColumnName( $name );
@@ -1749,9 +1591,7 @@
17501592 /**
17511593 * Gets changes that reference this object by category, type, and ID
17521594 */
1753 - public function getChanges(
1754 - array $options = array()
1755 - ) {
 1595+ public function getChanges( array $options = array() ) {
17561596 return DataCenterDB::getChanges(
17571597 array_merge_recursive(
17581598 $options,
@@ -1768,9 +1608,7 @@
17691609 );
17701610 }
17711611
1772 - public function numChanges(
1773 - array $options = array()
1774 - ) {
 1612+ public function numChanges( array $options = array() ) {
17751613 return DataCenterDB::numChanges(
17761614 array_merge_recursive(
17771615 $options,
@@ -1787,9 +1625,7 @@
17881626 );
17891627 }
17901628
1791 - public function saveMetaValues(
1792 - $values = null
1793 - ) {
 1629+ public function saveMetaValues( $values = null ) {
17941630 if ( !is_array( $values ) ) {
17951631 return;
17961632 }
@@ -1823,9 +1659,7 @@
18241660 }
18251661 }
18261662
1827 - public function insertChange(
1828 - $values
1829 - ) {
 1663+ public function insertChange( $values ) {
18301664 if ( !is_array( $values ) ) {
18311665 return;
18321666 }
@@ -1926,10 +1760,7 @@
19271761 * - category as asset
19281762 * - type as rack
19291763 */
1930 - public static function newFromType(
1931 - $type,
1932 - array $values = array()
1933 - ) {
 1764+ public static function newFromType( $type, array $values = array() ) {
19341765 return parent::newFromClass( __CLASS__, 'asset', $type, $values );
19351766 }
19361767
@@ -1965,10 +1796,7 @@
19661797 * - class as DataCenterDBModel
19671798 * - category as model
19681799 */
1969 - public static function newFromType(
1970 - $type,
1971 - array $values = array()
1972 - ) {
 1800+ public static function newFromType( $type, array $values = array() ) {
19731801 return parent::newFromClass( __CLASS__, 'model', $type, $values );
19741802 }
19751803
@@ -2031,9 +1859,7 @@
20321860 * - category as link
20331861 * - type as asset
20341862 */
2035 - public static function newFromValues(
2036 - array $values = array()
2037 - ) {
 1863+ public static function newFromValues( array $values = array() ) {
20381864 return parent::newFromClass( __CLASS__, 'link', 'asset', $values );
20391865 }
20401866
@@ -2042,9 +1868,7 @@
20431869 /**
20441870 * Gets flat list of links
20451871 */
2046 - public function getLinks(
2047 - array $options = array()
2048 - ) {
 1872+ public function getLinks( array $options = array() ) {
20491873 if ( !$this->links ) {
20501874 $links = DataCenterDB::getAssetLinks(
20511875 DataCenterDB::buildCondition(
@@ -2081,12 +1905,10 @@
20821906
20831907 /**
20841908 * Builds structure of links recursively using list of links
2085 - * @param links Array of DataCenterDBAssetLink to use as source
2086 - * for recursive structure construction
 1909+ * @param $links Array: DataCenterDBAssetLink to use as source for
 1910+ * recursive structure construction
20871911 */
2088 - public function buildStructure(
2089 - array $links
2090 - ) {
 1912+ public function buildStructure( array $links ) {
20911913 $id = $this->getId();
20921914 foreach ( $links as $key => $link ) {
20931915 if ( $link->get( 'parent_link' ) == $id ) {
@@ -2113,9 +1935,7 @@
21141936 * - category as link
21151937 * - type as model
21161938 */
2117 - public static function newFromValues(
2118 - array $values = array()
2119 - ) {
 1939+ public static function newFromValues( array $values = array() ) {
21201940 return parent::newFromClass( __CLASS__, 'link', 'model', $values );
21211941 }
21221942
@@ -2124,10 +1944,7 @@
21251945 * @param parent DataCenterDBModel to set as parent
21261946 * @param child DataCenterDBModel to set as child
21271947 */
2128 - public static function newFromModels(
2129 - $parent,
2130 - $child
2131 - ) {
 1948+ public static function newFromModels( $parent, $child ) {
21321949 if ( !( $parent instanceof DataCenterDBModel ) ) {
21331950 throw new MWException(
21341951 'Parent object is not compatible with DataCenterDBModel'
@@ -2170,9 +1987,7 @@
21711988 * - category as link
21721989 * - type as field
21731990 */
2174 - public static function newFromValues(
2175 - array $values = array()
2176 - ) {
 1991+ public static function newFromValues( array $values = array() ) {
21771992 return parent::newFromClass( __CLASS__, 'link', 'field', $values );
21781993 }
21791994
@@ -2235,9 +2050,7 @@
22362051 * - category as facility
22372052 * - type as location
22382053 */
2239 - public static function newFromValues(
2240 - array $values = array()
2241 - ) {
 2054+ public static function newFromValues( array $values = array() ) {
22422055 return parent::newFromClass(
22432056 __CLASS__, 'facility', 'location', $values
22442057 );
@@ -2245,9 +2058,7 @@
22462059
22472060 /* Functions */
22482061
2249 - public function getSpaces(
2250 - array $options = array()
2251 - ) {
 2062+ public function getSpaces( array $options = array() ) {
22522063 return DataCenterDB::getRows(
22532064 __CLASS__,
22542065 'facility',
@@ -2272,15 +2083,11 @@
22732084 * - category as facility
22742085 * - type as space
22752086 */
2276 - public static function newFromValues(
2277 - array $values = array()
2278 - ) {
 2087+ public static function newFromValues( array $values = array() ) {
22792088 return parent::newFromClass( __CLASS__, 'facility', 'space', $values );
22802089 }
22812090
2282 - public function getPlans(
2283 - array $options = array()
2284 - ) {
 2091+ public function getPlans( array $options = array() ) {
22852092 if ( $this->type == 'space' ) {
22862093 return DataCenterDB::getPlans(
22872094 array_merge_recursive(
@@ -2311,17 +2118,13 @@
23122119 * - category as meta
23132120 * - type as field
23142121 */
2315 - public static function newFromValues(
2316 - array $values = array()
2317 - ) {
 2122+ public static function newFromValues( array $values = array() ) {
23182123 return parent::newFromClass( __CLASS__, 'meta', 'field', $values );
23192124 }
23202125
23212126 /* Functions */
23222127
2323 - public function getLinks(
2324 - array $options = array()
2325 - ) {
 2128+ public function getLinks( array $options = array() ) {
23262129 return DataCenterDB::getMetaFieldLinks(
23272130 array_merge_recursive(
23282131 $options,
@@ -2359,9 +2162,7 @@
23602163 * - category as meta
23612164 * - type as value
23622165 */
2363 - public static function newFromValues(
2364 - array $values = array()
2365 - ) {
 2166+ public static function newFromValues( array $values = array() ) {
23662167 return parent::newFromClass( __CLASS__, 'meta', 'value', $values );
23672168 }
23682169
@@ -2398,9 +2199,7 @@
23992200 * - category as meta
24002201 * - type as change
24012202 */
2402 - public static function newFromValues(
2403 - array $values = array()
2404 - ) {
 2203+ public static function newFromValues( array $values = array() ) {
24052204 return parent::newFromClass( __CLASS__, 'meta', 'change', $values );
24062205 }
24072206
@@ -2446,9 +2245,7 @@
24472246 * - category as meta
24482247 * - type as plan
24492248 */
2450 - public static function newFromValues(
2451 - array $values = array()
2452 - ) {
 2249+ public static function newFromValues( array $values = array() ) {
24532250 return parent::newFromClass( __CLASS__, 'meta', 'plan', $values );
24542251 }
24552252
@@ -2466,9 +2263,7 @@
24672264 /**
24682265 * Gets flat list of links
24692266 */
2470 - public function getLinks(
2471 - array $options = array()
2472 - ) {
 2267+ public function getLinks( array $options = array() ) {
24732268 if ( !$this->links ) {
24742269 $this->links = DataCenterDB::getAssetLinks(
24752270 DataCenterDB::buildCondition(
@@ -2482,9 +2277,7 @@
24832278 /**
24842279 * Gets structure of links
24852280 */
2486 - public function getStructure(
2487 - array $options = array()
2488 - ) {
 2281+ public function getStructure( array $options = array() ) {
24892282 if ( !$this->structure ) {
24902283 $links = DataCenterDB::getRows(
24912284 'DataCenterDBAssetLink',
Index: trunk/extensions/DataCenter/DataCenter.js
@@ -11,7 +11,7 @@
1212 *
1313 */
1414 function DataCenterRenderer() {
15 -
 15+
1616 /* Private Members */
1717
1818 var self = this;
@@ -25,9 +25,7 @@
2626 * Gets a reference to a target by it's id
2727 * @param target String or Integer of ID of target
2828 */
29 - this.getTarget = function(
30 - target
31 - ) {
 29+ this.getTarget = function( target ) {
3230 if ( targets[target] !== undefined ) {
3331 return targets[target];
3432 }
@@ -38,10 +36,7 @@
3937 * @param type A function object which will be created and then passed
4038 * to each job for each target
4139 */
42 - this.addQueue = function(
43 - queue,
44 - type
45 - ) {
 40+ this.addQueue = function( queue, type ) {
4641 queues[queue] = type;
4742 }
4843 /**
@@ -49,11 +44,7 @@
5045 * @param queue String of name of rendering system used to reference it
5146 * @param target String of XML ID of element to perform this job for
5247 */
53 - this.addJob = function(
54 - queue,
55 - target,
56 - job
57 - ) {
 48+ this.addJob = function( queue, target, job ) {
5849 if ( jobs[queue] === undefined ) {
5950 jobs[queue] = {};
6051 }
@@ -107,7 +98,7 @@
10899 * which can be added, accessed and removed during run-time.
109100 */
110101 function DataCenterPool() {
111 -
 102+
112103 /* Private Members */
113104
114105 var self = this;
@@ -120,9 +111,7 @@
121112 * Adds an object to pool, and returns it's unique ID
122113 * @param object Object reference to add
123114 */
124 - this.addObject = function(
125 - object
126 - ) {
 115+ this.addObject = function( object ) {
127116 var id = count++;
128117 objects[id] = object;
129118 return id;
@@ -131,9 +120,7 @@
132121 * Removes an object form pool
133122 * @param id ID number of object to remove
134123 */
135 - this.removeObject = function(
136 - id
137 - ) {
 124+ this.removeObject = function( id ) {
138125 if ( objects[id] !== undefined ) {
139126 delete objects[id];
140127 }
@@ -142,9 +129,7 @@
143130 * Gets an object from pool
144131 * @param id ID number of object to get
145132 */
146 - this.getObject = function(
147 - id
148 - ) {
 133+ this.getObject = function( id ) {
149134 if ( objects[id] !== undefined ) {
150135 return objects[id];
151136 }
@@ -155,12 +140,9 @@
156141 * @param target The XML ID of a DIV in which a plan should be rendered
157142 * into.
158143 */
159 -function DataCenterScene(
160 - target
161 -) {
162 -
 144+function DataCenterScene( target ) {
163145 /* Private Members */
164 -
 146+
165147 // Reference to itself
166148 var self = this;
167149 // Colors used in rendering
@@ -175,9 +157,9 @@
176158 var features = {
177159 radialGradient: true
178160 };
179 -
 161+
180162 /* Configuration */
181 -
 163+
182164 // Gets target element
183165 var element = document.getElementById( target );
184166 // Sets element's background color so there's consistency when resizing
@@ -206,9 +188,9 @@
207189 'click',
208190 new Function( target + ".getModule().click();" )
209191 );
210 -
 192+
211193 /* Public Functions */
212 -
 194+
213195 /**
214196 * Checks if scene that rack is part of is live
215197 */
@@ -245,10 +227,7 @@
246228 * @param newModule Object of scene compatible module to render
247229 * @param update Boolean flag indicating desire to re-render now
248230 */
249 - this.setModule = function (
250 - newModule,
251 - update
252 - ) {
 231+ this.setModule = function( newModule, update ) {
253232 newModule.setScene( self );
254233 module = newModule;
255234 // Automatically re-render
@@ -258,9 +237,7 @@
259238 * Re-renders scene
260239 * @param update Boolean flag indicating desire to re-render now
261240 */
262 - this.update = function (
263 - update
264 - ) {
 241+ this.update = function( update ) {
265242 // Check if scene is live and update flag is set
266243 if ( self.isLive() && update ) {
267244 // Renders scene
@@ -304,9 +281,7 @@
305282 /**
306283 * Abstraction for a Google Maps object
307284 */
308 -function DataCenterMap(
309 - target
310 -) {
 285+function DataCenterMap( target ) {
311286 // Checks that browser is compatible with Google Maps
312287 if ( !GBrowserIsCompatible() ) {
313288 return;
@@ -338,11 +313,7 @@
339314 * content String of content to place in info window (optional)
340315 * popup Boolean of whether to initially show info window
341316 */
342 - this.addMarker = function(
343 - lat,
344 - lng,
345 - options
346 - ) {
 317+ this.addMarker = function( lat, lng, options ) {
347318 var marker = new GMarker( new GLatLng( lat, lng ) );
348319 map.addOverlay( marker );
349320 if ( options && options.content ) {
@@ -366,10 +337,7 @@
367338 * latField Object reference of XML form element to update
368339 * lngField Object reference of XML form element to update
369340 */
370 - this.showAddress = function(
371 - address,
372 - options
373 - ) {
 341+ this.showAddress = function( address, options ) {
374342 // Adds this object to pool and gets it's ID
375343 poolID = dataCenter.pool.addObject( self );
376344 // Stores the options last used for later reference
@@ -385,9 +353,7 @@
386354 * Response to address lookup which is called asynchronously
387355 * @param point GPoint object of address lookup result
388356 */
389 - this.respond = function(
390 - point
391 - ) {
 357+ this.respond = function( point ) {
392358 if ( point ) {
393359 map.setCenter( point, 14 );
394360 map.clearOverlays();
@@ -417,11 +383,7 @@
418384 * content String of content to place in info window (optional)
419385 * popup Boolean of whether to initially show info window
420386 */
421 - this.showPosition = function(
422 - lat,
423 - lng,
424 - options
425 - ) {
 387+ this.showPosition = function( lat, lng, options ) {
426388 var point = new GLatLng( lat, lng );
427389 map.setCenter( point, 14 );
428390 map.clearOverlays();
@@ -438,8 +400,8 @@
439401 dataCenter.ui.layouts = {};
440402 dataCenter.ui.widgets = {};
441403 // Adds hooks that cause dataCenter systems to react to window events
442 -hookEvent( "load", dataCenter.renderer.setup );
443 -hookEvent( "resize", dataCenter.renderer.render );
 404+hookEvent( 'load', dataCenter.renderer.setup );
 405+hookEvent( 'resize', dataCenter.renderer.render );
444406 // Adds rendering queues for scene system
445407 dataCenter.renderer.addQueue( 'scene', DataCenterScene );
446408 // Adds rendering queues for map system
Index: trunk/extensions/DataCenter/DataCenter.page.php
@@ -17,9 +17,7 @@
1818
1919 /* Abstract Functions */
2020
21 - public abstract function __construct(
22 - array $path
23 - );
 21+ public abstract function __construct( array $path );
2422 }
2523
2624 abstract class DataCenterView {
@@ -30,9 +28,7 @@
3129
3230 /* Functions */
3331
34 - public function __construct(
35 - $controller
36 - ) {
 32+ public function __construct( $controller ) {
3733 $this->controller = $controller;
3834 }
3935 }
@@ -139,9 +135,7 @@
140136
141137 /* Private Static Functions */
142138
143 - private static function urlToSub(
144 - $url
145 - ) {
 139+ private static function urlToSub( $url ) {
146140 global $wgTitle;
147141 $start = stripos( $url, $wgTitle->getBaseText() );
148142 if ( $start !== false ) {
@@ -154,9 +148,7 @@
155149 return $url;
156150 }
157151
158 - private static function subToPath(
159 - $sub
160 - ) {
 152+ private static function subToPath( $sub ) {
161153 $path = array();
162154 // Removes leading or trailing slashes, sanitizing hand-entered URLs
163155 $sub = trim( $sub, '/');
@@ -212,9 +204,7 @@
213205
214206 /* Public Static Functions */
215207
216 - public static function getState(
217 - $key
218 - ) {
 208+ public static function getState( $key ) {
219209 if ( isset( self::$state['public'][$key] ) ) {
220210 return self::$state['public'][$key];
221211 } else {
@@ -222,10 +212,7 @@
223213 }
224214 }
225215
226 - public static function setState(
227 - $key,
228 - $value
229 - ) {
 216+ public static function setState( $key, $value ) {
230217 self::$state['public'][$key] = $value;
231218 }
232219
@@ -244,9 +231,7 @@
245232 return self::$path;
246233 }
247234
248 - public static function userCan(
249 - $action
250 - ) {
 235+ public static function userCan( $action ) {
251236 if ( is_array( $action ) ) {
252237 if ( count( $action ) > 0 ) {
253238 foreach ( $action as $right ) {
@@ -270,9 +255,7 @@
271256 wfLoadExtensionMessages( 'DataCenter' );
272257 }
273258
274 - public function execute(
275 - $sub
276 - ) {
 259+ public function execute( $sub ) {
277260 global $wgOut, $wgScriptPath, $wgUser, $wgRequest;
278261 // Checks if the user is logged in
279262 if ( !$wgUser->isLoggedIn() ) {
Index: trunk/extensions/DataCenter/DataCenter.ui.php
@@ -10,9 +10,7 @@
1111
1212 /* Static Functions */
1313
14 - public static function toAttributes(
15 - array $attributes
16 - ) {
 14+ public static function toAttributes( array $attributes ) {
1715 $cssOutput = '';
1816 foreach( $attributes as $name => $value ) {
1917 if ( !is_int( $name ) ) {
@@ -27,15 +25,12 @@
2826
2927 /* Static Functions */
3028
31 - public static function chain(
32 - $functions,
33 - $end = true
34 - ) {
 29+ public static function chain( $functions, $end = true ) {
3530 $jsFunctions = array();
3631 foreach( $functions as $name => $arguments ) {
3732 if ( is_int( $name ) ) {
3833 $jsFunctions[] = sprintf( '%s()', $arguments );
39 - } else if ( is_array( $arguments ) ) {
 34+ } elseif ( is_array( $arguments ) ) {
4035 $jsFunctions[] = sprintf(
4136 '%s(%s)', $name, implode( ',', $arguments )
4237 );
@@ -47,12 +42,10 @@
4843 }
4944
5045 /**
51 - * Escapes a javascript string to make it safe to use anywhere
52 - * @param string String to escape
 46+ * Escapes a JavaScript string to make it safe to use anywhere
 47+ * @param $string String: String to escape
5348 */
54 - public static function escape(
55 - $string
56 - ) {
 49+ public static function escape( $string ) {
5750 return Xml::escapeJSString( $string );
5851 }
5952
@@ -60,9 +53,7 @@
6154 * Converts a PHP value to a javascript object
6255 * @param value Associative Array to convert
6356 */
64 - public static function toObject(
65 - $values
66 - ) {
 57+ public static function toObject( $values ) {
6758 // Arrays
6859 if ( is_array( $values ) ) {
6960 $jsValues = array();
@@ -82,9 +73,7 @@
8374 * Converts a PHP value to a javascript array
8475 * @param value Array or Scalar to convert
8576 */
86 - public static function toArray(
87 - $values
88 - ) {
 77+ public static function toArray( $values ) {
8978 // Arrays
9079 if ( is_array( $values ) ) {
9180 $jsValues = array();
@@ -108,9 +97,7 @@
10998 * in which case the ' quotes will be removed and
11099 * the value will be used as a statement
111100 */
112 - public static function toScalar(
113 - $value
114 - ) {
 101+ public static function toScalar( $value ) {
115102 // Arrays
116103 if ( is_array( $value ) ) {
117104 return "'" . self::escape( implode( $value ) ) . "'";
@@ -149,18 +136,15 @@
150137
151138 /**
152139 * Builds an annonomous javascript function declaration
153 - * @param arguments Array of argument names to accept
154 - * @param body String of code for body
 140+ * @param $arguments Array: array of argument names to accept
 141+ * @param $body String: code for body
155142 */
156 - public static function buildFunction(
157 - $arguments,
158 - $body
159 - ) {
 143+ public static function buildFunction( $arguments, $body ) {
160144 if ( is_array( $arguments ) ) {
161145 return sprintf(
162146 'function(%s){%s}', implode( ',', $arguments ), $body
163147 );
164 - } else if ( $arguments !== null ) {
 148+ } elseif ( $arguments !== null ) {
165149 return sprintf( 'function(%s){%s}', $arguments, $body );
166150 } else {
167151 return sprintf( 'function(){%s}', $body );
@@ -169,13 +153,10 @@
170154
171155 /**
172156 * Builds an annonomous javascript function declaration
173 - * @param arguments Array of argument names to accept
174 - * @param body String of code for body
 157+ * @param $prototype String
 158+ * @param $arguments Array: array of argument names to accept
175159 */
176 - public static function buildInstance(
177 - $prototype,
178 - $arguments = array()
179 - ) {
 160+ public static function buildInstance( $prototype, $arguments = array() ) {
180161 if ( !is_array( $arguments ) ) {
181162 $arguments = array( $arguments );
182163 }
@@ -202,18 +183,11 @@
203184 ) . ( $end ? ';' : '' );
204185 }
205186
206 - public static function declareVar(
207 - $name,
208 - $value = 'null',
209 - $end = true
210 - ) {
 187+ public static function declareVar( $name, $value = 'null', $end = true ) {
211188 return sprintf( 'var %s=%s', $name, $value ) . ( $end ? ';' : '' );
212189 }
213190
214 - public static function declareVars(
215 - array $vars,
216 - $end = true
217 - ) {
 191+ public static function declareVars( array $vars, $end = true ) {
218192 $jsOutput = '';
219193 foreach( $vars as $name => $value ) {
220194 if ( is_int( $name ) ) {
@@ -245,7 +219,7 @@
246220 }
247221
248222 /**
249 - * Builds javascript effect
 223+ * Builds JavaScript effect
250224 * @param options Array of effect parameters containing...
251225 * script JavaScript to run, with sprintf syntax for
252226 * including fields in the order listed
@@ -262,10 +236,7 @@
263237 * @param row DataCenterDBRow object from which to extract
264238 * fields from
265239 */
266 - public static function buildEffect(
267 - $script,
268 - $fields = null
269 - ) {
 240+ public static function buildEffect( $script, $fields = null ) {
270241 // Checks for...
271242 if (
272243 // Required types
@@ -323,7 +294,6 @@
324295 * @param attributes Optional Array of XML attributes
325296 * @param content... Any number of Strings of XML content
326297 */
327 -
328298 public static function row() {
329299 $arguments = func_get_args();
330300 $attributes = array();
@@ -415,11 +385,9 @@
416386
417387 /**
418388 * Builds an XML string for a complete input
419 - * @param attributes Array of XML attributes
 389+ * @param $attributes Array: XML attributes
420390 */
421 - public static function input(
422 - array $attributes = array()
423 - ) {
 391+ public static function input( array $attributes = array() ) {
424392 return self::tag( 'div', $attributes );
425393 }
426394
@@ -446,23 +414,18 @@
447415
448416 /**
449417 * Builds an XML string for a tag opening
450 - * @param tag Name of tag
451 - * @param attributes Array of XML attributes
 418+ * @param $tag String: name of tag
 419+ * @param $attributes Array: XML attributes
452420 */
453 - public static function open(
454 - $tag,
455 - array $attributes = array()
456 - ) {
 421+ public static function open( $tag, array $attributes = array() ) {
457422 return Xml::openElement( $tag, $attributes );
458423 }
459424
460425 /**
461426 * Builds an XML string for a tag closing
462 - * @param tag Name of tag
 427+ * @param $tag String: name of tag
463428 */
464 - public static function close(
465 - $tag
466 - ) {
 429+ public static function close( $tag ) {
467430 return Xml::closeElement( $tag );
468431 }
469432
@@ -478,9 +441,7 @@
479442 * @param script String of raw text to use as script contents or
480443 * Array of attributes such as src
481444 */
482 - public static function script(
483 - $script
484 - ) {
 445+ public static function script( $script ) {
485446 if ( is_array( $script ) ) {
486447 return Xml::element(
487448 'script',
@@ -510,9 +471,7 @@
511472 * id Scalar of ID of row
512473 * parameter Scalar parameter or Array of parameters
513474 */
514 - public static function url(
515 - array $parameters
516 - ) {
 475+ public static function url( array $parameters ) {
517476 global $wgTitle;
518477 // Gets the base url
519478 if ( !self::$urlBase ) {
@@ -550,14 +509,14 @@
551510 $url .= '/' . $parameters['action'];
552511 // Checks if parameter was given
553512 if ( $parameters['parameter'] !== null ) {
554 - if ( is_array( $parameters['parameter'] ) ) { // Adds parameter to url
 513+ if ( is_array( $parameters['parameter'] ) ) { // Adds parameter to url
555514 $url .= ':' . implode( ',', $parameters['parameter'] );
556515 } else {
557516 // Adds parameter to url
558517 $url .= ':' . $parameters['parameter'];
559518 }
560519 }
561 - } else if ( $parameters['limit'] !== null ) {
 520+ } elseif ( $parameters['limit'] !== null ) {
562521 $url .= '/';
563522 }
564523 if ( $parameters['limit'] !== null ) {
@@ -600,13 +559,10 @@
601560
602561 /**
603562 * Builds an XML string for a link
604 - * @param label String of raw text to use as label
605 - * @param parameters Array of link parameters for self::url
 563+ * @param $label String: raw text to use as label
 564+ * @param $parameters Array: link parameters for self::url
606565 */
607 - public static function link(
608 - $label = null,
609 - array $parameters
610 - ) {
 566+ public static function link( $label = null, array $parameters ) {
611567 return Xml::element(
612568 'a', array( 'href' => self::url( $parameters ) ), $label
613569 );
@@ -635,10 +591,7 @@
636592 * @param row DataCenterDBRow object from which to extract
637593 * field/fields from
638594 */
639 - public static function buildLink(
640 - $options,
641 - $row = null
642 - ) {
 595+ public static function buildLink( $options, $row = null ) {
643596 // Checks if row was given
644597 if ( isset( $options['page'] ) && $row instanceof DataCenterDBRow ) {
645598 // Transforms options based on row
@@ -701,18 +654,12 @@
702655 * @param row DataCenterDBRow object from which to extract
703656 * field/fields from
704657 */
705 - public static function buildEffects(
706 - array $options,
707 - $fields
708 - ) {
 658+ public static function buildEffects( array $options, $fields ) {
709659 if ( $fields instanceof DataCenterDBRow ) {
710660 $fields = $fields->get();
711661 }
712 - // Checks for...
713 - if (
714 - // Required types
715 - ( is_array( $fields ) )
716 - ) {
 662+ // Checks for required types
 663+ if ( ( is_array( $fields ) ) ) {
717664 $effects = array();
718665 // Loops over each effect
719666 foreach ( $options as $effect ) {
@@ -737,21 +684,17 @@
738685
739686 /**
740687 * Abstract function for rendering the input
741 - * @param parameters Array of parameters
 688+ * @param $parameters Array: array of parameters
742689 */
743 - public static function render(
744 - array $parameters
745 - ) {}
 690+ public static function render( array $parameters ) {}
746691
747692 /* Protected Static Functions */
748693
749694 /**
750695 * Builds XML string of begining of input
751 - * @param class CSS class name of widget
 696+ * @param $class String: CSS class name of widget
752697 */
753 - protected static function begin(
754 - $class
755 - ) {
 698+ protected static function begin( $class ) {
756699 return DataCenterXml::open( 'div', array( 'class' => $class ) );
757700 }
758701
@@ -775,10 +718,7 @@
776719
777720 /* Static Functions */
778721
779 - public static function buildPaging(
780 - $page,
781 - $num
782 - ) {
 722+ public static function buildPaging( $page, $num ) {
783723 $range = array( 'limit' => 10, 'offset' => 0 );
784724 if ( isset( $page['limit'] ) && $page['limit'] !== null ) {
785725 $range['limit'] = $page['limit'];
@@ -933,11 +873,7 @@
934874 * @param arguments String or array of strings of arguments which
935875 * will be passed to MediaWiki's message parser
936876 */
937 - public static function message(
938 - $type,
939 - $name = null,
940 - $arguments = null
941 - ) {
 877+ public static function message( $type, $name = null, $arguments = null ) {
942878 if ( !$name ) {
943879 return wfMsg( $type );
944880 }
@@ -955,10 +891,7 @@
956892 * no formatting or any of the following...
957893 * date Localized date and time format from timestamp
958894 */
959 - public static function format(
960 - $value,
961 - $format
962 - ) {
 895+ public static function format( $value, $format ) {
963896 global $wgLang;
964897 // Handles format type
965898 switch ( $format ) {
@@ -1001,7 +934,7 @@
1002935 $wgOut->addScript(
1003936 DataCenterXml::script( array( 'src' => $url ) )
1004937 );
1005 - } else if ( strpos( $url, '<' ) !== false ) {
 938+ } elseif ( strpos( $url, '<' ) !== false ) {
1006939 $wgOut->addScript( sprintf( $url, $wgScriptPath ) );
1007940 } else {
1008941 $wgOut->addScriptFile( $wgScriptPath . $url );
@@ -1031,14 +964,11 @@
1032965
1033966 /**
1034967 * Builds string of XML using widget
1035 - * @param name Name of widget to use
1036 - * @param parameters Parameters to pass on to widget
 968+ * @param $name String: name of widget to use
 969+ * @param $parameters Array: parameters to pass on to widget
1037970 * @return String of widget's XML output
1038971 */
1039 - public static function renderWidget(
1040 - $name,
1041 - array $parameters = array()
1042 - ) {
 972+ public static function renderWidget( $name, array $parameters = array() ) {
1043973 if ( isset( self::$widgets[$name] ) ) {
1044974 $function = array( self::$widgets[$name], 'render' );
1045975 if ( is_callable( $function ) ) {
@@ -1053,14 +983,11 @@
1054984
1055985 /**
1056986 * Builds string of XML using input
1057 - * @param name Name of input to use
1058 - * @param parameters Parameters to pass on to input
 987+ * @param $name String: name of input to use
 988+ * @param $parameters Array: parameters to pass on to input
1059989 * @return String of input's XML output
1060990 */
1061 - public static function renderInput(
1062 - $name,
1063 - array $parameters = array()
1064 - ) {
 991+ public static function renderInput( $name, array $parameters = array() ) {
1065992 if ( isset( self::$inputs[$name] ) ) {
1066993 $function = array( self::$inputs[$name], 'render' );
1067994 if ( is_callable( $function ) ) {
@@ -1075,14 +1002,11 @@
10761003
10771004 /**
10781005 * Builds string of XML using layout
1079 - * @param name Name of layout to use
1080 - * @param contents Array of strings of XML to layout
1081 - * @return String of layout's XML output
 1006+ * @param $name String: name of layout to use
 1007+ * @param $contents Array: array of strings of XML to layout
 1008+ * @return String of layout's XML output
10821009 */
1083 - public static function renderLayout(
1084 - $name,
1085 - array $contents = array()
1086 - ) {
 1010+ public static function renderLayout( $name, array $contents = array() ) {
10871011 if ( isset( self::$layouts[$name] ) ) {
10881012 $function = array( self::$layouts[$name], 'render' );
10891013 if ( is_callable( $function ) ) {
@@ -1097,11 +1021,9 @@
10981022
10991023 /**
11001024 * Appends the scripts list, skipping duplicate entries
1101 - * @param url Fully qualified URL to javascript file
 1025+ * @param $url String: fully qualified URL to JavaScript file
11021026 */
1103 - public static function addScript(
1104 - $url
1105 - ) {
 1027+ public static function addScript( $url ) {
11061028 if ( !in_array( $url, self::$output['scripts'] ) ) {
11071029 self::$output['scripts'][] = $url;
11081030 }
@@ -1109,11 +1031,9 @@
11101032
11111033 /**
11121034 * Appends content to the output cache
1113 - * @param content String of XML content to append
 1035+ * @param $content String: XML content to append
11141036 */
1115 - public static function addContent(
1116 - $content
1117 - ) {
 1037+ public static function addContent( $content ) {
11181038 self::$output['content'] .= $content;
11191039 }
11201040
@@ -1198,34 +1118,28 @@
11991119
12001120 /**
12011121 * Checks if widget is available
1202 - * @param name Name of widget to look for
1203 - * @return Boolean true if exists, false if not
 1122+ * @param $name String: name of widget to look for
 1123+ * @return Boolean true if exists, false if not
12041124 */
1205 - public static function isWidget(
1206 - $name
1207 - ) {
 1125+ public static function isWidget( $name ) {
12081126 return isset( self::$widgets[$name] );
12091127 }
12101128
12111129 /**
12121130 * Checks if input is available
1213 - * @param name Name of input to look for
1214 - * @return Boolean true if exists, false if not
 1131+ * @param $name String: name of input to look for
 1132+ * @return Boolean true if exists, false if not
12151133 */
1216 - public static function isInput(
1217 - $name
1218 - ) {
 1134+ public static function isInput( $name ) {
12191135 return isset( self::$inputs[$name] );
12201136 }
12211137
12221138 /**
12231139 * Checks if layout is available
1224 - * @param name Name of layout to look for
1225 - * @return Boolean true if exists, false if not
 1140+ * @param $name String: name of layout to look for
 1141+ * @return Boolean true if exists, false if not
12261142 */
1227 - public static function isLayout(
1228 - $name
1229 - ) {
 1143+ public static function isLayout( $name ) {
12301144 return isset( self::$layouts[$name] );
12311145 }
12321146 }

Status & tagging log