Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php |
— | — | @@ -0,0 +1,59 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Parameter manipulation ensuring the service is valid and loading adittional parameter definitions. |
| 6 | + * |
| 7 | + * @since 0.7 |
| 8 | + * |
| 9 | + * @file Maps_ParamService.php |
| 10 | + * @ingroup Validator |
| 11 | + * @ingroup ParameterManipulations |
| 12 | + * |
| 13 | + * @author Jeroen De Dauw |
| 14 | + */ |
| 15 | +class MapsParamService extends ItemParameterManipulation { |
| 16 | + |
| 17 | + /** |
| 18 | + * The mapping feature. Needed to determine which services are available. |
| 19 | + * |
| 20 | + * @since 0.7 |
| 21 | + * |
| 22 | + * @var string |
| 23 | + */ |
| 24 | + protected $feature; |
| 25 | + |
| 26 | + /** |
| 27 | + * Adittional parameter definitions to load. |
| 28 | + * |
| 29 | + * @since 0.7 |
| 30 | + * |
| 31 | + * @var array of Parameter |
| 32 | + */ |
| 33 | + protected $serviceParams; |
| 34 | + |
| 35 | + /** |
| 36 | + * Constructor. |
| 37 | + * |
| 38 | + * @since 0.7 |
| 39 | + */ |
| 40 | + public function __construct( $feature, array $serviceParams = array() ) { |
| 41 | + parent::__construct(); |
| 42 | + |
| 43 | + $this->feature = $feature; |
| 44 | + $this->serviceParams = $serviceParams; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see ItemParameterManipulation::doManipulation |
| 49 | + * |
| 50 | + * @since 0.7 |
| 51 | + */ |
| 52 | + public function doManipulation( &$value, array &$parameters ) { |
| 53 | + // Make sure the service is valid. |
| 54 | + $value = MapsMappingService::getValidServiceName( $value, $this->feature ); |
| 55 | + |
| 56 | + // Add the service specific service parameters. |
| 57 | + $parameters = array_merge( $parameters, $this->serviceParams ); |
| 58 | + } |
| 59 | + |
| 60 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 61 | + native |