Code Duplication    Length = 9-9 lines in 3 locations

src/Api/Service/ReferenceRemover.php 1 location

@@ 49-57 (lines=9) @@
46
			throw new UnexpectedValueException( 'Could not get reference hash from $reference' );
47
		}
48
49
		if ( is_string( $target ) ) {
50
			$guid = $target;
51
		} elseif ( $target instanceof StatementGuid ) {
52
			$guid = $target->getSerialization();
53
		} elseif ( $target instanceof Statement ) {
54
			$guid = $target->getGuid();
55
		} else {
56
			throw new UnexpectedValueException( 'Could not get statement guid from $target' );
57
		}
58
		if ( !is_string( $guid ) ) {
59
			throw new UnexpectedValueException( 'Unexpected statement guid got from $target' );
60
		}

src/Api/Service/ReferenceSetter.php 1 location

@@ 51-59 (lines=9) @@
48
	 * @throws UnexpectedValueException
49
	 */
50
	public function set( Reference $reference, $statement, $targetReference = null, EditInfo $editInfo = null ) {
51
		if ( is_string( $statement ) ) {
52
			$guid = $statement;
53
		} elseif ( $statement instanceof StatementGuid ) {
54
			$guid = $statement->getSerialization();
55
		} elseif ( $statement instanceof Statement ) {
56
			$guid = $statement->getGuid();
57
		} else {
58
			throw new UnexpectedValueException( 'Could not get statement guid from $statement' );
59
		}
60
		if ( !is_string( $guid ) ) {
61
			throw new UnexpectedValueException( 'Unexpected statement guid got from $statement' );
62
		}

src/Api/Service/StatementRemover.php 1 location

@@ 40-48 (lines=9) @@
37
	 * @throws UnexpectedValueException
38
	 */
39
	public function remove( $statement, EditInfo $editInfo = null ) {
40
		if ( is_string( $statement ) ) {
41
			$guid = $statement;
42
		} elseif ( $statement instanceof StatementGuid ) {
43
			$guid = $statement->getSerialization();
44
		} elseif ( $statement instanceof Statement ) {
45
			$guid = $statement->getGuid();
46
		} else {
47
			throw new UnexpectedValueException( 'Could not get statement guid from $statement' );
48
		}
49
		if ( !is_string( $guid ) ) {
50
			throw new UnexpectedValueException( 'Unexpected statement guid got from $statement' );
51
		}