Url::extractId()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Rogierw\RwAcme\Support;
4
5
class Url
6
{
7
    public static function extractId(string $url): string
8
    {
9
        if (empty($url)) {
10
            return '';
11
        }
12
13
        $url = rtrim($url, '/');
14
15
        $positionLastSlash = strrpos($url, '/');
16
17
        return substr($url, ($positionLastSlash + 1));
18
    }
19
}
20