• 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/UnavailableFieldsTrait.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
use ReflectionProperty;
17

18
trait UnavailableFieldsTrait
19
{
20
    /**
21
     * @param mixed  $clazzName
22
     * @param string $fieldName
23
     * @param mixed  $instance
24
     *
25
     * @return mixed|null
26
     */
27
    protected function getFieldByReflection($clazzName, string $fieldName, $instance)
7✔
28
    {
29
        if (!empty($clazzName)) {
7✔
30
            $refObject = new ReflectionProperty($clazzName, $fieldName);
7✔
31
            $refObject->setAccessible(true); // NOSONAR: php:S3011
7✔
32

33
            return $refObject->getValue($instance);  // NOSONAR: php:S3011
7✔
34
        } else {
UNCOV
35
            return null;
×
36
        }
37
    }
38

39
    /**
40
     * @param string $fieldName
41
     *
42
     * @return mixed|null
43
     */
44
    protected function getFieldFromO2t(string $fieldName)
7✔
45
    {
46
        /** @psalm-suppress RedundantConditionGivenDocblockType */
47
        if (!empty($this->o2t)) { // @phpstan-ignore empty.property,property.notFound
7✔
48
            $locO2t = $this->o2t;
6✔
49
            /** @psalm-suppress TypeDoesNotContainType */
50
            $clazzName = get_class($locO2t) === false ? '' : get_class($locO2t); // @phpstan-ignore identical.alwaysFalse
6✔
51

52
            return $this->getFieldByReflection($clazzName, $fieldName, $locO2t);
6✔
53
        } else {
54
            return null;
1✔
55
        }
56
    }
57
}
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