Aude has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232026

Change subject: Remove DispatchingValueParser from lib
......................................................................

Remove DispatchingValueParser from lib

This has been moved to data-values/common 0.3 which Wikibase now uses.

https://github.com/DataValues/Common/blob/master/src/ValueParsers/DispatchingValueParser.php

there are no tests for this in lib (there are tests in data values/common),
and both versions have the same namespace, so any usage (e.g. TimeParser)
does not need to be updated.

Change-Id: Id39d9463b89031d0ef7cd47c4f523b6e79c3361e
---
D lib/includes/parsers/DispatchingValueParser.php
1 file changed, 0 insertions(+), 73 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/26/232026/1

diff --git a/lib/includes/parsers/DispatchingValueParser.php 
b/lib/includes/parsers/DispatchingValueParser.php
deleted file mode 100644
index abf0faa..0000000
--- a/lib/includes/parsers/DispatchingValueParser.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-namespace ValueParsers;
-
-use InvalidArgumentException;
-
-/**
- * A generic value parser that forwards parsing to a list of other value 
parsers and returns the
- * result of the first parse attempt that succeeded.
- *
- * @since 0.5
- *
- * @licence GNU GPL v2+
- * @author Thiemo Mättig
- *
- * @todo Move to data-values/common, next to StringValueParser.
- */
-class DispatchingValueParser implements ValueParser {
-
-       /**
-        * @var ValueParser[]
-        */
-       private $parsers;
-
-       /**
-        * @see ParseException::getExpectedFormat
-        *
-        * @var string
-        */
-       private $format;
-
-       /**
-        * @param ValueParser[] $parsers
-        * @param string $format An identifier describing the expected format 
of the values to parse.
-        *
-        * @throws InvalidArgumentException
-        */
-       public function __construct( array $parsers, $format ) {
-               if ( empty( $parsers ) ) {
-                       throw new InvalidArgumentException( '$parsers must be a 
non-empty array' );
-               }
-
-               if ( !is_string( $format ) || $format === '' ) {
-                       throw new InvalidArgumentException( '$format must be a 
non-empty string' );
-               }
-
-               $this->parsers = $parsers;
-               $this->format = $format;
-       }
-
-       /**
-        * @param mixed $value
-        *
-        * @throws ParseException
-        * @return mixed
-        */
-       public function parse( $value ) {
-               foreach ( $this->parsers as $parser ) {
-                       try {
-                               return $parser->parse( $value );
-                       } catch ( ParseException $ex ) {
-                               continue;
-                       }
-               }
-
-               throw new ParseException(
-                       'The value is not recognized by the configured parsers',
-                       $value,
-                       $this->format
-               );
-       }
-
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/232026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id39d9463b89031d0ef7cd47c4f523b6e79c3361e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to