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

heimrichhannot / contao-utils-bundle / 7195481576

13 Dec 2023 12:52PM UTC coverage: 73.935% (-0.3%) from 74.277%
7195481576

push

github

koertho
added class utils

1 of 6 new or added lines in 2 files covered. (16.67%)

746 of 1009 relevant lines covered (73.93%)

3.67 hits per line

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

0.0
/src/Util/ClassUtil.php
1
<?php
2

3
namespace HeimrichHannot\UtilsBundle\Util;
4

5
class ClassUtil
6
{
7
    /**
8
     * Return true if the given class or a parent class implements the given trait
9
     */
10
    public function classImplementsTrait(object|string $class, string $trait): bool
11
    {
12
        do {
NEW
13
            if (in_array($trait, class_uses($class))) {
×
NEW
14
                return true;
×
15
            }
16

NEW
17
        } while($class = get_parent_class($class));
×
18

NEW
19
        return false;
×
20
    }
21
}
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