Skip to content

Commit

Permalink
Start replacing spatie dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
chiiya committed Oct 9, 2024
1 parent cfbe5e0 commit 4737b11
Show file tree
Hide file tree
Showing 135 changed files with 3,082 additions and 2,911 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ node_modules
service-credentials.json
.env
/tests/certs
.phpunit.cache/
40 changes: 11 additions & 29 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="Chiiya Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Chiiya Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
23 changes: 13 additions & 10 deletions src/Apple/Components/AuxiliaryField.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

namespace Chiiya\Passes\Apple\Components;

use Chiiya\Passes\Common\Validation\ValueIn;
use Spatie\DataTransferObject\Attributes\Strict;
use Symfony\Component\Validator\Constraints\Choice;

#[Strict]
class AuxiliaryField extends SecondaryField
{
/**
* Optional.
* A number you use to add a row to the auxiliary field in an event ticket pass type.
* Set the value to 1 to add an auxiliary row. Each row displays up to four fields.
*/
#[ValueIn([0, 1])]
public ?int $row;
public function __construct(
/**
* Optional.
* A number you use to add a row to the auxiliary field in an event ticket pass type.
* Set the value to 1 to add an auxiliary row. Each row displays up to four fields.
*/
#[Choice([0, 1])]
public ?int $row = null,
...$args,
) {
parent::__construct(...$args);
}
}
68 changes: 34 additions & 34 deletions src/Apple/Components/Barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,41 @@

use Chiiya\Passes\Apple\Enumerators\BarcodeFormat;
use Chiiya\Passes\Common\Component;
use Chiiya\Passes\Common\Validation\Required;
use Chiiya\Passes\Common\Validation\ValueIn;
use Spatie\DataTransferObject\Attributes\Strict;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\NotBlank;

#[Strict]
class Barcode extends Component
{
/**
* Optional.
* For example, a human-readable version of the barcode data in case
* the barcode doesn't scan.
*/
public ?string $altText;

/**
* Required.
* Barcode format. The barcode format PKBarcodeFormatCode128 isn’t supported for watchOS.
*
* @see BarcodeFormat
*/
#[Required]
#[ValueIn([BarcodeFormat::QR, BarcodeFormat::AZTEC, BarcodeFormat::GS1_128, BarcodeFormat::PDF417])]
public ?string $format;

/**
* Required.
* Message or payload to be displayed as a barcode.
*/
#[Required]
public ?string $message;

/**
* Required.
* Text encoding that is used to convert the message from the string representation to a data
* representation to render the barcode.
*/
public ?string $messageEncoding = 'iso-8859-1';
public function __construct(
/**
* Required.
* Barcode format. The barcode format PKBarcodeFormatCode128 isn’t supported for watchOS.
*
* @see BarcodeFormat
*/
#[NotBlank]
#[Choice([BarcodeFormat::QR, BarcodeFormat::AZTEC, BarcodeFormat::GS1_128, BarcodeFormat::PDF417])]
public string $format,
/**
* Required.
* Message or payload to be displayed as a barcode.
*/
#[NotBlank]
public string $message,
/**
* Required.
* Text encoding that is used to convert the message from the string representation to a data
* representation to render the barcode.
*/
#[NotBlank]
public string $messageEncoding = 'iso-8859-1',
/**
* Optional.
* For example, a human-readable version of the barcode data in case
* the barcode doesn't scan.
*/
public ?string $altText = null,
) {
parent::__construct();
}
}
59 changes: 29 additions & 30 deletions src/Apple/Components/Beacon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,39 @@
namespace Chiiya\Passes\Apple\Components;

use Chiiya\Passes\Common\Component;
use Chiiya\Passes\Common\Validation\NumberBetween;
use Chiiya\Passes\Common\Validation\Required;
use Spatie\DataTransferObject\Attributes\Strict;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;

/**
* @since iOS v7.0
*/
#[Strict]
class Beacon extends Component
{
/**
* Optional.
* Major identifier of a Bluetooth Low Energy location beacon.
*/
#[NumberBetween(0, 65535)]
public ?int $major;

/**
* Optional.
* Minor identifier of a Bluetooth Low Energy location beacon.
*/
#[NumberBetween(0, 65535)]
public ?int $minor;

/**
* Required.
* Unique identifier of a Bluetooth Low Energy location beacon.
*/
#[Required]
public ?string $proximityUUID;

/**
* Optional.
* Text displayed on the lock screen when the pass is currently relevant.
*/
public ?string $relevantText;
public function __construct(
/**
* Required.
* Unique identifier of a Bluetooth Low Energy location beacon.
*/
#[NotBlank]
public string $proximityUUID,
/**
* Optional.
* Major identifier of a Bluetooth Low Energy location beacon.
*/
#[Range(min: 0, max: 65535)]
public ?int $major = null,
/**
* Optional.
* Minor identifier of a Bluetooth Low Energy location beacon.
*/
#[Range(min: 0, max: 65535)]
public ?int $minor = null,
/**
* Optional.
* Text displayed on the lock screen when the pass is currently relevant.
*/
public ?string $relevantText = null,
) {
parent::__construct();
}
}
27 changes: 14 additions & 13 deletions src/Apple/Components/CurrencyAmount.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
namespace Chiiya\Passes\Apple\Components;

use Chiiya\Passes\Common\Component;
use Spatie\DataTransferObject\Attributes\Strict;

#[Strict]
class CurrencyAmount extends Component
{
/**
* Optional.
* The amount of money.
*/
public ?string $amount;

/**
* Optional.
* The currency code for amount.
*/
public ?string $currencyCode;
public function __construct(
/**
* Optional.
* The amount of money.
*/
public ?string $amount = null,
/**
* Optional.
* The currency code for amount.
*/
public ?string $currencyCode = null,
) {
parent::__construct();
}
}
Loading

0 comments on commit 4737b11

Please sign in to comment.