Completed
Push — issue/96 ( 542eb1...939878 )
by Alex
02:21
created

StandardAbstract::getFeedRuleSet()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
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
namespace FeedIo;
11
12
use FeedIo\Reader\Document;
13
use FeedIo\Rule\DateTimeBuilder;
14
use FeedIo\Rule\ModifiedSince;
15
use FeedIo\Rule\Title;
16
17
abstract class StandardAbstract
18
{
19
20
    /**
21
     * DateTime default format
22
     */
23
    const DATETIME_FORMAT = \DateTime::RFC2822;
24
25
    /**
26
     * Supported format
27
     */
28
    const SYNTAX_FORMAT = '';
29
30
    /**
31
     * @var array
32
     */
33
    protected $mandatoryFields = array();
34
35
    /**
36
     * @var \FeedIo\Rule\DateTimeBuilder
37
     */
38
    protected $dateTimeBuilder;
39
40
    /**
41
     * @var string
42
     */
43
    protected $syntaxFormat = '';
44
45
    /**
46
     * @param \FeedIo\Rule\DateTimeBuilder $dateTimeBuilder
47
     */
48 52
    public function __construct(DateTimeBuilder $dateTimeBuilder)
49
    {
50 52
        $this->dateTimeBuilder = $dateTimeBuilder;
51 52
    }
52
53
    /**
54
     * Tells if the parser can handle the feed or not
55
     * @param  Document $document
56
     * @return boolean
57
     */
58
    abstract public function canHandle(Document $document);
59
60
    /**
61
     * @return string
62
     */
63 14
    public function getDefaultDateFormat()
64
    {
65 14
        return static::DATETIME_FORMAT;
66
    }
67
68
    /**
69
     * @return array
70
     */
71 9
    public function getMandatoryFields()
72
    {
73 9
        return $this->mandatoryFields;
74
    }
75
76
    /**
77
     * Returns the Format supported by the standard (XML, JSON, Text...)
78
     * @return string
79
     */
80 7
    public function getSyntaxFormat()
81
    {
82 7
        return static::SYNTAX_FORMAT;
83
    }
84
85
}
86