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

mimmi20 / browser-detector / 12915563542

22 Jan 2025 07:24PM UTC coverage: 89.212% (-10.8%) from 100.0%
12915563542

push

github

web-flow
Merge pull request #872 from mimmi20/updates

rewrite Headers

2983 of 3466 new or added lines in 72 files covered. (86.06%)

9 existing lines in 2 files now uncovered.

4234 of 4746 relevant lines covered (89.21%)

11.89 hits per line

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

88.89
/src/Loader/CompanyLoaderFactory.php
1
<?php
2

3
/**
4
 * This file is part of the browser-detector package.
5
 *
6
 * Copyright (c) 2012-2025, Thomas Mueller <mimmi20@live.de>
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
declare(strict_types = 1);
13

14
namespace BrowserDetector\Loader;
15

16
use BrowserDetector\Loader\InitData\Company as DataCompany;
17
use Laminas\Hydrator\ArraySerializableHydrator;
18
use Laminas\Hydrator\Exception\InvalidArgumentException;
19
use Laminas\Hydrator\Strategy\CollectionStrategy;
20
use Laminas\Hydrator\Strategy\StrategyChain;
21
use Laminas\Hydrator\Strategy\StrategyInterface;
22
use Override;
23
use RuntimeException;
24

25
final class CompanyLoaderFactory implements CompanyLoaderFactoryInterface
26
{
27
    private CompanyLoader | null $loader = null;
28

29
    /** @throws RuntimeException */
30
    #[Override]
1✔
31
    public function __invoke(StrategyInterface $strategy): CompanyLoaderInterface
32
    {
33
        if ($this->loader === null) {
1✔
34
            try {
35
                $this->loader = new CompanyLoader(
1✔
36
                    initData: new Data\Company(
1✔
37
                        strategy: new StrategyChain(
1✔
38
                            [
1✔
39
                                new CollectionStrategy(
1✔
40
                                    new ArraySerializableHydrator(),
1✔
41
                                    DataCompany::class,
1✔
42
                                ),
1✔
43
                                $strategy,
1✔
44
                            ],
1✔
45
                        ),
1✔
46
                    ),
1✔
47
                );
1✔
NEW
48
            } catch (InvalidArgumentException $e) {
×
NEW
49
                throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
×
50
            }
51
        }
52

53
        return $this->loader;
1✔
54
    }
55
}
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