r69450 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69449‎ | r69450 | r69451 >
Date:23:51, 16 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6.5 - some refactoring
Modified paths:
  • /trunk/extensions/Maps/Features/iMappingFeature.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Services/Maps_MappingService.php (modified) (history)
  • /trunk/extensions/Maps/Services/iMappingService.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Services/Maps_MappingService.php
@@ -111,18 +111,6 @@
112112 }
113113
114114 /**
115 - * Initializes the service parameters.
116 - *
117 - * You can override this method to set service specific parameters in the inheriting class.
118 - *
119 - * @since 0.6.3
120 - *
121 - * @param array $parameters
122 - */
123 - protected function initParameterInfo( array &$parameters ) {
124 - }
125 -
126 - /**
127115 * @see iMappingService::createMarkersJs
128116 *
129117 * @since 0.6.5
@@ -188,74 +176,71 @@
189177 }
190178
191179 /**
192 - * Adds a dependency that is needed for this service. It will be passed along with the next
193 - * call to getDependencyHtml or addDependencies.
 180+ * @see iMappingService::addDependency
194181 *
195182 * @since 0.6.3
196 - *
197 - * @param string $dependencyHtml
198183 */
199184 public final function addDependency( $dependencyHtml ) {
200185 $this->dependencies[] = $dependencyHtml;
201186 }
202187
203188 /**
204 - * Returns a list of html fragments, such as script includes, the current service depends on.
 189+ * @see iMappingService::getName
205190 *
206191 * @since 0.6.3
 192+ */
 193+ public function getName() {
 194+ return $this->serviceName;
 195+ }
 196+
 197+ /**
 198+ * @see iMappingService::getFeature
207199 *
208 - * @return array
 200+ * @since 0.6.3
209201 */
210 - protected function getDependencies() {
211 - return array();
 202+ public function getFeature( $featureName ) {
 203+ return array_key_exists( $featureName, $this->features ) ? $this->features[$featureName] : false;
212204 }
213205
214206 /**
215 - * Returns the internal name of the service.
 207+ * @see iMappingService::getAliases
216208 *
217209 * @since 0.6.3
218 - *
219 - * @return string
220210 */
221 - public function getName() {
222 - return $this->serviceName;
 211+ public function getAliases() {
 212+ return $this->aliases;
223213 }
224214
225215 /**
226 - * Returns the name of the class that handles the provided feature in this service, or false if there is none.
 216+ * @see iMappingService::hasAlias
227217 *
228218 * @since 0.6.3
229 - *
230 - * @param string $featureName.
231 - *
232 - * @return mixed String or false
233219 */
234 - public function getFeature( $featureName ) {
235 - return array_key_exists( $featureName, $this->features ) ? $this->features[$featureName] : false;
 220+ public function hasAlias( $alias ) {
 221+ return in_array( $alias, $this->aliases );
236222 }
237223
238224 /**
239 - * Returns a list of aliases.
 225+ * Returns a list of html fragments, such as script includes, the current service depends on.
240226 *
241227 * @since 0.6.3
242228 *
243229 * @return array
244230 */
245 - public function getAliases() {
246 - return $this->aliases;
 231+ protected function getDependencies() {
 232+ return array();
247233 }
248234
249235 /**
250 - * Returns if the service has a certain alias or not.
 236+ * Initializes the service parameters.
251237 *
 238+ * You can override this method to set service specific parameters in the inheriting class.
 239+ *
252240 * @since 0.6.3
253241 *
254 - * @param string $alias
255 - *
256 - * @return boolean
257 - */
258 - public function hasAlias( $alias ) {
259 - return in_array( $alias, $this->aliases );
260 - }
 242+ * @param array $parameters
 243+ */
 244+ protected function initParameterInfo( array &$parameters ) {
 245+ }
261246
262247 }
\ No newline at end of file
Index: trunk/extensions/Maps/Services/iMappingService.php
@@ -21,6 +21,15 @@
2222 interface iMappingService {
2323
2424 /**
 25+ * Returns the internal name of the service.
 26+ *
 27+ * @since 0.6.5
 28+ *
 29+ * @return string
 30+ */
 31+ function getName();
 32+
 33+ /**
2534 * Adds the dependencies to the parser output as head items.
2635 *
2736 * @since 0.6.3
@@ -40,6 +49,47 @@
4150 function getParameterInfo();
4251
4352 /**
 53+ * Adds a dependency that is needed for this service. It will be passed along with the next
 54+ * call to getDependencyHtml or addDependencies.
 55+ *
 56+ * @since 0.6.5
 57+ *
 58+ * @param string $dependencyHtml
 59+ */
 60+ function addDependency( $dependencyHtml );
 61+
 62+ /**
 63+ * Returns the name of the class that handles the provided feature in this service, or false if there is none.
 64+ *
 65+ * @since 0.6.5
 66+ *
 67+ * @param string $featureName.
 68+ *
 69+ * @return mixed String or false
 70+ */
 71+ function getFeature( $featureName );
 72+
 73+ /**
 74+ * Returns a list of aliases.
 75+ *
 76+ * @since 0.6.5
 77+ *
 78+ * @return array
 79+ */
 80+ function getAliases();
 81+
 82+ /**
 83+ * Returns if the service has a certain alias or not.
 84+ *
 85+ * @since 0.6.5
 86+ *
 87+ * @param string $alias
 88+ *
 89+ * @return boolean
 90+ */
 91+ function hasAlias( $alias );
 92+
 93+ /**
4494 * Returns the default zoomlevel for the mapping service.
4595 *
4696 * @since 0.6.5
Index: trunk/extensions/Maps/Maps.php
@@ -33,7 +33,7 @@
3434 echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.';
3535 }
3636 else {
37 - define( 'Maps_VERSION', '0.6.5 a5' );
 37+ define( 'Maps_VERSION', '0.6.5 a6' );
3838
3939 // The different coordinate notations.
4040 define( 'Maps_COORDS_FLOAT', 'float' );
Index: trunk/extensions/Maps/Features/iMappingFeature.php
@@ -21,6 +21,7 @@
2222 * @author Jeroen De Dauw
2323 */
2424 interface iMappingFeature {
 25+
2526 /**
2627 * Adds the HTML specific to the mapping service to the output.
2728 *
@@ -39,4 +40,5 @@
4041 * @return array
4142 */
4243 function getSpecificParameterInfo();
 44+
4345 }
\ No newline at end of file

Status & tagging log