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

conedevelopment / root / 15084089635

17 May 2025 10:00AM UTC coverage: 77.93% (+0.04%) from 77.891%
15084089635

push

github

web-flow
Modernize back-end.yml (#240)

3291 of 4223 relevant lines covered (77.93%)

36.04 hits per line

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

57.89
/src/Traits/ResolvesActions.php
1
<?php
2

3
namespace Cone\Root\Traits;
4

5
use Closure;
6
use Cone\Root\Actions\Action;
7
use Cone\Root\Actions\Actions;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Arr;
10

11
trait ResolvesActions
12
{
13
    /**
14
     * The actions collection.
15
     */
16
    protected ?Actions $actions = null;
17

18
    /**
19
     * The actions resolver callback.
20
     */
21
    protected ?Closure $actionsResolver = null;
22

23
    /**
24
     * Define the actions for the object.
25
     */
26
    public function actions(Request $request): array
198✔
27
    {
28
        return [];
198✔
29
    }
30

31
    /**
32
     * Set the actions resolver callback.
33
     */
34
    public function withActions(Closure $callback): static
×
35
    {
36
        $this->actionsResolver = $callback;
×
37

38
        return $this;
×
39
    }
40

41
    /**
42
     * Resolve the actions collection.
43
     */
44
    public function resolveActions(Request $request): Actions
198✔
45
    {
46
        if (is_null($this->actions)) {
198✔
47
            $this->actions = new Actions($this->actions($request));
198✔
48

49
            $this->actions->when(! is_null($this->actionsResolver), function (Actions $actions) use ($request): void {
198✔
50
                $actions->register(
×
51
                    Arr::wrap(call_user_func_array($this->actionsResolver, [$request]))
×
52
                );
×
53
            });
198✔
54

55
            $this->actions->each(function (Action $action) use ($request): void {
198✔
56
                $this->resolveAction($request, $action);
198✔
57
            });
198✔
58
        }
59

60
        return $this->actions;
198✔
61
    }
62

63
    /**
64
     * Handle the callback for the action resolution.
65
     */
66
    protected function resolveAction(Request $request, Action $action): void
×
67
    {
68
        //
69
    }
×
70
}
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

© 2025 Coveralls, Inc