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

orchestral / canvas / 13226414033

09 Feb 2025 02:02PM UTC coverage: 94.33% (+0.2%) from 94.118%
13226414033

Pull #42

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #42: Refactor `Orchestra\Canvas\Canvas`

4 of 5 new or added lines in 1 file covered. (80.0%)

732 of 776 relevant lines covered (94.33%)

32.65 hits per line

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

83.33
/src/Canvas.php
1
<?php
2

3
namespace Orchestra\Canvas;
4

5
use Illuminate\Support\Arr;
6
use InvalidArgumentException;
7

8
class Canvas
9
{
10
    /**
11
     * Make Preset from configuration.
12
     *
13
     * @param  array<string, mixed>  $config
14
     */
15
    public static function preset(array $config, string $basePath): Presets\Preset
16
    {
17
        /** @var array<string, mixed> $configuration */
18
        $configuration = Arr::except($config, 'preset');
85✔
19

20
        /** @var string|class-string<\Orchestra\Canvas\Presets\Preset> $preset */
21
        $preset = $config['preset'] ?? 'laravel';
85✔
22

23
        /** @phpstan-ignore return.type */
24
        return match (true) {
25
            $preset === 'package' => new Presets\Package($configuration, $basePath),
85✔
26
            $preset === 'laravel' => new Presets\Laravel($configuration, $basePath),
84✔
NEW
27
            class_exists($preset) => new $preset($configuration, $basePath),
×
28
            default => throw new InvalidArgumentException(\sprintf('Unable to resolve %s preset', $preset)),
85✔
29
        };
30
    }
31
}
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