Completed
Push — issue/98 ( 297abd )
by Alex
03:51 queued 03:51
created

StandardAbstract::getFormatter()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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