Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update webhook request with exceptions #104

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$finder = Symfony\Component\Finder\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/webhooks',
])
->name('*.php')
->ignoreDotFiles(true)
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ parameters:
level: 8
paths:
- src
- webhooks
tmpDir: build/phpstan
checkMissingIterableValueType: false
4 changes: 4 additions & 0 deletions src/Http/Actions/WebhookAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CSlant\TelegramGitNotifierApp\Http\Actions;

use CSlant\TelegramGitNotifier\Exceptions\WebhookException;
use CSlant\TelegramGitNotifier\Webhook;

class WebhookAction
Expand All @@ -21,6 +22,7 @@ public function __construct()
* Set webhook for telegram bot
*
* @return false|string
* @throws WebhookException
*/
public function set(): false|string
{
Expand All @@ -31,6 +33,7 @@ public function set(): false|string
* Delete webhook for telegram bot
*
* @return false|string
* @throws WebhookException
*/
public function delete(): false|string
{
Expand All @@ -41,6 +44,7 @@ public function delete(): false|string
* Get webhook update
*
* @return false|string
* @throws WebhookException
*/
public function getUpdates(): false|string
{
Expand Down
8 changes: 0 additions & 8 deletions webhook/delete.php

This file was deleted.

8 changes: 0 additions & 8 deletions webhook/getUpdate.php

This file was deleted.

8 changes: 0 additions & 8 deletions webhook/set.php

This file was deleted.

14 changes: 14 additions & 0 deletions webhooks/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use CSlant\TelegramGitNotifier\Exceptions\WebhookException;
use CSlant\TelegramGitNotifierApp\Http\Actions\WebhookAction;

require __DIR__ . '/../init.php';

$webhookAction = new WebhookAction();

try {
echo $webhookAction->delete();
} catch (WebhookException $e) {
echo $e->getMessage();
}
14 changes: 14 additions & 0 deletions webhooks/getUpdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use CSlant\TelegramGitNotifier\Exceptions\WebhookException;
use CSlant\TelegramGitNotifierApp\Http\Actions\WebhookAction;

require __DIR__ . '/../init.php';

$webhookAction = new WebhookAction();

try {
echo $webhookAction->getUpdates();
} catch (WebhookException $e) {
echo $e->getMessage();
}
14 changes: 14 additions & 0 deletions webhooks/set.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use CSlant\TelegramGitNotifier\Exceptions\WebhookException;
use CSlant\TelegramGitNotifierApp\Http\Actions\WebhookAction;

require __DIR__ . '/../init.php';

$webhookAction = new WebhookAction();

try {
echo $webhookAction->set();
} catch (WebhookException $e) {
echo $e->getMessage();
}