Rss::__construct()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 40
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 34
CRAP Score 1

Importance

Changes 3
Bugs 2 Features 1
Metric Value
c 3
b 2
f 1
dl 0
loc 40
ccs 34
cts 34
cp 1
rs 8.8571
cc 1
eloc 33
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Fwk
4
 *
5
 * Copyright (c) 2011-2012, Julien Ballestracci <[email protected]>.
6
 * All rights reserved.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
15
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
16
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
21
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
 * POSSIBILITY OF SUCH DAMAGE.
23
 *
24
 * PHP Version 5.3
25
 *
26
 * @category  XML
27
 * @package   Fwk\Xml
28
 * @author    Julien Ballestracci <[email protected]>
29
 * @copyright 2011-2014 Julien Ballestracci <[email protected]>
30
 * @license   http://www.opensource.org/licenses/bsd-license.php  BSD License
31
 * @link      http://www.nitronet.org/fwk
32
 */
33
namespace Fwk\Xml\Maps;
34
35
use Fwk\Xml\Map,
36
    Fwk\Xml\Path;
37
38
/**
39
 * Rss Xml Map
40
 * 
41
 * This Map helps the parsing of RSS files.
42
 * 
43
 * @category   Library
44
 * @package    Fwk\Xml
45
 * @subpackage Maps
46
 * @author     Julien Ballestracci <[email protected]>
47
 * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
48
 * @link       http://www.nitronet.org/fwk
49
 */
50
class Rss extends Map
51
{
52
    /**
53
     * Constructor
54
     * 
55
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
56
     */
57 3
    public function __construct()
58
    {
59 3
        $this->add(
60 3
            Path::factory('/rss/channel', 'channel')
61 3
            ->addChildren(Path::factory('title', 'title'))
62 3
            ->addChildren(Path::factory('link', 'link'))
63 3
            ->addChildren(Path::factory('description', 'description'))
64 3
            ->addChildren(Path::factory('language', 'language'))
65 3
            ->addChildren(Path::factory('lastBuildDate', 'lastBuildDate'))
66 3
            ->addChildren(Path::factory('sy:updatePeriod', 'updatePeriod'))
67 3
            ->addChildren(Path::factory('sy:updateFrequency', 'updateFrequency'))
68 3
            ->addChildren(Path::factory('generator', 'generator'))
69 3
            ->addChildren(
70 3
                Path::factory('image', 'image')
71 3
                ->addChildren(Path::factory('link', 'link'))
72 3
                ->addChildren(Path::factory('url', 'url'))
73 3
                ->addChildren(Path::factory('title', 'title'))
74
            )
75
        );
76
77 3
        $this->add(
78 3
            Path::factory('/rss/channel/item', 'items')
79 3
            ->loop(true)
80 3
            ->addChildren(Path::factory('title', 'title'))
81 3
            ->addChildren(Path::factory('link', 'link'))
82 3
            ->addChildren(Path::factory('comments', 'comments'))
83 3
            ->addChildren(Path::factory('pubDate', 'pubDate'))
84 3
            ->addChildren(Path::factory('dc:creator', 'creator'))
85 3
            ->addChildren(Path::factory('category', 'categories')->loop(true))
86 3
            ->addChildren(
87 3
                Path::factory('guid', 'guid')
88 3
                ->attribute('isPermaLink', 'permalink')
89 3
                ->value('value')
90 3
            )->addChildren(Path::factory('description', 'description'))
91 3
            ->addChildren(
92 3
                Path::factory('media:thumbnail', 'thumbnail')
93 3
                ->attribute('url')
94
            )
95
        );
96
    }
97
}