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

The-oGlow / ezlogging / 17213505842

25 Aug 2025 03:37PM UTC coverage: 81.865%. Remained the same
17213505842

push

github

ollily
Initial commit

18 of 24 new or added lines in 7 files covered. (75.0%)

12 existing lines in 4 files now uncovered.

158 of 193 relevant lines covered (81.87%)

6.96 hits per line

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

91.67
/src/Tools/Reflection/UnavailableMethodsTrait.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of ezlogging
7
 *
8
 * (c) 2025 Oliver Glowa, coding.glowa.com
9
 *
10
 * This source file is subject to the Apache-2.0 license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13

14
namespace ollily\Tools\Reflection;
15

16
trait UnavailableMethodsTrait
17
{
18
    /**
19
     * Calls hidden method (private, protected, package) without parameters by reflection.
20
     *
21
     * @param mixed $clazzName
22
     * @param string $methodName
23
     * @param mixed  $instance
24
     *
25
     * @return mixed|null
26
     */
27
    protected function callMethodByReflection($clazzName, string $methodName, $instance)
17✔
28
    {
29
        if (!empty($clazzName)) {
17✔
30
            $refObject = new \ReflectionMethod($clazzName, $methodName);
17✔
31
            $refObject->setAccessible(true); // NOSONAR: php:S3011
17✔
32

33
            return $refObject->invoke($instance);
17✔
34
        } else {
UNCOV
35
            return null;
×
36
        }
37
    }
38

39
    /**
40
     * Calls a hidden method on an object which shall be tested (o2t).
41
     *
42
     * @param string $methodName
43
     *
44
     * @return mixed|null
45
     */
46
    protected function callMethodOnO2t(string $methodName)
17✔
47
    {
48
        /** @psalm-suppress RedundantConditionGivenDocblockType */
49
        if (!empty($this->o2t)) { // @phpstan-ignore empty.property,property.notFound
17✔
50
            $locO2t = $this->o2t;
16✔
51
            /** @psalm-suppress TypeDoesNotContainType */
52
            $clazzName = get_class($locO2t) === false ? '' : get_class($locO2t); // @phpstan-ignore identical.alwaysFalse
16✔
53

54
            return $this->callMethodByReflection($clazzName, $methodName, $locO2t);
16✔
55
        } else {
56
            return null;
1✔
57
        }
58
    }
59
}
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