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

orchestral / canvas / 6222524073

18 Sep 2023 12:30PM UTC coverage: 91.007% (-2.9%) from 93.885%
6222524073

Pull #25

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #25: Use `Illuminate\Console\GeneratorCommand`

549 of 549 new or added lines in 33 files covered. (100.0%)

506 of 556 relevant lines covered (91.01%)

25.62 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
use Illuminate\Support\Collection;
7

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

21
        $preset = $config['preset'];
72✔
22

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

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