Completed
Pull Request — master (#1510)
by
unknown
18:08
created

CustomType::closureToPHP()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.6666
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Doctrine\ODM\MongoDB\Types;
4
5
class CustomType extends Type
6
{
7
    /**
8
     * @return string Redirects to the method convertToPHPValue from child class
9
     */
10 1
    final public function closureToPHP()
11
    {
12 1
        $fqcn = get_class($this);
13
14 1
        return sprintf('
15
            $reflection = new \ReflectionClass("%s");
16
            $type = $reflection->newInstanceWithoutConstructor();
17 1
            $return = $type->convertToPHPValue($value);', $fqcn);
18
    }
19
}
20