Completed
Push — master ( 471a2c...9baf90 )
by Alex
14s
created

DefaultCallback   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 4 1
A handleError() 0 4 1
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Async;
12
13
use FeedIo\Reader\Result;
14
use \Psr\Log\LoggerInterface;
15
16
class DefaultCallback implements CallbackInterface
17
{
18
19
    /**
20
     * @var \Psr\Log\LoggerInterface
21
     */
22
    protected $logger;
23
24 2
    public function __construct(LoggerInterface $logger)
25
    {
26 2
        $this->logger = $logger;
27 2
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32 1
    public function process(Result $result): void
33
    {
34 1
        $this->logger->info("feed processed : {$result->getUrl()}");
35 1
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40 1
    public function handleError(Request $request, \Exception $exception) : void
41
    {
42 1
        $this->logger->warning("exception caught for {$request->getUrl()} : {$exception->getMessage()}");
43 1
    }
44
}
45