Completed
Pull Request — master (#16)
by Nikola
01:29
created

LoggingAspect::beforeMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Go\Symfony\GoAopBundle\Tests\TestProject\Aspect;
4
5
use Go\Aop\Aspect;
6
use Go\Aop\Intercept\MethodInvocation;
7
use Go\Lang\Annotation\Before;
8
use Psr\Log\LoggerInterface;
9
10
/**
11
 * Application logging aspect
12
 */
13
class LoggingAspect implements Aspect
14
{
15
    /**
16
     * @var LoggerInterface
17
     */
18
    private $logger;
19
20
    public function __construct(LoggerInterface $logger)
21
    {
22
        $this->logger = $logger;
23
    }
24
25
    /**
26
     * Writes a log info before method execution
27
     *
28
     * @param MethodInvocation $invocation
29
     * @Before("@execution(Go\Symfony\GoAopBundle\Tests\TestProject\Annotation\Loggable)")
30
     */
31
    public function beforeMethod(MethodInvocation $invocation)
32
    {
33
        $this->logger->info($invocation, $invocation->getArguments());
34
    }
35
}
36