TransactionalModule::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 16
ccs 12
cts 12
cp 1
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of the Ray.DoctrineOrmModule package
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\DoctrineOrmModule;
8
9
use Ray\Di\AbstractModule;
10
use Ray\DoctrineOrmModule\Annotation\Transactional;
11
12
class TransactionalModule extends AbstractModule
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 10
    protected function configure()
18
    {
19
        // Class annotated with @Transactional
20 10
        $this->bindInterceptor(
21 10
            $this->matcher->annotatedWith(Transactional::class),
22 10
            $this->matcher->any(),
23 10
            [TransactionalInterceptor::class]
24 10
        );
25
26
        // Method annotated with @Transactional
27 10
        $this->bindInterceptor(
28 10
            $this->matcher->any(),
29 10
            $this->matcher->annotatedWith(Transactional::class),
30 10
            [TransactionalInterceptor::class]
31 10
        );
32 10
    }
33
}
34