Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 8, 2019
1 parent c8b447f commit 30f8194
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 83 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: spatie
46 changes: 46 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: run-tests

on: [push]

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [7.4]
laravel: [6.*, 5.8.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 6.*
testbench: 4.*
- laravel: 5.8.*
testbench: 3.8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
extension-csv: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `laravel-webhook-server` will be documented in this file

## 1.5.0 - 2019-12-08

- drop support for PHP 7.3

## 1.4.0 - 2019-09-05

- add error info to the dispatched event
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
],
"require": {
"php": "^7.3",
"php": "^7.4",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.3",
"illuminate/bus": "^5.8|^6.0",
Expand Down
45 changes: 16 additions & 29 deletions src/CallWebhookJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Spatie\WebhookServer;

use GuzzleHttp\Psr7\Response;
use Exception;
use GuzzleHttp\Client;
use Illuminate\Support\Str;
Expand All @@ -19,50 +20,36 @@ class CallWebhookJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

/** @var string */
public $webhookUrl;
public ?string $webhookUrl = null;

/** @var string */
public $httpVerb;
public string $httpVerb;

/** @var int */
public $tries;
public int $tries;

/** @var int */
public $requestTimeout;
public int $requestTimeout;

/** @var string */
public $backoffStrategyClass;
public string $backoffStrategyClass;

/** @var string */
public $signerClass;
public ?string $signerClass = null;

/** @var array */
public $headers = [];
public array $headers = [];

/** @var bool */
public $verifySsl;
public bool $verifySsl;

/** @var string */
public $queue;
public $queue;

/** @var array */
public $payload = [];
public array $payload = [];

/** @var array */
public $meta = [];
public array $meta = [];

/** @var array */
public $tags = [];
public array $tags = [];

/** @var \GuzzleHttp\Psr7\Response|null */
private $response;
private ?Response $response = null;

/** @var string */
private $errorType;
private ?string $errorType = null;

/** @var string */
private $errorMessage;
private ?string $errorMessage = null;

public function handle()
{
Expand Down
20 changes: 10 additions & 10 deletions src/Events/WebhookCallEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
abstract class WebhookCallEvent
{
/** @var string */
public $httpVerb;
public string $httpVerb;

/** @var string */
public $webhookUrl;
public string $webhookUrl;

/** @var array */
public $payload;
public array $payload;

/** @var array */
public $headers;
public array $headers;

/** @var array */
public $meta;
public array $meta;

/** @var array */
public $tags;
public array $tags;

/** @var int */
public $attempt;
public int $attempt;

/** @var \GuzzleHttp\Psr7\Response|null */
public $response;
public ?Response $response;

/** @var string */
public $errorType;
public ?string $errorType;

/** @var string */
public $errorMessage;
public ?string $errorMessage;

public function __construct(
string $httpVerb,
Expand Down
15 changes: 5 additions & 10 deletions src/WebhookCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@

class WebhookCall
{
/** @var \Spatie\WebhookServer\CallWebhookJob */
protected $callWebhookJob;
protected CallWebhookJob $callWebhookJob;

/** @var string */
protected $secret;
protected string $secret;

/** @var \Spatie\WebhookServer\Signer\Signer */
protected $signer;
protected Signer $signer;

/** @var array */
protected $headers = [];
protected array $headers = [];

/** @var array */
private $payload = [];
private array $payload = [];

public static function create(): self
{
Expand Down
3 changes: 1 addition & 2 deletions tests/CallWebhookJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

class CallWebhookJobTest extends TestCase
{
/** @var \Spatie\WebhookServer\Tests\TestClasses\TestClient */
private $testClient;
private TestClient $testClient;

public function setUp(): void
{
Expand Down
8 changes: 4 additions & 4 deletions tests/TestClasses/TestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

class TestClient
{
private $requests = [];
private array $requests = [];

private $useResponseCode = 200;
private int $useResponseCode = 200;

private $throwRequestException = false;
private bool $throwRequestException = false;

private $throwConnectionException = false;
private bool $throwConnectionException = false;

public function request(string $method, string $url, array $options)
{
Expand Down

0 comments on commit 30f8194

Please sign in to comment.