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

conedevelopment / root / 17914324319

22 Sep 2025 11:49AM UTC coverage: 77.588% (-0.5%) from 78.055%
17914324319

push

github

iamgergo
copyable fields

10 of 38 new or added lines in 4 files covered. (26.32%)

3320 of 4279 relevant lines covered (77.59%)

35.45 hits per line

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

54.55
/src/Support/Alert.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Root\Support;
6

7
use Illuminate\Contracts\Support\Arrayable;
8
use Illuminate\Contracts\Support\Htmlable;
9
use Illuminate\Contracts\Support\Jsonable;
10
use Stringable;
11

12
class Alert implements Arrayable, Htmlable, Jsonable, Stringable
13
{
14
    public const string INFO = 'info';
15

16
    public const string SUCCESS = 'success';
17

18
    public const string ERROR = 'error';
19

20
    public const string WARNING = 'warning';
21

22
    /**
23
     * The alert message.
24
     */
25
    protected string $message;
26

27
    /**
28
     * The alert type.
29
     */
30
    protected string $type;
31

32
    /**
33
     * Create a new alert instance.
34
     */
35
    public function __construct(string $message, string $type = self::INFO)
14✔
36
    {
37
        $this->message = $message;
14✔
38
        $this->type = $type;
14✔
39
    }
40

41
    /**
42
     * Make a new info alert instance.
43
     */
44
    public static function info(string $message): array
4✔
45
    {
46
        return (new static($message, static::INFO))->toArray();
4✔
47
    }
48

49
    /**
50
     * Make a new success alert instance.
51
     */
52
    public static function success(string $message): array
10✔
53
    {
54
        return (new static($message, static::SUCCESS))->toArray();
10✔
55
    }
56

57
    /**
58
     * Make a new error alert instance.
59
     */
60
    public static function error(string $message): array
×
61
    {
62
        return (new static($message, static::ERROR))->toArray();
×
63
    }
64

65
    /**
66
     * Make a new warning alert instance.
67
     */
68
    public static function warning(string $message): array
×
69
    {
70
        return (new static($message, static::WARNING))->toArray();
×
71
    }
72

73
    /**
74
     * Get the array representation of the object.
75
     */
76
    public function toArray(): array
14✔
77
    {
78
        return [
14✔
79
            'message' => $this->message,
14✔
80
            'type' => $this->type,
14✔
81
        ];
14✔
82
    }
83

84
    /**
85
     * Get the JSON representation of the object.
86
     *
87
     * @param  int  $options
88
     */
89
    public function toJson($options = 0): string
×
90
    {
91
        return json_encode($this->toArray());
×
92
    }
93

94
    /**
95
     * Get content as a string of HTML.
96
     */
NEW
97
    public function toHtml(): string
×
98
    {
NEW
99
        return $this->message;
×
100
    }
101

102
    /**
103
     * Get the string representation of the object.
104
     */
105
    public function __toString(): string
×
106
    {
NEW
107
        return $this->toHtml();
×
108
    }
109
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc