LogExceptionsPointCut::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
 * THE SOFTWARE.
12
 *
13
 * This software consists of voluntary contributions made by many individuals
14
 * and is licensed under the MIT license.
15
 *
16
 * Copyright (c) 2015-2020 Yuuki Takezawa
17
 *
18
 */
19
20
namespace Ytake\LaravelAspect\PointCut;
21
22
use Illuminate\Contracts\Container\Container;
23
use Ray\Aop\Pointcut;
24
use Ytake\LaravelAspect\Annotation\LogExceptions;
25
use Ytake\LaravelAspect\Interceptor\LogExceptionsInterceptor;
26
27
/**
28
 * Class LogExceptionsPointCut
29
 */
30 View Code Duplication
class LogExceptionsPointCut extends CommonPointCut implements PointCutable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
{
32
    /** @var string */
33
    protected $annotation = LogExceptions::class;
34
35
    /**
36
     * @param Container $app
37
     *
38
     * @return \Ray\Aop\Pointcut
39
     */
40
    public function configure(Container $app): Pointcut
41
    {
42
        $interceptor = new LogExceptionsInterceptor;
43
        $interceptor->setLogger($app['Psr\Log\LoggerInterface']);
44
        $this->setInterceptor($interceptor);
45
46
        return $this->withAnnotatedAnyInterceptor();
47
    }
48
}
49