Skip to content

Commit 7275477

Browse files
committed
Applied coding standards
1 parent e639f92 commit 7275477

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+398
-592
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// … that are not ignored by VCS
1111
$finder->ignoreVCSIgnored(true);
1212

13+
$finder->exclude(['lib', 'generated-classes']);
14+
1315
$config = new PhpCsFixer\Config();
1416
$config->setFinder($finder);
1517

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- [PR-44](https://github.com/itk-dev/serviceplatformen/pull/44)
11+
- Cleaned up in preparation for adding support for
12+
[Fordelingskomponenten](https://digitaliseringskataloget.dk/l%C3%B8sninger/fordelingskomponenten)
13+
1014
## [1.7.1] - 2025-08-20
1115

1216
- [PR-43](https://github.com/itk-dev/serviceplatformen/pull/43)

compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
services:
22
phpfpm:
33
image: itkdev/php8.3-fpm:latest
4+
user: ${COMPOSE_USER:-deploy}
45
profiles:
56
- dev
67
volumes:

composer.json

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "itk-dev/serviceplatformen",
33
"description": "",
4-
"type": "library",
54
"license": "MIT",
5+
"type": "library",
66
"authors": [
77
{
88
"name": "Lars Steen",
@@ -13,10 +13,6 @@
1313
"email": "[email protected]"
1414
}
1515
],
16-
"bin": [
17-
"bin/serviceplatformen-sf1500-data-lookup",
18-
"bin/serviceplatformen-sf1601-kombipostafsend"
19-
],
2016
"require": {
2117
"php": "^8.1",
2218
"ext-curl": "*",
@@ -40,6 +36,7 @@
4036
"wsdltophp/packagebase": "^5.0"
4137
},
4238
"require-dev": {
39+
"ergebnis/composer-normalize": "^2.48",
4340
"friendsofphp/php-cs-fixer": "^3.11",
4441
"goetas-webservices/xsd2php": "dev-feature-xml-namespace-prefix",
4542
"phan/phan": "^5.4",
@@ -50,82 +47,89 @@
5047
"symfony/mime": "^5.4 || ^6.0",
5148
"wsdltophp/packagegenerator": "^4.1"
5249
},
53-
"config": {
54-
"optimize-autoloader": true,
55-
"preferred-install": "dist",
56-
"sort-packages": true
50+
"repositories": {
51+
"goetas-webservices/xsd2php": {
52+
"type": "vcs",
53+
"url": "https://github.com/rimi-itk/xsd2php"
54+
}
5755
},
56+
"minimum-stability": "dev",
57+
"prefer-stable": true,
5858
"autoload": {
5959
"psr-4": {
60+
"DataGovDk\\Model\\Core\\": "lib/DataGovDk/Model/Core/",
61+
"DataGovDk\\Model\\DataTypes\\": "lib/DataGovDk/Model/DataTypes/",
62+
"DigitalPost\\MeMo\\": "lib/DigitalPost/MeMo/",
63+
"Digitaliseringskataloget\\": "lib/digitaliseringskataloget",
6064
"ItkDev\\Serviceplatformen\\": "src/",
6165
"ItkDev\\Serviceplatformen\\SF1500\\": "generated-classes/ItkDev/Serviceplatformen/SF1500/",
6266
"ItkDev\\Serviceplatformen\\SF1600\\": "generated-classes/ItkDev/Serviceplatformen/SF1600/",
63-
"DigitalPost\\MeMo\\": "lib/DigitalPost/MeMo/",
64-
"DataGovDk\\Model\\DataTypes\\": "lib/DataGovDk/Model/DataTypes/",
65-
"DataGovDk\\Model\\Core\\": "lib/DataGovDk/Model/Core/",
66-
"WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber\\": "lib/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/",
67-
"ServicesNsiDk\\En\\Services\\SOR\\": "lib/ServicesNsiDk/En/Services/SOR/",
68-
"MotorregisterSkatDk\\": "lib/MotorregisterSkatDk/",
69-
"KleOnlineDk\\": "lib/KleOnlineDk/",
70-
"WwwFormOnlineDk\\": "lib/WwwFormOnlineDk/",
67+
"KleOnlineDk\\": "lib/KleOnlineDk/",
68+
"MotorregisterSkatDk\\": "lib/MotorregisterSkatDk/",
69+
"Oio\\": "lib/Oio/",
70+
"ServicesNsiDk\\En\\Services\\SOR\\": "lib/ServicesNsiDk/En/Services/SOR/",
7171
"WwwDstDk\\Da\\TilSalg\\Forskningsservice\\Dokumentation\\Hoejkvalitetsvariable\\Elevregister2\\Udd\\": "lib/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd/",
72-
"Digitaliseringskataloget\\": "lib/digitaliseringskataloget",
73-
"Oio\\": "lib/Oio/"
72+
"WwwFormOnlineDk\\": "lib/WwwFormOnlineDk/",
73+
"WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber\\": "lib/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/"
7474
}
7575
},
7676
"autoload-dev": {
7777
"psr-4": {
7878
"ItkDev\\Serviceplatformen\\Tests\\": "tests/"
7979
}
8080
},
81-
"minimum-stability": "dev",
82-
"prefer-stable": true,
81+
"bin": [
82+
"bin/serviceplatformen-sf1500-data-lookup",
83+
"bin/serviceplatformen-sf1601-kombipostafsend"
84+
],
85+
"config": {
86+
"allow-plugins": {
87+
"ergebnis/composer-normalize": true
88+
},
89+
"optimize-autoloader": true,
90+
"preferred-install": "dist",
91+
"sort-packages": true
92+
},
8393
"scripts": {
84-
"tests/unit": [
85-
"phpunit --configuration phpunit.xml.dist --testsuite Unit"
86-
],
87-
"tests/end-to-end": [
88-
"phpunit --configuration phpunit.xml.dist --testsuite EndToEnd"
89-
],
90-
"tests": [
91-
"@tests/unit",
92-
"@tests/end-to-end"
94+
"code-analysis": [
95+
"@code-analysis/phan",
96+
"@code-analysis/phpstan"
9397
],
94-
"coding-standards-check/php-cs-fixer": [
95-
"php-cs-fixer fix --dry-run"
98+
"code-analysis/phan": [
99+
"phan --allow-polyfill-parser"
96100
],
97-
"coding-standards-check/phpcs": [
98-
"phpcs --standard=phpcs.xml.dist"
101+
"code-analysis/phpstan": [
102+
"phpstan analyse"
99103
],
100-
"coding-standards-check": [
101-
"@coding-standards-check/php-cs-fixer",
102-
"@coding-standards-check/phpcs"
104+
"coding-standards-apply": [
105+
"@coding-standards-apply/php-cs-fixer",
106+
"@coding-standards-apply/phpcs"
103107
],
104108
"coding-standards-apply/php-cs-fixer": [
105109
"php-cs-fixer fix"
106110
],
107111
"coding-standards-apply/phpcs": [
108112
"phpcbf --standard=phpcs.xml.dist"
109113
],
110-
"coding-standards-apply": [
111-
"@coding-standards-apply/php-cs-fixer",
112-
"@coding-standards-apply/phpcs"
114+
"coding-standards-check": [
115+
"@coding-standards-check/php-cs-fixer",
116+
"@coding-standards-check/phpcs"
113117
],
114-
"code-analysis/phan": [
115-
"phan --allow-polyfill-parser"
118+
"coding-standards-check/php-cs-fixer": [
119+
"php-cs-fixer fix --dry-run"
116120
],
117-
"code-analysis/phpstan": [
118-
"phpstan analyse"
121+
"coding-standards-check/phpcs": [
122+
"phpcs --standard=phpcs.xml.dist"
119123
],
120-
"code-analysis": [
121-
"@code-analysis/phan",
122-
"@code-analysis/phpstan"
124+
"tests": [
125+
"@tests/unit",
126+
"@tests/end-to-end"
127+
],
128+
"tests/end-to-end": [
129+
"phpunit --configuration phpunit.xml.dist --testsuite EndToEnd"
130+
],
131+
"tests/unit": [
132+
"phpunit --configuration phpunit.xml.dist --testsuite Unit"
123133
]
124-
},
125-
"repositories": {
126-
"goetas-webservices/xsd2php": {
127-
"type": "vcs",
128-
"url": "https://github.com/rimi-itk/xsd2php"
129-
}
130134
}
131135
}

src/Certificate/AbstractCertificateLocator.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,28 @@
1010

1111
namespace ItkDev\Serviceplatformen\Certificate;
1212

13-
use phpDocumentor\Reflection\Types\Mixed_;
14-
1513
abstract class AbstractCertificateLocator implements CertificateLocatorInterface, \JsonSerializable
1614
{
1715
protected $passphrase;
1816

1917
/**
2018
* AbstractCertificateLocator constructor.
21-
*
22-
* @param string $passphrases
2319
*/
2420
public function __construct(string $passphrases = '')
2521
{
2622
$this->passphrase = $passphrases;
2723
}
2824

29-
/**
30-
* {@inheritDoc}
31-
*/
3225
public function getPassphrase(): string
3326
{
3427
return $this->passphrase;
3528
}
3629

37-
/**
38-
* {@inheritDoc}
39-
*/
4030
public function hasPassphrase(): bool
4131
{
4232
return !empty($this->passphrase);
4333
}
4434

45-
/**
46-
* {@inheritdoc}
47-
*/
4835
public function jsonSerialize(): mixed
4936
{
5037
return [

src/Certificate/AzureKeyVaultCertificateLocator.php

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ class AzureKeyVaultCertificateLocator extends AbstractCertificateLocator impleme
2222

2323
/**
2424
* AzureKeyVaultCertificateLocator constructor.
25-
*
26-
* @param VaultSecret $vaultSecret
27-
* @param string $certificateName
28-
* @param string $version
29-
* @param string $passphrase
3025
*/
3126
public function __construct(VaultSecret $vaultSecret, string $certificateName, string $version, string $passphrase = '')
3227
{
@@ -36,9 +31,6 @@ public function __construct(VaultSecret $vaultSecret, string $certificateName, s
3631
parent::__construct($passphrase);
3732
}
3833

39-
/**
40-
* {@inheritDoc}
41-
*/
4234
public function getCertificates(): array
4335
{
4436
try {
@@ -50,9 +42,6 @@ public function getCertificates(): array
5042
return $this->getCertificateStoreDataFromSecret($secret->getValue());
5143
}
5244

53-
/**
54-
* {@inheritDoc}
55-
*/
5645
public function getCertificate(): string
5746
{
5847
try {
@@ -66,9 +55,6 @@ public function getCertificate(): string
6655
return $this->extractCertificateFromStoreData($certificateStoreData);
6756
}
6857

69-
/**
70-
* {@inheritDoc}
71-
*/
7258
public function getAbsolutePathToCertificate(): string
7359
{
7460
$certificate = $this->getCertificate();
@@ -79,9 +65,9 @@ public function getAbsolutePathToCertificate(): string
7965
/**
8066
* Returns certificate store data from a base64 encoded azure key vault secret value.
8167
*
82-
* @param string $secretValue base64 encoded secret value.
68+
* @param string $secretValue base64 encoded secret value
8369
*
84-
* @return array the certificate store data.
70+
* @return array the certificate store data
8571
*
8672
* @throws AzureKeyVaultCertificateLocatorException
8773
*/
@@ -107,9 +93,9 @@ private function getCertificateStoreDataFromSecret(string $secretValue): array
10793
/**
10894
* Extracts certificate data from certificate store data generated by openssl_pkcs12_read().
10995
*
110-
* @param array $certificateStoreData certificate store data generated by openssl_pkcs12_read().
96+
* @param array $certificateStoreData certificate store data generated by openssl_pkcs12_read()
11197
*
112-
* @return string certificate in pem format.
98+
* @return string certificate in pem format
11399
*
114100
* @throws AzureKeyVaultCertificateLocatorException
115101
*/
@@ -124,8 +110,8 @@ private function extractCertificateFromStoreData(array $certificateStoreData): s
124110
}
125111

126112
$combinedCertificate = $certificateStoreData['pkey']
127-
. PHP_EOL
128-
. $certificateStoreData['cert'];
113+
.PHP_EOL
114+
.$certificateStoreData['cert'];
129115

130116
if (array_key_exists('extracerts', $certificateStoreData)) {
131117
$combinedCertificate .= is_array($certificateStoreData['extracerts'])
@@ -141,9 +127,9 @@ private function extractCertificateFromStoreData(array $certificateStoreData): s
141127
*
142128
* The file will be removed from the filesystem when no more references exists to the file.
143129
*
144-
* @param string $content the content of the temporary file.
130+
* @param string $content the content of the temporary file
145131
*
146-
* @return string the absolute path to the temporary file.
132+
* @return string the absolute path to the temporary file
147133
*/
148134
private function getAbsoluteTmpPathByContent(string $content): string
149135
{
@@ -155,17 +141,15 @@ private function getAbsoluteTmpPathByContent(string $content): string
155141
$tmpFile = tmpfile();
156142
fwrite($tmpFile, $content);
157143
$streamMetaData = stream_get_meta_data($tmpFile);
144+
158145
return $streamMetaData['uri'];
159146
}
160147

161-
/**
162-
* {@inheritdoc}
163-
*/
164148
public function jsonSerialize(): mixed
165149
{
166150
return parent::jsonSerialize() + [
167-
'certificateName' => $this->certificateName,
168-
'version' => $this->version,
169-
];
151+
'certificateName' => $this->certificateName,
152+
'version' => $this->version,
153+
];
170154
}
171155
}

src/Certificate/CertificateLocatorInterface.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
use ItkDev\Serviceplatformen\Certificate\Exception\CertificateLocatorException;
1414

1515
/**
16-
* Interface CertificateLocatorInterface
16+
* Interface CertificateLocatorInterface.
1717
*/
1818
interface CertificateLocatorInterface
1919
{
2020
/**
2121
* Returns the certificate parts.
2222
*
23-
* @return array the certificate parts.
23+
* @return array the certificate parts
2424
*
2525
* @throws CertificateLocatorException
2626
*/
@@ -34,21 +34,18 @@ public function getCertificate(): string;
3434
/**
3535
* Returns the absolute path to the certificate.
3636
*
37-
* @deprecated Use self::getCertificate() to get the certificate and store it in a temporary file if needed.
37+
* @deprecated use self::getCertificate() to get the certificate and store it in a temporary file if needed
3838
*
39-
* @return string the absolute path to the certificate.
39+
* @return string the absolute path to the certificate
4040
*
4141
* @throws CertificateLocatorException
4242
*/
4343
public function getAbsolutePathToCertificate(): string;
4444

45-
/**
46-
* @return string
47-
*/
4845
public function getPassphrase(): string;
4946

5047
/**
51-
* @return bool true if passphrase is present else false.
48+
* @return bool true if passphrase is present else false
5249
*/
5350
public function hasPassphrase(): bool;
5451
}

src/Certificate/Exception/AzureKeyVaultCertificateLocatorException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace ItkDev\Serviceplatformen\Certificate\Exception;
1212

1313
/**
14-
* Class AzureKeyVaultCertificateLocatorException
14+
* Class AzureKeyVaultCertificateLocatorException.
1515
*
1616
* Exception cast by the AzureKeyVaultCertificateLocator class when errors occurs.
1717
*/

0 commit comments

Comments
 (0)