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

BlockPrefixTrait::getBlockPrefix()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 4
nop 0
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