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

codeigniter4 / CodeIgniter4 / 12739860967

13 Jan 2025 03:03AM UTC coverage: 84.454%. Remained the same
12739860967

push

github

web-flow
chore: add more trailing commas in more places (#9395)

* Apply to parameters

* Apply to array destructuring

* Apply to match

* Apply for arguments

337 of 397 new or added lines in 117 files covered. (84.89%)

1 existing line in 1 file now uncovered.

20464 of 24231 relevant lines covered (84.45%)

189.67 hits per line

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

66.67
/system/Test/ConfigFromArrayTrait.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Test;
15

16
use LogicException;
17

18
trait ConfigFromArrayTrait
19
{
20
    /**
21
     * Creates a Config instance from an array.
22
     *
23
     * @template T of \CodeIgniter\Config\BaseConfig
24
     *
25
     * @param class-string<T>      $classname Config classname
26
     * @param array<string, mixed> $config
27
     *
28
     * @return T
29
     */
30
    private function createConfigFromArray(string $classname, array $config)
31
    {
32
        $configObj = new $classname();
56✔
33

34
        foreach ($config as $key => $value) {
56✔
35
            if (property_exists($configObj, $key)) {
54✔
36
                $configObj->{$key} = $value;
54✔
37

38
                continue;
54✔
39
            }
40

41
            throw new LogicException(
×
NEW
42
                'No such property: ' . $classname . '::$' . $key,
×
43
            );
×
44
        }
45

46
        return $configObj;
56✔
47
    }
48
}
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

© 2025 Coveralls, Inc