Conditions | 5 |
Paths | 7 |
Total Lines | 21 |
Lines | 9 |
Ratio | 42.86 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
39 | public function remove( $statement, EditInfo $editInfo = null ) { |
||
40 | View Code Duplication | 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 | } |
||
52 | |||
53 | $params = [ |
||
54 | 'claim' => $guid, |
||
55 | ]; |
||
56 | |||
57 | $this->api->postRequest( 'wbremoveclaims', $params, $editInfo ); |
||
58 | return true; |
||
59 | } |
||
60 | |||
62 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.