Skip to content

Commit

Permalink
/ Removed Exception catching on building Notification attributes (Lab…
Browse files Browse the repository at this point in the history
…el, Message, Type, Context)
  • Loading branch information
neneaX committed Mar 17, 2016
1 parent add9a8c commit aba6566
Showing 1 changed file with 4 additions and 37 deletions.
41 changes: 4 additions & 37 deletions src/NotificationFactory.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?php
namespace Xqddd\Notifications;

use Xqddd\Notifications\Exceptions\InvalidNotificationContextException;
use Xqddd\Notifications\Exceptions\InvalidNotificationLabelException;
use Xqddd\Notifications\Exceptions\InvalidNotificationMessageException;
use Xqddd\Notifications\Exceptions\InvalidNotificationTypeException;

/**
* Notification Factory class
*
Expand Down Expand Up @@ -179,14 +174,7 @@ public function buildEmergency($labelValue, $messageValue, $contextValue = null)
*/
protected function buildLabel($labelValue)
{
try {
$label = new Label($labelValue);
} catch (InvalidNotificationLabelException $e) {
/*
* @todo handle this case
*/
}
return $label;
return new Label($labelValue);
}

/**
Expand All @@ -197,14 +185,7 @@ protected function buildLabel($labelValue)
*/
protected function buildType($typeValue)
{
try {
$type = new Type($typeValue);
} catch (InvalidNotificationTypeException $e) {
/*
* @todo handle this case
*/
}
return $type;
return new Type($typeValue);
}

/**
Expand All @@ -215,14 +196,7 @@ protected function buildType($typeValue)
*/
protected function buildMessage($messageValue)
{
try {
$message = new Message($messageValue);
} catch (InvalidNotificationMessageException $e) {
/*
* @todo handle this case
*/
}
return $message;
return new Message($messageValue);
}

/**
Expand All @@ -233,13 +207,6 @@ protected function buildMessage($messageValue)
*/
protected function buildContext($contextValue)
{
try {
$context = new Context($contextValue);
} catch (InvalidNotificationContextException $e) {
/*
* @todo handle this case
*/
}
return $context;
return new Context($contextValue);
}
}

0 comments on commit aba6566

Please sign in to comment.