• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

webeweb / xmltv-library / 3821848929

pending completion
3821848929

push

github

webeweb
Remove unused configuration files

1302 of 1306 relevant lines covered (99.69%)

294.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Model/Attribute/ArrayCategoriesTrait.php
1
<?php
2

3
/*
4
 * This file is part of the xmltv-library package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace WBW\Library\XmlTv\Model\Attribute;
13

14
use WBW\Library\XmlTv\Model\Category;
15

16
/**
17
 * Array categories trait.
18
 *
19
 * @author webeweb <https://github.com/webeweb>
20
 * @package WBW\Library\XmlTv\Model\Attribute
21
 */
22
trait ArrayCategoriesTrait {
23

24
    /**
25
     * Categories.
26
     *
27
     * @var Category[]
28
     */
29
    protected $categories;
30

31
    /**
32
     * Add a category.
33
     *
34
     * @param Category $category The category.
35
     * @return self Returns this instance.
36
     */
37
    public function addCategory(Category $category): self {
38
        $this->categories[] = $category;
357✔
39
        return $this;
357✔
40
    }
41

42
    /**
43
     * Get the categories.
44
     *
45
     * @return Category[] Returns the categories.
46
     */
47
    public function getCategories(): array {
48
        return $this->categories;
84✔
49
    }
50

51
    /**
52
     * Get the number of categories.
53
     *
54
     * @return int Returns the number of categories.
55
     */
56
    public function getNumberCategories(): int {
57
        return count($this->getCategories());
14✔
58
    }
59

60
    /**
61
     * Determines if this programme has categories.
62
     *
63
     * @return bool Returns true in case of success, false otherwise.
64
     */
65
    public function hasCategories(): bool {
66
        return 1 <= $this->getNumberCategories();
14✔
67
    }
68

69
    /**
70
     * Set the categories.
71
     *
72
     * @param Category[] $categories The categories.
73
     * @return self Returns this instance.
74
     */
75
    protected function setCategories(array $categories): self {
76
        $this->categories = $categories;
2,345✔
77
        return $this;
2,345✔
78
    }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc