-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
/ Redesigned the NotificationCollection class + Added Classes for Notification attributes + Added support for PSR-3 list of logger interface levels + Created a class that extends Notification class, for each logger level: * Emergency * Critical * Alert * Error * Warning * Notice * Info * Debug + Created a Notification factory + Created a Notification Factory facade: Notif + Created a Presentable Interface for toString, toArray, toOutput, toJson methods + Created a Presentable Trait for basic implementations of toOutput and toJson methods
- Loading branch information
Showing
57 changed files
with
3,637 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
], | ||
"require": { | ||
"php": ">=5.4.0", | ||
"psr/log": "1.*", | ||
"xqddd/exceptions": "0.*" | ||
}, | ||
"require-dev": { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace Xqddd\Notifications; | ||
|
||
/** | ||
* Alert class | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications | ||
*/ | ||
class Alert extends Notification | ||
{ | ||
|
||
/** | ||
* Alert constructor. | ||
* | ||
* @param Label $label | ||
* @param Message $message | ||
*/ | ||
public function __construct(Label $label, Message $message) | ||
{ | ||
$type = new Type(TypeList::ALERT); | ||
|
||
parent::__construct($label, $message, $type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace Xqddd\Notifications; | ||
|
||
/** | ||
* Critical class | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications | ||
*/ | ||
class Critical extends Notification | ||
{ | ||
|
||
/** | ||
* Critical constructor. | ||
* | ||
* @param Label $label | ||
* @param Message $message | ||
*/ | ||
public function __construct(Label $label, Message $message) | ||
{ | ||
$type = new Type(TypeList::CRITICAL); | ||
|
||
parent::__construct($label, $message, $type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace Xqddd\Notifications; | ||
|
||
/** | ||
* Debug class | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications | ||
*/ | ||
class Debug extends Notification | ||
{ | ||
|
||
/** | ||
* Debug constructor. | ||
* | ||
* @param Label $label | ||
* @param Message $message | ||
*/ | ||
public function __construct(Label $label, Message $message) | ||
{ | ||
$type = new Type(TypeList::DEBUG); | ||
|
||
parent::__construct($label, $message, $type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace Xqddd\Notifications; | ||
|
||
/** | ||
* Emergency class | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications | ||
*/ | ||
class Emergency extends Notification | ||
{ | ||
|
||
/** | ||
* Emergency constructor. | ||
* | ||
* @param Label $label | ||
* @param Message $message | ||
*/ | ||
public function __construct(Label $label, Message $message) | ||
{ | ||
$type = new Type(TypeList::EMERGENCY); | ||
|
||
parent::__construct($label, $message, $type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace Xqddd\Notifications; | ||
|
||
/** | ||
* Error class | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications | ||
*/ | ||
class Error extends Notification | ||
{ | ||
|
||
/** | ||
* Error constructor. | ||
* | ||
* @param Label $label | ||
* @param Message $message | ||
*/ | ||
public function __construct(Label $label, Message $message) | ||
{ | ||
$type = new Type(TypeList::ERROR); | ||
|
||
parent::__construct($label, $message, $type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
namespace Xqddd\Notifications\Exceptions; | ||
|
||
use Xqddd\Exceptions\InvalidArgumentException; | ||
|
||
/** | ||
* Exception for invalid notification type | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications\Exceptions | ||
*/ | ||
class InvalidNotificationTypeException extends InvalidArgumentException | ||
{ | ||
|
||
/** | ||
* The exception message | ||
* | ||
* @var string | ||
*/ | ||
protected $message = 'Invalid [%s] notification type: [%s] expected - [%s] given.'; | ||
|
||
/** | ||
* The exception code | ||
* | ||
* @var int | ||
*/ | ||
protected $code = Codes::INVALID_NOTIFICATION_TYPE; | ||
|
||
/** | ||
* The exception string code | ||
* | ||
* @var string | ||
*/ | ||
protected $stringCode = 'INVALID_NOTIFICATION_TYPE'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
namespace Xqddd\Notifications\Exceptions; | ||
|
||
use Xqddd\Exceptions\DomainException; | ||
|
||
/** | ||
* Exception for an inappropriate notification type | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications\Exceptions | ||
*/ | ||
class NotificationTypeDomainException extends DomainException | ||
{ | ||
|
||
/** | ||
* The exception message | ||
* | ||
* @var string | ||
*/ | ||
protected $message = 'The provided notification type [%s] does not exist or does not belong to the current domain [%s].'; | ||
|
||
/** | ||
* The exception code | ||
* | ||
* @var int | ||
*/ | ||
protected $code = Codes::NOTIFICATION_TYPE_DOMAIN; | ||
|
||
/** | ||
* The exception string code | ||
* | ||
* @var string | ||
*/ | ||
protected $stringCode = 'NOTIFICATION_TYPE_DOMAIN'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace Xqddd\Notifications; | ||
|
||
/** | ||
* Info class | ||
* | ||
* @author Andrei Pirjoleanu <andreipirjoleanu@gmail.com> | ||
* @package Xqddd\Notifications | ||
*/ | ||
class Info extends Notification | ||
{ | ||
|
||
/** | ||
* Info constructor. | ||
* | ||
* @param Label $label | ||
* @param Message $message | ||
*/ | ||
public function __construct(Label $label, Message $message) | ||
{ | ||
$type = new Type(TypeList::INFO); | ||
|
||
parent::__construct($label, $message, $type); | ||
} | ||
} |
Oops, something went wrong.