Skip to content

Commit

Permalink
Removed unused $categoryId parameter from the NotificationParser pars…
Browse files Browse the repository at this point in the history
…e function
  • Loading branch information
mabdelrahman91 committed Jun 27, 2017
1 parent c517aff commit 349ed53
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Notifynder/Builder/Notification.php
Expand Up @@ -165,7 +165,7 @@ public function getText()
$notification = new ModelNotification($this);
$notifynderParse = new NotificationParser();

return $notifynderParse->parse($notification, $this->category_id);
return $notifynderParse->parse($notification);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Notifynder/Models/Notification.php
Expand Up @@ -132,7 +132,7 @@ public function getTextAttribute()
{
if (! array_key_exists('text', $this->attributes)) {
$notifynderParse = new NotificationParser();
$this->attributes['text'] = $notifynderParse->parse($this, $this->category_id);
$this->attributes['text'] = $notifynderParse->parse($this);
}

return $this->attributes['text'];
Expand Down
3 changes: 1 addition & 2 deletions src/Notifynder/Parsers/NotificationParser.php
Expand Up @@ -21,11 +21,10 @@ class NotificationParser
* Parse a notification and return the body text.
*
* @param ModelNotification $notification
* @param int $categoryId
* @return string
* @throws ExtraParamsException
*/
public function parse($notification, $categoryId)
public function parse($notification)
{
$category = $notification->category;
if (is_null($category)) {
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/Parsers/NotificationParserTest.php
Expand Up @@ -6,9 +6,8 @@

class NotificationParserTest extends NotifynderTestCase
{
public function testThrowsModelNotFoundExceptionIfCategoryIsNull()
public function testParseThrowsModelNotFoundExceptionIfCategoryIsNull()
{
$category = $this->createCategory();
$from = $this->createUser();
$to = $this->createUser();
$notification = new Notification();
Expand All @@ -18,6 +17,6 @@ public function testThrowsModelNotFoundExceptionIfCategoryIsNull()

$this->expectException(ModelNotFoundException::class);
$parser = new NotificationParser();
$parser->parse($notification, $category->id);
$parser->parse($notification);
}
}

0 comments on commit 349ed53

Please sign in to comment.