Completed
Push — master ( 401ef4...2832e5 )
by yuuki
02:02
created

QueryLogPointCut::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
/**
4
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10
 * THE SOFTWARE.
11
 *
12
 * This software consists of voluntary contributions made by many individuals
13
 * and is licensed under the MIT license.
14
 *
15
 * Copyright (c) 2015-2017 Yuuki Takezawa
16
 *
17
 */
18
19
namespace Ytake\LaravelAspect\PointCut;
20
21
use Illuminate\Contracts\Container\Container;
22
use Ytake\LaravelAspect\Annotation\QueryLog;
23
use Ytake\LaravelAspect\Interceptor\QueryLogInterceptor;
24
25
/**
26
 * Class QueryLogPointCut
27
 */
28 View Code Duplication
class QueryLogPointCut 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...
29
{
30
    /** @var string */
31
    protected $annotation = QueryLog::class;
32
33
    /**
34
     * @param Container $app
35
     *
36
     * @return \Ray\Aop\Pointcut
37
     */
38
    public function configure(Container $app)
39
    {
40
        $interceptor = new QueryLogInterceptor;
41
        $interceptor->setLogger($app['Psr\Log\LoggerInterface']);
42
        $interceptor->setDispatcher($app['Illuminate\Contracts\Events\Dispatcher']);
43
        $this->setInterceptor($interceptor);
44
45
        return $this->withAnnotatedAnyInterceptor();
46
    }
47
}
48