Skip to content

Commit

Permalink
Rename Action to AbstractAction
Browse files Browse the repository at this point in the history
  • Loading branch information
VerifiedJoseph committed Apr 21, 2024
1 parent 934094f commit 8807918
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/Action.php → src/Action/AbstractAction.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace Ntfy;
namespace Ntfy\Action;

/**
* Base class for button actions
*
* @see https://ntfy.sh/docs/publish/#action-buttons
*/
abstract class Action
abstract class AbstractAction
{
/** @var string $type Button action type */
protected string $type = '';
Expand Down
4 changes: 1 addition & 3 deletions src/Action/Broadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace Ntfy\Action;

use Ntfy\Action;

/**
* Class for creating an android broadcast button action
*
* @see https://ntfy.sh/docs/publish/#send-android-broadcast
*/
class Broadcast extends Action
class Broadcast extends AbstractAction
{
/** {@inheritDoc} */
protected string $type = 'broadcast';
Expand Down
4 changes: 1 addition & 3 deletions src/Action/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace Ntfy\Action;

use Ntfy\Action;

/**
* Class for creating a http button action
*
* @see https://ntfy.sh/docs/publish/#open-websiteapp
*/
class Http extends Action
class Http extends AbstractAction
{
/** {@inheritDoc} */
protected string $type = 'http';
Expand Down
4 changes: 1 addition & 3 deletions src/Action/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace Ntfy\Action;

use Ntfy\Action;

/**
* Class for creating a view button action
*
* @see https://ntfy.sh/docs/publish/#open-websiteapp
*/
class View extends Action
class View extends AbstractAction
{
/** {@inheritDoc} */
protected string $type = 'view';
Expand Down
7 changes: 5 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Ntfy;

use Ntfy\Action\Broadcast;
use Ntfy\Action\Http;
use Ntfy\Action\View;
use Ntfy\Exception\NtfyException;

/**
Expand Down Expand Up @@ -191,11 +194,11 @@ public function attachURL(string $url, string $name = ''): void
/**
* Set an action button
*
* @param Action $action Action class instance
* @param Broadcast|Http|View $action Action class instance
*
* @see https://ntfy.sh/docs/publish/#action-buttons
*/
public function action(Action $action): void
public function action(Broadcast|Http|View $action): void
{
$this->data['actions'][] = $action->get();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Action/BroadcastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Ntfy\Action\Broadcast;

#[CoversClass(Broadcast::class)]
#[UsesClass(Ntfy\Action::class)]
#[UsesClass(Ntfy\Action\AbstractAction::class)]
class BroadcastTest extends TestCase
{
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Action/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Ntfy\Action\Http;

#[CoversClass(Http::class)]
#[UsesClass(Ntfy\Action::class)]
#[UsesClass(Ntfy\Action\AbstractAction::class)]
class HttpTest extends TestCase
{
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Action/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Ntfy\Action\View;

#[CoversClass(View::class)]
#[CoversClass(Ntfy\Action::class)]
#[CoversClass(Ntfy\Action\AbstractAction::class)]
class ViewTest extends TestCase
{
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#[UsesClass(Server::class)]
#[UsesClass(Message::class)]
#[UsesClass(Json::class)]
#[UsesClass(Action::class)]
#[UsesClass(Ntfy\Guzzle::class)]
#[UsesClass(Ntfy\Auth\User::class)]
#[UsesClass(Ntfy\Auth\Token::class)]
#[UsesClass(Ntfy\Auth\AbstractAuth::class)]
#[UsesClass(Ntfy\Action\View::class)]
#[UsesClass(Ntfy\Action\AbstractAction::class)]
class ClientTest extends TestCase
{
protected static stdClass $authParams;
Expand Down
2 changes: 1 addition & 1 deletion tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use Ntfy\Exception\NtfyException;

#[CoversClass(Message::class)]
#[UsesClass(Action::class)]
#[UsesClass(Json::class)]
#[UsesClass(Action\View::class)]
#[UsesClass(Action\AbstractAction::class)]
#[UsesClass(NtfyException::class)]
class MessageTest extends TestCase
{
Expand Down

0 comments on commit 8807918

Please sign in to comment.