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

orchestral / canvas / 6224137920

18 Sep 2023 02:42PM UTC coverage: 90.984% (+1.0%) from 89.945%
6224137920

push

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

603 of 603 new or added lines in 34 files covered. (100.0%)

555 of 610 relevant lines covered (90.98%)

24.54 hits per line

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

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

3
namespace Orchestra\Canvas;
4

5
use Illuminate\Support\Arr;
6

7
class Canvas
8
{
9
    /**
10
     * Make Preset from configuration.
11
     *
12
     * @param  array<string, mixed>  $config
13
     * @return \Orchestra\Canvas\Presets\Preset
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');
74✔
19

20
        $preset = $config['preset'];
74✔
21

22
        switch ($preset) {
23
            case 'package':
74✔
24
                return new Presets\Package($configuration, $basePath);
1✔
25
            case 'laravel':
73✔
26
                return new Presets\Laravel($configuration, $basePath);
73✔
27
            default:
28
                if (class_exists($preset)) {
×
29
                    /**
30
                     * @var class-string<\Orchestra\Canvas\Presets\Preset> $preset
31
                     *
32
                     * @return \Orchestra\Canvas\Presets\Preset
33
                     */
34
                    return new $preset($configuration, $basePath);
×
35
                }
36

37
                return new Presets\Laravel($configuration, $basePath);
×
38
        }
39
    }
40
}
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