| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.0466 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 35 | public function getUrlForFileName( string $fileName ): string { |
|
| 17 | 35 | $colonPosition = strpos( $fileName, ':' ); |
|
| 18 | |||
| 19 | 35 | $titleWithoutPrefix = $colonPosition === false ? $fileName : substr( $fileName, $colonPosition + 1 ); |
|
| 20 | |||
| 21 | 35 | $file = RepoGroup::singleton()->findFile( trim( $titleWithoutPrefix ) ); |
|
| 22 | |||
| 23 | 35 | if ( $file && $file->exists() ) { |
|
| 24 | return $file->getURL(); |
||
| 25 | } |
||
| 26 | |||
| 27 | 35 | return trim( $fileName ); |
|
| 28 | } |
||
| 29 | } |
||
| 30 |