Code Duplication    Length = 54-54 lines in 3 locations

src/RSSFeed/simplepie/simplepie_1.3.1.mini.php 3 locations

@@ 1112-1165 (lines=54) @@
1109
        }
1110
    }
1111
    
1112
    public function get_categories()
1113
    {
1114
        $categories = array();
1115
        foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
1116
        {
1117
            $term = null;
1118
            $scheme = null;
1119
            $label = null;
1120
            if (isset($category['attribs']['']['term']))
1121
            {
1122
                $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
1123
            }
1124
            if (isset($category['attribs']['']['scheme']))
1125
            {
1126
                $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1127
            }
1128
            if (isset($category['attribs']['']['label']))
1129
            {
1130
                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
1131
            }
1132
            $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
1133
        }
1134
        foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
1135
        {
1136
            // This is really the label, but keep this as the term also for BC.
1137
            // Label will also work on retrieving because that falls back to term.
1138
            $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
1139
            if (isset($category['attribs']['']['domain']))
1140
            {
1141
                $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
1142
            }
1143
            else
1144
            {
1145
                $scheme = null;
1146
            }
1147
            $categories[] = $this->registry->create('Category', array($term, $scheme, null));
1148
        }
1149
        foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
1150
        {
1151
            $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
1152
        }
1153
        foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
1154
        {
1155
            $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
1156
        }
1157
        if (!empty($categories))
1158
        {
1159
            return array_unique($categories);
1160
        }
1161
        else
1162
        {
1163
            return null;
1164
        }
1165
    }
1166
    
1167
    public function get_author($key = 0)
1168
    {
@@ 6337-6390 (lines=54) @@
6334
        }
6335
    }
6336
    
6337
    public function get_categories()
6338
    {
6339
        $categories = array();
6340
        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
6341
        {
6342
            $term = null;
6343
            $scheme = null;
6344
            $label = null;
6345
            if (isset($category['attribs']['']['term']))
6346
            {
6347
                $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
6348
            }
6349
            if (isset($category['attribs']['']['scheme']))
6350
            {
6351
                $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
6352
            }
6353
            if (isset($category['attribs']['']['label']))
6354
            {
6355
                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
6356
            }
6357
            $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
6358
        }
6359
        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
6360
        {
6361
            // This is really the label, but keep this as the term also for BC.
6362
            // Label will also work on retrieving because that falls back to term.
6363
            $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6364
            if (isset($category['attribs']['']['domain']))
6365
            {
6366
                $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
6367
            }
6368
            else
6369
            {
6370
                $scheme = null;
6371
            }
6372
            $categories[] = $this->registry->create('Category', array($term, $scheme, null));
6373
        }
6374
        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
6375
        {
6376
            $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
6377
        }
6378
        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
6379
        {
6380
            $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
6381
        }
6382
        if (!empty($categories))
6383
        {
6384
            return array_unique($categories);
6385
        }
6386
        else
6387
        {
6388
            return null;
6389
        }
6390
    }
6391
    
6392
    public function get_author($key = 0)
6393
    {
@@ 12718-12771 (lines=54) @@
12715
            return null;
12716
        }
12717
    }
12718
    public function get_categories()
12719
    {
12720
        $categories = array();
12721
        foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
12722
        {
12723
            $term = null;
12724
            $scheme = null;
12725
            $label = null;
12726
            if (isset($category['attribs']['']['term']))
12727
            {
12728
                $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
12729
            }
12730
            if (isset($category['attribs']['']['scheme']))
12731
            {
12732
                $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
12733
            }
12734
            if (isset($category['attribs']['']['label']))
12735
            {
12736
                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
12737
            }
12738
            $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
12739
        }
12740
        foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
12741
        {
12742
            // This is really the label, but keep this as the term also for BC.
12743
            // Label will also work on retrieving because that falls back to term.
12744
            $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
12745
            if (isset($category['attribs']['']['domain']))
12746
            {
12747
                $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
12748
            }
12749
            else
12750
            {
12751
                $scheme = null;
12752
            }
12753
            $categories[] = $this->registry->create('Category', array($term, $scheme, null));
12754
        }
12755
        foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
12756
        {
12757
            $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
12758
        }
12759
        foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
12760
        {
12761
            $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
12762
        }
12763
        if (!empty($categories))
12764
        {
12765
            return array_unique($categories);
12766
        }
12767
        else
12768
        {
12769
            return null;
12770
        }
12771
    }
12772
    public function get_author($key = 0)
12773
    {
12774
        $authors = $this->get_authors();