+ * @phpcs:disable Generic.NamingConventions.UpperCaseConstantName
*/
class NumberField extends Field
{
+ /**
+ * @deprecated please use ::NUMBER_STYLE_DECIMAL instead.
+ */
+ public const PKNumberStyleDecimal = 'PKNumberStyleDecimal';
+
+ /**
+ * @deprecated please use ::NUMBER_STYLE_PERCENT instead.
+ */
+ public const PKNumberStylePercent = 'PKNumberStylePercent';
+
+ /**
+ * @deprecated please use ::NUMBER_STYLE_SCIENTIFIC instead.
+ */
+ public const PKNumberStyleScientific = 'PKNumberStyleScientific';
+
/**
* @var string
*/
- const PKNumberStyleDecimal = 'PKNumberStyleDecimal';
+ public const NUMBER_STYLE_DECIMAL = 'PKNumberStyleDecimal';
/**
* @var string
*/
- const PKNumberStylePercent = 'PKNumberStylePercent';
+ public const NUMBER_STYLE_PERCENT = 'PKNumberStylePercent';
/**
* @var string
*/
- const PKNumberStyleScientific = 'PKNumberStyleScientific';
+ public const NUMBER_STYLE_SCIENTIFIC = 'PKNumberStyleScientific';
/**
* ISO 4217
@@ -129,4 +145,4 @@ public function getValue()
// Ensure value is int or float; adding 0 will convert type from string
return 0 + parent::getValue();
}
-}
\ No newline at end of file
+}
diff --git a/src/Passbook/Pass/StructureInterface.php b/src/Passbook/Pass/StructureInterface.php
index bc01cab..fc0b8cf 100644
--- a/src/Passbook/Pass/StructureInterface.php
+++ b/src/Passbook/Pass/StructureInterface.php
@@ -23,7 +23,7 @@ interface StructureInterface extends ArrayableInterface
/**
* Adds header field
*
- * @param Field
+ * @param Field $headerField
*/
public function addHeaderField(FieldInterface $headerField);
@@ -37,7 +37,7 @@ public function getHeaderFields();
/**
* Adds primary field
*
- * @param Field
+ * @param Field $primaryField
*/
public function addPrimaryField(FieldInterface $primaryField);
@@ -51,7 +51,7 @@ public function getPrimaryFields();
/**
* Adds secondary field
*
- * @param Field
+ * @param Field $secondaryField
*/
public function addSecondaryField(FieldInterface $secondaryField);
@@ -65,7 +65,7 @@ public function getSecondaryFields();
/**
* Adds auxiliary field
*
- * @param Field
+ * @param Field $auxiliaryField
*/
public function addAuxiliaryField(FieldInterface $auxiliaryField);
@@ -79,7 +79,7 @@ public function getAuxiliaryFields();
/**
* Adds back field
*
- * @param Field
+ * @param Field $backField
*/
public function addBackField(FieldInterface $backField);
diff --git a/src/Passbook/PassFactory.php b/src/Passbook/PassFactory.php
index f45e323..92c8342 100644
--- a/src/Passbook/PassFactory.php
+++ b/src/Passbook/PassFactory.php
@@ -95,7 +95,7 @@ class PassFactory
*
* @var string
*/
- const PASS_EXTENSION = '.pkpass';
+ public const PASS_EXTENSION = '.pkpass';
public function __construct($passTypeIdentifier, $teamIdentifier, $organizationName, $p12File, $p12Pass, $wwdrFile)
{
@@ -115,7 +115,7 @@ public function __construct($passTypeIdentifier, $teamIdentifier, $organizationN
/**
* Set outputPath
*
- * @param string
+ * @param string $outputPath
*
* @return $this
*/
@@ -149,7 +149,7 @@ public function getNormalizedOutputPath()
/**
* Set overwrite
*
- * @param boolean
+ * @param boolean $overwrite
*
* @return $this
*/
@@ -176,7 +176,7 @@ public function isOverwrite()
* When set, the pass will not be signed when packaged. This should only
* be used for testing.
*
- * @param boolean
+ * @param boolean $skipSignature
*
* @return $this
*/
@@ -251,7 +251,7 @@ public function package(PassInterface $pass, $passName = '')
$this->populateRequiredInformation($pass);
if ($this->passValidator) {
- if (!$this->passValidator->validate($pass)){
+ if (!$this->passValidator->validate($pass)) {
throw new PassInvalidException('Failed to validate passbook', $this->passValidator->getErrors());
};
}
@@ -304,7 +304,7 @@ private function sign($passDir, $manifestJSONFile): void
$signatureFile,
$certdata,
$privkey,
- array(),
+ [],
PKCS7_BINARY | PKCS7_DETACHED,
$this->wwdr->getRealPath()
);
@@ -326,7 +326,7 @@ private function sign($passDir, $manifestJSONFile): void
throw new FileException("Couldn't write signature file.");
}
} else {
- throw new FileException("Error reading certificate file");
+ throw new FileException('Error reading certificate file');
}
}
@@ -342,12 +342,12 @@ private function sign($passDir, $manifestJSONFile): void
private function zip($source, $destination)
{
if (!extension_loaded('zip')) {
- throw new Exception("ZIP extension not available");
+ throw new Exception('ZIP extension not available');
}
$source = realpath($source);
if (!is_dir($source)) {
- throw new FileException("Source must be a directory.");
+ throw new FileException('Source must be a directory.');
}
$zip = new ZipArchive();
@@ -362,7 +362,7 @@ private function zip($source, $destination)
while ($iterator->valid()) {
if ($iterator->isDir()) {
$zip->addEmptyDir($iterator->getSubPathName());
- } else if ($iterator->isFile()) {
+ } elseif ($iterator->isFile()) {
$zip->addFromString($iterator->getSubPathName(), file_get_contents($iterator->key()));
}
$iterator->next();
@@ -380,7 +380,7 @@ private function zip($source, $destination)
*/
private function rrmdir($dir)
{
- $files = array_diff(scandir($dir), array('.', '..'));
+ $files = array_diff(scandir($dir), ['.', '..']);
foreach ($files as $file) {
is_dir("$dir/$file") ? $this->rrmdir("$dir/$file") : unlink("$dir/$file");
}
@@ -426,7 +426,7 @@ private static function jsonEncode($array)
*/
public function getPassName($passName, PassInterface $pass)
{
- $passNameSanitised = preg_replace("/[^a-zA-Z0-9]+/", "", $passName);
+ $passNameSanitised = preg_replace('/[^a-zA-Z0-9]+/', '', $passName);
return strlen($passNameSanitised) != 0 ? $passNameSanitised : $pass->getSerialNumber();
}
@@ -445,7 +445,7 @@ private function prepareManifest($passDir)
);
foreach ($files as $file) {
// Ignore "." and ".." folders
- if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) {
+ if (in_array(substr($file, strrpos($file, '/') + 1), ['.', '..'])) {
continue;
}
//
@@ -470,7 +470,7 @@ private function preparePassDirectory(PassInterface $pass)
$passDir = $this->getNormalizedOutputPath() . $pass->getSerialNumber() . DIRECTORY_SEPARATOR;
$passDirExists = file_exists($passDir);
if ($passDirExists && !$this->isOverwrite()) {
- throw new FileException("Temporary pass directory already exists");
+ throw new FileException('Temporary pass directory already exists');
} elseif (!$passDirExists && !mkdir($passDir, 0777, true)) {
throw new FileException("Couldn't create temporary pass directory");
}
@@ -489,7 +489,7 @@ private function prepareImages(PassInterface $pass, $passDir): void
$fileName = $passDir . $image->getContext();
if ($image->getDensity() === 2) {
$fileName .= '@2x';
- } else if ($image->getDensity() === 3) {
+ } elseif ($image->getDensity() === 3) {
$fileName .= '@3x';
}
@@ -523,7 +523,7 @@ private function prepareLocalizations(PassInterface $pass, $passDir): void
$fileName = $localizationDir . $image->getContext();
if ($image->getDensity() === 2) {
$fileName .= '@2x';
- } else if ($image->getDensity() === 3) {
+ } elseif ($image->getDensity() === 3) {
$fileName .= '@3x';
}
$fileName .= '.' . $image->getExtension();
diff --git a/src/Passbook/PassInterface.php b/src/Passbook/PassInterface.php
index 28e7904..ae3623a 100644
--- a/src/Passbook/PassInterface.php
+++ b/src/Passbook/PassInterface.php
@@ -86,7 +86,7 @@ public function getStructure();
public function addImage(ImageInterface $image);
/**
- * @return Image[]
+ * @return ImageInterface[]
*/
public function getImages();
@@ -119,17 +119,16 @@ public function addBeacon(BeaconInterface $beacon);
* {@inheritdoc}
*/
public function getBeacons();
-
+
/**
* {@inheritdoc}
*/
public function addNfc(NfcInterface $nfc);
/**
- * {@inheritdoc}
+ * @return NfcInterface[]
*/
public function getNfc();
-
/**
* {@inheritdoc}
@@ -228,7 +227,7 @@ public function setLogoText($logoText);
* {@inheritdoc}
*/
public function getLogoText();
-
+
/**
* {@inheritdoc}
*/
@@ -237,7 +236,7 @@ public function setSharingProhibited(bool $sharingProhibited);
/**
* {@inheritdoc}
*/
- public function getSharingProhibited();
+ public function getSharingProhibited();
/**
* {@inheritdoc}
@@ -310,25 +309,24 @@ public function addLocalization(LocalizationInterface $localization);
* @return LocalizationInterface[]
*/
public function getLocalizations();
-
+
/**
* {@inheritdoc}
*/
public function setAppLaunchURL($appLaunchURL);
-
+
/**
* {@inheritdoc}
*/
public function getAppLaunchURL();
- /**
- * {@inheritdoc}
- */
- public function setUserInfo($userInfo);
-
- /**
- * {@inheritdoc}
- */
- public function getUserInfo();
+ /**
+ * {@inheritdoc}
+ */
+ public function setUserInfo($userInfo);
+ /**
+ * {@inheritdoc}
+ */
+ public function getUserInfo();
}
diff --git a/src/Passbook/PassValidator.php b/src/Passbook/PassValidator.php
index 74418ee..577480c 100644
--- a/src/Passbook/PassValidator.php
+++ b/src/Passbook/PassValidator.php
@@ -21,32 +21,32 @@ class PassValidator implements PassValidatorInterface
{
private $errors;
- const DESCRIPTION_REQUIRED = 'description is required and cannot be blank';
- const FORMAT_VERSION_REQUIRED = 'formatVersion is required and must be 1';
- const ORGANIZATION_NAME_REQUIRED = 'organizationName is required and cannot be blank';
- const PASS_TYPE_IDENTIFIER_REQUIRED = 'passTypeIdentifier is required and cannot be blank';
- const SERIAL_NUMBER_REQUIRED = 'serialNumber is required and cannot be blank';
- const TEAM_IDENTIFIER_REQUIRED = 'teamIdentifier is required and cannot be blank';
- const ICON_REQUIRED = 'pass must have an icon image';
- const BARCODE_FORMAT_INVALID = 'barcode format is invalid';
- const BARCODE_MESSAGE_INVALID = 'barcode message is invalid; must be a string';
- const LOCATION_LATITUDE_REQUIRED = 'location latitude is required';
- const LOCATION_LONGITUDE_REQUIRED = 'location longitude is required';
- const LOCATION_LATITUDE_INVALID = 'location latitude is invalid; must be numeric';
- const LOCATION_LONGITUDE_INVALID = 'location longitude is invalid; must be numeric';
- const LOCATION_ALTITUDE_INVALID = 'location altitude is invalid; must be numeric';
- const BEACON_PROXIMITY_UUID_REQUIRED = 'beacon proximityUUID is required';
- const BEACON_MAJOR_INVALID = 'beacon major is invalid; must be 16-bit unsigned integer';
- const BEACON_MINOR_INVALID = 'beacon minor is invalid; must be 16-bit unsigned integer';
- const NFC_MESSAGE_REQUIRED = 'NFC message is required';
- const NFC_ENCRYPTION_PUBLIC_KEY_REQUIRED = 'NFC encryption public key is required';
- const WEB_SERVICE_URL_INVALID = 'webServiceURL is invalid; must start with https (or http for development)';
- const WEB_SERVICE_AUTHENTICATION_TOKEN_REQUIRED = 'authenticationToken required with webServiceURL and cannot be blank';
- const WEB_SERVICE_AUTHENTICATION_TOKEN_INVALID = 'authenticationToken is invalid; must be at least 16 characters';
- const ASSOCIATED_STORE_IDENTIFIER_INVALID = 'associatedStoreIdentifiers is invalid; must be an integer';
- const ASSOCIATED_STORE_IDENTIFIER_REQUIRED = 'appLaunchURL is required when associatedStoreIdentifiers is present';
- const IMAGE_TYPE_INVALID = 'image files must be PNG format';
- const GROUPING_IDENTITY_INVALID = 'the grouping identity may only be used on boarding pass and event ticket types';
+ public const DESCRIPTION_REQUIRED = 'description is required and cannot be blank';
+ public const FORMAT_VERSION_REQUIRED = 'formatVersion is required and must be 1';
+ public const ORGANIZATION_NAME_REQUIRED = 'organizationName is required and cannot be blank';
+ public const PASS_TYPE_IDENTIFIER_REQUIRED = 'passTypeIdentifier is required and cannot be blank';
+ public const SERIAL_NUMBER_REQUIRED = 'serialNumber is required and cannot be blank';
+ public const TEAM_IDENTIFIER_REQUIRED = 'teamIdentifier is required and cannot be blank';
+ public const ICON_REQUIRED = 'pass must have an icon image';
+ public const BARCODE_FORMAT_INVALID = 'barcode format is invalid';
+ public const BARCODE_MESSAGE_INVALID = 'barcode message is invalid; must be a string';
+ public const LOCATION_LATITUDE_REQUIRED = 'location latitude is required';
+ public const LOCATION_LONGITUDE_REQUIRED = 'location longitude is required';
+ public const LOCATION_LATITUDE_INVALID = 'location latitude is invalid; must be numeric';
+ public const LOCATION_LONGITUDE_INVALID = 'location longitude is invalid; must be numeric';
+ public const LOCATION_ALTITUDE_INVALID = 'location altitude is invalid; must be numeric';
+ public const BEACON_PROXIMITY_UUID_REQUIRED = 'beacon proximityUUID is required';
+ public const BEACON_MAJOR_INVALID = 'beacon major is invalid; must be 16-bit unsigned integer';
+ public const BEACON_MINOR_INVALID = 'beacon minor is invalid; must be 16-bit unsigned integer';
+ public const NFC_MESSAGE_REQUIRED = 'NFC message is required';
+ public const NFC_ENCRYPTION_PUBLIC_KEY_REQUIRED = 'NFC encryption public key is required';
+ public const WEB_SERVICE_URL_INVALID = 'webServiceURL is invalid; must start with https (or http for development)';
+ public const WEB_SERVICE_AUTHENTICATION_TOKEN_REQUIRED = 'authenticationToken required with webServiceURL and cannot be blank';
+ public const WEB_SERVICE_AUTHENTICATION_TOKEN_INVALID = 'authenticationToken is invalid; must be at least 16 characters';
+ public const ASSOCIATED_STORE_IDENTIFIER_INVALID = 'associatedStoreIdentifiers is invalid; must be an integer';
+ public const ASSOCIATED_STORE_IDENTIFIER_REQUIRED = 'appLaunchURL is required when associatedStoreIdentifiers is present';
+ public const IMAGE_TYPE_INVALID = 'image files must be PNG format';
+ public const GROUPING_IDENTITY_INVALID = 'the grouping identity may only be used on boarding pass and event ticket types';
/**
* {@inheritdoc}
@@ -185,7 +185,7 @@ private function validateLocation(Location $location)
private function validateBarcodeKeys(PassInterface $pass)
{
- $validBarcodeFormats = array(Barcode::TYPE_QR, Barcode::TYPE_AZTEC, Barcode::TYPE_PDF_417, Barcode::TYPE_CODE_128);
+ $validBarcodeFormats = [Barcode::TYPE_QR, Barcode::TYPE_AZTEC, Barcode::TYPE_PDF_417, Barcode::TYPE_CODE_128];
$barcode = $pass->getBarcode();
@@ -279,5 +279,4 @@ private function addError($string)
{
$this->errors[] = $string;
}
-
}
diff --git a/src/Passbook/PassValidatorInterface.php b/src/Passbook/PassValidatorInterface.php
index 24e3789..466c6a6 100644
--- a/src/Passbook/PassValidatorInterface.php
+++ b/src/Passbook/PassValidatorInterface.php
@@ -20,5 +20,4 @@ public function validate(PassInterface $pass);
* @return string[]
*/
public function getErrors();
-
}
diff --git a/src/Passbook/Type/BoardingPass.php b/src/Passbook/Type/BoardingPass.php
index 3cc300c..2b44872 100644
--- a/src/Passbook/Type/BoardingPass.php
+++ b/src/Passbook/Type/BoardingPass.php
@@ -43,27 +43,27 @@ class BoardingPass extends Pass
/**
* @var string
*/
- const TYPE_AIR = 'PKTransitTypeAir';
+ public const TYPE_AIR = 'PKTransitTypeAir';
/**
* @var string
*/
- const TYPE_BOAT = 'PKTransitTypeBoat';
+ public const TYPE_BOAT = 'PKTransitTypeBoat';
/**
* @var string
*/
- const TYPE_BUS = 'PKTransitTypeBus';
+ public const TYPE_BUS = 'PKTransitTypeBus';
/**
* @var string
*/
- const TYPE_GENERIC = 'PKTransitTypeGeneric';
+ public const TYPE_GENERIC = 'PKTransitTypeGeneric';
/**
* @var string
*/
- const TYPE_TRAIN = 'PKTransitTypeTrain';
+ public const TYPE_TRAIN = 'PKTransitTypeTrain';
/**
* Class constructor
diff --git a/tests/Passbook/Tests/Certificate/P12Test.php b/tests/Passbook/Tests/Certificate/P12Test.php
index 540d37e..1ca4413 100644
--- a/tests/Passbook/Tests/Certificate/P12Test.php
+++ b/tests/Passbook/Tests/Certificate/P12Test.php
@@ -10,7 +10,7 @@ class P12Test extends TestCase
{
public function testP12()
{
- $p12 = new P12(__DIR__.'/../../../cert/pass.com.example.testpass.p12', '123456');
+ $p12 = new P12(__DIR__ . '/../../../cert/pass.com.example.testpass.p12', '123456');
$this->assertEquals($p12->getPassword(), '123456');
}
@@ -18,6 +18,6 @@ public function testP12()
public function testP12Exception()
{
$this->expectException(FileNotFoundException::class);
- new P12(__DIR__.'/non-existing-file', '123456');
+ new P12(__DIR__ . '/non-existing-file', '123456');
}
-}
\ No newline at end of file
+}
diff --git a/tests/Passbook/Tests/Certificate/WWDRTest.php b/tests/Passbook/Tests/Certificate/WWDRTest.php
index 2c867b9..7303dc5 100644
--- a/tests/Passbook/Tests/Certificate/WWDRTest.php
+++ b/tests/Passbook/Tests/Certificate/WWDRTest.php
@@ -10,13 +10,13 @@ class WWDRTest extends TestCase
{
public function testWWDR()
{
- $wwdr = new WWDR(__DIR__.'/../../../cert/wwdr.pem');
+ $wwdr = new WWDR(__DIR__ . '/../../../cert/wwdr.pem');
$this->assertInstanceOf(WWDR::class, $wwdr);
}
public function testWWDRException()
{
$this->expectException(FileNotFoundException::class);
- new WWDR(__DIR__.'/non-existing-file');
+ new WWDR(__DIR__ . '/non-existing-file');
}
-}
\ No newline at end of file
+}
diff --git a/tests/Passbook/Tests/Exception/PassInvalidExceptionTest.php b/tests/Passbook/Tests/Exception/PassInvalidExceptionTest.php
index aa9f577..fe54359 100644
--- a/tests/Passbook/Tests/Exception/PassInvalidExceptionTest.php
+++ b/tests/Passbook/Tests/Exception/PassInvalidExceptionTest.php
@@ -17,7 +17,7 @@ public function testNewExceptionWithoutErrorsArray()
public function testNewExceptionWithErrorsArray()
{
- $errors = array('error 1', 'error 2');
+ $errors = ['error 1', 'error 2'];
$exception = new PassInvalidException('', $errors);
self::assertTrue(is_array($exception->getErrors()));
@@ -26,12 +26,11 @@ public function testNewExceptionWithErrorsArray()
public function testNewExceptionWithMessageAndArray()
{
- $errors = array('error 1', 'error 2');
+ $errors = ['error 1', 'error 2'];
$exception = new PassInvalidException('Exception message', $errors);
self::assertTrue(is_array($exception->getErrors()));
self::assertEquals($errors, $exception->getErrors());
self::assertSame('Exception message', $exception->getMessage());
}
-
}
diff --git a/tests/Passbook/Tests/Pass/BarcodeTest.php b/tests/Passbook/Tests/Pass/BarcodeTest.php
index b4ef962..5da4609 100644
--- a/tests/Passbook/Tests/Pass/BarcodeTest.php
+++ b/tests/Passbook/Tests/Pass/BarcodeTest.php
@@ -42,4 +42,4 @@ public function testBarcodeMessageIsString()
$barcode->setMessage(null);
$this->assertEquals('', $barcode->getMessage());
}
-}
\ No newline at end of file
+}
diff --git a/tests/Passbook/Tests/Pass/BeaconTest.php b/tests/Passbook/Tests/Pass/BeaconTest.php
index 070ebce..6be5c6e 100644
--- a/tests/Passbook/Tests/Pass/BeaconTest.php
+++ b/tests/Passbook/Tests/Pass/BeaconTest.php
@@ -29,4 +29,4 @@ public function testBeacon()
$this->assertEquals($expected, $beacon->toArray());
}
-}
\ No newline at end of file
+}
diff --git a/tests/Passbook/Tests/Pass/FieldTest.php b/tests/Passbook/Tests/Pass/FieldTest.php
index d068369..695c1b3 100644
--- a/tests/Passbook/Tests/Pass/FieldTest.php
+++ b/tests/Passbook/Tests/Pass/FieldTest.php
@@ -10,17 +10,17 @@
class FieldTest extends TestCase
{
- public function testField()
- {
- $field = new Field('key', 'val');
- $field
- ->setChangeMessage('change-message')
- ->setTextAlignment(Field::ALIGN_RIGHT)
- ;
-
- $array = $field->toArray();
- $this->assertArrayHasKey('key', $array);
- }
+ public function testField()
+ {
+ $field = new Field('key', 'val');
+ $field
+ ->setChangeMessage('change-message')
+ ->setTextAlignment(Field::ALIGN_RIGHT)
+ ;
+
+ $array = $field->toArray();
+ $this->assertArrayHasKey('key', $array);
+ }
public function testDateField()
{
@@ -31,14 +31,14 @@ public function testDateField()
$this->assertEquals('2014-01-01T00:00:00+00:00', $array['value']);
}
- public function testNumberField()
- {
- $field = new NumberField('key', 0);
- $field
- ->setNumberStyle(NumberField::PKNumberStyleDecimal)
- ->setCurrencyCode('EUR')
- ;
-
- $this->assertArrayHasKey('currencyCode', $field->toArray());
- }
-}
\ No newline at end of file
+ public function testNumberField()
+ {
+ $field = new NumberField('key', 0);
+ $field
+ ->setNumberStyle(NumberField::NUMBER_STYLE_DECIMAL)
+ ->setCurrencyCode('EUR')
+ ;
+
+ $this->assertArrayHasKey('currencyCode', $field->toArray());
+ }
+}
diff --git a/tests/Passbook/Tests/Pass/ImageTest.php b/tests/Passbook/Tests/Pass/ImageTest.php
index 4e57a9d..53531e4 100644
--- a/tests/Passbook/Tests/Pass/ImageTest.php
+++ b/tests/Passbook/Tests/Pass/ImageTest.php
@@ -9,7 +9,7 @@ class ImageTest extends TestCase
{
public function testImage()
{
- $image = new Image(__DIR__.'/../../../img/icon.png', 'thumbnail');
+ $image = new Image(__DIR__ . '/../../../img/icon.png', 'thumbnail');
$image->setDensity(2);
$this->assertEquals($image->getContext(), 'thumbnail');
@@ -18,7 +18,7 @@ public function testImage()
public function testImage3x()
{
- $image = new Image(__DIR__.'/../../../img/icon.png', 'thumbnail');
+ $image = new Image(__DIR__ . '/../../../img/icon.png', 'thumbnail');
$image->setDensity(3);
$this->assertEquals('thumbnail', $image->getContext());
diff --git a/tests/Passbook/Tests/Pass/LocationTest.php b/tests/Passbook/Tests/Pass/LocationTest.php
index 937cec4..6befbef 100644
--- a/tests/Passbook/Tests/Pass/LocationTest.php
+++ b/tests/Passbook/Tests/Pass/LocationTest.php
@@ -28,4 +28,4 @@ public function testBarcode()
$this->assertEquals($expected, $location->toArray());
}
-}
\ No newline at end of file
+}
diff --git a/tests/Passbook/Tests/Pass/NumberFieldTest.php b/tests/Passbook/Tests/Pass/NumberFieldTest.php
index 12efe80..9384546 100644
--- a/tests/Passbook/Tests/Pass/NumberFieldTest.php
+++ b/tests/Passbook/Tests/Pass/NumberFieldTest.php
@@ -2,7 +2,6 @@
namespace Passbook\Tests\Pass;
-
use Passbook\Pass\NumberField;
use PHPUnit\Framework\TestCase;
@@ -16,5 +15,4 @@ public function testValueIsNumber()
$field = new NumberField('price', '12');
$this->assertIsInt($field->getValue());
}
-
}
diff --git a/tests/Passbook/Tests/Pass/StructureTest.php b/tests/Passbook/Tests/Pass/StructureTest.php
index 9d6822a..c400cea 100644
--- a/tests/Passbook/Tests/Pass/StructureTest.php
+++ b/tests/Passbook/Tests/Pass/StructureTest.php
@@ -17,14 +17,14 @@ public function testStructure()
$actual = $structure->toArray();
$expected = [
- "headerFields" => [
- ["key" => "balance", "value" => "13.50 USD"],
+ 'headerFields' => [
+ ['key' => 'balance', 'value' => '13.50 USD'],
],
- "backFields" => [
- ["key" => "publisher", "value" => "Passbook Limited"]
+ 'backFields' => [
+ ['key' => 'publisher', 'value' => 'Passbook Limited']
]
];
$this->assertEquals($expected, $actual);
}
-}
\ No newline at end of file
+}
diff --git a/tests/Passbook/Tests/PassFactoryTest.php b/tests/Passbook/Tests/PassFactoryTest.php
index f85f34a..f0e66db 100644
--- a/tests/Passbook/Tests/PassFactoryTest.php
+++ b/tests/Passbook/Tests/PassFactoryTest.php
@@ -108,13 +108,13 @@ public function testFactoryPackage()
$pass->setBarcode($barcode);
// Add Localizations (this also tests zipping subdirectories)
- $englishText = array(
+ $englishText = [
'created_by' => 'Pass produced by php-passbook'
- );
+ ];
- $spanishText = array(
+ $spanishText = [
'created_by' => 'Pase producido por php-passbook'
- );
+ ];
$es = new Localization('es');
$es->addStrings($spanishText);
@@ -188,7 +188,7 @@ public function testNormalizedOutputPath()
$this->factory->setOutputPath("path-ending-with-separator{$s}");
self::assertEquals("path-ending-with-separator{$s}", $this->factory->getNormalizedOutputPath());
- $this->factory->setOutputPath("path-not-ending-with-separator");
+ $this->factory->setOutputPath('path-not-ending-with-separator');
self::assertEquals("path-not-ending-with-separator{$s}", $this->factory->getNormalizedOutputPath());
$this->factory->setOutputPath("path-ending-with-multiple-separators{$s}{$s}");
diff --git a/tests/Passbook/Tests/PassTest.php b/tests/Passbook/Tests/PassTest.php
index 4c7d5ca..38a4e5d 100644
--- a/tests/Passbook/Tests/PassTest.php
+++ b/tests/Passbook/Tests/PassTest.php
@@ -260,7 +260,7 @@ public function testPass()
->addAssociatedStoreIdentifier(123)
;
- $properties = array(
+ $properties = [
'webServiceURL',
'foregroundColor',
'backgroundColor',
@@ -270,7 +270,7 @@ public function testPass()
'suppressStripShine',
'associatedStoreIdentifiers',
'appLaunchURL',
- );
+ ];
$array = $this->pass->toArray();
foreach ($properties as $property) {
$this->assertTrue(isset($array[$property]));
diff --git a/tests/Passbook/Tests/PassValidatorTest.php b/tests/Passbook/Tests/PassValidatorTest.php
index d6fb95e..a9a695f 100644
--- a/tests/Passbook/Tests/PassValidatorTest.php
+++ b/tests/Passbook/Tests/PassValidatorTest.php
@@ -13,8 +13,8 @@
class PassValidatorTest extends TestCase
{
- const SERIAL_NUMBER = '123';
- const DESCRIPTION = 'description';
+ protected const SERIAL_NUMBER = '123';
+ protected const DESCRIPTION = 'description';
/**
* @var Pass
@@ -114,7 +114,7 @@ public function testPassLocation()
$this->assertPasses($this->pass, PassValidator::LOCATION_LATITUDE_REQUIRED);
$this->assertPasses($this->pass, PassValidator::LOCATION_ALTITUDE_INVALID);
- $location = new Location(0,0);
+ $location = new Location(0, 0);
$this->pass->addLocation($location);
$this->assertPasses($this->pass, PassValidator::LOCATION_LONGITUDE_REQUIRED);
$this->assertPasses($this->pass, PassValidator::LOCATION_LATITUDE_REQUIRED);
@@ -197,7 +197,7 @@ public function testPassWithoutIcon()
self::assertArrayNotHasKey('icon', $this->pass->getImages(), 'pass must not have an icon for test to be valid');
$this->assertFails($this->pass, PassValidator::ICON_REQUIRED);
- $icon = new Image(__DIR__.'/../../img/icon.png', 'icon');
+ $icon = new Image(__DIR__ . '/../../img/icon.png', 'icon');
$this->pass->addImage($icon);
$this->assertPasses($this->pass, PassValidator::ICON_REQUIRED);
}
diff --git a/tests/cert/pass.com.example.testpass.p12 b/tests/cert/pass.com.example.testpass.p12
index 2e15a13..6eb08fe 100644
Binary files a/tests/cert/pass.com.example.testpass.p12 and b/tests/cert/pass.com.example.testpass.p12 differ
diff --git a/www/router.php b/www/router.php
index 1c18f9a..45dbbd9 100644
--- a/www/router.php
+++ b/www/router.php
@@ -1,12 +1,12 @@
";
- echo ''.$pass.' | ';
- echo "".round(filesize($dir.$pass) / 1024)."KB | ";
- echo "".date('Y-m-d H:i:s', filectime($dir.$pass))." | ";
- echo "";
+ echo '';
+ echo '' . $pass . ' | ';
+ echo '' . round(filesize($dir . $pass) / 1024) . 'KB | ';
+ echo '' . date('Y-m-d H:i:s', filectime($dir . $pass)) . ' | ';
+ echo '
';
}
?>