Json   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 23
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canHandle() 0 4 1
A getFormatter() 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\Standard;
12
13
use FeedIo\Formatter\JsonFormatter;
14
use FeedIo\FormatterInterface;
15
use FeedIo\Reader\Document;
16
use FeedIo\StandardAbstract;
17
18
class Json extends StandardAbstract
19
{
20
    const SYNTAX_FORMAT = 'Json';
21
22
    protected $mandatoryFields = ['version', 'title', 'items'];
23
24
    /**
25
     * @param Document $document
26
     * @return bool
27
     */
28 2
    public function canHandle(Document $document) : bool
29
    {
30 2
        return $document->isJson();
31
    }
32
33
    /**
34
     * @return FormatterInterface
35
     */
36
    public function getFormatter() : FormatterInterface
37
    {
38
        return new JsonFormatter();
39
    }
40
}
41