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

DefaultCallback::handleError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 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