Skip to content

Commit cde4a1d

Browse files
committed
Adds a warning event
1 parent 5c10837 commit cde4a1d

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

src/Event/Warning.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
namespace phpbu\App\Event;
3+
4+
/**
5+
* Debug Event
6+
*
7+
* @package phpbu
8+
* @subpackage Event
9+
* @author MoeBrowne <moebrowne@users.noreply.github.com>
10+
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
11+
* @link http://phpbu.de/
12+
* @since Class available since Release 6.0.0
13+
*/
14+
class Warning
15+
{
16+
/**
17+
* Event name
18+
*/
19+
const NAME = 'phpbu.warning';
20+
21+
/**
22+
* Warning message
23+
*
24+
* @var string
25+
*/
26+
protected $message;
27+
28+
/**
29+
* Constructor.
30+
*
31+
* @param string $message
32+
*/
33+
public function __construct(string $message)
34+
{
35+
$this->message = $message;
36+
}
37+
38+
/**
39+
* Message getter.
40+
*
41+
* @return string
42+
*/
43+
public function getMessage() : string
44+
{
45+
return $this->message;
46+
}
47+
}

src/Result.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,4 +564,15 @@ public function debug($msg) : void
564564
$event = new Event\Debug($msg);
565565
$this->eventDispatcher->dispatch(Event\Debug::NAME, $event);
566566
}
567+
568+
/**
569+
* Warning
570+
*
571+
* @param string $msg
572+
*/
573+
public function warn($msg) : void
574+
{
575+
$event = new Event\Warning($msg);
576+
$this->eventDispatcher->dispatch(Event\Warning::NAME, $event);
577+
}
567578
}

0 commit comments

Comments
 (0)