Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
php: ['8.2', '8.3']
continue-on-error: ${{ matrix.php == '8.3' }}
php: ['8.2', '8.3', '8.4']
continue-on-error: ${{ matrix.php == '8.4' }}
steps:
- uses: actions/checkout@v2

Expand All @@ -27,15 +27,15 @@ jobs:
run: composer validate

- name: Install dependencies
if: ${{ matrix.php != '8.3' }}
if: ${{ matrix.php != '8.4' }}
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 3
command: composer update --no-interaction --no-progress

- name: Install Dependencies (ignore platform)
if: ${{ matrix.php == '8.3' }}
if: ${{ matrix.php == '8.4' }}
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
Expand Down
50 changes: 50 additions & 0 deletions src/Struct/Generic/JobState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

namespace Scn\EvalancheSoapStruct\Struct\Generic;

/**
* Represents the state of a background job
*
* @package Scn\EvalancheSoapStruct\Struct\Generic
*/
class JobState implements JobStateInterface
{
/** @var string */
private $id;

/** @var int */
private $status;

/** @var string */
private $statusDescription;

public function __construct(
string $id = '',
int $status = 0,
string $statusDescription = '',
) {
$this->id = $id;
$this->status = $status;
$this->statusDescription = $statusDescription;
}

/** @inheritDoc */
public function getId(): string
{
return $this->id;
}

/** @inheritDoc */
public function getStatus(): int
{
return $this->status;
}

/** @inheritDoc */
public function getStatusDescription(): string
{
return $this->statusDescription;
}
}
28 changes: 28 additions & 0 deletions src/Struct/Generic/JobStateInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Scn\EvalancheSoapStruct\Struct\Generic;

use Scn\EvalancheSoapStruct\Struct\StructInterface;

/**
* @package Scn\EvalancheSoapStruct\Struct\Generic
*/
interface JobStateInterface extends StructInterface
{
/**
* Returns the id of the background-job
*/
public function getId(): string;

/**
* Returns the status-code of the background-job
*/
public function getStatus(): int;

/**
* Returns a textual representation of the status-code
*/
public function getStatusDescription(): string;
}
36 changes: 36 additions & 0 deletions tests/Struct/Generic/JobStateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Scn\EvalancheSoapStruct\Struct\Generic;

use PHPUnit\Framework\TestCase;

class JobStateTest extends TestCase
{
private JobState $subject;

public function setUp(): void
{
$this->subject = new JobState(
'some id',
4,
'some description',
);
}

public function testGetIdCanReturnString(): void
{
self::assertSame('some id', $this->subject->getId());
}

public function testGetStatusCanReturnInt(): void
{
self::assertSame(4, $this->subject->getStatus());
}

public function testGetStatusDescriptionCanReturnString(): void
{
self::assertSame('some description', $this->subject->getStatusDescription());
}
}
Loading