• 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

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

3
namespace Cone\Root\Support;
4

5
use Illuminate\Contracts\Support\Arrayable;
6
use Illuminate\Contracts\Support\Jsonable;
7
use Stringable;
8

9
class Alert implements Arrayable, Jsonable, Stringable
10
{
11
    public const string INFO = 'info';
12

13
    public const string SUCCESS = 'success';
14

15
    public const string ERROR = 'error';
16

17
    public const string WARNING = 'warning';
18

19
    /**
20
     * The alert message.
21
     */
22
    protected string $message;
23

24
    /**
25
     * The alert type.
26
     */
27
    protected string $type;
28

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

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

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

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

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

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

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

91
    /**
92
     * Get the string representation of the object.
93
     */
94
    public function __toString(): string
×
95
    {
96
        return $this->message;
×
97
    }
98
}
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