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

JsonMapper / LaravelPackage / 13370932230

17 Feb 2025 01:04PM UTC coverage: 100.0%. Remained the same
13370932230

Pull #24

github

web-flow
Merge 03cbee78c into b0d87283e
Pull Request #24: ci: extend workflow matrix to include php 8.2, 8.3 and 8.4

20 of 20 relevant lines covered (100.0%)

27.05 hits per line

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

100.0
/src/ServiceProvider.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace JsonMapper\LaravelPackage;
6

7
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
8
use JsonMapper\JsonMapper;
9
use JsonMapper\JsonMapperBuilder;
10
use JsonMapper\JsonMapperFactory;
11
use JsonMapper\JsonMapperInterface;
12

13
class ServiceProvider extends BaseServiceProvider
14
{
15
    private const CONFIG_FILE = __DIR__ . '/../config/json-mapper.php';
16

17
    /** @return void */
18
    public function register()
19
    {
20
        $this->mergeConfigFrom(self::CONFIG_FILE, 'json-mapper');
39✔
21

22
        $this->app->singleton(JsonMapperInterface::class, function ($app) {
33✔
23
            $config = $app->get('config')->get('json-mapper.type');
39✔
24
            $builder = JsonMapperBuilder::new()
39✔
25
                ->withJsonMapperClassName(\JsonMapper\LaravelPackage\JsonMapper::class);
39✔
26
            $factory = new JsonMapperFactory($builder);
39✔
27

28
            switch ($config) {
6✔
29
                case 'best-fit':
39✔
30
                    return $factory->bestFit();
13✔
31
                case 'default':
26✔
32
                default:
33
                    return $factory->default();
26✔
34
            }
35
        });
39✔
36

37
        $this->app->alias(JsonMapperInterface::class, JsonMapper::class);
39✔
38
        $this->app->alias(JsonMapperInterface::class, \JsonMapper\LaravelPackage\JsonMapperInterface::class);
39✔
39
        $this->app->alias(JsonMapperInterface::class, \JsonMapper\LaravelPackage\JsonMapper::class);
39✔
40
    }
6✔
41

42
    /**
43
     * @return void
44
     */
45
    public function boot()
46
    {
47
        $this->publishes([self::CONFIG_FILE => \config_path('json-mapper.php')]);
13✔
48
    }
2✔
49
}
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