Completed
Branch master (5acf81)
by Steevan
04:21
created

BlockPrefixTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getBlockPrefix() 0 8 3
1
<?php
2
3
namespace steevanb\SymfonyFormOptionsBuilder;
4
5
trait BlockPrefixTrait
6
{
7
    /**
8
     * @return string
9
     * @link https://github.com/symfony/symfony/pull/16724
10
     * @since 2.8
11
     */
12
    public function getBlockPrefix()
13
    {
14
        $fullClassName = get_class($this);
15
        $className = ($pos = strrpos($fullClassName, '\\')) ? substr($fullClassName, $pos + 1) : $fullClassName;
16
        $className = ($pos = strrpos($className, 'Type')) ? substr($className, 0, -4) : $className;
17
18
        return 'form_type_' . strtolower($className);
19
    }
20
}
21