ShortName   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 12
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A shortname() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Packagist Mirror.
7
 *
8
 * For the full license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webs\Mirror;
13
14
/**
15
 * Trait to shortname of package.
16
 *
17
 * @author Webysther Nunes <[email protected]>
18
 */
19
trait ShortName
20
{
21
    /**
22
     * Find hash and replace by *.
23
     *
24
     * @param string $name Name of provider or package
25
     *
26
     * @return string Shortname
27
     */
28 1
    protected function shortname(string $name):string
29
    {
30 1
        return str_replace('*', '$*', preg_replace('/\$(\w*)/', '*', $name));
31
    }
32
}
33