Passed
Pull Request — 1.x (#13)
by
unknown
12:35
created

StringFormatter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveString() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Renderer\MermaidRenderer;
6
7
trait StringFormatter
8
{
9
    public function resolveString(string $value): string
10
    {
11
        if (\preg_match('/[^_a-zA-Z0-9]/u', $value)) {
12
            $value = \preg_replace('/[^a-z0-9_]/u', '_', $value);
13
        }
14
15
        return $value;
16
    }
17
}
18