From c9e134265e01254726af81bacb0cf9e5dad37f52 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 11 Sep 2025 15:25:21 +0200 Subject: [PATCH 1/9] Cleaned up --- .editorconfig | 24 +++++-- .github/workflows/changelog.yaml | 29 +++++++++ .github/workflows/composer.yaml | 80 +++++++++++++++++++++++ .github/workflows/markdown.yaml | 44 +++++++++++++ .github/workflows/php.yaml | 60 +++++++++++++++++ .github/workflows/pr.yaml | 94 ++------------------------- .github/workflows/yaml.yaml | 41 ++++++++++++ .markdownlint.jsonc | 4 ++ .markdownlintignore | 12 ++++ .php-cs-fixer.dist.php | 34 ++++------ .prettierignore | 1 + README.md | 30 ++++----- Taskfile.yml | 22 +++++++ compose.yaml | 29 +++++++++ composer.json | 2 +- xsd2php-config.yml | 106 +++++++++++++++---------------- 16 files changed, 426 insertions(+), 186 deletions(-) create mode 100644 .github/workflows/changelog.yaml create mode 100644 .github/workflows/composer.yaml create mode 100644 .github/workflows/markdown.yaml create mode 100644 .github/workflows/php.yaml create mode 100644 .github/workflows/yaml.yaml create mode 100644 .markdownlintignore create mode 100644 .prettierignore create mode 100644 Taskfile.yml create mode 100644 compose.yaml diff --git a/.editorconfig b/.editorconfig index cc084450..8f37febe 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,14 +1,24 @@ -# Drupal editor configuration normalization -# @see http://editorconfig.org/ +# This file is copied from config/symfony/.editorconfig in https://github.com/itk-dev/devops_itkdev-docker. +# Feel free to edit the file, but consider making a pull request if you find a general issue with the file. -# This is the top-most .editorconfig file; do not search in parent directories. +# EditorConfig is awesome: https://editorconfig.org + +# top-most EditorConfig file root = true -# All files. [*] +charset = utf-8 end_of_line = LF -indent_style = space indent_size = 4 -charset = utf-8 -trim_trailing_whitespace = true +indent_style = space insert_final_newline = true +trim_trailing_whitespace = true + +[*.{js,css,scss}] +indent_size = 2 + +[*.{yml,yaml}] +indent_size = 2 + +[config/**/*.{yml,yaml}] +indent_size = 4 diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml new file mode 100644 index 00000000..483da6e9 --- /dev/null +++ b/.github/workflows/changelog.yaml @@ -0,0 +1,29 @@ +# Do not edit this file! Make a pull request on changing +# github/workflows/changelog.yaml in +# https://github.com/itk-dev/devops_itkdev-docker if need be. + +### ### Changelog +### +### Checks that changelog has been updated + +name: Changelog + +on: + pull_request: + +jobs: + changelog: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Git fetch + run: git fetch + + - name: Check that changelog has been updated. + run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0 diff --git a/.github/workflows/composer.yaml b/.github/workflows/composer.yaml new file mode 100644 index 00000000..6c3a30cd --- /dev/null +++ b/.github/workflows/composer.yaml @@ -0,0 +1,80 @@ +# Do not edit this file! Make a pull request on changing +# github/workflows/composer.yaml in +# https://github.com/itk-dev/devops_itkdev-docker if need be. + +### ### Composer +### +### Validates composer.json and checks that it's normalized. +### +### #### Assumptions +### +### 1. A docker compose service named `phpfpm` can be run and `composer` can be +### run inside the `phpfpm` service. +### 2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) +### is a dev requirement in `composer.json`: +### +### ``` shell +### docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize +### ``` +### +### Normalize `composer.json` by running +### +### ``` shell +### docker compose run --rm phpfpm composer normalize +### ``` + +name: Composer + +env: + COMPOSE_USER: root + +on: + pull_request: + push: + branches: + - main + - develop + +jobs: + composer-validate: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - name: Create docker network + run: | + docker network create frontend + + - run: | + docker compose run --rm phpfpm composer validate --strict + + composer-normalized: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - name: Create docker network + run: | + docker network create frontend + + - run: | + docker compose run --rm phpfpm composer install + docker compose run --rm phpfpm composer normalize --dry-run + + composer-audit: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - name: Create docker network + run: | + docker network create frontend + + - run: | + docker compose run --rm phpfpm composer audit diff --git a/.github/workflows/markdown.yaml b/.github/workflows/markdown.yaml new file mode 100644 index 00000000..f8bcf090 --- /dev/null +++ b/.github/workflows/markdown.yaml @@ -0,0 +1,44 @@ +# Do not edit this file! Make a pull request on changing +# github/workflows/markdown.yaml in +# https://github.com/itk-dev/devops_itkdev-docker if need be. + +### ### Markdown +### +### Lints Markdown files (`**/*.md`) in the project. +### +### [markdownlint-cli configuration +### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration), +### `.markdownlint.jsonc` and `.markdownlintignore`, control what is actually +### linted and how. +### +### #### Assumptions +### +### 1. A docker compose service named `markdownlint` for running `markdownlint` +### (from +### [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli)) +### exists. + +name: Markdown + +on: + pull_request: + push: + branches: + - main + - develop + +jobs: + markdown-lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create docker network + run: | + docker network create frontend + + - run: | + docker compose run --rm markdownlint markdownlint '**/*.md' diff --git a/.github/workflows/php.yaml b/.github/workflows/php.yaml new file mode 100644 index 00000000..d3240970 --- /dev/null +++ b/.github/workflows/php.yaml @@ -0,0 +1,60 @@ +# Do not edit this file! Make a pull request on changing +# github/workflows/symfony/php.yaml in +# https://github.com/itk-dev/devops_itkdev-docker if need be. + +### ### Symfony PHP +### +### Checks that PHP code adheres to the [Symfony coding +### standards](https://symfony.com/doc/current/contributing/code/standards.html). +### +### #### Assumptions +### +### 1. A docker compose service named `phpfpm` can be run and `composer` can be +### run inside the `phpfpm` service. 2. +### [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) +### is a dev requirement in `composer.json`: +### +### ``` shell +### docker compose run --rm phpfpm composer require --dev friendsofphp/php-cs-fixer +### ``` +### +### Clean up and check code by running +### +### ``` shell +### docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix +### docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix --dry-run --diff +### ``` +### +### > [!NOTE] The template adds `.php-cs-fixer.dist.php` as [a configuration +### > file for PHP CS +### > Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst) +### > and this makes it possible to override the actual configuration used in a +### > project by adding a more important configuration file, `.php-cs-fixer.php`. + +name: Symfony PHP + +env: + COMPOSE_USER: root + +on: + pull_request: + push: + branches: + - main + - develop + +jobs: + coding-standards: + name: PHP - Check Coding Standards + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create docker network + run: | + docker network create frontend + + - run: | + docker compose run --rm phpfpm composer install + # https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/usage.rst#the-check-command + docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix --dry-run --diff diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 21ab944d..17f2fb24 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,91 +1,14 @@ on: pull_request -name: Review -jobs: - changelog: - runs-on: ubuntu-latest - name: Changelog should be updated - strategy: - fail-fast: false - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Git fetch - run: git fetch - - - name: Check that changelog has been updated. - run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0 - - test-composer-install: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: [ '8.3' ] - name: Validate composer (${{ matrix.php}}) - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php}} - extensions: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip - coverage: none - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ matrix.php }}-composer- - - name: Validate composer files - run: composer validate composer.json - - name: Composer install with exported .env variables - run: | - set -a && source .env && set +a - APP_ENV=prod composer install --no-dev -o - - coding-standards-php: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: [ '8.3' ] - name: PHP coding Standards (${{ matrix.php }}) - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php}} - extensions: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip - coverage: none - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ matrix.php }}-composer- - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - name: coding-standards-check - run: composer coding-standards-check +name: Review +jobs: code-analysis-php: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - php: [ '8.3' ] + php: ["8.3"] name: PHP code analysis (${{ matrix.php }}) steps: - name: Checkout @@ -110,21 +33,12 @@ jobs: - name: code-analysis run: composer code-analysis - coding-standards-markdown: - runs-on: ubuntu-latest - name: Markdown coding standards - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: coding-standards-check - run: docker run --rm --volume ${PWD}:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md' - test-unit: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - php: [ '8.3' ] + php: ["8.3"] name: Run unit tests (${{ matrix.php}}) steps: - name: Checkout diff --git a/.github/workflows/yaml.yaml b/.github/workflows/yaml.yaml new file mode 100644 index 00000000..8c609637 --- /dev/null +++ b/.github/workflows/yaml.yaml @@ -0,0 +1,41 @@ +# Do not edit this file! Make a pull request on changing +# github/workflows/yaml.yaml in +# https://github.com/itk-dev/devops_itkdev-docker if need be. + +### ### YAML +### +### Validates YAML files. +### +### #### Assumptions +### +### 1. A docker compose service named `prettier` for running +### [Prettier](https://prettier.io/) exists. +### +### #### Symfony YAML +### +### Symfony's YAML config files use 4 spaces for indentation and single quotes. +### Therefore we use a [Prettier configuration +### file](https://prettier.io/docs/configuration), `.prettierrc.yaml`, to make +### Prettier format YAML files in the `config/` folder like Symfony expects. + +name: YAML + +on: + pull_request: + push: + branches: + - main + - develop + +jobs: + yaml-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create docker network + run: | + docker network create frontend + + - run: | + docker compose run --rm prettier '**/*.{yml,yaml}' --check diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc index 86516e72..02530965 100644 --- a/.markdownlint.jsonc +++ b/.markdownlint.jsonc @@ -1,3 +1,7 @@ +// This file is copied from config/markdown/.markdownlint.jsonc in https://github.com/itk-dev/devops_itkdev-docker. +// Feel free to edit the file, but consider making a pull request if you find a general issue with the file. + +// markdownlint-cli configuration file (cf. https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration) { "default": true, // https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 00000000..d143acee --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1,12 @@ +# This file is copied from config/markdown/.markdownlintignore in https://github.com/itk-dev/devops_itkdev-docker. +# Feel free to edit the file, but consider making a pull request if you find a general issue with the file. + +# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files +vendor/ +node_modules/ +LICENSE.md +# Drupal +web/*.md +web/core/ +web/libraries/ +web/*/contrib/ diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e9c21a1a..c23b927b 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,26 +1,20 @@ in(__DIR__.'/{src,tests}') -; +// https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst -$header =<<<'HEADER' -This file is part of itk-dev/serviceplatformen. +$finder = new PhpCsFixer\Finder(); +// Check all files … +$finder->in(__DIR__); +// … that are not ignored by VCS +$finder->ignoreVCSIgnored(true); -(c) 2020 ITK Development +$config = new PhpCsFixer\Config(); +$config->setFinder($finder); -This source file is subject to the MIT license. -HEADER; +$config->setRules([ + '@Symfony' => true, +]); -return (new PhpCsFixer\Config()) - ->setRiskyAllowed(true) - ->setRules([ - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'header_comment' => ['header' => $header, 'comment_type' => 'PHPDoc'], - 'list_syntax' => ['syntax' => 'short'], - 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], - 'strict_comparison' => true, - ]) - ->setFinder($finder) -; +return $config; diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..c3af8579 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +lib/ diff --git a/README.md b/README.md index a76c7fc5..69212c00 100644 --- a/README.md +++ b/README.md @@ -18,32 +18,32 @@ generate PHP classes for talking to SOAP services. To update [resources](./resources) and [generated classes](./generated-classes), run ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer install +docker compose run --rm phpfpm composer install # Update WSDL resources. -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest bin/generate resources +docker compose run --rm phpfpm bin/generate resources # Generate PHP classes from WSDL resources. -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest bin/generate classes +docker compose run --rm phpfpm bin/generate classes ``` ## Test commands ``` shell -docker run --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest vendor/bin/serviceplatformen-sf1601-kombipostafsend --help +docker compose run --rm phpfpm vendor/bin/serviceplatformen-sf1601-kombipostafsend --help ``` Use `bin/serviceplatformen-sf1601-kombipostafsend` (symlinked to `bin/SF1601/kombipostafsend`) during development of this library. i.e. ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest bin/serviceplatformen-sf1601-kombipostafsend +docker compose run --rm phpfpm bin/serviceplatformen-sf1601-kombipostafsend ``` ``` shell -docker run --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest vendor/bin/serviceplatformen-sf1601-postforespoerg --help +docker compose run --rm phpfpm vendor/bin/serviceplatformen-sf1601-postforespoerg --help ``` ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest bin/serviceplatformen-sf1601-postforespoerg +docker compose run --rm phpfpm bin/serviceplatformen-sf1601-postforespoerg ``` ## Getting Started @@ -79,13 +79,13 @@ composer install Unit tests: ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer tests/unit +docker compose run --rm phpfpm composer tests/unit ``` End to end tests: ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer tests/end-to-end +docker compose run --rm phpfpm composer tests/end-to-end ``` ### And coding style tests @@ -237,20 +237,20 @@ reviewer to merge it for you. ### Coding standards ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer install -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer coding-standards-apply -docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer coding-standards-check +docker compose run --rm phpfpm composer install +docker compose run --rm phpfpm composer coding-standards-apply +docker compose run --rm phpfpm composer coding-standards-check ``` ``` shell -docker run --rm --volume ${PWD}:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md' --fix -docker run --rm --volume ${PWD}:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md' +docker compose run --rm markdownlint markdownlint '**/*.md' --fix +docker compose run --rm markdownlint markdownlint '**/*.md' ``` ### Code analysis ``` shell -docker run --interactive --tty --rm --volume ${PWD}:/app --env COMPOSER_MEMORY_LIMIT=-1 itkdev/php8.3-fpm:latest composer code-analysis +docker compose run --rm phpfpm composer code-analysis ``` ## Versioning diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 00000000..71b319c5 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,22 @@ +# https://taskfile.dev + +version: "3" + +tasks: + generate: + desc: Generate stuff … + cmds: + - task: compose + vars: + COMPOSE_ARGS: run --rm phpfpm composer install + - task: compose + vars: + COMPOSE_ARGS: run --rm phpfpm bin/generate resources + - task: compose + vars: + COMPOSE_ARGS: run --rm phpfpm bin/generate classes + + compose: + cmds: + - docker compose {{.COMPOSE_ARGS}} {{.CLI_ARGS}} + internal: true diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..bb2ba203 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,29 @@ +services: + phpfpm: + image: itkdev/php8.3-fpm:latest + profiles: + - dev + volumes: + - .:/app + environment: + PHP_MEMORY_LIMIT: 512M + COMPOSER_MEMORY_LIMIT: -1 + + # Code checks tools + markdownlint: + image: itkdev/markdownlint + profiles: + - dev + volumes: + - ./:/md + + prettier: + # Prettier does not (yet, fcf. + # https://github.com/prettier/prettier/issues/15206) have an official + # docker image. + # https://hub.docker.com/r/jauderho/prettier is good candidate (cf. https://hub.docker.com/search?q=prettier&sort=updated_at&order=desc) + image: jauderho/prettier + profiles: + - dev + volumes: + - ./:/work diff --git a/composer.json b/composer.json index f4d60f1c..d6ca9910 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "bin/serviceplatformen-sf1601-kombipostafsend" ], "require": { - "php": "^8.1", + "php": "^8.3", "ext-curl": "*", "ext-dom": "*", "ext-json": "*", diff --git a/xsd2php-config.yml b/xsd2php-config.yml index 3f19a803..ef4964ff 100644 --- a/xsd2php-config.yml +++ b/xsd2php-config.yml @@ -2,15 +2,15 @@ xsd2php: namespaces: - 'https://DigitalPost.dk/MeMo-1': 'DigitalPost\MeMo' - 'https://data.gov.dk/model/dataTypes/': 'DataGovDk\Model\DataTypes' - 'https://data.gov.dk/model/core/': 'DataGovDk\Model\Core' - 'https://www.gs1.dk/gs1-standarder/identifikation/gln-global-location-number/': 'WwwGs1Dk\Gs1Standarder\Identifikation\GlnGlobalLocationNumber' - 'https://services.nsi.dk/en/Services/SOR': 'ServicesNsiDk\En\Services\SOR' - 'https://motorregister.skat.dk/': 'MotorregisterSkatDk' - 'http://kle-online.dk/': 'KleOnlineDk' - 'http://www.form-online.dk/': 'WwwFormOnlineDk' - 'https://www.dst.dk/da/TilSalg/Forskningsservice/Dokumentation/hoejkvalitetsvariable/elevregister-2/udd#': 'WwwDstDk\Da\TilSalg\Forskningsservice\Dokumentation\Hoejkvalitetsvariable\Elevregister2\Udd' + "https://DigitalPost.dk/MeMo-1": "DigitalPost\\MeMo" + "https://data.gov.dk/model/dataTypes/": "DataGovDk\\Model\\DataTypes" + "https://data.gov.dk/model/core/": "DataGovDk\\Model\\Core" + "https://www.gs1.dk/gs1-standarder/identifikation/gln-global-location-number/": "WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber" + "https://services.nsi.dk/en/Services/SOR": "ServicesNsiDk\\En\\Services\\SOR" + "https://motorregister.skat.dk/": "MotorregisterSkatDk" + "http://kle-online.dk/": "KleOnlineDk" + "http://www.form-online.dk/": "WwwFormOnlineDk" + "https://www.dst.dk/da/TilSalg/Forskningsservice/Dokumentation/hoejkvalitetsvariable/elevregister-2/udd#": "WwwDstDk\\Da\\TilSalg\\Forskningsservice\\Dokumentation\\Hoejkvalitetsvariable\\Elevregister2\\Udd" # https://digitaliseringskataloget.dk/integration/sf1500 "http://stoettesystemerne.dk/klassifikation/facet/6/": "Digitaliseringskataloget\\SF1500\\Organisation6\\Facet" @@ -30,71 +30,71 @@ xsd2php: "http://stoettesystemerne.dk/organisation/organisationsystem/6/": "Digitaliseringskataloget\\SF1500\\Organisation6\\Organisationsystem" "http://stoettesystemerne.dk/organisation/person/6/": "Digitaliseringskataloget\\SF1500\\Organisation6\\Person" "http://stoettesystemerne.dk/organisation/virksomhed/6/": "Digitaliseringskataloget\\SF1500\\Organisation6\\Virksomhed" - "urn:oio:sagdok:3.0.0": "Digitaliseringskataloget\\Sagdok3_0_0" + # "urn:oio:sagdok:3.0.0": "Digitaliseringskataloget\\Sagdok3_0_0" "urn:oio:sts:6": "Digitaliseringskataloget\\Sts6" "urn:oio:sts:part:6": "Digitaliseringskataloget\\Sts6\\Part" - 'http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/': 'Oio\Cpr' - 'http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/05/19/': 'Oio\Cpr' - 'http://rep.oio.dk/cvr.dk/xml/schemas/2005/03/22/': 'Oio\Cvr' - 'http://rep.oio.dk/ebxml/xml/schemas/dkcc/2003/02/13/': 'Oio\Ebxml' - 'http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/03/15/': 'Oio\Ebxml' - 'http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/05/13/': 'Oio\Ebxml' - 'http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/05/19/': 'Oio\Ebxml' - 'http://rep.oio.dk/itst.dk/xml/schemas/2006/01/17/': 'Oio\Itst' - 'http://rep.oio.dk/xkom.dk/xml/schemas/2005/03/15/': 'Oio\Xkom' - 'urn:oio:adir:dagpenge:2009.07.01': 'Oio\Adir\Dagpenge' - 'urn:oio:dkal:1.0.0': 'Oio\Dkal' - 'urn:oio:fjernprint:1.0.0': 'Oio\Fjernprint' - 'urn:oio:sagdok:3.0.0': 'Oio\Sagdok' + "http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/": "Oio\\Cpr" + "http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/05/19/": "Oio\\Cpr" + "http://rep.oio.dk/cvr.dk/xml/schemas/2005/03/22/": "Oio\\Cvr" + "http://rep.oio.dk/ebxml/xml/schemas/dkcc/2003/02/13/": "Oio\\Ebxml" + "http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/03/15/": "Oio\\Ebxml" + "http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/05/13/": "Oio\\Ebxml" + "http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/05/19/": "Oio\\Ebxml" + "http://rep.oio.dk/itst.dk/xml/schemas/2006/01/17/": "Oio\\Itst" + "http://rep.oio.dk/xkom.dk/xml/schemas/2005/03/15/": "Oio\\Xkom" + "urn:oio:adir:dagpenge:2009.07.01": "Oio\\Adir\\Dagpenge" + "urn:oio:dkal:1.0.0": "Oio\\Dkal" + "urn:oio:fjernprint:1.0.0": "Oio\\Fjernprint" + "urn:oio:sagdok:3.0.0": "Oio\\Sagdok" destinations_php: # These must also be set in autoload.psr-4 in composer.json. - 'DigitalPost\MeMo': 'lib/DigitalPost/MeMo/' - 'DataGovDk\Model\DataTypes': 'lib/DataGovDk/Model/DataTypes/' - 'DataGovDk\Model\Core': 'lib/DataGovDk/Model/Core/' - 'WwwGs1Dk\Gs1Standarder\Identifikation\GlnGlobalLocationNumber': 'lib/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/' - 'ServicesNsiDk\En\Services\SOR': 'lib/ServicesNsiDk/En/Services/SOR/' - 'MotorregisterSkatDk': 'lib/MotorregisterSkatDk/' - 'KleOnlineDk': 'lib/KleOnlineDk/' - 'WwwFormOnlineDk': 'lib/WwwFormOnlineDk/' - 'WwwDstDk\Da\TilSalg\Forskningsservice\Dokumentation\Hoejkvalitetsvariable\Elevregister2\Udd': 'lib/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd/' + "DigitalPost\\MeMo": "lib/DigitalPost/MeMo/" + "DataGovDk\\Model\\DataTypes": "lib/DataGovDk/Model/DataTypes/" + "DataGovDk\\Model\\Core": "lib/DataGovDk/Model/Core/" + "WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber": "lib/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/" + "ServicesNsiDk\\En\\Services\\SOR": "lib/ServicesNsiDk/En/Services/SOR/" + "MotorregisterSkatDk": "lib/MotorregisterSkatDk/" + "KleOnlineDk": "lib/KleOnlineDk/" + "WwwFormOnlineDk": "lib/WwwFormOnlineDk/" + "WwwDstDk\\Da\\TilSalg\\Forskningsservice\\Dokumentation\\Hoejkvalitetsvariable\\Elevregister2\\Udd": "lib/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd/" # https://digitaliseringskataloget.dk/integration/sf1500 "Digitaliseringskataloget\\Sts6": "lib/digitaliseringskataloget/Sts6" "Digitaliseringskataloget\\Sagdok3_0_0": "lib/digitaliseringskataloget/Sagdok3_0_0" "Digitaliseringskataloget\\SF1500\\Organisation6": "lib/digitaliseringskataloget/SF1500/Organisation6" - 'Oio': 'lib/Oio' + "Oio": "lib/Oio" destinations_jms: # These must also be set in src/Service/SF1601/Serializer.php - 'DigitalPost\MeMo': 'lib/metadata/DigitalPost/MeMo/' - 'DataGovDk\Model\DataTypes': 'lib/metadata/DataGovDk/Model/DataTypes/' - 'DataGovDk\Model\Core': 'lib/metadata/DataGovDk/Model/Core/' - 'WwwGs1Dk\Gs1Standarder\Identifikation\GlnGlobalLocationNumber': 'lib/metadata/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/' - 'ServicesNsiDk\En\Services\SOR': 'lib/metadata/ServicesNsiDk/En/Services/SOR/' - 'MotorregisterSkatDk': 'lib/metadata/MotorregisterSkatDk/' - 'KleOnlineDk': 'lib/metadata/KleOnlineDk/' - 'WwwFormOnlineDk': 'lib/metadata/WwwFormOnlineDk/' - 'WwwDstDk\Da\TilSalg\Forskningsservice\Dokumentation\Hoejkvalitetsvariable\Elevregister2\Udd': 'lib/metadata/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd/' + "DigitalPost\\MeMo": "lib/metadata/DigitalPost/MeMo/" + "DataGovDk\\Model\\DataTypes": "lib/metadata/DataGovDk/Model/DataTypes/" + "DataGovDk\\Model\\Core": "lib/metadata/DataGovDk/Model/Core/" + "WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber": "lib/metadata/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/" + "ServicesNsiDk\\En\\Services\\SOR": "lib/metadata/ServicesNsiDk/En/Services/SOR/" + "MotorregisterSkatDk": "lib/metadata/MotorregisterSkatDk/" + "KleOnlineDk": "lib/metadata/KleOnlineDk/" + "WwwFormOnlineDk": "lib/metadata/WwwFormOnlineDk/" + "WwwDstDk\\Da\\TilSalg\\Forskningsservice\\Dokumentation\\Hoejkvalitetsvariable\\Elevregister2\\Udd": "lib/metadata/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd/" # https://digitaliseringskataloget.dk/integration/sf1500 "Digitaliseringskataloget\\Sts6": "lib/metadata/digitaliseringskataloget/Sts6" "Digitaliseringskataloget\\Sagdok3_0_0": "lib/metadata/digitaliseringskataloget/Sagdok3_0_0" "Digitaliseringskataloget\\SF1500\\Organisation6": "lib/metadata/digitaliseringskataloget/SF1500/Organisation6" - 'Oio': 'lib/metadata/Oio' + "Oio": "lib/metadata/Oio" xml_namespaces: # prefix: namespace - 'memo': 'https://DigitalPost.dk/MeMo-1' - 'gln': 'https://www.gs1.dk/gs1-standarder/identifikation/gln-global-location-number/' - 'udd': 'https://www.dst.dk/da/TilSalg/Forskningsservice/Dokumentation/hoejkvalitetsvariable/elevregister-2/udd#' - 'rid': 'https://www.nets.eu/dk-da/l%%C3%%B8sninger/nemid/nemid-tjenesteudbyder/supplerende-tjenester/pid-rid-cpr-tjenester' - 'pnum': 'https://indberet.virk.dk/myndigheder/stat/ERST/P-enhedsloesningen' - 'form': 'http://www.form-online.dk/' - 'kle': 'http://kle-online.dk/' - 'dmv': 'https://motorregister.skat.dk/' - 'grd': 'https://data.gov.dk/model/core/' - 'sor': 'https://services.nsi.dk/en/Services/SOR' + "memo": "https://DigitalPost.dk/MeMo-1" + "gln": "https://www.gs1.dk/gs1-standarder/identifikation/gln-global-location-number/" + "udd": "https://www.dst.dk/da/TilSalg/Forskningsservice/Dokumentation/hoejkvalitetsvariable/elevregister-2/udd#" + "rid": "https://www.nets.eu/dk-da/l%%C3%%B8sninger/nemid/nemid-tjenesteudbyder/supplerende-tjenester/pid-rid-cpr-tjenester" + "pnum": "https://indberet.virk.dk/myndigheder/stat/ERST/P-enhedsloesningen" + "form": "http://www.form-online.dk/" + "kle": "http://kle-online.dk/" + "dmv": "https://motorregister.skat.dk/" + "grd": "https://data.gov.dk/model/core/" + "sor": "https://services.nsi.dk/en/Services/SOR" From 51fb50e26b9da7a71c267c93bc433acc76b42b29 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 11 Sep 2025 15:54:33 +0200 Subject: [PATCH 2/9] Applied coding standards --- .php-cs-fixer.dist.php | 2 + CHANGELOG.md | 4 + compose.yaml | 1 + composer.json | 110 +++++++++--------- .../AbstractCertificateLocator.php | 13 --- .../AzureKeyVaultCertificateLocator.php | 40 ++----- .../CertificateLocatorInterface.php | 13 +-- ...ureKeyVaultCertificateLocatorException.php | 2 +- .../Exception/CertificateLocatorException.php | 4 +- .../FilesystemCertificateLocatorException.php | 2 +- .../FilesystemCertificateLocator.php | 32 ++--- src/Command/SF1500/AbstractSF1500Command.php | 7 +- src/Command/SF1500/SF1500LookupCommand.php | 29 ++--- src/Command/SF1500/SF1500ReadCommand.php | 6 +- src/Command/SF1500/SF1500SearchCommand.php | 6 +- src/Command/SF1601/AbstractCommand.php | 2 +- src/Command/SF1601/KombiPostAfsendCommand.php | 24 ++-- src/Command/SF1601/PostForespoergCommand.php | 4 +- src/DigitalPost/DigitalPost.php | 98 ++++++++-------- .../InvocationContextRequestGenerator.php | 13 +-- src/Request/RequestGeneratorInterface.php | 2 +- src/Service/AbstractRESTService.php | 65 +++++------ src/Service/AbstractService.php | 18 ++- .../Exception/InvalidArgumentException.php | 4 +- .../Exception/InvalidQueryException.php | 2 +- src/Service/Exception/NoCvrFoundException.php | 4 +- src/Service/Exception/NoPnrFoundException.php | 2 +- src/Service/Exception/SAMLTokenException.php | 2 +- src/Service/Exception/SF1500Exception.php | 2 +- src/Service/Exception/ServiceException.php | 4 +- src/Service/Exception/SoapException.php | 4 +- src/Service/OnlineService.php | 18 +-- src/Service/PersonBaseDataExtendedService.php | 12 +- src/Service/SF1500/AbstractService.php | 16 +-- src/Service/SF1500/AdresseService.php | 20 +--- src/Service/SF1500/BrugerService.php | 24 +--- src/Service/SF1500/Model/AbstractModel.php | 1 - src/Service/SF1500/Model/Bruger.php | 2 +- .../SF1500/Model/OrganisationFunktion.php | 4 +- .../SF1500/OrganisationFunktionService.php | 21 +--- src/Service/SF1500/OrganisationService.php | 20 +--- src/Service/SF1500/PersonService.php | 19 +-- src/Service/SF1500/SF1500.php | 64 +++++----- src/Service/SF1500/SF1500XMLBuilder.php | 20 ++-- src/Service/SF1500/ServiceInterface.php | 8 +- src/Service/SF1500/SoapClient.php | 6 +- src/Service/SF1500/SoapClientBase.php | 9 +- src/Service/SF1500/VirksomhedService.php | 20 +--- src/Service/SF1514/SF1514.php | 72 ++++++------ .../SF1601/DocumentNormalizerInterface.php | 4 +- .../SF1601/Exception/InvalidMemoException.php | 4 +- src/Service/SF1601/SF1601.php | 55 ++++----- src/Service/SF1601/Serializer.php | 35 ++---- src/Service/SoapClient.php | 11 +- tests/Unit/Service/SF1601/SF1601Test.php | 4 +- 55 files changed, 398 insertions(+), 592 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index c23b927b..3c407e9c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -10,6 +10,8 @@ // … that are not ignored by VCS $finder->ignoreVCSIgnored(true); +$finder->exclude(['lib', 'generated-classes']); + $config = new PhpCsFixer\Config(); $config->setFinder($finder); diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a8b0566..5600e68f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [PR-44](https://github.com/itk-dev/serviceplatformen/pull/44) + - Cleaned up in preparation for adding support for + [Fordelingskomponenten](https://digitaliseringskataloget.dk/l%C3%B8sninger/fordelingskomponenten) + ## [1.7.1] - 2025-08-20 - [PR-43](https://github.com/itk-dev/serviceplatformen/pull/43) diff --git a/compose.yaml b/compose.yaml index bb2ba203..68029acd 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,7 @@ services: phpfpm: image: itkdev/php8.3-fpm:latest + user: ${COMPOSE_USER:-deploy} profiles: - dev volumes: diff --git a/composer.json b/composer.json index d6ca9910..30cfd091 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "itk-dev/serviceplatformen", "description": "", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "Lars Steen", @@ -13,10 +13,6 @@ "email": "rimi@aarhus.dk" } ], - "bin": [ - "bin/serviceplatformen-sf1500-data-lookup", - "bin/serviceplatformen-sf1601-kombipostafsend" - ], "require": { "php": "^8.3", "ext-curl": "*", @@ -40,6 +36,7 @@ "wsdltophp/packagebase": "^5.0" }, "require-dev": { + "ergebnis/composer-normalize": "^2.48", "friendsofphp/php-cs-fixer": "^3.11", "goetas-webservices/xsd2php": "dev-feature-xml-namespace-prefix", "phan/phan": "^5.4", @@ -50,27 +47,30 @@ "symfony/mime": "^5.4 || ^6.0", "wsdltophp/packagegenerator": "^4.1" }, - "config": { - "optimize-autoloader": true, - "preferred-install": "dist", - "sort-packages": true + "repositories": { + "goetas-webservices/xsd2php": { + "type": "vcs", + "url": "https://github.com/rimi-itk/xsd2php" + } }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { + "DataGovDk\\Model\\Core\\": "lib/DataGovDk/Model/Core/", + "DataGovDk\\Model\\DataTypes\\": "lib/DataGovDk/Model/DataTypes/", + "DigitalPost\\MeMo\\": "lib/DigitalPost/MeMo/", + "Digitaliseringskataloget\\": "lib/digitaliseringskataloget", "ItkDev\\Serviceplatformen\\": "src/", "ItkDev\\Serviceplatformen\\SF1500\\": "generated-classes/ItkDev/Serviceplatformen/SF1500/", "ItkDev\\Serviceplatformen\\SF1600\\": "generated-classes/ItkDev/Serviceplatformen/SF1600/", - "DigitalPost\\MeMo\\": "lib/DigitalPost/MeMo/", - "DataGovDk\\Model\\DataTypes\\": "lib/DataGovDk/Model/DataTypes/", - "DataGovDk\\Model\\Core\\": "lib/DataGovDk/Model/Core/", - "WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber\\": "lib/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/", - "ServicesNsiDk\\En\\Services\\SOR\\": "lib/ServicesNsiDk/En/Services/SOR/", - "MotorregisterSkatDk\\": "lib/MotorregisterSkatDk/", - "KleOnlineDk\\": "lib/KleOnlineDk/", - "WwwFormOnlineDk\\": "lib/WwwFormOnlineDk/", + "KleOnlineDk\\": "lib/KleOnlineDk/", + "MotorregisterSkatDk\\": "lib/MotorregisterSkatDk/", + "Oio\\": "lib/Oio/", + "ServicesNsiDk\\En\\Services\\SOR\\": "lib/ServicesNsiDk/En/Services/SOR/", "WwwDstDk\\Da\\TilSalg\\Forskningsservice\\Dokumentation\\Hoejkvalitetsvariable\\Elevregister2\\Udd\\": "lib/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd/", - "Digitaliseringskataloget\\": "lib/digitaliseringskataloget", - "Oio\\": "lib/Oio/" + "WwwFormOnlineDk\\": "lib/WwwFormOnlineDk/", + "WwwGs1Dk\\Gs1Standarder\\Identifikation\\GlnGlobalLocationNumber\\": "lib/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber/" } }, "autoload-dev": { @@ -78,28 +78,32 @@ "ItkDev\\Serviceplatformen\\Tests\\": "tests/" } }, - "minimum-stability": "dev", - "prefer-stable": true, + "bin": [ + "bin/serviceplatformen-sf1500-data-lookup", + "bin/serviceplatformen-sf1601-kombipostafsend" + ], + "config": { + "allow-plugins": { + "ergebnis/composer-normalize": true + }, + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true + }, "scripts": { - "tests/unit": [ - "phpunit --configuration phpunit.xml.dist --testsuite Unit" - ], - "tests/end-to-end": [ - "phpunit --configuration phpunit.xml.dist --testsuite EndToEnd" - ], - "tests": [ - "@tests/unit", - "@tests/end-to-end" + "code-analysis": [ + "@code-analysis/phan", + "@code-analysis/phpstan" ], - "coding-standards-check/php-cs-fixer": [ - "php-cs-fixer fix --dry-run" + "code-analysis/phan": [ + "phan --allow-polyfill-parser" ], - "coding-standards-check/phpcs": [ - "phpcs --standard=phpcs.xml.dist" + "code-analysis/phpstan": [ + "phpstan analyse" ], - "coding-standards-check": [ - "@coding-standards-check/php-cs-fixer", - "@coding-standards-check/phpcs" + "coding-standards-apply": [ + "@coding-standards-apply/php-cs-fixer", + "@coding-standards-apply/phpcs" ], "coding-standards-apply/php-cs-fixer": [ "php-cs-fixer fix" @@ -107,25 +111,25 @@ "coding-standards-apply/phpcs": [ "phpcbf --standard=phpcs.xml.dist" ], - "coding-standards-apply": [ - "@coding-standards-apply/php-cs-fixer", - "@coding-standards-apply/phpcs" + "coding-standards-check": [ + "@coding-standards-check/php-cs-fixer", + "@coding-standards-check/phpcs" ], - "code-analysis/phan": [ - "phan --allow-polyfill-parser" + "coding-standards-check/php-cs-fixer": [ + "php-cs-fixer fix --dry-run" ], - "code-analysis/phpstan": [ - "phpstan analyse" + "coding-standards-check/phpcs": [ + "phpcs --standard=phpcs.xml.dist" ], - "code-analysis": [ - "@code-analysis/phan", - "@code-analysis/phpstan" + "tests": [ + "@tests/unit", + "@tests/end-to-end" + ], + "tests/end-to-end": [ + "phpunit --configuration phpunit.xml.dist --testsuite EndToEnd" + ], + "tests/unit": [ + "phpunit --configuration phpunit.xml.dist --testsuite Unit" ] - }, - "repositories": { - "goetas-webservices/xsd2php": { - "type": "vcs", - "url": "https://github.com/rimi-itk/xsd2php" - } } } diff --git a/src/Certificate/AbstractCertificateLocator.php b/src/Certificate/AbstractCertificateLocator.php index 330c5c56..42a6eae5 100644 --- a/src/Certificate/AbstractCertificateLocator.php +++ b/src/Certificate/AbstractCertificateLocator.php @@ -10,41 +10,28 @@ namespace ItkDev\Serviceplatformen\Certificate; -use phpDocumentor\Reflection\Types\Mixed_; - abstract class AbstractCertificateLocator implements CertificateLocatorInterface, \JsonSerializable { protected $passphrase; /** * AbstractCertificateLocator constructor. - * - * @param string $passphrases */ public function __construct(string $passphrases = '') { $this->passphrase = $passphrases; } - /** - * {@inheritDoc} - */ public function getPassphrase(): string { return $this->passphrase; } - /** - * {@inheritDoc} - */ public function hasPassphrase(): bool { return !empty($this->passphrase); } - /** - * {@inheritdoc} - */ public function jsonSerialize(): mixed { return [ diff --git a/src/Certificate/AzureKeyVaultCertificateLocator.php b/src/Certificate/AzureKeyVaultCertificateLocator.php index 5ccd084a..1cd70613 100644 --- a/src/Certificate/AzureKeyVaultCertificateLocator.php +++ b/src/Certificate/AzureKeyVaultCertificateLocator.php @@ -22,11 +22,6 @@ class AzureKeyVaultCertificateLocator extends AbstractCertificateLocator impleme /** * AzureKeyVaultCertificateLocator constructor. - * - * @param VaultSecret $vaultSecret - * @param string $certificateName - * @param string $version - * @param string $passphrase */ public function __construct(VaultSecret $vaultSecret, string $certificateName, string $version, string $passphrase = '') { @@ -36,9 +31,6 @@ public function __construct(VaultSecret $vaultSecret, string $certificateName, s parent::__construct($passphrase); } - /** - * {@inheritDoc} - */ public function getCertificates(): array { try { @@ -50,9 +42,6 @@ public function getCertificates(): array return $this->getCertificateStoreDataFromSecret($secret->getValue()); } - /** - * {@inheritDoc} - */ public function getCertificate(): string { try { @@ -66,9 +55,6 @@ public function getCertificate(): string return $this->extractCertificateFromStoreData($certificateStoreData); } - /** - * {@inheritDoc} - */ public function getAbsolutePathToCertificate(): string { $certificate = $this->getCertificate(); @@ -79,9 +65,9 @@ public function getAbsolutePathToCertificate(): string /** * Returns certificate store data from a base64 encoded azure key vault secret value. * - * @param string $secretValue base64 encoded secret value. + * @param string $secretValue base64 encoded secret value * - * @return array the certificate store data. + * @return array the certificate store data * * @throws AzureKeyVaultCertificateLocatorException */ @@ -107,9 +93,9 @@ private function getCertificateStoreDataFromSecret(string $secretValue): array /** * Extracts certificate data from certificate store data generated by openssl_pkcs12_read(). * - * @param array $certificateStoreData certificate store data generated by openssl_pkcs12_read(). + * @param array $certificateStoreData certificate store data generated by openssl_pkcs12_read() * - * @return string certificate in pem format. + * @return string certificate in pem format * * @throws AzureKeyVaultCertificateLocatorException */ @@ -124,8 +110,8 @@ private function extractCertificateFromStoreData(array $certificateStoreData): s } $combinedCertificate = $certificateStoreData['pkey'] - . PHP_EOL - . $certificateStoreData['cert']; + .PHP_EOL + .$certificateStoreData['cert']; if (array_key_exists('extracerts', $certificateStoreData)) { $combinedCertificate .= is_array($certificateStoreData['extracerts']) @@ -141,9 +127,9 @@ private function extractCertificateFromStoreData(array $certificateStoreData): s * * The file will be removed from the filesystem when no more references exists to the file. * - * @param string $content the content of the temporary file. + * @param string $content the content of the temporary file * - * @return string the absolute path to the temporary file. + * @return string the absolute path to the temporary file */ private function getAbsoluteTmpPathByContent(string $content): string { @@ -155,17 +141,15 @@ private function getAbsoluteTmpPathByContent(string $content): string $tmpFile = tmpfile(); fwrite($tmpFile, $content); $streamMetaData = stream_get_meta_data($tmpFile); + return $streamMetaData['uri']; } - /** - * {@inheritdoc} - */ public function jsonSerialize(): mixed { return parent::jsonSerialize() + [ - 'certificateName' => $this->certificateName, - 'version' => $this->version, - ]; + 'certificateName' => $this->certificateName, + 'version' => $this->version, + ]; } } diff --git a/src/Certificate/CertificateLocatorInterface.php b/src/Certificate/CertificateLocatorInterface.php index 217f4d2c..87ec1936 100644 --- a/src/Certificate/CertificateLocatorInterface.php +++ b/src/Certificate/CertificateLocatorInterface.php @@ -13,14 +13,14 @@ use ItkDev\Serviceplatformen\Certificate\Exception\CertificateLocatorException; /** - * Interface CertificateLocatorInterface + * Interface CertificateLocatorInterface. */ interface CertificateLocatorInterface { /** * Returns the certificate parts. * - * @return array the certificate parts. + * @return array the certificate parts * * @throws CertificateLocatorException */ @@ -34,21 +34,18 @@ public function getCertificate(): string; /** * Returns the absolute path to the certificate. * - * @deprecated Use self::getCertificate() to get the certificate and store it in a temporary file if needed. + * @deprecated use self::getCertificate() to get the certificate and store it in a temporary file if needed * - * @return string the absolute path to the certificate. + * @return string the absolute path to the certificate * * @throws CertificateLocatorException */ public function getAbsolutePathToCertificate(): string; - /** - * @return string - */ public function getPassphrase(): string; /** - * @return bool true if passphrase is present else false. + * @return bool true if passphrase is present else false */ public function hasPassphrase(): bool; } diff --git a/src/Certificate/Exception/AzureKeyVaultCertificateLocatorException.php b/src/Certificate/Exception/AzureKeyVaultCertificateLocatorException.php index 48685281..60fe44c7 100644 --- a/src/Certificate/Exception/AzureKeyVaultCertificateLocatorException.php +++ b/src/Certificate/Exception/AzureKeyVaultCertificateLocatorException.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Certificate\Exception; /** - * Class AzureKeyVaultCertificateLocatorException + * Class AzureKeyVaultCertificateLocatorException. * * Exception cast by the AzureKeyVaultCertificateLocator class when errors occurs. */ diff --git a/src/Certificate/Exception/CertificateLocatorException.php b/src/Certificate/Exception/CertificateLocatorException.php index c4d364a5..d89e3bcd 100644 --- a/src/Certificate/Exception/CertificateLocatorException.php +++ b/src/Certificate/Exception/CertificateLocatorException.php @@ -13,11 +13,11 @@ use Exception; /** - * Class CertificateLocatorException + * Class CertificateLocatorException. * * General exception meant to be casted by implementors of this interface when errors occurs. * Usually it is extended by more specific exceptions. */ -class CertificateLocatorException extends Exception +class CertificateLocatorException extends \Exception { } diff --git a/src/Certificate/Exception/FilesystemCertificateLocatorException.php b/src/Certificate/Exception/FilesystemCertificateLocatorException.php index a44be730..62f56c21 100644 --- a/src/Certificate/Exception/FilesystemCertificateLocatorException.php +++ b/src/Certificate/Exception/FilesystemCertificateLocatorException.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Certificate\Exception; /** - * Class FilesystemCertificateLocatorException + * Class FilesystemCertificateLocatorException. * * Exception cast by the FilesystemCertificateLocator class when errors occurs. */ diff --git a/src/Certificate/FilesystemCertificateLocator.php b/src/Certificate/FilesystemCertificateLocator.php index ea3ece97..b28bd0eb 100644 --- a/src/Certificate/FilesystemCertificateLocator.php +++ b/src/Certificate/FilesystemCertificateLocator.php @@ -10,11 +10,10 @@ namespace ItkDev\Serviceplatformen\Certificate; -use InvalidArgumentException; use ItkDev\Serviceplatformen\Certificate\Exception\CertificateLocatorException; /** - * Class FilesystemCertificateLocator + * Class FilesystemCertificateLocator. */ class FilesystemCertificateLocator extends AbstractCertificateLocator implements CertificateLocatorInterface { @@ -23,10 +22,9 @@ class FilesystemCertificateLocator extends AbstractCertificateLocator implements /** * FilesystemCertificateLocator constructor. * - * @param string $pathToCertificate the absolute path to the certificate. - * @param string $passphrase + * @param string $pathToCertificate the absolute path to the certificate * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct(string $pathToCertificate, string $passphrase = '') { @@ -35,42 +33,33 @@ public function __construct(string $pathToCertificate, string $passphrase = '') } /** - * @param string $pathToCertificate the absolute path to the certificate. + * @param string $pathToCertificate the absolute path to the certificate * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException */ private function setPathToCertificate(string $pathToCertificate) { if (realpath($pathToCertificate) !== $pathToCertificate) { - throw new InvalidArgumentException('The provided path is not absolute.'); + throw new \InvalidArgumentException('The provided path is not absolute.'); } if (!is_file($pathToCertificate)) { - throw new InvalidArgumentException('No file exist at the provided path!'); + throw new \InvalidArgumentException('No file exist at the provided path!'); } $this->pathToCertificate = $pathToCertificate; } - /** - * @return string - */ public function getCertificate(): string { return file_get_contents($this->pathToCertificate); } - /** - * {@inheritDoc} - */ public function getAbsolutePathToCertificate(): string { return $this->pathToCertificate; } - /** - * {@inheritdoc} - */ public function getCertificates(): array { $certificateStoreData = []; @@ -86,13 +75,10 @@ public function getCertificates(): array return $certificateStoreData; } - /** - * {@inheritdoc} - */ public function jsonSerialize(): mixed { return parent::jsonSerialize() + [ - 'pathToCertificate' => $this->pathToCertificate, - ]; + 'pathToCertificate' => $this->pathToCertificate, + ]; } } diff --git a/src/Command/SF1500/AbstractSF1500Command.php b/src/Command/SF1500/AbstractSF1500Command.php index a6aa7483..8a1bfc7e 100644 --- a/src/Command/SF1500/AbstractSF1500Command.php +++ b/src/Command/SF1500/AbstractSF1500Command.php @@ -22,18 +22,16 @@ use ItkDev\Serviceplatformen\Service\SF1500\BrugerService; use ItkDev\Serviceplatformen\Service\SF1500\PersonService; use ItkDev\Serviceplatformen\Service\SF1500\SF1500; -use ItkDev\Serviceplatformen\Service\SF1500\SF1500XMLBuilder; use ItkDev\Serviceplatformen\Service\SF1514\SF1514; use ItkDev\Serviceplatformen\Service\SoapClient; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\InvalidOptionException; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\PropertyAccess\PropertyAccessor; class AbstractSF1500Command extends Command { - const SF1500_SERVICE_ENDPOINT = 'http://stoettesystemerne.dk/service/organisation/3'; + public const SF1500_SERVICE_ENDPOINT = 'http://stoettesystemerne.dk/service/organisation/3'; protected array $inputOptions = []; protected function buildInputOptions(array $definition): array @@ -50,7 +48,9 @@ protected function buildInputOptions(array $definition): array /** * @template T of SF1500 + * * @param class-string $className + * * @return T */ protected function getService(string $className, array $options): SF1500 @@ -135,6 +135,7 @@ protected function getCertificateLocator(string $spec, string $passphrase): Cert if (null === $certificatepath) { throw new InvalidOptionException(sprintf('Invalid path %s', $spec)); } + return new FilesystemCertificateLocator($certificatepath, $passphrase); } } diff --git a/src/Command/SF1500/SF1500LookupCommand.php b/src/Command/SF1500/SF1500LookupCommand.php index 1ca7bb01..beafd05f 100644 --- a/src/Command/SF1500/SF1500LookupCommand.php +++ b/src/Command/SF1500/SF1500LookupCommand.php @@ -121,12 +121,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $organisationFunktionsId = $managerInfo['funktionsId']; $this->outputData($output, $sf1500, $userId, [$organisationFunktionsId]); - $count++; + ++$count; } return static::SUCCESS; } else { $output->writeln(sprintf('Cannot find a manager for: %s', $name)); + return static::SUCCESS; } } @@ -135,6 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (empty($organisationFunktionsIds)) { $output->writeln('Cannot find any organisation funktion(ansættelse) for provided user id.'); + return static::SUCCESS; } @@ -145,29 +147,28 @@ protected function execute(InputInterface $input, OutputInterface $output) private function outputData(OutputInterface $output, SF1500 $sf1500, string $userId, array $funktiondIds) { - $output->writeln('Name: '. $sf1500->getPersonName($userId)); - $output->writeln('Phone: '. $sf1500->getPersonPhone($userId)); - $output->writeln('Email: '. $sf1500->getPersonEmail($userId)); - $output->writeln('Az: '. $sf1500->getPersonAZIdent($userId)); - $output->writeln('Location: '. $sf1500->getPersonLocation($userId)); + $output->writeln('Name: '.$sf1500->getPersonName($userId)); + $output->writeln('Phone: '.$sf1500->getPersonPhone($userId)); + $output->writeln('Email: '.$sf1500->getPersonEmail($userId)); + $output->writeln('Az: '.$sf1500->getPersonAZIdent($userId)); + $output->writeln('Location: '.$sf1500->getPersonLocation($userId)); $count = 1; foreach ($funktiondIds as $funktionsId) { $output->writeln(sprintf('Printing data for organisation funktion %s', $count)); $this->outputFunktionsData($output, $sf1500, $funktionsId); - $count++; + ++$count; } } - private function outputFunktionsData(OutputInterface $output, SF1500 $sf1500, string $funktionsId) { - $output->writeln('Organisation funktion: '. $funktionsId); - $output->writeln('Organisation funktions navn: '. $sf1500->getFunktionsNavn($funktionsId)); - $output->writeln('Organisations enhed: '. $sf1500->getOrganisationEnhed($funktionsId)); - $output->writeln('Organisations adresse: '. $sf1500->getOrganisationAddress($funktionsId)); - $output->writeln('Organisations enhed niveau 2: '. $sf1500->getOrganisationEnhedNiveauTo($funktionsId)); - $output->writeln('Magistrat: '. $sf1500->getPersonMagistrat($funktionsId)); + $output->writeln('Organisation funktion: '.$funktionsId); + $output->writeln('Organisation funktions navn: '.$sf1500->getFunktionsNavn($funktionsId)); + $output->writeln('Organisations enhed: '.$sf1500->getOrganisationEnhed($funktionsId)); + $output->writeln('Organisations adresse: '.$sf1500->getOrganisationAddress($funktionsId)); + $output->writeln('Organisations enhed niveau 2: '.$sf1500->getOrganisationEnhedNiveauTo($funktionsId)); + $output->writeln('Magistrat: '.$sf1500->getPersonMagistrat($funktionsId)); } protected function configureOptions(OptionsResolver $resolver): OptionsResolver diff --git a/src/Command/SF1500/SF1500ReadCommand.php b/src/Command/SF1500/SF1500ReadCommand.php index 5abd8a05..bf37fabf 100644 --- a/src/Command/SF1500/SF1500ReadCommand.php +++ b/src/Command/SF1500/SF1500ReadCommand.php @@ -104,12 +104,12 @@ private function doRead(string $type, string $id, array $options): ?AbstractMode switch ($type) { case 'adresse': - return ($this->getAdresseService($options))->laes($id, $fields); + return $this->getAdresseService($options)->laes($id, $fields); case 'person': - return ($this->getPersonService($options))->laes($id, $fields); + return $this->getPersonService($options)->laes($id, $fields); case 'user': case 'bruger': - return ($this->getBrugerService($options))->laes($id, $fields); + return $this->getBrugerService($options)->laes($id, $fields); } throw new RuntimeException(sprintf('invalid search type: %s', $type)); diff --git a/src/Command/SF1500/SF1500SearchCommand.php b/src/Command/SF1500/SF1500SearchCommand.php index 3157d321..5d671387 100644 --- a/src/Command/SF1500/SF1500SearchCommand.php +++ b/src/Command/SF1500/SF1500SearchCommand.php @@ -122,12 +122,12 @@ private function doSearch(string $type, array $query, array $options): array switch ($type) { case 'adresse': - return ($this->getAdresseService($options))->soeg($query, $fields); + return $this->getAdresseService($options)->soeg($query, $fields); case 'person': - return ($this->getPersonService($options))->soeg($query, $fields); + return $this->getPersonService($options)->soeg($query, $fields); case 'user': case 'bruger': - return ($this->getBrugerService($options))->soeg($query, $fields); + return $this->getBrugerService($options)->soeg($query, $fields); } throw new RuntimeException(sprintf('invalid search type: %s', $type)); diff --git a/src/Command/SF1601/AbstractCommand.php b/src/Command/SF1601/AbstractCommand.php index 34cf0a1c..558a9e31 100644 --- a/src/Command/SF1601/AbstractCommand.php +++ b/src/Command/SF1601/AbstractCommand.php @@ -75,6 +75,7 @@ protected function getCertificateLocator(string $spec, string $passphrase): Cert if (null === $certificatepath) { throw new InvalidOptionException(sprintf('Invalid path %s', $spec)); } + return new FilesystemCertificateLocator($certificatepath, $passphrase); } } @@ -121,7 +122,6 @@ protected function configureOptions(OptionsResolver $resolver): OptionsResolver ; } - protected function getOptionsDetails(OptionsResolver $resolver, string $indent = '') { $lines = []; diff --git a/src/Command/SF1601/KombiPostAfsendCommand.php b/src/Command/SF1601/KombiPostAfsendCommand.php index 810aace1..40268b00 100644 --- a/src/Command/SF1601/KombiPostAfsendCommand.php +++ b/src/Command/SF1601/KombiPostAfsendCommand.php @@ -74,8 +74,8 @@ protected function configure() new InputOption('certificate-passphrase', null, InputOption::VALUE_REQUIRED, 'certificate passphrase', ''), new InputOption('file', null, InputOption::VALUE_REQUIRED, 'file to send'), new InputOption('memo', null, InputOption::VALUE_REQUIRED, 'memo document to send'), - new InputOption('attachment', null, InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'attachment'), - new InputOption('action', null, InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'action (see help for details)'), + new InputOption('attachment', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'attachment'), + new InputOption('action', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'action (see help for details)'), ]; $this->setDefinition(new InputDefinition($inputOptions)); @@ -190,11 +190,7 @@ private function buildAction(string $spec): Action try { $options = $resolver->resolve($options); } catch (ExceptionInterface $exception) { - throw new InvalidOptionException(sprintf( - 'Invalid action %s: %s', - json_encode($spec), - $exception->getMessage() - )); + throw new InvalidOptionException(sprintf('Invalid action %s: %s', json_encode($spec), $exception->getMessage())); } $this->debug(var_export(['action options' => $options], true)); @@ -265,6 +261,7 @@ private function getCertificateLocator(string $spec, string $passphrase): Certif if (null === $certificatepath) { throw new InvalidOptionException(sprintf('Invalid path %s', $spec)); } + return new FilesystemCertificateLocator($certificatepath, $passphrase); } } @@ -289,7 +286,7 @@ private function configureOptions(OptionsResolver $resolver) 'action' => null, 'certificate-passphrase' => '', ]) - ->setNormalizer('production', static fn (Options $options, $value) => (bool)$value) + ->setNormalizer('production', static fn (Options $options, $value) => (bool) $value) ->setNormalizer('file', static function (Options $options, $value) { if (null === $value xor null === $options['memo']) { return $value; @@ -361,7 +358,7 @@ private function buildMessage(array $options): Message ->setEncodingFormat($mimeTypes->guessMimeType($filename)) ->setLanguage('da') ->setFilename(basename($filename)) - ->setContent(file_get_contents($filename)) + ->setContent(file_get_contents($filename)), ]); if ($options['action']) { @@ -378,13 +375,13 @@ private function buildMessage(array $options): Message if (!empty($options['attachment'])) { foreach ($options['attachment'] as $index => $filename) { $additionalDocument = (new AdditionalDocument()) - ->setLabel(sprintf('Attachment %d', $index+1)) + ->setLabel(sprintf('Attachment %d', $index + 1)) ->setFile([ (new File()) ->setEncodingFormat($mimeTypes->guessMimeType($filename)) ->setLanguage('da') ->setFilename(basename($filename)) - ->setContent(file_get_contents($filename)) + ->setContent(file_get_contents($filename)), ]); $body->addToAdditionalDocument($additionalDocument); } @@ -423,10 +420,7 @@ private function getActionOptionsResolver(): OptionsResolver }) ->setNormalizer('entrypoint', static function (Options $options, $value) { if (null === $value && SF1601::ACTION_AFTALE !== $options['action']) { - throw new InvalidOptionsException(sprintf( - 'Action entrypoint is required for all actions but %s', - SF1601::ACTION_AFTALE - )); + throw new InvalidOptionsException(sprintf('Action entrypoint is required for all actions but %s', SF1601::ACTION_AFTALE)); } return $value; diff --git a/src/Command/SF1601/PostForespoergCommand.php b/src/Command/SF1601/PostForespoergCommand.php index 03c81a33..daddfb9a 100644 --- a/src/Command/SF1601/PostForespoergCommand.php +++ b/src/Command/SF1601/PostForespoergCommand.php @@ -32,7 +32,7 @@ protected function configure() new InputOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate or a query string with Azure Key Vault information (see help for details)'), new InputOption('certificate-passphrase', null, InputOption::VALUE_REQUIRED, 'certificate passphrase', ''), new InputOption('type', null, InputOption::VALUE_REQUIRED, 'type', 'digitalpost'), - new InputArgument('identifier', InputArgument::REQUIRED|InputArgument::IS_ARRAY, 'identifier'), + new InputArgument('identifier', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'identifier'), ]; $this->setDefinition(new InputDefinition($definition)); @@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->definitionList( ['identifier' => $identifier], - ['result' => json_encode($result, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE)] + ['result' => json_encode($result, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)] ); } diff --git a/src/DigitalPost/DigitalPost.php b/src/DigitalPost/DigitalPost.php index 339820b2..90c66658 100644 --- a/src/DigitalPost/DigitalPost.php +++ b/src/DigitalPost/DigitalPost.php @@ -42,12 +42,10 @@ abstract class DigitalPost /** * The client. - * - * @var ClientInterface */ private ClientInterface $guzzleClient; - public function __construct(ClientInterface $client = null) + public function __construct(?ClientInterface $client = null) { $this->guzzleClient = $client ?? new Client(); } @@ -58,24 +56,24 @@ public function __construct(ClientInterface $client = null) protected function afsendBrevPerson( string $kanalValg, string $prioritet, - string $cprNummerIdentifikator = null, - string $personName = null, - string $coNavn = null, - string $streetName = null, - string $streetBuildingIdentifier = null, - string $floorIdentifier = null, - string $suiteIdentifier = null, - string $mailDeliverySublocationIdentifier = null, - string $postCodeIdentifier = null, - string $districtSubdivisionIdentifier = null, - int $postOfficeBoxIdentifier = null, - string $countryIdentificationCode = null, - string $filFormatNavn = null, - string $meddelelseIndholdData = null, - string $titelTekst = null, - string $brevDato = null, - BilagSamlingType $bilagSamling = null - ): array { + ?string $cprNummerIdentifikator = null, + ?string $personName = null, + ?string $coNavn = null, + ?string $streetName = null, + ?string $streetBuildingIdentifier = null, + ?string $floorIdentifier = null, + ?string $suiteIdentifier = null, + ?string $mailDeliverySublocationIdentifier = null, + ?string $postCodeIdentifier = null, + ?string $districtSubdivisionIdentifier = null, + ?int $postOfficeBoxIdentifier = null, + ?string $countryIdentificationCode = null, + ?string $filFormatNavn = null, + ?string $meddelelseIndholdData = null, + ?string $titelTekst = null, + ?string $brevDato = null, + ?BilagSamlingType $bilagSamling = null, + ): array { if (!$this->acquireLock()) { $this->waitLock(); } @@ -174,13 +172,13 @@ protected function afsendBrevPerson( * Afsend digital post person. */ public function afsendDigitalPostPerson( - string $kanalValg = null, - string $prioritet = null, - string $cprNummerIdentifikator = null, - string $filFormatNavn = null, - string $meddelelseIndholdData = null, - string $titelTekst = null, - BilagSamlingType $bilagSamling = null + ?string $kanalValg = null, + ?string $prioritet = null, + ?string $cprNummerIdentifikator = null, + ?string $filFormatNavn = null, + ?string $meddelelseIndholdData = null, + ?string $titelTekst = null, + ?BilagSamlingType $bilagSamling = null, ): array { if (!$this->acquireLock()) { $this->waitLock(); @@ -260,24 +258,24 @@ public function afsendDigitalPostPerson( protected function afsendBrevCVR( string $kanalValg, string $prioritet, - string $cvrNummerIdentifikator = null, - string $personName = null, - string $coNavn = null, - string $streetName = null, - string $streetBuildingIdentifier = null, - string $floorIdentifier = null, - string $suiteIdentifier = null, - string $mailDeliverySublocationIdentifier = null, - string $postCodeIdentifier = null, - string $districtSubdivisionIdentifier = null, - int $postOfficeBoxIdentifier = null, - string $countryIdentificationCode = null, - string $filFormatNavn = null, - string $meddelelseIndholdData = null, - string $titelTekst = null, - string $brevDato = null, - BilagSamlingType $bilagSamling = null - ): array { + ?string $cvrNummerIdentifikator = null, + ?string $personName = null, + ?string $coNavn = null, + ?string $streetName = null, + ?string $streetBuildingIdentifier = null, + ?string $floorIdentifier = null, + ?string $suiteIdentifier = null, + ?string $mailDeliverySublocationIdentifier = null, + ?string $postCodeIdentifier = null, + ?string $districtSubdivisionIdentifier = null, + ?int $postOfficeBoxIdentifier = null, + ?string $countryIdentificationCode = null, + ?string $filFormatNavn = null, + ?string $meddelelseIndholdData = null, + ?string $titelTekst = null, + ?string $brevDato = null, + ?BilagSamlingType $bilagSamling = null, + ): array { if (!$this->acquireLock()) { $this->waitLock(); } @@ -391,7 +389,7 @@ private function getAzureKeyVaultCertificateLocator( string $clientSecret, string $keyVaultName, string $keyVaultSecret, - string $keyVaultSecretVersion + string $keyVaultSecretVersion, ): CertificateLocatorInterface { $httpClient = new GuzzleAdapter($this->guzzleClient); $requestFactory = new RequestFactory(); @@ -418,7 +416,6 @@ private function getAzureKeyVaultCertificateLocator( ); } - /** * Generate AfsendelsesIdentifikator. * @@ -433,9 +430,10 @@ private function generateAfsendelseIdentifikator(): string if (strlen($serialNumber) > 21) { throw new \RuntimeException(sprintf('The digital post serial contains more the 21 characters: %s', $serialNumber)); } + return str_pad($this->serviceOptions['digital_post_system_id'], 6, '0', STR_PAD_LEFT) - . $this->serviceOptions['digital_post_afsender_system'] - . str_pad($serialNumber, 21, '0', STR_PAD_LEFT); + .$this->serviceOptions['digital_post_afsender_system'] + .str_pad($serialNumber, 21, '0', STR_PAD_LEFT); } protected function generateNextSerialNumber(): string diff --git a/src/Request/InvocationContextRequestGenerator.php b/src/Request/InvocationContextRequestGenerator.php index 9424a4ca..56b683b0 100644 --- a/src/Request/InvocationContextRequestGenerator.php +++ b/src/Request/InvocationContextRequestGenerator.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Request; /** - * Class InvocationContextRequestGenerator + * Class InvocationContextRequestGenerator. */ class InvocationContextRequestGenerator implements RequestGeneratorInterface { @@ -23,10 +23,10 @@ class InvocationContextRequestGenerator implements RequestGeneratorInterface /** * InvocationContextRequestGenerator constructor. * - * @param string $serviceAgreementUuid the uuid of the service agreement. - * @param string $userSystemUuid the uuid of the user system. - * @param string $serviceUuid the uuid of the called service. - * @param string $userUuid the uuid of the user, usually the uuid of the calling municipality. + * @param string $serviceAgreementUuid the uuid of the service agreement + * @param string $userSystemUuid the uuid of the user system + * @param string $serviceUuid the uuid of the called service + * @param string $userUuid the uuid of the user, usually the uuid of the calling municipality */ public function __construct(string $serviceAgreementUuid, string $userSystemUuid, string $serviceUuid, string $userUuid) { @@ -36,9 +36,6 @@ public function __construct(string $serviceAgreementUuid, string $userSystemUuid $this->userUuid = $userUuid; } - /** - * {@inheritDoc} - */ public function makeRequest(array $message): array { $context = [ diff --git a/src/Request/RequestGeneratorInterface.php b/src/Request/RequestGeneratorInterface.php index c1e5589f..a6fcc48d 100644 --- a/src/Request/RequestGeneratorInterface.php +++ b/src/Request/RequestGeneratorInterface.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Request; /** - * Interface RequestGeneratorInterface + * Interface RequestGeneratorInterface. */ interface RequestGeneratorInterface { diff --git a/src/Service/AbstractRESTService.php b/src/Service/AbstractRESTService.php index 728c7d07..f36a8880 100644 --- a/src/Service/AbstractRESTService.php +++ b/src/Service/AbstractRESTService.php @@ -10,8 +10,6 @@ namespace ItkDev\Serviceplatformen\Service; -use DateTimeImmutable; -use DateTimeInterface; use ItkDev\Serviceplatformen\Certificate\CertificateLocatorInterface; use ItkDev\Serviceplatformen\Service\Exception\ServiceException; use ItkDev\Serviceplatformen\Service\SF1601\Serializer; @@ -51,17 +49,12 @@ protected function getOption(string $name) public function isTestMode(): bool { - return (bool)$this->options['test_mode']; + return (bool) $this->options['test_mode']; } /** * Call a REST service endpoint. * - * @param string $entityId - * @param string $method - * @param string $url - * @param array $options - * @return ResponseInterface * @throws ServiceException */ protected function call(string $entityId, string $method, string $url, array $options): ResponseInterface @@ -76,13 +69,13 @@ protected function call(string $entityId, string $method, string $url, array $op $transactionId = $options['transactionId']; unset($options['transactionId']); - $transactionTid = $options['transactionTid'] ?? new DateTimeImmutable(); - if ($transactionTid instanceof DateTimeInterface) { + $transactionTid = $options['transactionTid'] ?? new \DateTimeImmutable(); + if ($transactionTid instanceof \DateTimeInterface) { $transactionTid = Serializer::formatDateTimeZulu($transactionTid); } unset($options['transactionTid']); - $headers = (isset($options['headers']) && is_array($options['headers'])) ? $options['headers'] : []; + $headers = (isset($options['headers']) && is_array($options['headers'])) ? $options['headers'] : []; unset($options['headers']); return $this->request( @@ -90,12 +83,12 @@ protected function call(string $entityId, string $method, string $url, array $op $url, [ 'headers' => [ - 'Authorization' => sprintf('%s %s', $accessToken['token_type'], $accessToken['access_token']), - 'x-TransaktionsId' => $transactionId, - 'x-TransaktionsTid' => $transactionTid, - ] + $headers, + 'Authorization' => sprintf('%s %s', $accessToken['token_type'], $accessToken['access_token']), + 'x-TransaktionsId' => $transactionId, + 'x-TransaktionsTid' => $transactionTid, + ] + $headers, ] - +$options + + $options ); } @@ -121,28 +114,26 @@ private function request(string $method, string $url, array $options): ResponseI file_put_contents($privateKeyFilename, $this->getPrivateKey()); return $this->client()->request($method, $url, $options + [ - 'local_cert' => $certificateFilename, - 'local_pk' => $privateKeyFilename, - 'on_progress' => function (int $dlNow, int $dlSize, array $info) use (&$certificateFilename, &$privateKeyFilename): void { - // Delete temporary certificate files when receiving response headers. - if (!empty($info['response_headers'])) { - if (isset($certificateFilename) && file_exists($certificateFilename)) { - unlink($certificateFilename); - $certificateFilename = null; - } - if (isset($privateKeyFilename) && file_exists($privateKeyFilename)) { - unlink($privateKeyFilename); - $privateKeyFilename = null; - } + 'local_cert' => $certificateFilename, + 'local_pk' => $privateKeyFilename, + 'on_progress' => function (int $dlNow, int $dlSize, array $info) use (&$certificateFilename, &$privateKeyFilename): void { + // Delete temporary certificate files when receiving response headers. + if (!empty($info['response_headers'])) { + if (isset($certificateFilename) && file_exists($certificateFilename)) { + unlink($certificateFilename); + $certificateFilename = null; } - }, - ]); + if (isset($privateKeyFilename) && file_exists($privateKeyFilename)) { + unlink($privateKeyFilename); + $privateKeyFilename = null; + } + } + }, + ]); } /** * Get SAML token. - * - * @return string */ private function getSAMLToken(string $entityId): string { @@ -169,6 +160,7 @@ private function getSAMLToken(string $entityId): string if (null !== $token && $this->getSAMLTokenExpirationTime($token)->modify($expirationTimeOffset) <= new \DateTimeImmutable()) { // Remove expired token from cache and get a new token. $cache->delete($cacheKey); + return $this->getSAMLToken($entityId); } @@ -185,7 +177,7 @@ private function getCacheKey(string $key, array $payload): string return preg_replace( '#[{}()/\\\\@:]+#', '_', - $key . '|' . sha1(json_encode($payload+$this->options)) + $key.'|'.sha1(json_encode($payload + $this->options)) ); } @@ -199,13 +191,12 @@ private function getSAMLTokenExpirationTime(string $token): \DateTimeImmutable } $notOnOrAfter = reset($nodes); - return new \DateTimeImmutable((string)$notOnOrAfter); + return new \DateTimeImmutable((string) $notOnOrAfter); } /** * Fetch SAML token. * - * @return string * @throws ServiceException * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface @@ -228,7 +219,7 @@ private function fetchSAMLToken(string $entityId): string 'AnvenderKontekst' => ['Cvr' => $this->options['authority_cvr']], 'UseKey' => $useKey, 'AppliesTo' => ['EndpointReference' => ['Address' => $entityId]], - 'OnBehalfOf' => null + 'OnBehalfOf' => null, ]; $response = $this->request('POST', $this->options['saml_token_svc'], [ diff --git a/src/Service/AbstractService.php b/src/Service/AbstractService.php index 2c921006..72995362 100644 --- a/src/Service/AbstractService.php +++ b/src/Service/AbstractService.php @@ -13,11 +13,10 @@ use ItkDev\Serviceplatformen\Certificate\CertificateLocatorInterface; use ItkDev\Serviceplatformen\Request\RequestGeneratorInterface; use ItkDev\Serviceplatformen\Service\Exception\ServiceException; -use SoapClient; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * Class AbstractService + * Class AbstractService. */ abstract class AbstractService { @@ -26,9 +25,6 @@ abstract class AbstractService /** * AbstractService constructor. - * - * @param array $soapClientOptions - * @param RequestGeneratorInterface $requestGenerator */ public function __construct(array $soapClientOptions, RequestGeneratorInterface $requestGenerator) { @@ -39,12 +35,12 @@ public function __construct(array $soapClientOptions, RequestGeneratorInterface /** * Performs a call to the provided operation with the message in the right context. * - * @param string $operation the operation on the service to call. - * @param array $message the message to be passed to the operation. + * @param string $operation the operation on the service to call + * @param array $message the message to be passed to the operation * - * @return object the raw response. + * @return object the raw response * - * @throws ServiceException is thrown on SoapFaults. + * @throws ServiceException is thrown on SoapFaults */ public function makeCall(string $operation, array $message): object { @@ -56,10 +52,10 @@ public function makeCall(string $operation, array $message): object $localCertFilename = tempnam(sys_get_temp_dir(), 'cert'); file_put_contents($localCertFilename, $certificateLocator->getCertificate()); - $soapClient = new SoapClient($wsdl, $this->soapClientOptions['options'] + $soapClient = new \SoapClient($wsdl, $this->soapClientOptions['options'] + [ 'local_cert' => $localCertFilename, - 'passphrase' => $certificateLocator->getPassphrase() + 'passphrase' => $certificateLocator->getPassphrase(), ]); try { diff --git a/src/Service/Exception/InvalidArgumentException.php b/src/Service/Exception/InvalidArgumentException.php index 4e41637e..ce9017ef 100644 --- a/src/Service/Exception/InvalidArgumentException.php +++ b/src/Service/Exception/InvalidArgumentException.php @@ -11,9 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class InvalidArgumentException - * - * @package ItkDev\Serviceplatformen\Service\Exception + * Class InvalidArgumentException. */ class InvalidArgumentException extends ServiceException { diff --git a/src/Service/Exception/InvalidQueryException.php b/src/Service/Exception/InvalidQueryException.php index af4e606e..34a4a3b9 100644 --- a/src/Service/Exception/InvalidQueryException.php +++ b/src/Service/Exception/InvalidQueryException.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class InvalidFilterException + * Class InvalidFilterException. * * Exception cast when specifying an invalid filter. */ diff --git a/src/Service/Exception/NoCvrFoundException.php b/src/Service/Exception/NoCvrFoundException.php index 52f5cb13..7f9b50b3 100644 --- a/src/Service/Exception/NoCvrFoundException.php +++ b/src/Service/Exception/NoCvrFoundException.php @@ -11,9 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class NoCvrFoundException - * - * @package ItkDev\Serviceplatformen\Service\Exception + * Class NoCvrFoundException. */ class NoCvrFoundException extends ServiceException { diff --git a/src/Service/Exception/NoPnrFoundException.php b/src/Service/Exception/NoPnrFoundException.php index cb89c836..54a919f9 100644 --- a/src/Service/Exception/NoPnrFoundException.php +++ b/src/Service/Exception/NoPnrFoundException.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class NoPnrFoundException + * Class NoPnrFoundException. * * Exception cast when performing a call to the PersonBaseDataExtended service with an unknown PNR. */ diff --git a/src/Service/Exception/SAMLTokenException.php b/src/Service/Exception/SAMLTokenException.php index e309d46a..e3aee59d 100644 --- a/src/Service/Exception/SAMLTokenException.php +++ b/src/Service/Exception/SAMLTokenException.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class SAMLTokenException + * Class SAMLTokenException. * * Exception cast when failing to fetch SAML token from SF1514. */ diff --git a/src/Service/Exception/SF1500Exception.php b/src/Service/Exception/SF1500Exception.php index a4ee6a4b..6a3846e3 100644 --- a/src/Service/Exception/SF1500Exception.php +++ b/src/Service/Exception/SF1500Exception.php @@ -11,7 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class SAMLTokenException + * Class SAMLTokenException. * * Exception cast when failing to fetch SAML token from SF1514. */ diff --git a/src/Service/Exception/ServiceException.php b/src/Service/Exception/ServiceException.php index 6d214e14..0cdf9ee2 100644 --- a/src/Service/Exception/ServiceException.php +++ b/src/Service/Exception/ServiceException.php @@ -13,10 +13,10 @@ use Exception; /** - * Class ServiceException + * Class ServiceException. * * Generic exception cast when an error occurs on a service call. */ -class ServiceException extends Exception +class ServiceException extends \Exception { } diff --git a/src/Service/Exception/SoapException.php b/src/Service/Exception/SoapException.php index 51813cd0..cb85887d 100644 --- a/src/Service/Exception/SoapException.php +++ b/src/Service/Exception/SoapException.php @@ -11,9 +11,7 @@ namespace ItkDev\Serviceplatformen\Service\Exception; /** - * Class SoapException - * - * @package ItkDev\Serviceplatformen\Service\Exception + * Class SoapException. */ class SoapException extends ServiceException { diff --git a/src/Service/OnlineService.php b/src/Service/OnlineService.php index d8254182..bd5b8392 100644 --- a/src/Service/OnlineService.php +++ b/src/Service/OnlineService.php @@ -14,7 +14,7 @@ use ItkDev\Serviceplatformen\Service\Exception\ServiceException; /** - * Class OnlineService + * Class OnlineService. */ class OnlineService extends AbstractService { @@ -22,18 +22,18 @@ class OnlineService extends AbstractService * Performs a call to the getLegalUnit operation on the Online Service. * Returns the response in raw object form. * - * @param string $cvr The CVR number to look up. + * @param string $cvr the CVR number to look up * - * @return object the raw response in object form. + * @return object the raw response in object form * * @throws ServiceException */ public function getLegalUnit(string $cvr) { $request = [ - 'GetLegalUnitRequest' => [ - 'LegalUnitIdentifier' => $cvr, - ], + 'GetLegalUnitRequest' => [ + 'LegalUnitIdentifier' => $cvr, + ], ]; try { @@ -47,13 +47,13 @@ public function getLegalUnit(string $cvr) * Returns specific exception based on the generic ServiceException. * If no specific exception can be determined, the original exception will be returned. * - * @param ServiceException $exception the exception to determine. + * @param ServiceException $exception the exception to determine * - * @return ServiceException the specific exception or the original exception if no specific could be determined. + * @return ServiceException the specific exception or the original exception if no specific could be determined */ private function handleException(ServiceException $exception) { - if (strpos($exception->getMessage(), "Required property '/virksomhed/CVRNummer' missing.") !== false) { + if (false !== strpos($exception->getMessage(), "Required property '/virksomhed/CVRNummer' missing.")) { return new NoCvrFoundException($exception->getMessage(), $exception->getCode()); } diff --git a/src/Service/PersonBaseDataExtendedService.php b/src/Service/PersonBaseDataExtendedService.php index 243f6bd5..89beb0f8 100644 --- a/src/Service/PersonBaseDataExtendedService.php +++ b/src/Service/PersonBaseDataExtendedService.php @@ -14,7 +14,7 @@ use ItkDev\Serviceplatformen\Service\Exception\ServiceException; /** - * Class PersonBaseDataExtendedService + * Class PersonBaseDataExtendedService. */ class PersonBaseDataExtendedService extends AbstractService { @@ -22,9 +22,9 @@ class PersonBaseDataExtendedService extends AbstractService * Performs a call to the personLookup operation on the PersonBaseDataExtended service. * Returns the response in raw object form. * - * @param string $pnr the person-number to lookup. + * @param string $pnr the person-number to lookup * - * @return object the raw response in object form. + * @return object the raw response in object form * * @throws ServiceException */ @@ -41,13 +41,13 @@ public function personLookup(string $pnr): object * Returns specific exception based on the generic ServiceException. * If no specific exception can be determined, the original exception will be returned. * - * @param ServiceException $exception the exception to determine. + * @param ServiceException $exception the exception to determine * - * @return ServiceException the specific exception or the original exception if no specific could be determined. + * @return ServiceException the specific exception or the original exception if no specific could be determined */ private function handleServiceException(ServiceException $exception): ServiceException { - if (strpos($exception->getMessage(), 'PNR not found') !== false) { + if (false !== strpos($exception->getMessage(), 'PNR not found')) { return new NoPnrFoundException($exception->getMessage(), $exception->getCode()); } diff --git a/src/Service/SF1500/AbstractService.php b/src/Service/SF1500/AbstractService.php index 6fc79dab..8e90e8a2 100644 --- a/src/Service/SF1500/AbstractService.php +++ b/src/Service/SF1500/AbstractService.php @@ -12,7 +12,6 @@ use ItkDev\Serviceplatformen\Service\Exception\InvalidQueryException; use ItkDev\Serviceplatformen\Service\SF1500\Model\AbstractModel; -use ItkDev\Serviceplatformen\SF1500\Person\StructType\FiltreretOejebliksbilledeType; /** * @template T of AbstractModel @@ -39,9 +38,6 @@ final public static function getPaginationParameters(): array */ abstract public static function getValidFilters(): array; - /** - * {@inheritdoc} - */ public function soeg(array $query, array $fields = []): array { $this->validateQuery($query); @@ -68,9 +64,6 @@ public function soeg(array $query, array $fields = []): array return $this->list($ids, $fields); } - /** - * {@inheritdoc} - */ public function list(array $ids, array $fields = []): array { $list = $this->doList($ids); @@ -85,9 +78,6 @@ public function list(array $ids, array $fields = []): array ); } - /** - * {@inheritdoc} - */ public function laes(string $id, array $fields = []): mixed { $data = $this->doLaes($id); @@ -109,11 +99,7 @@ protected function validateQuery(array $query) $validFilters = array_merge($this->getValidFilters(), self::getPaginationParameters()); $invalidFilters = array_values(array_diff($usedFilters, $validFilters)); if (!empty($invalidFilters)) { - throw new InvalidQueryException(sprintf( - 'Invalid filters: %s; Valid filters: %s.', - json_encode($invalidFilters), - json_encode($validFilters) - )); + throw new InvalidQueryException(sprintf('Invalid filters: %s; Valid filters: %s.', json_encode($invalidFilters), json_encode($validFilters))); } } diff --git a/src/Service/SF1500/AdresseService.php b/src/Service/SF1500/AdresseService.php index b9794f0e..52f40532 100644 --- a/src/Service/SF1500/AdresseService.php +++ b/src/Service/SF1500/AdresseService.php @@ -29,9 +29,6 @@ final class AdresseService extends AbstractService { public const FILTER_ADRESSETEKST = 'adressetekst'; - /** - * {@inheritdoc} - */ public static function getValidFilters(): array { return [ @@ -39,9 +36,6 @@ public static function getValidFilters(): array ]; } - /** - * {@inheritdoc} - */ protected function doSoeg(array $query): ?SoegOutputType { $attributListe = new AttributListeType(); @@ -53,35 +47,26 @@ protected function doSoeg(array $query): ?SoegOutputType $relationListe = new RelationListeType(); $request = (new SoegInputType()) - ->setMaksimalAntalKvantitet((int)($query['limit'] ?? self::DEFAULT_LIMIT)) - ->setFoersteResultatReference((int)($query['offset'] ?? 0)) + ->setMaksimalAntalKvantitet((int) ($query['limit'] ?? self::DEFAULT_LIMIT)) + ->setFoersteResultatReference((int) ($query['offset'] ?? 0)) ->setAttributListe($attributListe) ->setRelationListe($relationListe); return $this->clientSoeg()->soeg($request) ?: null; } - /** - * {@inheritdoc} - */ protected function doList(array $ids): ?ListOutputType { return $this->clientList() ->_list(new ListInputType($ids)) ?: null; } - /** - * {@inheritdoc} - */ protected function doLaes(string $id): ?LaesOutputType { return $this->clientLaes() ->laes(new LaesInputType($id)) ?: null; } - /** - * {@inheritdoc} - */ protected function buildModel($oejebliksbillede): Adresse { assert($oejebliksbillede instanceof FiltreretOejebliksbilledeType); @@ -96,7 +81,6 @@ protected function buildModel($oejebliksbillede): Adresse return $model; } - private function clientSoeg(array $options = []): Soeg { $client = $this->getClient(Soeg::class, $options); diff --git a/src/Service/SF1500/BrugerService.php b/src/Service/SF1500/BrugerService.php index 41dacf6b..128e475e 100644 --- a/src/Service/SF1500/BrugerService.php +++ b/src/Service/SF1500/BrugerService.php @@ -37,9 +37,6 @@ final class BrugerService extends AbstractService public const FILTER_EMAIL = 'email'; public const FILTER_LEDER = 'leder'; - /** - * {@inheritdoc} - */ public static function getValidFilters(): array { return [ @@ -49,9 +46,6 @@ public static function getValidFilters(): array ]; } - /** - * {@inheritdoc} - */ public function list(array $ids, array $fields = []): array { $list = $this->doList($ids); @@ -98,9 +92,6 @@ public function list(array $ids, array $fields = []): array return $items; } - /** - * {@inheritdoc} - */ protected function doSoeg(array $query): ?SoegOutputType { $attributListe = new AttributListeType(); @@ -114,7 +105,7 @@ protected function doSoeg(array $query): ?SoegOutputType // TODO We cannot search by email yet } if (isset($query[self::FILTER_PERSON_ID])) { - $ids = (array)$query[self::FILTER_PERSON_ID]; + $ids = (array) $query[self::FILTER_PERSON_ID]; foreach ($ids as $id) { $relationListe->addToTilknyttedePersoner((new PersonFlerRelationType()) ->setReferenceID(new UnikIdType($id))); @@ -122,8 +113,8 @@ protected function doSoeg(array $query): ?SoegOutputType } $request = (new SoegInputType()) - ->setMaksimalAntalKvantitet((int)($query['limit'] ?? self::DEFAULT_LIMIT)) - ->setFoersteResultatReference((int)($query['offset'] ?? 0)) + ->setMaksimalAntalKvantitet((int) ($query['limit'] ?? self::DEFAULT_LIMIT)) + ->setFoersteResultatReference((int) ($query['offset'] ?? 0)) ->setAttributListe($attributListe) ->setRelationListe($relationListe); @@ -164,27 +155,18 @@ private function getManagerIds() ))); } - /** - * {@inheritdoc} - */ protected function doList(array $ids): ?ListOutputType { return $this->clientList() ->_list_1(new ListInputType($ids)) ?: null; } - /** - * {@inheritdoc} - */ protected function doLaes(string $id): ?LaesOutputType { return $this->clientLaes() ->laes(new LaesInputType($id)) ?: null; } - /** - * {@inheritdoc} - */ protected function buildModel($oejebliksbillede): Bruger { assert($oejebliksbillede instanceof FiltreretOejebliksbilledeType); diff --git a/src/Service/SF1500/Model/AbstractModel.php b/src/Service/SF1500/Model/AbstractModel.php index 16538059..f18e03b3 100644 --- a/src/Service/SF1500/Model/AbstractModel.php +++ b/src/Service/SF1500/Model/AbstractModel.php @@ -31,7 +31,6 @@ public function __construct(array $data) /** * All properties (apart from id) are nullable. * - * @param $name * @return mixed|null */ public function __get($name) diff --git a/src/Service/SF1500/Model/Bruger.php b/src/Service/SF1500/Model/Bruger.php index c11a6119..084b527d 100644 --- a/src/Service/SF1500/Model/Bruger.php +++ b/src/Service/SF1500/Model/Bruger.php @@ -33,7 +33,7 @@ public function __get($name) self::FIELD_EMAIL => $this->relations[self::RELATION_ADRESSE][Adresse::EMAIL] ?? null, self::FIELD_MOBILTELEFON => $this->relations[self::RELATION_ADRESSE][Adresse::MOBILTELEFON] ?? null, self::FIELD_LOKATION => $this->relations[self::RELATION_ADRESSE][Adresse::LOKATION] ?? null, - default => parent::__get($name) + default => parent::__get($name), }; } } diff --git a/src/Service/SF1500/Model/OrganisationFunktion.php b/src/Service/SF1500/Model/OrganisationFunktion.php index e280cc40..ea4fabad 100644 --- a/src/Service/SF1500/Model/OrganisationFunktion.php +++ b/src/Service/SF1500/Model/OrganisationFunktion.php @@ -11,8 +11,8 @@ namespace ItkDev\Serviceplatformen\Service\SF1500\Model; /** - * @property string $id - * @property string $funktionnavn + * @property string $id + * @property string $funktionnavn * @property string[] $tilknyttedeBrugere */ final class OrganisationFunktion extends AbstractModel diff --git a/src/Service/SF1500/OrganisationFunktionService.php b/src/Service/SF1500/OrganisationFunktionService.php index 1b9a39aa..6bf81358 100644 --- a/src/Service/SF1500/OrganisationFunktionService.php +++ b/src/Service/SF1500/OrganisationFunktionService.php @@ -33,9 +33,6 @@ final class OrganisationFunktionService extends AbstractService public const FILTER_FUNKTIONNAVN = 'funktionnavn'; public const FILTER_FUNKTIONSTYPEID = 'funktionstypeid'; - /** - * {@inheritdoc} - */ public static function getValidFilters(): array { return [ @@ -44,9 +41,6 @@ public static function getValidFilters(): array ]; } - /** - * {@inheritdoc} - */ protected function doSoeg(array $query): ?SoegOutputType { $attributListe = new AttributListeType(); @@ -58,40 +52,31 @@ protected function doSoeg(array $query): ?SoegOutputType $relationListe = new RelationListeType(); if (isset($query[self::FILTER_FUNKTIONSTYPEID])) { - $relationListe->setFunktionstype((new KlasseRelationType) + $relationListe->setFunktionstype((new KlasseRelationType()) ->setReferenceID(new UnikIdType($query[self::FILTER_FUNKTIONSTYPEID]))); } $request = (new SoegInputType()) - ->setMaksimalAntalKvantitet((int)($query['limit'] ?? self::DEFAULT_LIMIT)) - ->setFoersteResultatReference((int)($query['offset'] ?? 0)) + ->setMaksimalAntalKvantitet((int) ($query['limit'] ?? self::DEFAULT_LIMIT)) + ->setFoersteResultatReference((int) ($query['offset'] ?? 0)) ->setAttributListe($attributListe) ->setRelationListe($relationListe); return $this->clientSoeg()->soeg($request) ?: null; } - /** - * {@inheritdoc} - */ protected function doList(array $ids): ?ListOutputType { return $this->clientList() ->_list_10(new ListInputType($ids)) ?: null; } - /** - * {@inheritdoc} - */ protected function doLaes(string $id): ?LaesOutputType { return $this->clientLaes() ->laes(new LaesInputType($id)) ?: null; } - /** - * {@inheritdoc} - */ protected function buildModel($oejebliksbillede): OrganisationFunktion { assert($oejebliksbillede instanceof FiltreretOejebliksbilledeType); diff --git a/src/Service/SF1500/OrganisationService.php b/src/Service/SF1500/OrganisationService.php index 7dee044f..06c963d9 100644 --- a/src/Service/SF1500/OrganisationService.php +++ b/src/Service/SF1500/OrganisationService.php @@ -10,7 +10,6 @@ namespace ItkDev\Serviceplatformen\Service\SF1500; -use ItkDev\Serviceplatformen\Service\SF1500\Model\Bruger; use ItkDev\Serviceplatformen\Service\SF1500\Model\Organisation; use ItkDev\Serviceplatformen\SF1500\Organisation\ServiceType\_List; use ItkDev\Serviceplatformen\SF1500\Organisation\ServiceType\Laes; @@ -28,17 +27,11 @@ final class OrganisationService extends AbstractService { - /** - * {@inheritdoc} - */ public static function getValidFilters(): array { return []; } - /** - * {@inheritdoc} - */ protected function doSoeg(array $query): ?SoegOutputType { $attributListe = new AttributListeType(); @@ -50,35 +43,26 @@ protected function doSoeg(array $query): ?SoegOutputType $relationListe = new RelationListeType(); $request = (new SoegInputType()) - ->setMaksimalAntalKvantitet((int)($query['limit'] ?? self::DEFAULT_LIMIT)) - ->setFoersteResultatReference((int)($query['offset'] ?? 0)) + ->setMaksimalAntalKvantitet((int) ($query['limit'] ?? self::DEFAULT_LIMIT)) + ->setFoersteResultatReference((int) ($query['offset'] ?? 0)) ->setAttributListe($attributListe) ->setRelationListe($relationListe); return $this->clientSoeg()->soeg($request) ?: null; } - /** - * {@inheritdoc} - */ protected function doList(array $ids): ?ListOutputType { return $this->clientList() ->_list_8(new ListInputType($ids)) ?: null; } - /** - * {@inheritdoc} - */ protected function doLaes(string $id): ?LaesOutputType { return $this->clientLaes() ->laes(new LaesInputType($id)); } - /** - * {@inheritdoc} - */ protected function buildModel($oejebliksbillede): Organisation { assert($oejebliksbillede instanceof FiltreretOejebliksbilledeType); diff --git a/src/Service/SF1500/PersonService.php b/src/Service/SF1500/PersonService.php index 0873b37e..7c9bf41b 100644 --- a/src/Service/SF1500/PersonService.php +++ b/src/Service/SF1500/PersonService.php @@ -29,9 +29,6 @@ class PersonService extends AbstractService { public const FILTER_NAVNTEKST = 'navntekst'; - /** - * {@inheritdoc} - */ public static function getValidFilters(): array { return [ @@ -39,9 +36,6 @@ public static function getValidFilters(): array ]; } - /** - * {@inheritdoc} - */ protected function doSoeg(array $query): ?SoegOutputType { $attributListe = new AttributListeType(); @@ -53,35 +47,26 @@ protected function doSoeg(array $query): ?SoegOutputType $relationListe = new RelationListeType(); $request = (new SoegInputType()) - ->setMaksimalAntalKvantitet((int)($query['limit'] ?? 50)) - ->setFoersteResultatReference((int)($query['offset'] ?? 0)) + ->setMaksimalAntalKvantitet((int) ($query['limit'] ?? 50)) + ->setFoersteResultatReference((int) ($query['offset'] ?? 0)) ->setAttributListe($attributListe) ->setRelationListe($relationListe); return $this->clientSoeg()->soeg($request) ?: null; } - /** - * {@inheritdoc} - */ protected function doList(array $ids): ?ListOutputType { return $this->clientList() ->_list_11(new ListInputType($ids)) ?: null; } - /** - * {@inheritdoc} - */ protected function doLaes(string $id): ?LaesOutputType { return $this->clientLaes() ->laes(new LaesInputType($id)) ?: null; } - /** - * {@inheritdoc} - */ protected function buildModel($oejebliksbillede): Person { assert($oejebliksbillede instanceof FiltreretOejebliksbilledeType); diff --git a/src/Service/SF1500/SF1500.php b/src/Service/SF1500/SF1500.php index 84fcab5f..c60e5fb8 100644 --- a/src/Service/SF1500/SF1500.php +++ b/src/Service/SF1500/SF1500.php @@ -63,13 +63,11 @@ class SF1500 { /** * Client instances indexed by class name. - * @var array */ protected array $clients = []; /** * Service instances indexed by class name. - * @var array */ protected array $services = []; @@ -77,7 +75,7 @@ class SF1500 private SF1514 $sf1514; protected array $options; - private static bool|null $shutdownFunctionRegistered = null; + private static ?bool $shutdownFunctionRegistered = null; public function __construct(SF1514 $sf1514, array $options) { @@ -219,6 +217,7 @@ public function getOrganisationEnhed(string $funktionsId, bool $returnOrganisati public function getFunktionsNavn(string $funktionsId): string { $response = $this->organisationFunktionLaes($funktionsId); + return $response ->getFiltreretOejebliksbillede() ->getRegistrering()[0] @@ -254,6 +253,7 @@ public function getOrganisationEnhedNiveauTo(string $funktionsId): string } $response = $this->organisationEnhedLaes($orgEnhedId); + return $response ->getFiltreretOejebliksbillede() ->getRegistrering()[0] @@ -363,14 +363,15 @@ public function getEnhedNavnOgOverordnetOrganisationsId($organisationEnhedsId): } return [ - 'overordnet_id' => $overordnetId, - 'enhedNavn' => $enhedNavn, + 'overordnet_id' => $overordnetId, + 'enhedNavn' => $enhedNavn, ]; } /** * Fetches bruger and organisation funktions id for managers from user id. * Returns empty array if no manager exists. + * * @throws SF1500Exception|SAMLTokenException */ public function getManagerBrugerAndFunktionsIdFromUserId($userId, $managerFunktionsTypeId): array @@ -400,7 +401,8 @@ public function getManagerBrugerAndFunktionsIdFromUserId($userId, $managerFunkti /** * Fetches bruger and organisation funktions id for managers from funktions id. - * Returns empty array if no manager exists + * Returns empty array if no manager exists. + * * @throws SF1500Exception */ private function getManagerBrugerAndFunktionsIdFromFunktionsId($funktionsId, $managerFunktionsTypeId): array @@ -487,6 +489,7 @@ public function getBrugerIdFromOrganisationFunktion($organisationFunktionsId): s /** * Gets SAML token from SF1514. + * * @throws SAMLTokenException */ private function getSAMLToken(): string @@ -518,6 +521,7 @@ private function getCertificatePart(string $part): string private function brugerLaes($brugerId): BrugerLaesOutputType { $brugerLaesClient = $this->getClient(BrugerLaes::class); + return $brugerLaesClient->laes(new BrugerLaesInputType($brugerId)); } @@ -562,7 +566,7 @@ private function organisationFunktionSoeg(?string $brugerId, ?string $funktionsN $relationsListe = new OrganisationFunktionRelationListeType(); if (null !== $brugerId) { - $relationsListe->addToTilknyttedeBrugere((new OrganisationFunktionBrugerFlerRelationType) + $relationsListe->addToTilknyttedeBrugere((new OrganisationFunktionBrugerFlerRelationType()) ->setReferenceID(new OrganisationFunktionUnikIdType($brugerId))); } if (null !== $organisationsId) { @@ -571,7 +575,7 @@ private function organisationFunktionSoeg(?string $brugerId, ?string $funktionsN ->setReferenceID(new OrganisationFunktionUnikIdType($organisationsId))); } if (null !== $funktionsTypeId) { - $relationsListe->setFunktionstype((new OrganisationFunktionKlasseRelationType) + $relationsListe->setFunktionstype((new OrganisationFunktionKlasseRelationType()) ->setReferenceID(new OrganisationFunktionUnikIdType($funktionsTypeId))); } @@ -670,7 +674,6 @@ public function getSoapLocation(string $location): string return $soapLocation; } - private const NS_SOAP_ENVELOPE = 'http://www.w3.org/2003/05/soap-envelope'; private const NS_SAGDOK = 'urn:oio:sagdok:3.0.0'; private const STATUS_KODE_OK = '20'; @@ -680,7 +683,7 @@ public function formatSoapRequest( string $location, string $action, int $version, - bool $oneWay = false + bool $oneWay = false, ): string { $doc = Serializer::loadXML($request); @@ -706,7 +709,6 @@ public function formatSoapRequest( private static array $tokenXSLTProcessors = []; /** - * * @see https://bugs.php.net/bug.php?id=55294 */ private static function getTokenXSLTProcessor(string $token): \XSLTProcessor @@ -791,7 +793,7 @@ private function getSoapRequestCacheKey(string $key, array $payload): string return preg_replace( '#[{}()/\\\\@:]+#', '_', - $key . '|' . sha1(json_encode($payload+$this->options)) + $key.'|'.sha1(json_encode($payload + $this->options)) ); } @@ -811,7 +813,9 @@ public function getSoapRequestCacheExpirationDateTime(): ?\DateTimeImmutable /** * @template Service of ServiceInterface + * * @param class-string $className + * * @return Service */ public function getService(string $className): ServiceInterface @@ -825,7 +829,9 @@ public function getService(string $className): ServiceInterface /** * @template Client of SoapClientBase + * * @param class-string $className + * * @return Client */ public function getClient(string $className, array $options = []): SoapClientBase @@ -833,8 +839,8 @@ public function getClient(string $className, array $options = []): SoapClientBas if (!isset($this->clients[$className])) { [$wsdlUrl, $classMap] = $this->getSoapClientInfo($className); $this->clients[$className] = (new $className([ - SoapClientBase::WSDL_URL => $wsdlUrl, - SoapClientBase::WSDL_CLASSMAP => $classMap, + SoapClientBase::WSDL_URL => $wsdlUrl, + SoapClientBase::WSDL_CLASSMAP => $classMap, ] + $options)) ->setSF1500($this); } @@ -849,37 +855,37 @@ protected function getSoapClientInfo(string $className): array case AdresseList::class: case AdresseLaes::class: return [ - __DIR__ . '/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/Adresse.wsdl', - AdresseClassMap::get(), - ]; + __DIR__.'/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/Adresse.wsdl', + AdresseClassMap::get(), + ]; case BrugerSoeg::class: case BrugerList::class: case BrugerLaes::class: return [ - __DIR__ . '/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/Bruger.wsdl', - BrugerClassMap::get(), - ]; + __DIR__.'/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/Bruger.wsdl', + BrugerClassMap::get(), + ]; case OrganisationEnhedSoeg::class: case OrganisationEnhedList::class: case OrganisationEnhedLaes::class: return [ - __DIR__ . '/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/OrganisationEnhed.wsdl', - OrganisationEnhedClassMap::get(), - ]; + __DIR__.'/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/OrganisationEnhed.wsdl', + OrganisationEnhedClassMap::get(), + ]; case OrganisationFunktionSoeg::class: case OrganisationFunktionList::class: case OrganisationFunktionLaes::class: return [ - __DIR__ . '/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/OrganisationFunktion.wsdl', - OrganisationFunktionClassMap::get(), - ]; + __DIR__.'/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/OrganisationFunktion.wsdl', + OrganisationFunktionClassMap::get(), + ]; case PersonSoeg::class: case PersonList::class: case PersonLaes::class: return [ - __DIR__ . '/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/Person.wsdl', - PersonClassMap::get(), - ]; + __DIR__.'/../../../resources/sf1500/Tekniske specifikationer (v6.0 Services)/v6_0_0_0/wsdl/Person.wsdl', + PersonClassMap::get(), + ]; } throw new \InvalidArgumentException(sprintf('Invalid class name: %s', $className)); diff --git a/src/Service/SF1500/SF1500XMLBuilder.php b/src/Service/SF1500/SF1500XMLBuilder.php index 870f7621..25105292 100644 --- a/src/Service/SF1500/SF1500XMLBuilder.php +++ b/src/Service/SF1500/SF1500XMLBuilder.php @@ -59,7 +59,7 @@ public function buildSoapHeader(\DOMElement $header, string $to, string $action, $messageElement = $document->createElementNS(self::NS_A, 'a:MessageID'); $messageElement->setAttributeNS(self::NS_U, 'u:Id', '_3'); - $messageElement->nodeValue = 'urn:uuid:' . $this->generateUuid(); + $messageElement->nodeValue = 'urn:uuid:'.$this->generateUuid(); $header->appendChild($messageElement); $replyElement = $document->createElementNS(self::NS_A, 'a:ReplyTo'); @@ -162,7 +162,7 @@ public function buildSignedRequest(string $requestSimple, string $privKey) ]; foreach ($referenceIds as &$value) { - $isSTR = ($value === 'SecurityTokenReference'); + $isSTR = ('SecurityTokenReference' === $value); $tags = $documentRequest->getElementsByTagName($value); @@ -247,21 +247,21 @@ public function generateUuid() return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" - mt_rand(0, 0xffff), - mt_rand(0, 0xffff), + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF), // 16 bits for "time_mid" - mt_rand(0, 0xffff), + mt_rand(0, 0xFFFF), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 - mt_rand(0, 0x0fff) | 0x4000, + mt_rand(0, 0x0FFF) | 0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one for variant DCE1.1 - mt_rand(0, 0x3fff) | 0x8000, + mt_rand(0, 0x3FFF) | 0x8000, // 48 bits for "node" - mt_rand(0, 0xffff), - mt_rand(0, 0xffff), - mt_rand(0, 0xffff) + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF) ); } } diff --git a/src/Service/SF1500/ServiceInterface.php b/src/Service/SF1500/ServiceInterface.php index 55e6634d..998a6d5d 100644 --- a/src/Service/SF1500/ServiceInterface.php +++ b/src/Service/SF1500/ServiceInterface.php @@ -18,29 +18,27 @@ interface ServiceInterface { /** - * @param array $query - * @param array $fields * @return T[] */ public function soeg(array $query, array $fields = []): array; /** * @param array|string[] $ids - * @param array $fields + * * @return T[] */ public function list(array $ids, array $fields = []): array; /** - * @param string $id - * @param array $fields * @return T|null */ public function laes(string $id, array $fields = []); /** * @template Client of SoapClientBase + * * @param class-string $className + * * @return Client */ public function getClient(string $className, array $options = []): SoapClientBase; diff --git a/src/Service/SF1500/SoapClient.php b/src/Service/SF1500/SoapClient.php index b621f9ba..db87a795 100644 --- a/src/Service/SF1500/SoapClient.php +++ b/src/Service/SF1500/SoapClient.php @@ -18,9 +18,9 @@ class SoapClient extends \SoapClient private ?string $lastFormattedRequest; private bool $disableCache; - public function __construct(?string $wsdl, array $options = null) + public function __construct(?string $wsdl, ?array $options = null) { - $this->disableCache = (bool)($options[SoapClientBase::SOAP_DISABLE_CACHE] ?? false); + $this->disableCache = (bool) ($options[SoapClientBase::SOAP_DISABLE_CACHE] ?? false); unset($options[SoapClientBase::SOAP_DISABLE_CACHE]); parent::__construct($wsdl, $options); @@ -49,7 +49,7 @@ private function doRequest( string $location, string $action, int $version, - bool $oneWay = false + bool $oneWay = false, ): ?string { $formattedRequest = $this->sf1500->formatSoapRequest($request, $location, $action, $version, $oneWay); $this->lastFormattedRequest = $formattedRequest; diff --git a/src/Service/SF1500/SoapClientBase.php b/src/Service/SF1500/SoapClientBase.php index e996bded..488251ac 100644 --- a/src/Service/SF1500/SoapClientBase.php +++ b/src/Service/SF1500/SoapClientBase.php @@ -11,7 +11,6 @@ namespace ItkDev\Serviceplatformen\Service\SF1500; use ItkDev\Serviceplatformen\Service\Exception\SoapException; -use SoapFault; use WsdlToPhp\PackageBase\AbstractSoapClientBase; /** @@ -21,7 +20,7 @@ class SoapClientBase extends AbstractSoapClientBase { protected SF1500 $sf1500; - const SOAP_DISABLE_CACHE = 'soap_disable_cache'; + public const SOAP_DISABLE_CACHE = 'soap_disable_cache'; public function getSoapClientClassName(?string $soapClientClassName = null): string { @@ -31,8 +30,8 @@ public function getSoapClientClassName(?string $soapClientClassName = null): str public static function getDefaultWsdlOptions(): array { return [ - self::WSDL_SOAP_VERSION => SOAP_1_2, - ]+parent::getDefaultWsdlOptions(); + self::WSDL_SOAP_VERSION => SOAP_1_2, + ] + parent::getDefaultWsdlOptions(); } public function setSF1500(SF1500 $sf1500): self @@ -51,7 +50,7 @@ public function getSoapClient(): ?SoapClient return $soapClient; } - public function saveLastError(string $methodName, SoapFault $soapFault): self + public function saveLastError(string $methodName, \SoapFault $soapFault): self { // Throw a SOAP exception rather than just storing a SOAP fault as the parent class does. throw new SoapException($soapFault, $this->getLastRequest(), $this->getLastResponse()); diff --git a/src/Service/SF1500/VirksomhedService.php b/src/Service/SF1500/VirksomhedService.php index 02f3a4a4..1de4202d 100644 --- a/src/Service/SF1500/VirksomhedService.php +++ b/src/Service/SF1500/VirksomhedService.php @@ -11,7 +11,6 @@ namespace ItkDev\Serviceplatformen\Service\SF1500; use ItkDev\Serviceplatformen\Service\SF1500\Model\Virksomhed; -use ItkDev\Serviceplatformen\SF1500\Virksomhed\ClassMap; use ItkDev\Serviceplatformen\SF1500\Virksomhed\ServiceType\_List; use ItkDev\Serviceplatformen\SF1500\Virksomhed\ServiceType\Laes; use ItkDev\Serviceplatformen\SF1500\Virksomhed\ServiceType\Soeg; @@ -28,17 +27,11 @@ final class VirksomhedService extends AbstractService { - /** - * {@inheritdoc} - */ public static function getValidFilters(): array { return []; } - /** - * {@inheritdoc} - */ protected function doSoeg(array $query): ?SoegOutputType { $attributListe = new AttributListeType(); @@ -50,35 +43,26 @@ protected function doSoeg(array $query): ?SoegOutputType $relationListe = new RelationListeType(); $request = (new SoegInputType()) - ->setMaksimalAntalKvantitet((int)($query['limit'] ?? self::DEFAULT_LIMIT)) - ->setFoersteResultatReference((int)($query['offset'] ?? 0)) + ->setMaksimalAntalKvantitet((int) ($query['limit'] ?? self::DEFAULT_LIMIT)) + ->setFoersteResultatReference((int) ($query['offset'] ?? 0)) ->setAttributListe($attributListe) ->setRelationListe($relationListe); return $this->clientSoeg()->soeg($request) ?: null; } - /** - * {@inheritdoc} - */ protected function doList(array $ids): ?ListOutputType { return $this->clientList() ->_list_12(new ListInputType($ids)) ?: null; } - /** - * {@inheritdoc} - */ protected function doLaes(string $id): ?LaesOutputType { return $this->clientLaes() ->laes(new LaesInputType($id)) ?: null; } - /** - * {@inheritdoc} - */ protected function buildModel($oejebliksbillede): Virksomhed { assert($oejebliksbillede instanceof FiltreretOejebliksbilledeType); diff --git a/src/Service/SF1514/SF1514.php b/src/Service/SF1514/SF1514.php index 44dbef3b..660734b3 100644 --- a/src/Service/SF1514/SF1514.php +++ b/src/Service/SF1514/SF1514.php @@ -23,11 +23,11 @@ class SF1514 { - const TOKENTYPE_SAML20 = 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0'; - const TOKENTYPE_STATUS = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Status'; + public const TOKENTYPE_SAML20 = 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0'; + public const TOKENTYPE_STATUS = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Status'; - const KEYTYPE_BEARER = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer'; - const KEYTYPE_PUBLIC = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey'; + public const KEYTYPE_BEARER = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer'; + public const KEYTYPE_PUBLIC = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey'; private SoapClient $soapClient; private array $options; @@ -52,10 +52,9 @@ protected function getOption(string $name) public function isTestMode(): bool { - return (bool)$this->options['test_mode']; + return (bool) $this->options['test_mode']; } - /** * @throws SAMLTokenException */ @@ -73,7 +72,7 @@ public function getSAMLToken(): string $token = $cache->get($cacheKey, function (ItemInterface $item) use ($expirationTimeOffset) { $token = $this->fetchSAMLToken(); - if ($token === null) { + if (null === $token) { throw new SAMLTokenException('Could not fetch SAML token.'); } @@ -93,6 +92,7 @@ public function getSAMLToken(): string if ($this->getSAMLTokenExpirationTime($token)->modify($expirationTimeOffset) <= new \DateTimeImmutable()) { // Remove expired token from cache and get a new token. $cache->delete($cacheKey); + return $this->getSAMLToken(); } @@ -109,7 +109,7 @@ private function getCacheKey(string $key, array $payload): string return preg_replace( '#[{}()/\\\\@:]+#', '_', - $key . '|' . sha1(json_encode($payload+$this->options)) + $key.'|'.sha1(json_encode($payload + $this->options)) ); } @@ -125,7 +125,7 @@ private function getSAMLTokenExpirationTime(string $token): \DateTimeImmutable } $notOnOrAfter = reset($nodes); - return new \DateTimeImmutable((string)$notOnOrAfter); + return new \DateTimeImmutable((string) $notOnOrAfter); } public function fetchSAMLToken(): ?string @@ -148,7 +148,7 @@ public function fetchSAMLToken(): ?string [$domSecurityTokenService, $token] = $this->getDecrypted($domSecurityTokenService, $xpath, $token, $this->getPrivateKey()); - return $token !== null ? $domSecurityTokenService->saveXML($token) : null; + return null !== $token ? $domSecurityTokenService->saveXML($token) : null; } private function getCertificate(): string @@ -174,14 +174,13 @@ private function getCertificatePart(string $part): string throw new \RuntimeException(sprintf('Cannot get certificate part %s', $part)); } - /** * Builds SAML token request XML. */ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) { $dom = new \DOMDocument(); - $dom->load(__DIR__ . '/SAMLTokenSoapTemplate.xml'); + $dom->load(__DIR__.'/SAMLTokenSoapTemplate.xml'); $xpath = new \DOMXPath($dom); $xpath->registerNamespace('wsu', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'); @@ -194,27 +193,27 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) $xpath->registerNamespace('wsse', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'); // Signature. - $signatureId = 'SIG-' . $this->generateUuid(); + $signatureId = 'SIG-'.$this->generateUuid(); $signature = $this->getElement($xpath, '//ds:Signature'); $signature->setAttribute('Id', $signatureId); // Action. - $actionId = '_' . $this->generateUuid(); + $actionId = '_'.$this->generateUuid(); $actionElement = $this->getElement($xpath, '//wsa:Action'); $actionElement->setAttribute('wsu:Id', $actionId); $this->handleReference($xpath, $actionElement, $actionId, 'action_id'); // MessageID. - $messageId = '_' . $this->generateUuid(); + $messageId = '_'.$this->generateUuid(); $messageIdElement = $this->getElement($xpath, '//wsa:MessageID'); $messageIdElement->setAttribute('wsu:Id', $messageId); - $messageIdElement->nodeValue = 'urn:uuid:' . $this->generateUuid(); + $messageIdElement->nodeValue = 'urn:uuid:'.$this->generateUuid(); $this->handleReference($xpath, $messageIdElement, $messageId, 'message_id_id'); // To. - $toId = '_' . $this->generateUuid(); + $toId = '_'.$this->generateUuid(); $toElement = $this->getElement($xpath, '//wsa:To'); $toElement->nodeValue = $appliesTo; $toElement->setAttribute('wsu:Id', $toId); @@ -222,14 +221,14 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) $this->handleReference($xpath, $toElement, $toId, 'to_id'); // ReplyTo. - $replyToId = '_' . $this->generateUuid(); + $replyToId = '_'.$this->generateUuid(); $replyToElement = $this->getElement($xpath, '//wsa:ReplyTo'); $replyToElement->setAttribute('wsu:Id', $replyToId); $this->handleReference($xpath, $replyToElement, $replyToId, 'reply_id'); // Timestamp. - $timestampId = 'TS-' . $this->generateUuid(); + $timestampId = 'TS-'.$this->generateUuid(); $timestampElement = $this->getElement($xpath, '//wsu:Timestamp'); $timestampElement->setAttribute('wsu:Id', $timestampId); @@ -241,7 +240,7 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) // BinarySecurityToken. $certificateKeyContent = str_replace(["\r", "\n"], '', $cert); - $binarySecurityTokenId = 'X509-' . $this->generateUuid(); + $binarySecurityTokenId = 'X509-'.$this->generateUuid(); $binarySecurityTokenElement = $this->getElement($xpath, '//wsse:BinarySecurityToken'); $binarySecurityTokenElement->setAttribute('wsu:Id', $binarySecurityTokenId); $binarySecurityTokenElement->nodeValue = $certificateKeyContent; @@ -249,7 +248,7 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) $this->handleReference($xpath, $binarySecurityTokenElement, $binarySecurityTokenId, 'security_token_id'); // Body. - $bodyId = '_' . $this->generateUuid(); + $bodyId = '_'.$this->generateUuid(); $bodyElement = $this->getElement($xpath, '//soap:Body'); $bodyElement->setAttribute('wsu:Id', $bodyId); @@ -259,13 +258,13 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) $this->handleReference($xpath, $bodyElement, $bodyId, 'body_id'); // KeyInfo. - $keyInfoId = 'KI-' . $this->generateUuid(); + $keyInfoId = 'KI-'.$this->generateUuid(); $keyInfoElement = $this->getElement($xpath, '//ds:KeyInfo'); $keyInfoElement->setAttribute('Id', $keyInfoId); // Set final ids. - $this->getElement($xpath, '//wsse:Reference')->setAttribute('URI', '#' . $binarySecurityTokenId); - $this->getElement($xpath, '//wsse:SecurityTokenReference')->setAttribute('wsu:Id', 'STR-' . $this->generateUuid()); + $this->getElement($xpath, '//wsse:Reference')->setAttribute('URI', '#'.$binarySecurityTokenId); + $this->getElement($xpath, '//wsse:SecurityTokenReference')->setAttribute('wsu:Id', 'STR-'.$this->generateUuid()); // Sign the request. $signedInfoElement = $this->getElement($xpath, '//ds:SignedInfo'); @@ -286,7 +285,7 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) private function handleReference(\DOMXPath $xpath, \DOMElement $element, string $elementId, $baseId) { $referenceElement = $this->getElement($xpath, "//ds:Reference[contains(@URI, '$baseId')]"); - $referenceElement->setAttribute('URI', '#' . $elementId); + $referenceElement->setAttribute('URI', '#'.$elementId); $digestValue = base64_encode(openssl_digest($element->C14N(true, false), 'SHA256', true)); $this->getElement($xpath, 'ds:DigestValue', $referenceElement)->nodeValue = $digestValue; @@ -295,7 +294,7 @@ private function handleReference(\DOMXPath $xpath, \DOMElement $element, string /** * Queries for element. */ - private function getElement(\DOMXPath $xpath, string $expression, \DOMElement $context = null): \DOMElement + private function getElement(\DOMXPath $xpath, string $expression, ?\DOMElement $context = null): \DOMElement { return $xpath->query($expression, $context)[0]; } @@ -316,21 +315,21 @@ public function generateUuid() return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" - mt_rand(0, 0xffff), - mt_rand(0, 0xffff), + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF), // 16 bits for "time_mid" - mt_rand(0, 0xffff), + mt_rand(0, 0xFFFF), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 - mt_rand(0, 0x0fff) | 0x4000, + mt_rand(0, 0x0FFF) | 0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one for variant DCE1.1 - mt_rand(0, 0x3fff) | 0x8000, + mt_rand(0, 0x3FFF) | 0x8000, // 48 bits for "node" - mt_rand(0, 0xffff), - mt_rand(0, 0xffff), - mt_rand(0, 0xffff) + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF) ); } @@ -341,7 +340,7 @@ public function parseRequestSecurityTokenResponse($result) { $dom = Serializer::loadXML($result); $doc = $dom->documentElement; - $xpath = new \DOMXpath($dom); + $xpath = new \DOMXPath($dom); $xpath->registerNamespace('s', 'http://www.w3.org/2003/05/soap-envelope'); $xpath->registerNamespace('wst', 'http://docs.oasis-open.org/ws-sx/ws-trust/200512'); $xpath->registerNamespace('wsse', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'); @@ -352,6 +351,7 @@ public function parseRequestSecurityTokenResponse($result) } else { $proofKey = null; } + return [$dom, $xpath, $token->item(0), $proofKey]; } @@ -367,7 +367,7 @@ public function getDecrypted(\DOMDocument $dom, $xpath, $token, $pkey, $type = s $xpathPrefix = '/s:Envelope/s:Body/wst:RequestSecurityTokenResponseCollection/wst:RequestSecurityTokenResponse/wst:RequestedSecurityToken'; $xpathSuffix = '/saml:Assertion'; - $data = $xpath->query($xpathPrefix . $xpathSuffix, $doc); + $data = $xpath->query($xpathPrefix.$xpathSuffix, $doc); if ($data->length > 0) { $token = $data->item(0); diff --git a/src/Service/SF1601/DocumentNormalizerInterface.php b/src/Service/SF1601/DocumentNormalizerInterface.php index 5daf3f3e..2ade7be4 100644 --- a/src/Service/SF1601/DocumentNormalizerInterface.php +++ b/src/Service/SF1601/DocumentNormalizerInterface.php @@ -10,9 +10,7 @@ namespace ItkDev\Serviceplatformen\Service\SF1601; -use DOMDocument; - interface DocumentNormalizerInterface { - public function normalizeDocument(DOMDocument $document): DOMDocument; + public function normalizeDocument(\DOMDocument $document): \DOMDocument; } diff --git a/src/Service/SF1601/Exception/InvalidMemoException.php b/src/Service/SF1601/Exception/InvalidMemoException.php index c7c19db6..490dd153 100644 --- a/src/Service/SF1601/Exception/InvalidMemoException.php +++ b/src/Service/SF1601/Exception/InvalidMemoException.php @@ -10,8 +10,6 @@ namespace ItkDev\Serviceplatformen\Service\SF1601\Exception; -use Exception; - -class InvalidMemoException extends Exception +class InvalidMemoException extends \Exception { } diff --git a/src/Service/SF1601/SF1601.php b/src/Service/SF1601/SF1601.php index bf68a387..2bd2ecad 100644 --- a/src/Service/SF1601/SF1601.php +++ b/src/Service/SF1601/SF1601.php @@ -10,11 +10,7 @@ namespace ItkDev\Serviceplatformen\Service\SF1601; -use DateTimeInterface; use DigitalPost\MeMo\Message; -use DOMDocument; -use DOMElement; -use DOMText; use ItkDev\Serviceplatformen\Service\AbstractRESTService; use ItkDev\Serviceplatformen\Service\Exception\InvalidArgumentException; use ItkDev\Serviceplatformen\Service\Exception\ServiceException; @@ -23,7 +19,6 @@ use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\HttpClient\ResponseInterface; -use XSLTProcessor; class SF1601 extends AbstractRESTService { @@ -80,8 +75,8 @@ class SF1601 extends AbstractRESTService self::ACTION_UNDERSKRIV, ]; - private ?DOMElement $lastKombiMemoMessage = null; - private ?DOMElement $lastKombiForsendelse = null; + private ?\DOMElement $lastKombiMemoMessage = null; + private ?\DOMElement $lastKombiForsendelse = null; protected function configureOptions(OptionsResolver $resolver) { @@ -104,13 +99,13 @@ protected function configureOptions(OptionsResolver $resolver) ]); } - public function postForespoerg(string $transactionId, string $type, string $identifier, DateTimeInterface $transactionTid = null): array + public function postForespoerg(string $transactionId, string $type, string $identifier, ?\DateTimeInterface $transactionTid = null): array { if (!in_array($type, self::FORESPOERG_TYPES)) { throw new InvalidArgumentException(sprintf('Invalid type: %s', $type)); } $entityId = $this->getOption('post_forespoerg_svc_entity_id'); - $url = $this->getOption('post_forespoerg_svc_endpoint') . '/' . $type; + $url = $this->getOption('post_forespoerg_svc_endpoint').'/'.$type; $response = $this->call($entityId, 'GET', $url, [ 'query' => [ // This almost matches the documented keys … @@ -123,14 +118,14 @@ public function postForespoerg(string $transactionId, string $type, string $iden return $response->toArray(); } - public function kombiPostAfsend(string $transactionId, string $type, ?Message $message, ?ForsendelseI $forsendelse = null, DateTimeInterface $transactionTid = null): ResponseInterface + public function kombiPostAfsend(string $transactionId, string $type, ?Message $message, ?ForsendelseI $forsendelse = null, ?\DateTimeInterface $transactionTid = null): ResponseInterface { $document = $this->buildKombiRequestDocument($type, $message, $forsendelse); // Serviceplatformen doesn't understand XML namespaces! - $xsldoc = new DOMDocument(); + $xsldoc = new \DOMDocument(); $xsldoc->load(__DIR__.'/resources/namespaces.xslt'); - $xsl = new XSLTProcessor(); + $xsl = new \XSLTProcessor(); $xsl->importStyleSheet($xsldoc); $document = $xsl->transformToDoc($document); @@ -149,29 +144,29 @@ public function kombiPostAfsend(string $transactionId, string $type, ?Message $m $entityId = $this->getOption('svc_entity_id'); $url = $this->getOption('svc_endpoint'); $response = $this->call($entityId, 'POST', $url, [ - 'headers' => [ - 'content-type' => 'application/xml', - 'accept' => 'application/xml', - ], - 'body' => $document->saveXML(), - 'transactionId' => $transactionId, - 'transactionTid' => $transactionTid, - ]); + 'headers' => [ + 'content-type' => 'application/xml', + 'accept' => 'application/xml', + ], + 'body' => $document->saveXML(), + 'transactionId' => $transactionId, + 'transactionTid' => $transactionTid, + ]); return $response; } - public function getLastKombiMeMoMessage(): ?DOMElement + public function getLastKombiMeMoMessage(): ?\DOMElement { return $this->lastKombiMemoMessage; } - public function getLastKombiForsendelse(): ?DOMElement + public function getLastKombiForsendelse(): ?\DOMElement { return $this->lastKombiForsendelse; } - private function buildKombiRequestDocument(string $type, ?Message $message, ?ForsendelseI $forsendelse): DOMDocument + private function buildKombiRequestDocument(string $type, ?Message $message, ?ForsendelseI $forsendelse): \DOMDocument { if (!in_array($type, [self::TYPE_AUTOMATISK_VALG, self::TYPE_DIGITAL_POST, self::TYPE_FYSISK_POST, self::TYPE_NEM_SMS])) { throw new ServiceException(sprintf('Invalid type: %s', $type)); @@ -180,7 +175,7 @@ private function buildKombiRequestDocument(string $type, ?Message $message, ?For // Build kombi document. $document = Serializer::loadXML(''); // Set KombiValgKode. - $document->documentElement->firstChild->appendChild(new DOMText($type)); + $document->documentElement->firstChild->appendChild(new \DOMText($type)); if (null !== $message) { // Set default values on some required attributes. @@ -256,18 +251,14 @@ private function validateActions(array $actions) $url = $action->getEntryPoint()?->getUrl(); // URL must be absolute and use https (cf. https://digitaliser.dk/digital-post/nyhedsarkiv/2024/nov/oeget-validering-i-digital-post) if ($url && 'https' !== parse_url($url, PHP_URL_SCHEME)) { - throw new \RuntimeException(sprintf( - 'URL %s for action "%s" (%s) must be absolute and use the https scheme, i.e. start with "https://".', - $url, - $action->getLabel(), - $action->getActionCode() - )); + throw new \RuntimeException(sprintf('URL %s for action "%s" (%s) must be absolute and use the https scheme, i.e. start with "https://".', $url, $action->getLabel(), $action->getActionCode())); } } } /** * @param \DigitalPost\MeMo\File[] $files + * * @return void */ private function sanitizeFilenames(array $files) @@ -282,7 +273,7 @@ private function sanitizeFilenames(array $files) } /** - * Sanitize MeMo filename (cf. https://digitaliser.dk/digital-post/nyhedsarkiv/2024/nov/oeget-validering-i-digital-post) + * Sanitize MeMo filename (cf. https://digitaliser.dk/digital-post/nyhedsarkiv/2024/nov/oeget-validering-i-digital-post). * * Non-empty sequences of invalid characters are replaced with a single character. */ @@ -291,7 +282,7 @@ private static function sanitizeFilename(string $filename, string $replacer = '- // < > : " / \ | ? * CR LF CRLF U+00A0 U+2000 U+2001 U+2002 U+2003 U+2004 U+2005 U+2006 U+2007 U+2008 U+2009 U+200A U+2028 U+205F U+2060 U+3000 $pattern = '@[<>:"/\\\\|?*\x{000D}\x{000A}\x{00A0}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}\x{2006}\x{2007}\x{2008}\x{2009}\x{200A}\x{2028}\x{205F}\x{2060}\x{3000}]+@u'; - if (mb_strlen($replacer) !== 1) { + if (1 !== mb_strlen($replacer)) { throw new \InvalidArgumentException(sprintf('Replacer must have length 1 (is %d)', mb_strlen($replacer))); } diff --git a/src/Service/SF1601/Serializer.php b/src/Service/SF1601/Serializer.php index 3a50f196..08b797c8 100644 --- a/src/Service/SF1601/Serializer.php +++ b/src/Service/SF1601/Serializer.php @@ -10,13 +10,7 @@ namespace ItkDev\Serviceplatformen\Service\SF1601; -use DateTimeImmutable; -use DateTimeInterface; -use DateTimeZone; -use DOMDocument; -use DOMXPath; use GoetasWebservices\Xsd\XsdToPhpRuntime\Jms\Handler\BaseTypesHandler; -use GoetasWebservices\Xsd\XsdToPhpRuntime\Jms\Handler\XmlSchemaDateHandler; use ItkDev\Serviceplatformen\Service\SF1601\Xsd\XsdToPhpRuntime\Jms\Handler\MeMoXmlSchemaDateHandler; use JMS\Serializer\Handler\HandlerRegistryInterface; use JMS\Serializer\SerializerBuilder; @@ -27,25 +21,23 @@ class Serializer { // Must match xsd2php.destinations_jms in xsd2php-config.yml private const NAMESPACE2METADATA = [ - 'DigitalPost\MeMo' => 'lib/metadata/DigitalPost/MeMo', - 'DataGovDk\Model\DataTypes' => 'lib/metadata/DataGovDk/Model/DataTypes', - 'DataGovDk\Model\Core' => 'lib/metadata/DataGovDk/Model/Core', - 'WwwGs1Dk\Gs1Standarder\Identifikation\GlnGlobalLocationNumber' => 'lib/metadata/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber', - 'ServicesNsiDk\En\Services\SOR' => 'lib/metadata/ServicesNsiDk/En/Services/SOR', - 'MotorregisterSkatDk' => 'lib/metadata/MotorregisterSkatDk', - 'KleOnlineDk' => 'lib/metadata/KleOnlineDk', - 'WwwFormOnlineDk' => 'lib/metadata/WwwFormOnlineDk', + 'DigitalPost\MeMo' => 'lib/metadata/DigitalPost/MeMo', + 'DataGovDk\Model\DataTypes' => 'lib/metadata/DataGovDk/Model/DataTypes', + 'DataGovDk\Model\Core' => 'lib/metadata/DataGovDk/Model/Core', + 'WwwGs1Dk\Gs1Standarder\Identifikation\GlnGlobalLocationNumber' => 'lib/metadata/WwwGs1Dk/Gs1Standarder/Identifikation/GlnGlobalLocationNumber', + 'ServicesNsiDk\En\Services\SOR' => 'lib/metadata/ServicesNsiDk/En/Services/SOR', + 'MotorregisterSkatDk' => 'lib/metadata/MotorregisterSkatDk', + 'KleOnlineDk' => 'lib/metadata/KleOnlineDk', + 'WwwFormOnlineDk' => 'lib/metadata/WwwFormOnlineDk', 'WwwDstDk\Da\TilSalg\Forskningsservice\Dokumentation\Hoejkvalitetsvariable\Elevregister2\Udd' => 'lib/metadata/WwwDstDk/Da/TilSalg/Forskningsservice/Dokumentation/Hoejkvalitetsvariable/Elevregister2/Udd', - 'Oio' => 'lib/metadata/Oio', + 'Oio' => 'lib/metadata/Oio', ]; private SerializerInterface $serializer; /** * Serialize data as XML. - * - * @param $data */ public function serialize($data): string { @@ -58,13 +50,10 @@ public function serialize($data): string * Format date time as Zulu time. * * @see https://stackoverflow.com/a/57701653/2502647 - * - * @param DateTimeInterface $dateTime - * @return string */ - public static function formatDateTimeZulu(DateTimeInterface $dateTime): string + public static function formatDateTimeZulu(\DateTimeInterface $dateTime): string { - return (new DateTimeImmutable($dateTime->format(DateTimeInterface::ATOM), new DateTimeZone('UTC'))) + return (new \DateTimeImmutable($dateTime->format(\DateTimeInterface::ATOM), new \DateTimeZone('UTC'))) ->format('Y-m-d\TH:i:s\Z'); } @@ -80,7 +69,7 @@ public static function createUuid(): string */ public static function loadXML(string $xml, ?\DOMDocument $document = null): \DOMDocument { - $document ??= new DOMDocument(); + $document ??= new \DOMDocument(); $document->loadXML($xml, LIBXML_PARSEHUGE); diff --git a/src/Service/SoapClient.php b/src/Service/SoapClient.php index efbbb74a..588ef6b9 100644 --- a/src/Service/SoapClient.php +++ b/src/Service/SoapClient.php @@ -59,17 +59,16 @@ private function call($url, $request, $action = null) curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSLVERSION, 6); - $headers = [ null !== $action - ? 'Content-Type: application/soap+xml; charset=utf-8; action="' . $action . '"' + ? 'Content-Type: application/soap+xml; charset=utf-8; action="'.$action.'"' : 'Content-Type: application/soap+xml; charset=utf-8', - 'Content-Length: ' . strlen($request), + 'Content-Length: '.strlen($request), ]; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - if ($request !== null) { + if (null !== $request) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); } @@ -91,7 +90,7 @@ private function getCacheKey(string $key, array $payload): string return preg_replace( '#[{}()/\\\\@:]+#', '_', - $key . '|' . sha1(json_encode($payload+$this->options)) + $key.'|'.sha1(json_encode($payload + $this->options)) ); } @@ -113,7 +112,7 @@ protected function configureOptions(OptionsResolver $resolver) { $resolver ->setRequired([ - 'cache_expiration_time' + 'cache_expiration_time', ]) ->setDefaults([ 'cache' => static function (Options $options) { diff --git a/tests/Unit/Service/SF1601/SF1601Test.php b/tests/Unit/Service/SF1601/SF1601Test.php index 1a9ca58c..3d304994 100644 --- a/tests/Unit/Service/SF1601/SF1601Test.php +++ b/tests/Unit/Service/SF1601/SF1601Test.php @@ -1,4 +1,6 @@ - Date: Fri, 12 Sep 2025 09:41:09 +0200 Subject: [PATCH 3/9] Added SF2900 to the mix --- bin/generate | 12 + .../Serviceplatformen/SF2900/ClassMap.php | 82 +++ .../SF2900/EnumType/AktoerTypeType.php | 66 +++ .../SF2900/EnumType/DokumentPartRolleType.php | 45 ++ .../SF2900/EnumType/DokumenttypeType.php | 80 +++ .../ForretningsValideringsKodeType.php | 59 ++ .../SF2900/EnumType/FremdriftType.php | 66 +++ .../EnumType/JournalPartObjekttypeType.php | 31 + .../SF2900/EnumType/JournalPostRolleType.php | 31 + .../SF2900/EnumType/KvitteringstypeType.php | 45 ++ .../SF2900/EnumType/LivscyklusKodeType.php | 31 + .../SF2900/EnumType/ObjektTypeType.php | 45 ++ .../SF2900/EnumType/PartObjektTypeType.php | 73 +++ .../SF2900/EnumType/RetningType.php | 59 ++ .../EnumType/TransportValideringsKodeType.php | 45 ++ .../SF2900/EnumType/VariantRolleType.php | 31 + .../ServiceType/Fordelingskvittering.php | 47 ++ .../SF2900/ServiceType/Fordelingsmodtager.php | 69 +++ .../SF2900/ServiceType/Fordelingsobjekt.php | 47 ++ .../SF2900/StructType/AnmodRequestType.php | 84 +++ .../StructType/AttributterListeType.php | 102 ++++ .../SF2900/StructType/AttributterType.php | 430 ++++++++++++++ .../StructType/AuthorityContextType.php | 64 ++ .../SF2900/StructType/CallContextType.php | 147 +++++ .../SF2900/StructType/DelAttributterType.php | 262 +++++++++ .../StructType/DistributionContextType.php | 282 +++++++++ .../StructType/DistributionDokumentType.php | 214 +++++++ .../StructType/DistributionFormularType.php | 174 ++++++ .../DistributionJournalPostType.php | 244 ++++++++ .../StructType/DistributionObjectType.php | 91 +++ .../StructType/DokumentPartListeType.php | 102 ++++ .../SF2900/StructType/DokumentPartType.php | 155 +++++ .../StructType/DokumentRegistreringType.php | 327 +++++++++++ .../SF2900/StructType/FejlListeType.php | 102 ++++ .../SF2900/StructType/FejlType.php | 92 +++ ...ngskvitteringModtagAnvenderRequestType.php | 84 +++ ...gskvitteringModtagAnvenderResponseType.php | 17 + .../FordelingskvitteringModtagRequestType.php | 146 +++++ ...FordelingskvitteringModtagResponseType.php | 17 + .../FordelingsmodtagerListRequest.php | 186 ++++++ .../FordelingsmodtagerListRequestType.php | 116 ++++ .../FordelingsmodtagerListResponseType.php | 54 ++ .../FordelingsmodtagerValiderRequestType.php | 156 +++++ .../FordelingsmodtagerValiderResponseType.php | 54 ++ .../FordelingsobjektAfsendRequestType.php | 116 ++++ .../FordelingsobjektAfsendResponseType.php | 84 +++ .../FordelingsobjektModtagRequestType.php | 54 ++ .../FordelingsobjektModtagResponseType.php | 54 ++ .../SF2900/StructType/FormularType.php | 156 +++++ .../SF2900/StructType/FormularXMLType.php | 65 +++ .../StructType/ForretningskvitteringType.php | 162 ++++++ .../StructType/JournalNotatEgenskaberType.php | 92 +++ .../SF2900/StructType/JournalPartType.php | 91 +++ .../JournalPostRegistreringType.php | 219 +++++++ .../JournalPostRelationsListeType.php | 102 ++++ .../SF2900/StructType/JournalPostType.php | 215 +++++++ .../StructType/JournalpostEgenskaberType.php | 88 +++ .../SF2900/StructType/MeddelelseType.php | 88 +++ .../StructType/ModtagerMedEndpointType.php | 218 +++++++ .../SF2900/StructType/ObjektIndholdType.php | 240 ++++++++ .../StructType/OffentlighedUndtagetType.php | 92 +++ .../SF2900/StructType/PartType.php | 91 +++ .../SF2900/StructType/RelationsListe.php | 84 +++ .../SF2900/StructType/RoutingKLEInfo.php | 104 ++++ .../SF2900/StructType/RoutingListeType.php | 102 ++++ .../SF2900/StructType/RoutingResponseType.php | 138 +++++ .../StructType/RoutingResposneListeType.php | 102 ++++ .../SF2900/StructType/RoutingType.php | 104 ++++ .../SF2900/StructType/RoutingValg.php | 180 ++++++ .../StructType/TilgaengeligeModtagereType.php | 102 ++++ .../SF2900/StructType/TilstandListeType.php | 102 ++++ .../SF2900/StructType/TilstandType.php | 91 +++ .../StructType/TransportkvitteringType.php | 125 ++++ .../SF2900/StructType/UUID_URN.php | 186 ++++++ .../SF2900/StructType/UUID_URN_Tekst.php | 264 +++++++++ .../StructType/VariantAttributterType.php | 194 ++++++ .../SF2900/StructType/VariantListeType.php | 102 ++++ .../SF2900/StructType/VariantType.php | 185 ++++++ .../SF2900/StructType/VirkningType.php | 193 ++++++ resources/sf2900/DistributionServiceMsg.xsd | 86 +++ .../DistributionServiceAnvenderV2.wsdl | 58 ++ .../DistributionServiceModtagerV2.wsdl | 56 ++ .../DistributionServiceMsgV2.xsd | 40 ++ .../DistributionServiceTypesV2.xsd | 550 ++++++++++++++++++ resources/sf2900/sp/AuthorityContext_1.xsd | 22 + resources/sf2900/sp/CallContext_1.xsd | 38 ++ resources/sf2900/sp/InvocationContext_1.xsd | 67 +++ resources/sf2900/sp/Kvittering_1.xsd | 70 +++ .../sp/ServiceplatformFaultMessage_1.wsdl | 18 + .../sf2900/sp/ServiceplatformFault_1.xsd | 27 + .../sp/TransportKvitteringFaultMessage_1.wsdl | 18 + resources/sf2900/sp/service.properties | 2 + .../wsdl/context/DistributionService.wsdl | 135 +++++ resources/sf2900/wsdl/context/policies.wsdl | 40 ++ .../wsdl/token/DistributionService.wsdl | 135 +++++ resources/sf2900/wsdl/token/policies.wsdl | 83 +++ .../sf2900/xsd/DistributionServiceTypes.xsd | 64 ++ 97 files changed, 10760 insertions(+) create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/ClassMap.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/AktoerTypeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/DokumentPartRolleType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/DokumenttypeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/ForretningsValideringsKodeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/FremdriftType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/JournalPartObjekttypeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/JournalPostRolleType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/KvitteringstypeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/LivscyklusKodeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/ObjektTypeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/PartObjektTypeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/RetningType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/TransportValideringsKodeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/VariantRolleType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingskvittering.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsmodtager.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsobjekt.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AnmodRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AuthorityContextType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/CallContextType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DelAttributterType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionContextType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionDokumentType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionFormularType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionJournalPostType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionObjectType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentRegistreringType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListRequest.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagRequestType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularXMLType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ForretningskvitteringType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalNotatEgenskaberType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPartType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRegistreringType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRelationsListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalpostEgenskaberType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/MeddelelseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ModtagerMedEndpointType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ObjektIndholdType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/OffentlighedUndtagetType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/PartType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RelationsListe.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingKLEInfo.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResponseType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResposneListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingValg.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilgaengeligeModtagereType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TransportkvitteringType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN_Tekst.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantAttributterType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantListeType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantType.php create mode 100644 generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VirkningType.php create mode 100644 resources/sf2900/DistributionServiceMsg.xsd create mode 100644 resources/sf2900/SF2900_EP_MS1-2/DistributionServiceAnvenderV2.wsdl create mode 100644 resources/sf2900/SF2900_EP_MS1-2/DistributionServiceModtagerV2.wsdl create mode 100644 resources/sf2900/SF2900_EP_MS1-2/DistributionServiceMsgV2.xsd create mode 100644 resources/sf2900/SF2900_EP_MS1-2/DistributionServiceTypesV2.xsd create mode 100644 resources/sf2900/sp/AuthorityContext_1.xsd create mode 100644 resources/sf2900/sp/CallContext_1.xsd create mode 100644 resources/sf2900/sp/InvocationContext_1.xsd create mode 100644 resources/sf2900/sp/Kvittering_1.xsd create mode 100644 resources/sf2900/sp/ServiceplatformFaultMessage_1.wsdl create mode 100644 resources/sf2900/sp/ServiceplatformFault_1.xsd create mode 100644 resources/sf2900/sp/TransportKvitteringFaultMessage_1.wsdl create mode 100644 resources/sf2900/sp/service.properties create mode 100644 resources/sf2900/wsdl/context/DistributionService.wsdl create mode 100644 resources/sf2900/wsdl/context/policies.wsdl create mode 100644 resources/sf2900/wsdl/token/DistributionService.wsdl create mode 100644 resources/sf2900/wsdl/token/policies.wsdl create mode 100644 resources/sf2900/xsd/DistributionServiceTypes.xsd diff --git a/bin/generate b/bin/generate index 02a69fff..e09add77 100755 --- a/bin/generate +++ b/bin/generate @@ -48,6 +48,18 @@ $services = [ ], 'namespace_name' => 'SF1600', ], + + // https://digitaliseringskataloget.dk/integration/sf2900 + 'sf2900' => [ + 'doc_url' => 'https://docs.kombit.dk/integration/sf2900/2.4/pakke', + 'resource_zip_glob' => 'SF2900 Teknisk Spec*.zip', + 'wsdl_paths' => [ + '' => 'wsdl/context/DistributionService.wsdl', + ], + 'namespace_name' => 'SF2900', + // @see https://github.com/WsdlToPhp/PackageEws365/blob/master/SoapClient/SoapClientBase.php + 'soap_client_class' => \ItkDev\Serviceplatformen\Service\SF2900\SoapClientBase::class, + ], ]; class ResourceHelper extends Helper { diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/ClassMap.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/ClassMap.php new file mode 100644 index 00000000..4d432fe1 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/ClassMap.php @@ -0,0 +1,82 @@ + '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\CallContextType', + 'AuthorityContextType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\AuthorityContextType', + 'UUID_URN' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\UUID_URN', + 'UUID_URN_Tekst' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\UUID_URN_Tekst', + 'TransportkvitteringType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\TransportkvitteringType', + 'FejlListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FejlListeType', + 'FejlType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FejlType', + 'ForretningskvitteringType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\ForretningskvitteringType', + 'anmodRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\AnmodRequestType', + 'DistributionContextType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DistributionContextType', + 'RoutingValg' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RoutingValg', + 'RoutingKLEInfo' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RoutingKLEInfo', + 'RoutingListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RoutingListeType', + 'RoutingType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RoutingType', + 'RoutingResposneListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RoutingResposneListeType', + 'RoutingResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RoutingResponseType', + 'DistributionObjectType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DistributionObjectType', + 'ObjektIndholdType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\ObjektIndholdType', + 'DistributionDokumentType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DistributionDokumentType', + 'DokumentRegistreringType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DokumentRegistreringType', + 'RelationsListe' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\RelationsListe', + 'VariantListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\VariantListeType', + 'VariantType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\VariantType', + 'VariantAttributterType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\VariantAttributterType', + 'DelAttributterType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DelAttributterType', + 'DokumentPartListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DokumentPartListeType', + 'DokumentPartType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DokumentPartType', + 'VirkningType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\VirkningType', + 'TilstandListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\TilstandListeType', + 'TilstandType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\TilstandType', + 'AttributterListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\AttributterListeType', + 'AttributterType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\AttributterType', + 'OffentlighedUndtagetType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\OffentlighedUndtagetType', + 'DistributionJournalPostType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DistributionJournalPostType', + 'JournalPostRegistreringType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\JournalPostRegistreringType', + 'PartType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\PartType', + 'JournalPostRelationsListeType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\JournalPostRelationsListeType', + 'JournalPostType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\JournalPostType', + 'JournalpostEgenskaberType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\JournalpostEgenskaberType', + 'JournalNotatEgenskaberType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\JournalNotatEgenskaberType', + 'JournalPartType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\JournalPartType', + 'DistributionFormularType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\DistributionFormularType', + 'MeddelelseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\MeddelelseType', + 'FormularType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FormularType', + 'FormularXMLType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FormularXMLType', + 'tilgaengeligeModtagereType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\TilgaengeligeModtagereType', + 'ModtagerMedEndpointType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\ModtagerMedEndpointType', + 'FordelingsmodtagerListRequest' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsmodtagerListRequest', + 'FordelingsobjektModtagRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsobjektModtagRequestType', + 'FordelingsobjektModtagResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsobjektModtagResponseType', + 'FordelingskvitteringModtagAnvenderRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingskvitteringModtagAnvenderRequestType', + 'FordelingskvitteringModtagAnvenderResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingskvitteringModtagAnvenderResponseType', + 'FordelingsobjektAfsendRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsobjektAfsendRequestType', + 'FordelingsobjektAfsendResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsobjektAfsendResponseType', + 'FordelingskvitteringModtagRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingskvitteringModtagRequestType', + 'FordelingskvitteringModtagResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingskvitteringModtagResponseType', + 'FordelingsmodtagerListRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsmodtagerListRequestType', + 'FordelingsmodtagerListResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsmodtagerListResponseType', + 'FordelingsmodtagerValiderRequestType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsmodtagerValiderRequestType', + 'FordelingsmodtagerValiderResponseType' => '\\ItkDev\\Serviceplatformen\\SF2900\\StructType\\FordelingsmodtagerValiderResponseType', + ]; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/AktoerTypeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/AktoerTypeType.php new file mode 100644 index 00000000..69fc5975 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/EnumType/AktoerTypeType.php @@ -0,0 +1,66 @@ +setResult($resultFordelingskvitteringModtag = $this->getSoapClient()->__soapCall('FordelingskvitteringModtag', [ + $request, + ], [], [], $this->outputHeaders)); + + return $resultFordelingskvitteringModtag; + } catch (SoapFault $soapFault) { + $this->saveLastError(__METHOD__, $soapFault); + + return false; + } + } + /** + * Returns the result + * @see SoapClientBase::getResult() + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagResponseType + */ + public function getResult() + { + return parent::getResult(); + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsmodtager.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsmodtager.php new file mode 100644 index 00000000..6e8fbba6 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsmodtager.php @@ -0,0 +1,69 @@ +setResult($resultFordelingsmodtagerList = $this->getSoapClient()->__soapCall('FordelingsmodtagerList', [ + $request, + ], [], [], $this->outputHeaders)); + + return $resultFordelingsmodtagerList; + } catch (SoapFault $soapFault) { + $this->saveLastError(__METHOD__, $soapFault); + + return false; + } + } + /** + * Method to call the operation originally named FordelingsmodtagerValider + * @uses SoapClientBase::getSoapClient() + * @uses SoapClientBase::setResult() + * @uses SoapClientBase::saveLastError() + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderRequestType $request + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderResponseType|bool + */ + public function FordelingsmodtagerValider(\ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderRequestType $request) + { + try { + $this->setResult($resultFordelingsmodtagerValider = $this->getSoapClient()->__soapCall('FordelingsmodtagerValider', [ + $request, + ], [], [], $this->outputHeaders)); + + return $resultFordelingsmodtagerValider; + } catch (SoapFault $soapFault) { + $this->saveLastError(__METHOD__, $soapFault); + + return false; + } + } + /** + * Returns the result + * @see SoapClientBase::getResult() + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListResponseType|\ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderResponseType + */ + public function getResult() + { + return parent::getResult(); + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsobjekt.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsobjekt.php new file mode 100644 index 00000000..7cdba9d9 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/ServiceType/Fordelingsobjekt.php @@ -0,0 +1,47 @@ +setResult($resultFordelingsobjektAfsend = $this->getSoapClient()->__soapCall('FordelingsobjektAfsend', [ + $request, + ], [], [], $this->outputHeaders)); + + return $resultFordelingsobjektAfsend; + } catch (SoapFault $soapFault) { + $this->saveLastError(__METHOD__, $soapFault); + + return false; + } + } + /** + * Returns the result + * @see SoapClientBase::getResult() + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendResponseType + */ + public function getResult() + { + return parent::getResult(); + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AnmodRequestType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AnmodRequestType.php new file mode 100644 index 00000000..9e8a833c --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AnmodRequestType.php @@ -0,0 +1,84 @@ +setDistributionContext($distributionContext) + ->setDistributionObject($distributionObject); + } + /** + * Get DistributionContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function getDistributionContext(): \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + { + return $this->DistributionContext; + } + /** + * Set DistributionContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType + */ + public function setDistributionContext(\ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext): self + { + $this->DistributionContext = $distributionContext; + + return $this; + } + /** + * Get DistributionObject value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType + */ + public function getDistributionObject(): \ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType + { + return $this->DistributionObject; + } + /** + * Set DistributionObject value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType $distributionObject + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType + */ + public function setDistributionObject(\ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType $distributionObject): self + { + $this->DistributionObject = $distributionObject; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterListeType.php new file mode 100644 index 00000000..badf1e1f --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterListeType.php @@ -0,0 +1,102 @@ +setAttributter($attributter); + } + /** + * Get Attributter value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType[] + */ + public function getAttributter(): array + { + return $this->Attributter; + } + /** + * This method is responsible for validating the value(s) passed to the setAttributter method + * This method is willingly generated in order to preserve the one-line inline validation within the setAttributter method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateAttributterForArrayConstraintFromSetAttributter(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $attributterListeTypeAttributterItem) { + // validation for constraint: itemType + if (!$attributterListeTypeAttributterItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType) { + $invalidValues[] = is_object($attributterListeTypeAttributterItem) ? get_class($attributterListeTypeAttributterItem) : sprintf('%s(%s)', gettype($attributterListeTypeAttributterItem), var_export($attributterListeTypeAttributterItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The Attributter property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set Attributter value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType[] $attributter + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType + */ + public function setAttributter(array $attributter): self + { + // validation for constraint: array + if ('' !== ($attributterArrayErrorMessage = self::validateAttributterForArrayConstraintFromSetAttributter($attributter))) { + throw new InvalidArgumentException($attributterArrayErrorMessage, __LINE__); + } + $this->Attributter = $attributter; + + return $this; + } + /** + * Add item to Attributter value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType + */ + public function addToAttributter(\ItkDev\Serviceplatformen\SF2900\StructType\AttributterType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType) { + throw new InvalidArgumentException(sprintf('The Attributter property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->Attributter[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterType.php new file mode 100644 index 00000000..be789140 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AttributterType.php @@ -0,0 +1,430 @@ +setBrugervendtNoegleTekst($brugervendtNoegleTekst) + ->setTitelTekst($titelTekst) + ->setBeskrivelseTekst($beskrivelseTekst) + ->setDokumenttype($dokumenttype) + ->setRetning($retning) + ->setBrevdato($brevdato) + ->setVirkning($virkning) + ->setFristdato($fristdato) + ->setVersionIdentifikator($versionIdentifikator) + ->setUnderversionIdentificator($underversionIdentificator) + ->setKassationskodeTekst($kassationskodeTekst) + ->setOffentlighedUndtaget($offentlighedUndtaget); + } + /** + * Get BrugervendtNoegleTekst value + * @return string + */ + public function getBrugervendtNoegleTekst(): string + { + return $this->BrugervendtNoegleTekst; + } + /** + * Set BrugervendtNoegleTekst value + * @param string $brugervendtNoegleTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setBrugervendtNoegleTekst(string $brugervendtNoegleTekst): self + { + // validation for constraint: string + if (!is_null($brugervendtNoegleTekst) && !is_string($brugervendtNoegleTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brugervendtNoegleTekst, true), gettype($brugervendtNoegleTekst)), __LINE__); + } + $this->BrugervendtNoegleTekst = $brugervendtNoegleTekst; + + return $this; + } + /** + * Get TitelTekst value + * @return string + */ + public function getTitelTekst(): string + { + return $this->TitelTekst; + } + /** + * Set TitelTekst value + * @param string $titelTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setTitelTekst(string $titelTekst): self + { + // validation for constraint: string + if (!is_null($titelTekst) && !is_string($titelTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($titelTekst, true), gettype($titelTekst)), __LINE__); + } + $this->TitelTekst = $titelTekst; + + return $this; + } + /** + * Get BeskrivelseTekst value + * @return string + */ + public function getBeskrivelseTekst(): string + { + return $this->BeskrivelseTekst; + } + /** + * Set BeskrivelseTekst value + * @param string $beskrivelseTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setBeskrivelseTekst(string $beskrivelseTekst): self + { + // validation for constraint: string + if (!is_null($beskrivelseTekst) && !is_string($beskrivelseTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($beskrivelseTekst, true), gettype($beskrivelseTekst)), __LINE__); + } + $this->BeskrivelseTekst = $beskrivelseTekst; + + return $this; + } + /** + * Get Dokumenttype value + * @return string + */ + public function getDokumenttype(): string + { + return $this->Dokumenttype; + } + /** + * Set Dokumenttype value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\DokumenttypeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\DokumenttypeType::getValidValues() + * @throws InvalidArgumentException + * @param string $dokumenttype + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setDokumenttype(string $dokumenttype): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\DokumenttypeType::valueIsValid($dokumenttype)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\DokumenttypeType', is_array($dokumenttype) ? implode(', ', $dokumenttype) : var_export($dokumenttype, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\DokumenttypeType::getValidValues())), __LINE__); + } + $this->Dokumenttype = $dokumenttype; + + return $this; + } + /** + * Get Retning value + * @return string + */ + public function getRetning(): string + { + return $this->Retning; + } + /** + * Set Retning value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\RetningType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\RetningType::getValidValues() + * @throws InvalidArgumentException + * @param string $retning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setRetning(string $retning): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\RetningType::valueIsValid($retning)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\RetningType', is_array($retning) ? implode(', ', $retning) : var_export($retning, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\RetningType::getValidValues())), __LINE__); + } + $this->Retning = $retning; + + return $this; + } + /** + * Get Brevdato value + * @return string + */ + public function getBrevdato(): string + { + return $this->Brevdato; + } + /** + * Set Brevdato value + * @param string $brevdato + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setBrevdato(string $brevdato): self + { + // validation for constraint: string + if (!is_null($brevdato) && !is_string($brevdato)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brevdato, true), gettype($brevdato)), __LINE__); + } + $this->Brevdato = $brevdato; + + return $this; + } + /** + * Get Virkning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function getVirkning(): \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + { + return $this->Virkning; + } + /** + * Set Virkning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setVirkning(\ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning): self + { + $this->Virkning = $virkning; + + return $this; + } + /** + * Get Fristdato value + * @return string|null + */ + public function getFristdato(): ?string + { + return $this->Fristdato; + } + /** + * Set Fristdato value + * @param string $fristdato + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setFristdato(?string $fristdato = null): self + { + // validation for constraint: string + if (!is_null($fristdato) && !is_string($fristdato)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fristdato, true), gettype($fristdato)), __LINE__); + } + $this->Fristdato = $fristdato; + + return $this; + } + /** + * Get VersionIdentifikator value + * @return int|null + */ + public function getVersionIdentifikator(): ?int + { + return $this->VersionIdentifikator; + } + /** + * Set VersionIdentifikator value + * @param int $versionIdentifikator + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setVersionIdentifikator(?int $versionIdentifikator = null): self + { + // validation for constraint: int + if (!is_null($versionIdentifikator) && !(is_int($versionIdentifikator) || ctype_digit($versionIdentifikator))) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($versionIdentifikator, true), gettype($versionIdentifikator)), __LINE__); + } + $this->VersionIdentifikator = $versionIdentifikator; + + return $this; + } + /** + * Get UnderversionIdentificator value + * @return int|null + */ + public function getUnderversionIdentificator(): ?int + { + return $this->UnderversionIdentificator; + } + /** + * Set UnderversionIdentificator value + * @param int $underversionIdentificator + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setUnderversionIdentificator(?int $underversionIdentificator = null): self + { + // validation for constraint: int + if (!is_null($underversionIdentificator) && !(is_int($underversionIdentificator) || ctype_digit($underversionIdentificator))) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($underversionIdentificator, true), gettype($underversionIdentificator)), __LINE__); + } + $this->UnderversionIdentificator = $underversionIdentificator; + + return $this; + } + /** + * Get KassationskodeTekst value + * @return string|null + */ + public function getKassationskodeTekst(): ?string + { + return $this->KassationskodeTekst; + } + /** + * Set KassationskodeTekst value + * @param string $kassationskodeTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setKassationskodeTekst(?string $kassationskodeTekst = null): self + { + // validation for constraint: string + if (!is_null($kassationskodeTekst) && !is_string($kassationskodeTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($kassationskodeTekst, true), gettype($kassationskodeTekst)), __LINE__); + } + $this->KassationskodeTekst = $kassationskodeTekst; + + return $this; + } + /** + * Get OffentlighedUndtaget value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType|null + */ + public function getOffentlighedUndtaget(): ?\ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType + { + return $this->OffentlighedUndtaget; + } + /** + * Set OffentlighedUndtaget value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType $offentlighedUndtaget + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterType + */ + public function setOffentlighedUndtaget(?\ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType $offentlighedUndtaget = null): self + { + $this->OffentlighedUndtaget = $offentlighedUndtaget; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AuthorityContextType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AuthorityContextType.php new file mode 100644 index 00000000..32f2a008 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/AuthorityContextType.php @@ -0,0 +1,64 @@ +setMunicipalityCVR($municipalityCVR); + } + /** + * Get MunicipalityCVR value + * @return string + */ + public function getMunicipalityCVR(): string + { + return $this->MunicipalityCVR; + } + /** + * Set MunicipalityCVR value + * @param string $municipalityCVR + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType + */ + public function setMunicipalityCVR(string $municipalityCVR): self + { + // validation for constraint: string + if (!is_null($municipalityCVR) && !is_string($municipalityCVR)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($municipalityCVR, true), gettype($municipalityCVR)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($municipalityCVR) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $municipalityCVR)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($municipalityCVR, true)), __LINE__); + } + $this->MunicipalityCVR = $municipalityCVR; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/CallContextType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/CallContextType.php new file mode 100644 index 00000000..75d55d5b --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/CallContextType.php @@ -0,0 +1,147 @@ +setOnBehalfOfUser($onBehalfOfUser) + ->setCallersServiceCallIdentifier($callersServiceCallIdentifier) + ->setAccountingInfo($accountingInfo); + } + /** + * Get OnBehalfOfUser value + * @return string|null + */ + public function getOnBehalfOfUser(): ?string + { + return $this->OnBehalfOfUser; + } + /** + * Set OnBehalfOfUser value + * @param string $onBehalfOfUser + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + */ + public function setOnBehalfOfUser(?string $onBehalfOfUser = null): self + { + // validation for constraint: string + if (!is_null($onBehalfOfUser) && !is_string($onBehalfOfUser)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($onBehalfOfUser, true), gettype($onBehalfOfUser)), __LINE__); + } + // validation for constraint: maxLength(255) + if (!is_null($onBehalfOfUser) && mb_strlen((string) $onBehalfOfUser) > 255) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 255', mb_strlen((string) $onBehalfOfUser)), __LINE__); + } + $this->OnBehalfOfUser = $onBehalfOfUser; + + return $this; + } + /** + * Get CallersServiceCallIdentifier value + * @return string|null + */ + public function getCallersServiceCallIdentifier(): ?string + { + return $this->CallersServiceCallIdentifier; + } + /** + * Set CallersServiceCallIdentifier value + * @param string $callersServiceCallIdentifier + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + */ + public function setCallersServiceCallIdentifier(?string $callersServiceCallIdentifier = null): self + { + // validation for constraint: string + if (!is_null($callersServiceCallIdentifier) && !is_string($callersServiceCallIdentifier)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callersServiceCallIdentifier, true), gettype($callersServiceCallIdentifier)), __LINE__); + } + // validation for constraint: maxLength(255) + if (!is_null($callersServiceCallIdentifier) && mb_strlen((string) $callersServiceCallIdentifier) > 255) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 255', mb_strlen((string) $callersServiceCallIdentifier)), __LINE__); + } + $this->CallersServiceCallIdentifier = $callersServiceCallIdentifier; + + return $this; + } + /** + * Get AccountingInfo value + * @return string|null + */ + public function getAccountingInfo(): ?string + { + return $this->AccountingInfo; + } + /** + * Set AccountingInfo value + * @param string $accountingInfo + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + */ + public function setAccountingInfo(?string $accountingInfo = null): self + { + // validation for constraint: string + if (!is_null($accountingInfo) && !is_string($accountingInfo)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($accountingInfo, true), gettype($accountingInfo)), __LINE__); + } + // validation for constraint: maxLength(255) + if (!is_null($accountingInfo) && mb_strlen((string) $accountingInfo) > 255) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 255', mb_strlen((string) $accountingInfo)), __LINE__); + } + $this->AccountingInfo = $accountingInfo; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DelAttributterType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DelAttributterType.php new file mode 100644 index 00000000..159914c9 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DelAttributterType.php @@ -0,0 +1,262 @@ +setDelTekst($delTekst) + ->setIndeks($indeks) + ->setIndhold($indhold) + ->setFilstoerrelse($filstoerrelse) + ->setMimeType($mimeType) + ->setScannerID($scannerID) + ->setLocation($location); + } + /** + * Get DelTekst value + * @return string + */ + public function getDelTekst(): string + { + return $this->DelTekst; + } + /** + * Set DelTekst value + * @param string $delTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setDelTekst(string $delTekst): self + { + // validation for constraint: string + if (!is_null($delTekst) && !is_string($delTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($delTekst, true), gettype($delTekst)), __LINE__); + } + $this->DelTekst = $delTekst; + + return $this; + } + /** + * Get Indeks value + * @return int|null + */ + public function getIndeks(): ?int + { + return $this->Indeks; + } + /** + * Set Indeks value + * @param int $indeks + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setIndeks(?int $indeks = null): self + { + // validation for constraint: int + if (!is_null($indeks) && !(is_int($indeks) || ctype_digit($indeks))) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($indeks, true), gettype($indeks)), __LINE__); + } + $this->Indeks = $indeks; + + return $this; + } + /** + * Get Indhold value + * @return string|null + */ + public function getIndhold(): ?string + { + return $this->Indhold; + } + /** + * Set Indhold value + * @param string $indhold + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setIndhold(?string $indhold = null): self + { + // validation for constraint: string + if (!is_null($indhold) && !is_string($indhold)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($indhold, true), gettype($indhold)), __LINE__); + } + $this->Indhold = $indhold; + + return $this; + } + /** + * Get Filstoerrelse value + * @return int|null + */ + public function getFilstoerrelse(): ?int + { + return $this->Filstoerrelse; + } + /** + * Set Filstoerrelse value + * @param int $filstoerrelse + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setFilstoerrelse(?int $filstoerrelse = null): self + { + // validation for constraint: int + if (!is_null($filstoerrelse) && !(is_int($filstoerrelse) || ctype_digit($filstoerrelse))) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($filstoerrelse, true), gettype($filstoerrelse)), __LINE__); + } + $this->Filstoerrelse = $filstoerrelse; + + return $this; + } + /** + * Get MimeType value + * @return string|null + */ + public function getMimeType(): ?string + { + return $this->MimeType; + } + /** + * Set MimeType value + * @param string $mimeType + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setMimeType(?string $mimeType = null): self + { + // validation for constraint: string + if (!is_null($mimeType) && !is_string($mimeType)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($mimeType, true), gettype($mimeType)), __LINE__); + } + $this->MimeType = $mimeType; + + return $this; + } + /** + * Get ScannerID value + * @return string|null + */ + public function getScannerID(): ?string + { + return $this->ScannerID; + } + /** + * Set ScannerID value + * @param string $scannerID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setScannerID(?string $scannerID = null): self + { + // validation for constraint: string + if (!is_null($scannerID) && !is_string($scannerID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($scannerID, true), gettype($scannerID)), __LINE__); + } + $this->ScannerID = $scannerID; + + return $this; + } + /** + * Get Location value + * @return string|null + */ + public function getLocation(): ?string + { + return $this->Location; + } + /** + * Set Location value + * @param string $location + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function setLocation(?string $location = null): self + { + // validation for constraint: string + if (!is_null($location) && !is_string($location)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($location, true), gettype($location)), __LINE__); + } + $this->Location = $location; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionContextType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionContextType.php new file mode 100644 index 00000000..915260b6 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionContextType.php @@ -0,0 +1,282 @@ +setAnvenderTransaktionsID($anvenderTransaktionsID) + ->setAfsendendeMyndighed($afsendendeMyndighed) + ->setRoutingMyndighed($routingMyndighed) + ->setRoutingValg($routingValg) + ->setDistributionTransktionsID($distributionTransktionsID) + ->setDigitalPostMeddelelsesID($digitalPostMeddelelsesID) + ->setDokumentFilNavn($dokumentFilNavn); + } + /** + * Get AnvenderTransaktionsID value + * @return string + */ + public function getAnvenderTransaktionsID(): string + { + return $this->AnvenderTransaktionsID; + } + /** + * Set AnvenderTransaktionsID value + * @param string $anvenderTransaktionsID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setAnvenderTransaktionsID(string $anvenderTransaktionsID): self + { + // validation for constraint: string + if (!is_null($anvenderTransaktionsID) && !is_string($anvenderTransaktionsID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($anvenderTransaktionsID, true), gettype($anvenderTransaktionsID)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($anvenderTransaktionsID) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $anvenderTransaktionsID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($anvenderTransaktionsID, true)), __LINE__); + } + $this->AnvenderTransaktionsID = $anvenderTransaktionsID; + + return $this; + } + /** + * Get AfsendendeMyndighed value + * @return string + */ + public function getAfsendendeMyndighed(): string + { + return $this->AfsendendeMyndighed; + } + /** + * Set AfsendendeMyndighed value + * @param string $afsendendeMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setAfsendendeMyndighed(string $afsendendeMyndighed): self + { + // validation for constraint: string + if (!is_null($afsendendeMyndighed) && !is_string($afsendendeMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($afsendendeMyndighed, true), gettype($afsendendeMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($afsendendeMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $afsendendeMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($afsendendeMyndighed, true)), __LINE__); + } + $this->AfsendendeMyndighed = $afsendendeMyndighed; + + return $this; + } + /** + * Get RoutingMyndighed value + * @return string + */ + public function getRoutingMyndighed(): string + { + return $this->RoutingMyndighed; + } + /** + * Set RoutingMyndighed value + * @param string $routingMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setRoutingMyndighed(string $routingMyndighed): self + { + // validation for constraint: string + if (!is_null($routingMyndighed) && !is_string($routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingMyndighed, true), gettype($routingMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($routingMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($routingMyndighed, true)), __LINE__); + } + $this->RoutingMyndighed = $routingMyndighed; + + return $this; + } + /** + * Get RoutingValg value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg + */ + public function getRoutingValg(): \ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg + { + return $this->RoutingValg; + } + /** + * Set RoutingValg value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg $routingValg + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setRoutingValg(\ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg $routingValg): self + { + $this->RoutingValg = $routingValg; + + return $this; + } + /** + * Get DistributionTransktionsID value + * @return string|null + */ + public function getDistributionTransktionsID(): ?string + { + return $this->DistributionTransktionsID; + } + /** + * Set DistributionTransktionsID value + * @param string $distributionTransktionsID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setDistributionTransktionsID(?string $distributionTransktionsID = null): self + { + // validation for constraint: string + if (!is_null($distributionTransktionsID) && !is_string($distributionTransktionsID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($distributionTransktionsID, true), gettype($distributionTransktionsID)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($distributionTransktionsID) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $distributionTransktionsID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($distributionTransktionsID, true)), __LINE__); + } + $this->DistributionTransktionsID = $distributionTransktionsID; + + return $this; + } + /** + * Get DigitalPostMeddelelsesID value + * @return string|null + */ + public function getDigitalPostMeddelelsesID(): ?string + { + return $this->DigitalPostMeddelelsesID; + } + /** + * Set DigitalPostMeddelelsesID value + * @param string $digitalPostMeddelelsesID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setDigitalPostMeddelelsesID(?string $digitalPostMeddelelsesID = null): self + { + // validation for constraint: string + if (!is_null($digitalPostMeddelelsesID) && !is_string($digitalPostMeddelelsesID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($digitalPostMeddelelsesID, true), gettype($digitalPostMeddelelsesID)), __LINE__); + } + $this->DigitalPostMeddelelsesID = $digitalPostMeddelelsesID; + + return $this; + } + /** + * Get DokumentFilNavn value + * @return string|null + */ + public function getDokumentFilNavn(): ?string + { + return $this->DokumentFilNavn; + } + /** + * Set DokumentFilNavn value + * @param string $dokumentFilNavn + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function setDokumentFilNavn(?string $dokumentFilNavn = null): self + { + // validation for constraint: string + if (!is_null($dokumentFilNavn) && !is_string($dokumentFilNavn)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($dokumentFilNavn, true), gettype($dokumentFilNavn)), __LINE__); + } + $this->DokumentFilNavn = $dokumentFilNavn; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionDokumentType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionDokumentType.php new file mode 100644 index 00000000..0e5744e4 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionDokumentType.php @@ -0,0 +1,214 @@ +setID($iD) + ->setKLEEmneForslag($kLEEmneForslag) + ->setRegistrering($registrering) + ->setHandlingFacetForslag($handlingFacetForslag) + ->setSagForslag($sagForslag); + } + /** + * Get ID value + * @return string + */ + public function getID(): string + { + return $this->ID; + } + /** + * Set ID value + * @param string $iD + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType + */ + public function setID(string $iD): self + { + // validation for constraint: string + if (!is_null($iD) && !is_string($iD)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($iD, true), gettype($iD)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($iD) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $iD)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($iD, true)), __LINE__); + } + $this->ID = $iD; + + return $this; + } + /** + * Get KLEEmneForslag value + * @return string + */ + public function getKLEEmneForslag(): string + { + return $this->KLEEmneForslag; + } + /** + * Set KLEEmneForslag value + * @param string $kLEEmneForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType + */ + public function setKLEEmneForslag(string $kLEEmneForslag): self + { + // validation for constraint: string + if (!is_null($kLEEmneForslag) && !is_string($kLEEmneForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($kLEEmneForslag, true), gettype($kLEEmneForslag)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][.][0-9][0-9][.][0-9][0-9]) + if (!is_null($kLEEmneForslag) && !preg_match('/[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', (string) $kLEEmneForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', var_export($kLEEmneForslag, true)), __LINE__); + } + $this->KLEEmneForslag = $kLEEmneForslag; + + return $this; + } + /** + * Get Registrering value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function getRegistrering(): \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + { + return $this->Registrering; + } + /** + * Set Registrering value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType $registrering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType + */ + public function setRegistrering(\ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType $registrering): self + { + $this->Registrering = $registrering; + + return $this; + } + /** + * Get HandlingFacetForslag value + * @return string|null + */ + public function getHandlingFacetForslag(): ?string + { + return $this->HandlingFacetForslag; + } + /** + * Set HandlingFacetForslag value + * @param string $handlingFacetForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType + */ + public function setHandlingFacetForslag(?string $handlingFacetForslag = null): self + { + // validation for constraint: string + if (!is_null($handlingFacetForslag) && !is_string($handlingFacetForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($handlingFacetForslag, true), gettype($handlingFacetForslag)), __LINE__); + } + // validation for constraint: pattern([A-Z,Æ,Ø,Å][0-9][0-9]) + if (!is_null($handlingFacetForslag) && !preg_match('/[A-Z,Æ,Ø,Å][0-9][0-9]/', (string) $handlingFacetForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z,Æ,Ø,Å][0-9][0-9]/', var_export($handlingFacetForslag, true)), __LINE__); + } + $this->HandlingFacetForslag = $handlingFacetForslag; + + return $this; + } + /** + * Get SagForslag value + * @return string|null + */ + public function getSagForslag(): ?string + { + return $this->SagForslag; + } + /** + * Set SagForslag value + * @param string $sagForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType + */ + public function setSagForslag(?string $sagForslag = null): self + { + // validation for constraint: string + if (!is_null($sagForslag) && !is_string($sagForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($sagForslag, true), gettype($sagForslag)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($sagForslag) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $sagForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($sagForslag, true)), __LINE__); + } + $this->SagForslag = $sagForslag; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionFormularType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionFormularType.php new file mode 100644 index 00000000..312dd2e5 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionFormularType.php @@ -0,0 +1,174 @@ +setID($iD) + ->setKLEEmneForslag($kLEEmneForslag) + ->setMeddelelse($meddelelse) + ->setHandlingFacetForslag($handlingFacetForslag); + } + /** + * Get ID value + * @return string + */ + public function getID(): string + { + return $this->ID; + } + /** + * Set ID value + * @param string $iD + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType + */ + public function setID(string $iD): self + { + // validation for constraint: string + if (!is_null($iD) && !is_string($iD)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($iD, true), gettype($iD)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($iD) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $iD)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($iD, true)), __LINE__); + } + $this->ID = $iD; + + return $this; + } + /** + * Get KLEEmneForslag value + * @return string + */ + public function getKLEEmneForslag(): string + { + return $this->KLEEmneForslag; + } + /** + * Set KLEEmneForslag value + * @param string $kLEEmneForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType + */ + public function setKLEEmneForslag(string $kLEEmneForslag): self + { + // validation for constraint: string + if (!is_null($kLEEmneForslag) && !is_string($kLEEmneForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($kLEEmneForslag, true), gettype($kLEEmneForslag)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][.][0-9][0-9][.][0-9][0-9]) + if (!is_null($kLEEmneForslag) && !preg_match('/[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', (string) $kLEEmneForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', var_export($kLEEmneForslag, true)), __LINE__); + } + $this->KLEEmneForslag = $kLEEmneForslag; + + return $this; + } + /** + * Get Meddelelse value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\MeddelelseType + */ + public function getMeddelelse(): \ItkDev\Serviceplatformen\SF2900\StructType\MeddelelseType + { + return $this->Meddelelse; + } + /** + * Set Meddelelse value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\MeddelelseType $meddelelse + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType + */ + public function setMeddelelse(\ItkDev\Serviceplatformen\SF2900\StructType\MeddelelseType $meddelelse): self + { + $this->Meddelelse = $meddelelse; + + return $this; + } + /** + * Get HandlingFacetForslag value + * @return string|null + */ + public function getHandlingFacetForslag(): ?string + { + return $this->HandlingFacetForslag; + } + /** + * Set HandlingFacetForslag value + * @param string $handlingFacetForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType + */ + public function setHandlingFacetForslag(?string $handlingFacetForslag = null): self + { + // validation for constraint: string + if (!is_null($handlingFacetForslag) && !is_string($handlingFacetForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($handlingFacetForslag, true), gettype($handlingFacetForslag)), __LINE__); + } + // validation for constraint: pattern([A-Z,Æ,Ø,Å][0-9][0-9]) + if (!is_null($handlingFacetForslag) && !preg_match('/[A-Z,Æ,Ø,Å][0-9][0-9]/', (string) $handlingFacetForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z,Æ,Ø,Å][0-9][0-9]/', var_export($handlingFacetForslag, true)), __LINE__); + } + $this->HandlingFacetForslag = $handlingFacetForslag; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionJournalPostType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionJournalPostType.php new file mode 100644 index 00000000..8ea94eef --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionJournalPostType.php @@ -0,0 +1,244 @@ +setID($iD) + ->setKLEEmneForslag($kLEEmneForslag) + ->setRegistrering($registrering) + ->setHandlingFacetForslag($handlingFacetForslag) + ->setSagForslag($sagForslag) + ->setPartAngivelse($partAngivelse); + } + /** + * Get ID value + * @return string + */ + public function getID(): string + { + return $this->ID; + } + /** + * Set ID value + * @param string $iD + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + */ + public function setID(string $iD): self + { + // validation for constraint: string + if (!is_null($iD) && !is_string($iD)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($iD, true), gettype($iD)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($iD) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $iD)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($iD, true)), __LINE__); + } + $this->ID = $iD; + + return $this; + } + /** + * Get KLEEmneForslag value + * @return string + */ + public function getKLEEmneForslag(): string + { + return $this->KLEEmneForslag; + } + /** + * Set KLEEmneForslag value + * @param string $kLEEmneForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + */ + public function setKLEEmneForslag(string $kLEEmneForslag): self + { + // validation for constraint: string + if (!is_null($kLEEmneForslag) && !is_string($kLEEmneForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($kLEEmneForslag, true), gettype($kLEEmneForslag)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][.][0-9][0-9][.][0-9][0-9]) + if (!is_null($kLEEmneForslag) && !preg_match('/[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', (string) $kLEEmneForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', var_export($kLEEmneForslag, true)), __LINE__); + } + $this->KLEEmneForslag = $kLEEmneForslag; + + return $this; + } + /** + * Get Registrering value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function getRegistrering(): \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + { + return $this->Registrering; + } + /** + * Set Registrering value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType $registrering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + */ + public function setRegistrering(\ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType $registrering): self + { + $this->Registrering = $registrering; + + return $this; + } + /** + * Get HandlingFacetForslag value + * @return string|null + */ + public function getHandlingFacetForslag(): ?string + { + return $this->HandlingFacetForslag; + } + /** + * Set HandlingFacetForslag value + * @param string $handlingFacetForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + */ + public function setHandlingFacetForslag(?string $handlingFacetForslag = null): self + { + // validation for constraint: string + if (!is_null($handlingFacetForslag) && !is_string($handlingFacetForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($handlingFacetForslag, true), gettype($handlingFacetForslag)), __LINE__); + } + // validation for constraint: pattern([A-Z,Æ,Ø,Å][0-9][0-9]) + if (!is_null($handlingFacetForslag) && !preg_match('/[A-Z,Æ,Ø,Å][0-9][0-9]/', (string) $handlingFacetForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z,Æ,Ø,Å][0-9][0-9]/', var_export($handlingFacetForslag, true)), __LINE__); + } + $this->HandlingFacetForslag = $handlingFacetForslag; + + return $this; + } + /** + * Get SagForslag value + * @return string|null + */ + public function getSagForslag(): ?string + { + return $this->SagForslag; + } + /** + * Set SagForslag value + * @param string $sagForslag + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + */ + public function setSagForslag(?string $sagForslag = null): self + { + // validation for constraint: string + if (!is_null($sagForslag) && !is_string($sagForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($sagForslag, true), gettype($sagForslag)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($sagForslag) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $sagForslag)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($sagForslag, true)), __LINE__); + } + $this->SagForslag = $sagForslag; + + return $this; + } + /** + * Get PartAngivelse value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\PartType|null + */ + public function getPartAngivelse(): ?\ItkDev\Serviceplatformen\SF2900\StructType\PartType + { + return $this->PartAngivelse; + } + /** + * Set PartAngivelse value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\PartType $partAngivelse + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + */ + public function setPartAngivelse(?\ItkDev\Serviceplatformen\SF2900\StructType\PartType $partAngivelse = null): self + { + $this->PartAngivelse = $partAngivelse; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionObjectType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionObjectType.php new file mode 100644 index 00000000..699a6a19 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DistributionObjectType.php @@ -0,0 +1,91 @@ +setObjektType($objektType) + ->setObjektIndhold($objektIndhold); + } + /** + * Get ObjektType value + * @return string + */ + public function getObjektType(): string + { + return $this->ObjektType; + } + /** + * Set ObjektType value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\ObjektTypeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\ObjektTypeType::getValidValues() + * @throws InvalidArgumentException + * @param string $objektType + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType + */ + public function setObjektType(string $objektType): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\ObjektTypeType::valueIsValid($objektType)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\ObjektTypeType', is_array($objektType) ? implode(', ', $objektType) : var_export($objektType, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\ObjektTypeType::getValidValues())), __LINE__); + } + $this->ObjektType = $objektType; + + return $this; + } + /** + * Get ObjektIndhold value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType + */ + public function getObjektIndhold(): \ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType + { + return $this->ObjektIndhold; + } + /** + * Set ObjektIndhold value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType $objektIndhold + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType + */ + public function setObjektIndhold(\ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType $objektIndhold): self + { + $this->ObjektIndhold = $objektIndhold; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartListeType.php new file mode 100644 index 00000000..9358e84a --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartListeType.php @@ -0,0 +1,102 @@ +setDokumentPart($dokumentPart); + } + /** + * Get DokumentPart value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType[] + */ + public function getDokumentPart(): array + { + return $this->DokumentPart; + } + /** + * This method is responsible for validating the value(s) passed to the setDokumentPart method + * This method is willingly generated in order to preserve the one-line inline validation within the setDokumentPart method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateDokumentPartForArrayConstraintFromSetDokumentPart(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $dokumentPartListeTypeDokumentPartItem) { + // validation for constraint: itemType + if (!$dokumentPartListeTypeDokumentPartItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType) { + $invalidValues[] = is_object($dokumentPartListeTypeDokumentPartItem) ? get_class($dokumentPartListeTypeDokumentPartItem) : sprintf('%s(%s)', gettype($dokumentPartListeTypeDokumentPartItem), var_export($dokumentPartListeTypeDokumentPartItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The DokumentPart property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set DokumentPart value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType[] $dokumentPart + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartListeType + */ + public function setDokumentPart(array $dokumentPart): self + { + // validation for constraint: array + if ('' !== ($dokumentPartArrayErrorMessage = self::validateDokumentPartForArrayConstraintFromSetDokumentPart($dokumentPart))) { + throw new InvalidArgumentException($dokumentPartArrayErrorMessage, __LINE__); + } + $this->DokumentPart = $dokumentPart; + + return $this; + } + /** + * Add item to DokumentPart value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartListeType + */ + public function addToDokumentPart(\ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType) { + throw new InvalidArgumentException(sprintf('The DokumentPart property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->DokumentPart[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartType.php new file mode 100644 index 00000000..c6dc4afd --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentPartType.php @@ -0,0 +1,155 @@ +setVirkning($virkning) + ->setRolle($rolle) + ->setIndeks($indeks) + ->setPart($part); + } + /** + * Get Virkning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function getVirkning(): \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + { + return $this->Virkning; + } + /** + * Set Virkning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType + */ + public function setVirkning(\ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning): self + { + $this->Virkning = $virkning; + + return $this; + } + /** + * Get Rolle value + * @return string + */ + public function getRolle(): string + { + return $this->Rolle; + } + /** + * Set Rolle value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\DokumentPartRolleType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\DokumentPartRolleType::getValidValues() + * @throws InvalidArgumentException + * @param string $rolle + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType + */ + public function setRolle(string $rolle): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\DokumentPartRolleType::valueIsValid($rolle)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\DokumentPartRolleType', is_array($rolle) ? implode(', ', $rolle) : var_export($rolle, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\DokumentPartRolleType::getValidValues())), __LINE__); + } + $this->Rolle = $rolle; + + return $this; + } + /** + * Get Indeks value + * @return int + */ + public function getIndeks(): int + { + return $this->Indeks; + } + /** + * Set Indeks value + * @param int $indeks + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType + */ + public function setIndeks(int $indeks): self + { + // validation for constraint: int + if (!is_null($indeks) && !(is_int($indeks) || ctype_digit($indeks))) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($indeks, true), gettype($indeks)), __LINE__); + } + $this->Indeks = $indeks; + + return $this; + } + /** + * Get Part value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\PartType + */ + public function getPart(): \ItkDev\Serviceplatformen\SF2900\StructType\PartType + { + return $this->Part; + } + /** + * Set Part value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\PartType $part + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartType + */ + public function setPart(\ItkDev\Serviceplatformen\SF2900\StructType\PartType $part): self + { + $this->Part = $part; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentRegistreringType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentRegistreringType.php new file mode 100644 index 00000000..db03bf1f --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/DokumentRegistreringType.php @@ -0,0 +1,327 @@ +setFraTidsPunkt($fraTidsPunkt) + ->setLivscyklusKode($livscyklusKode) + ->setRegistreringItSystem($registreringItSystem) + ->setRelationListe($relationListe) + ->setTilstandsListe($tilstandsListe) + ->setAttributListe($attributListe) + ->setImportTidspunkt($importTidspunkt) + ->setBrugerRef($brugerRef); + } + /** + * Get FraTidsPunkt value + * @return string + */ + public function getFraTidsPunkt(): string + { + return $this->FraTidsPunkt; + } + /** + * Set FraTidsPunkt value + * @param string $fraTidsPunkt + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setFraTidsPunkt(string $fraTidsPunkt): self + { + // validation for constraint: string + if (!is_null($fraTidsPunkt) && !is_string($fraTidsPunkt)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fraTidsPunkt, true), gettype($fraTidsPunkt)), __LINE__); + } + $this->FraTidsPunkt = $fraTidsPunkt; + + return $this; + } + /** + * Get LivscyklusKode value + * @return string + */ + public function getLivscyklusKode(): string + { + return $this->LivscyklusKode; + } + /** + * Set LivscyklusKode value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::getValidValues() + * @throws InvalidArgumentException + * @param string $livscyklusKode + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setLivscyklusKode(string $livscyklusKode): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::valueIsValid($livscyklusKode)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType', is_array($livscyklusKode) ? implode(', ', $livscyklusKode) : var_export($livscyklusKode, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::getValidValues())), __LINE__); + } + $this->LivscyklusKode = $livscyklusKode; + + return $this; + } + /** + * Get RegistreringItSystem value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + */ + public function getRegistreringItSystem(): \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + { + return $this->RegistreringItSystem; + } + /** + * Set RegistreringItSystem value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $registreringItSystem + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setRegistreringItSystem(\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $registreringItSystem): self + { + $this->RegistreringItSystem = $registreringItSystem; + + return $this; + } + /** + * Get RelationListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe + */ + public function getRelationListe(): \ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe + { + return $this->RelationListe; + } + /** + * Set RelationListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe $relationListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setRelationListe(\ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe $relationListe): self + { + $this->RelationListe = $relationListe; + + return $this; + } + /** + * Get TilstandsListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType[] + */ + public function getTilstandsListe(): array + { + return $this->TilstandsListe; + } + /** + * This method is responsible for validating the value(s) passed to the setTilstandsListe method + * This method is willingly generated in order to preserve the one-line inline validation within the setTilstandsListe method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateTilstandsListeForArrayConstraintFromSetTilstandsListe(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $dokumentRegistreringTypeTilstandsListeItem) { + // validation for constraint: itemType + if (!$dokumentRegistreringTypeTilstandsListeItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType) { + $invalidValues[] = is_object($dokumentRegistreringTypeTilstandsListeItem) ? get_class($dokumentRegistreringTypeTilstandsListeItem) : sprintf('%s(%s)', gettype($dokumentRegistreringTypeTilstandsListeItem), var_export($dokumentRegistreringTypeTilstandsListeItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The TilstandsListe property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set TilstandsListe value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType[] $tilstandsListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setTilstandsListe(array $tilstandsListe): self + { + // validation for constraint: array + if ('' !== ($tilstandsListeArrayErrorMessage = self::validateTilstandsListeForArrayConstraintFromSetTilstandsListe($tilstandsListe))) { + throw new InvalidArgumentException($tilstandsListeArrayErrorMessage, __LINE__); + } + $this->TilstandsListe = $tilstandsListe; + + return $this; + } + /** + * Add item to TilstandsListe value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function addToTilstandsListe(\ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType) { + throw new InvalidArgumentException(sprintf('The TilstandsListe property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->TilstandsListe[] = $item; + + return $this; + } + /** + * Get AttributListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType + */ + public function getAttributListe(): \ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType + { + return $this->AttributListe; + } + /** + * Set AttributListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType $attributListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setAttributListe(\ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType $attributListe): self + { + $this->AttributListe = $attributListe; + + return $this; + } + /** + * Get ImportTidspunkt value + * @return string|null + */ + public function getImportTidspunkt(): ?string + { + return $this->ImportTidspunkt; + } + /** + * Set ImportTidspunkt value + * @param string $importTidspunkt + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setImportTidspunkt(?string $importTidspunkt = null): self + { + // validation for constraint: string + if (!is_null($importTidspunkt) && !is_string($importTidspunkt)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($importTidspunkt, true), gettype($importTidspunkt)), __LINE__); + } + $this->ImportTidspunkt = $importTidspunkt; + + return $this; + } + /** + * Get BrugerRef value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN|null + */ + public function getBrugerRef(): ?\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + { + return $this->BrugerRef; + } + /** + * Set BrugerRef value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $brugerRef + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType + */ + public function setBrugerRef(?\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $brugerRef = null): self + { + $this->BrugerRef = $brugerRef; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlListeType.php new file mode 100644 index 00000000..9a4ae487 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlListeType.php @@ -0,0 +1,102 @@ +setFejl($fejl); + } + /** + * Get Fejl value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlType[] + */ + public function getFejl(): ?array + { + return $this->Fejl; + } + /** + * This method is responsible for validating the value(s) passed to the setFejl method + * This method is willingly generated in order to preserve the one-line inline validation within the setFejl method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateFejlForArrayConstraintFromSetFejl(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $fejlListeTypeFejlItem) { + // validation for constraint: itemType + if (!$fejlListeTypeFejlItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\FejlType) { + $invalidValues[] = is_object($fejlListeTypeFejlItem) ? get_class($fejlListeTypeFejlItem) : sprintf('%s(%s)', gettype($fejlListeTypeFejlItem), var_export($fejlListeTypeFejlItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The Fejl property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\FejlType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set Fejl value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FejlType[] $fejl + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType + */ + public function setFejl(?array $fejl = null): self + { + // validation for constraint: array + if ('' !== ($fejlArrayErrorMessage = self::validateFejlForArrayConstraintFromSetFejl($fejl))) { + throw new InvalidArgumentException($fejlArrayErrorMessage, __LINE__); + } + $this->Fejl = $fejl; + + return $this; + } + /** + * Add item to Fejl value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FejlType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType + */ + public function addToFejl(\ItkDev\Serviceplatformen\SF2900\StructType\FejlType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\FejlType) { + throw new InvalidArgumentException(sprintf('The Fejl property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\FejlType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->Fejl[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlType.php new file mode 100644 index 00000000..aebba370 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FejlType.php @@ -0,0 +1,92 @@ +setFejlKode($fejlKode) + ->setFejlTekst($fejlTekst); + } + /** + * Get FejlKode value + * @return string + */ + public function getFejlKode(): string + { + return $this->FejlKode; + } + /** + * Set FejlKode value + * @param string $fejlKode + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlType + */ + public function setFejlKode(string $fejlKode): self + { + // validation for constraint: string + if (!is_null($fejlKode) && !is_string($fejlKode)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fejlKode, true), gettype($fejlKode)), __LINE__); + } + $this->FejlKode = $fejlKode; + + return $this; + } + /** + * Get FejlTekst value + * @return string + */ + public function getFejlTekst(): string + { + return $this->FejlTekst; + } + /** + * Set FejlTekst value + * @param string $fejlTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlType + */ + public function setFejlTekst(string $fejlTekst): self + { + // validation for constraint: string + if (!is_null($fejlTekst) && !is_string($fejlTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fejlTekst, true), gettype($fejlTekst)), __LINE__); + } + $this->FejlTekst = $fejlTekst; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderRequestType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderRequestType.php new file mode 100644 index 00000000..86cd8aa9 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderRequestType.php @@ -0,0 +1,84 @@ +setForretningskvittering($forretningskvittering) + ->setDistributionContext($distributionContext); + } + /** + * Get Forretningskvittering value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function getForretningskvittering(): \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + { + return $this->Forretningskvittering; + } + /** + * Set Forretningskvittering value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningskvittering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagAnvenderRequestType + */ + public function setForretningskvittering(\ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningskvittering): self + { + $this->Forretningskvittering = $forretningskvittering; + + return $this; + } + /** + * Get DistributionContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function getDistributionContext(): \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + { + return $this->DistributionContext; + } + /** + * Set DistributionContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagAnvenderRequestType + */ + public function setDistributionContext(\ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext): self + { + $this->DistributionContext = $distributionContext; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderResponseType.php new file mode 100644 index 00000000..12bbc501 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagAnvenderResponseType.php @@ -0,0 +1,17 @@ +setForretningskvittering($forretningskvittering) + ->setDistributionContext($distributionContext) + ->setCallContext($callContext) + ->setAuthorityContext($authorityContext); + } + /** + * Get Forretningskvittering value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function getForretningskvittering(): \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + { + return $this->Forretningskvittering; + } + /** + * Set Forretningskvittering value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningskvittering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagRequestType + */ + public function setForretningskvittering(\ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningskvittering): self + { + $this->Forretningskvittering = $forretningskvittering; + + return $this; + } + /** + * Get DistributionContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function getDistributionContext(): \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + { + return $this->DistributionContext; + } + /** + * Set DistributionContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagRequestType + */ + public function setDistributionContext(\ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext): self + { + $this->DistributionContext = $distributionContext; + + return $this; + } + /** + * Get CallContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType|null + */ + public function getCallContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + { + return $this->CallContext; + } + /** + * Set CallContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagRequestType + */ + public function setCallContext(?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext = null): self + { + $this->CallContext = $callContext; + + return $this; + } + /** + * Get AuthorityContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType|null + */ + public function getAuthorityContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType + { + return $this->AuthorityContext; + } + /** + * Set AuthorityContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingskvitteringModtagRequestType + */ + public function setAuthorityContext(?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext = null): self + { + $this->AuthorityContext = $authorityContext; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagResponseType.php new file mode 100644 index 00000000..e547b5a6 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingskvitteringModtagResponseType.php @@ -0,0 +1,17 @@ +setAfsendendeMyndighed($afsendendeMyndighed) + ->setRoutingMyndighed($routingMyndighed) + ->setRoutingKLEEmne($routingKLEEmne) + ->setRoutingHandlingFacet($routingHandlingFacet); + } + /** + * Get AfsendendeMyndighed value + * @return string + */ + public function getAfsendendeMyndighed(): string + { + return $this->AfsendendeMyndighed; + } + /** + * Set AfsendendeMyndighed value + * @param string $afsendendeMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest + */ + public function setAfsendendeMyndighed(string $afsendendeMyndighed): self + { + // validation for constraint: string + if (!is_null($afsendendeMyndighed) && !is_string($afsendendeMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($afsendendeMyndighed, true), gettype($afsendendeMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($afsendendeMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $afsendendeMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($afsendendeMyndighed, true)), __LINE__); + } + $this->AfsendendeMyndighed = $afsendendeMyndighed; + + return $this; + } + /** + * Get RoutingMyndighed value + * @return string + */ + public function getRoutingMyndighed(): string + { + return $this->RoutingMyndighed; + } + /** + * Set RoutingMyndighed value + * @param string $routingMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest + */ + public function setRoutingMyndighed(string $routingMyndighed): self + { + // validation for constraint: string + if (!is_null($routingMyndighed) && !is_string($routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingMyndighed, true), gettype($routingMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($routingMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($routingMyndighed, true)), __LINE__); + } + $this->RoutingMyndighed = $routingMyndighed; + + return $this; + } + /** + * Get RoutingKLEEmne value + * @return string + */ + public function getRoutingKLEEmne(): string + { + return $this->RoutingKLEEmne; + } + /** + * Set RoutingKLEEmne value + * @param string $routingKLEEmne + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest + */ + public function setRoutingKLEEmne(string $routingKLEEmne): self + { + // validation for constraint: string + if (!is_null($routingKLEEmne) && !is_string($routingKLEEmne)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingKLEEmne, true), gettype($routingKLEEmne)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][.][0-9][0-9][.][0-9][0-9]) + if (!is_null($routingKLEEmne) && !preg_match('/[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', (string) $routingKLEEmne)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', var_export($routingKLEEmne, true)), __LINE__); + } + $this->RoutingKLEEmne = $routingKLEEmne; + + return $this; + } + /** + * Get RoutingHandlingFacet value + * @return string|null + */ + public function getRoutingHandlingFacet(): ?string + { + return $this->RoutingHandlingFacet; + } + /** + * Set RoutingHandlingFacet value + * @param string $routingHandlingFacet + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest + */ + public function setRoutingHandlingFacet(?string $routingHandlingFacet = null): self + { + // validation for constraint: string + if (!is_null($routingHandlingFacet) && !is_string($routingHandlingFacet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingHandlingFacet, true), gettype($routingHandlingFacet)), __LINE__); + } + // validation for constraint: pattern([A-Z,Æ,Ø,Å][0-9][0-9]) + if (!is_null($routingHandlingFacet) && !preg_match('/[A-Z,Æ,Ø,Å][0-9][0-9]/', (string) $routingHandlingFacet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z,Æ,Ø,Å][0-9][0-9]/', var_export($routingHandlingFacet, true)), __LINE__); + } + $this->RoutingHandlingFacet = $routingHandlingFacet; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListRequestType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListRequestType.php new file mode 100644 index 00000000..e42b0710 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListRequestType.php @@ -0,0 +1,116 @@ +setRouting($routing) + ->setCallContext($callContext) + ->setAuthorityContext($authorityContext); + } + /** + * Get Routing value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest + */ + public function getRouting(): \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest + { + return $this->Routing; + } + /** + * Set Routing value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest $routing + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequestType + */ + public function setRouting(\ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest $routing): self + { + $this->Routing = $routing; + + return $this; + } + /** + * Get CallContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType|null + */ + public function getCallContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + { + return $this->CallContext; + } + /** + * Set CallContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequestType + */ + public function setCallContext(?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext = null): self + { + $this->CallContext = $callContext; + + return $this; + } + /** + * Get AuthorityContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType|null + */ + public function getAuthorityContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType + { + return $this->AuthorityContext; + } + /** + * Set AuthorityContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequestType + */ + public function setAuthorityContext(?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext = null): self + { + $this->AuthorityContext = $authorityContext; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListResponseType.php new file mode 100644 index 00000000..20c35c2c --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerListResponseType.php @@ -0,0 +1,54 @@ +setSystemer($systemer); + } + /** + * Get Systemer value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilgaengeligeModtagereType + */ + public function getSystemer(): \ItkDev\Serviceplatformen\SF2900\StructType\TilgaengeligeModtagereType + { + return $this->Systemer; + } + /** + * Set Systemer value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\TilgaengeligeModtagereType $systemer + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListResponseType + */ + public function setSystemer(\ItkDev\Serviceplatformen\SF2900\StructType\TilgaengeligeModtagereType $systemer): self + { + $this->Systemer = $systemer; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderRequestType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderRequestType.php new file mode 100644 index 00000000..9d12ab45 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderRequestType.php @@ -0,0 +1,156 @@ +setAfsendendeMyndighed($afsendendeMyndighed) + ->setRoutingListe($routingListe) + ->setCallContext($callContext) + ->setAuthorityContext($authorityContext); + } + /** + * Get AfsendendeMyndighed value + * @return string + */ + public function getAfsendendeMyndighed(): string + { + return $this->AfsendendeMyndighed; + } + /** + * Set AfsendendeMyndighed value + * @param string $afsendendeMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderRequestType + */ + public function setAfsendendeMyndighed(string $afsendendeMyndighed): self + { + // validation for constraint: string + if (!is_null($afsendendeMyndighed) && !is_string($afsendendeMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($afsendendeMyndighed, true), gettype($afsendendeMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($afsendendeMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $afsendendeMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($afsendendeMyndighed, true)), __LINE__); + } + $this->AfsendendeMyndighed = $afsendendeMyndighed; + + return $this; + } + /** + * Get RoutingListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingListeType + */ + public function getRoutingListe(): \ItkDev\Serviceplatformen\SF2900\StructType\RoutingListeType + { + return $this->RoutingListe; + } + /** + * Set RoutingListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingListeType $routingListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderRequestType + */ + public function setRoutingListe(\ItkDev\Serviceplatformen\SF2900\StructType\RoutingListeType $routingListe): self + { + $this->RoutingListe = $routingListe; + + return $this; + } + /** + * Get CallContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType|null + */ + public function getCallContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + { + return $this->CallContext; + } + /** + * Set CallContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderRequestType + */ + public function setCallContext(?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext = null): self + { + $this->CallContext = $callContext; + + return $this; + } + /** + * Get AuthorityContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType|null + */ + public function getAuthorityContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType + { + return $this->AuthorityContext; + } + /** + * Set AuthorityContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderRequestType + */ + public function setAuthorityContext(?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext = null): self + { + $this->AuthorityContext = $authorityContext; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderResponseType.php new file mode 100644 index 00000000..f4708df6 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsmodtagerValiderResponseType.php @@ -0,0 +1,54 @@ +setRoutingListe($routingListe); + } + /** + * Get RoutingListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResposneListeType + */ + public function getRoutingListe(): \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResposneListeType + { + return $this->RoutingListe; + } + /** + * Set RoutingListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResposneListeType $routingListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerValiderResponseType + */ + public function setRoutingListe(\ItkDev\Serviceplatformen\SF2900\StructType\RoutingResposneListeType $routingListe): self + { + $this->RoutingListe = $routingListe; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendRequestType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendRequestType.php new file mode 100644 index 00000000..a7e19910 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendRequestType.php @@ -0,0 +1,116 @@ +setAnmodning($anmodning) + ->setCallContext($callContext) + ->setAuthorityContext($authorityContext); + } + /** + * Get anmodning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType + */ + public function getAnmodning(): \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType + { + return $this->anmodning; + } + /** + * Set anmodning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType $anmodning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendRequestType + */ + public function setAnmodning(\ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType $anmodning): self + { + $this->anmodning = $anmodning; + + return $this; + } + /** + * Get CallContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType|null + */ + public function getCallContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType + { + return $this->CallContext; + } + /** + * Set CallContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendRequestType + */ + public function setCallContext(?\ItkDev\Serviceplatformen\SF2900\StructType\CallContextType $callContext = null): self + { + $this->CallContext = $callContext; + + return $this; + } + /** + * Get AuthorityContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType|null + */ + public function getAuthorityContext(): ?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType + { + return $this->AuthorityContext; + } + /** + * Set AuthorityContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendRequestType + */ + public function setAuthorityContext(?\ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType $authorityContext = null): self + { + $this->AuthorityContext = $authorityContext; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendResponseType.php new file mode 100644 index 00000000..676eb9ae --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektAfsendResponseType.php @@ -0,0 +1,84 @@ +setForretningsKvittering($forretningsKvittering) + ->setDistributionContext($distributionContext); + } + /** + * Get ForretningsKvittering value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function getForretningsKvittering(): \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + { + return $this->ForretningsKvittering; + } + /** + * Set ForretningsKvittering value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningsKvittering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendResponseType + */ + public function setForretningsKvittering(\ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningsKvittering): self + { + $this->ForretningsKvittering = $forretningsKvittering; + + return $this; + } + /** + * Get DistributionContext value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + */ + public function getDistributionContext(): \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType + { + return $this->DistributionContext; + } + /** + * Set DistributionContext value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendResponseType + */ + public function setDistributionContext(\ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType $distributionContext): self + { + $this->DistributionContext = $distributionContext; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagRequestType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagRequestType.php new file mode 100644 index 00000000..a89e8ddd --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagRequestType.php @@ -0,0 +1,54 @@ +setAnmodning($anmodning); + } + /** + * Get anmodning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType + */ + public function getAnmodning(): \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType + { + return $this->anmodning; + } + /** + * Set anmodning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType $anmodning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektModtagRequestType + */ + public function setAnmodning(\ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType $anmodning): self + { + $this->anmodning = $anmodning; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagResponseType.php new file mode 100644 index 00000000..22e9afec --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FordelingsobjektModtagResponseType.php @@ -0,0 +1,54 @@ +setForretningsKvittering($forretningsKvittering); + } + /** + * Get ForretningsKvittering value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function getForretningsKvittering(): \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + { + return $this->ForretningsKvittering; + } + /** + * Set ForretningsKvittering value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningsKvittering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektModtagResponseType + */ + public function setForretningsKvittering(\ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType $forretningsKvittering): self + { + $this->ForretningsKvittering = $forretningsKvittering; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularType.php new file mode 100644 index 00000000..df58e516 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularType.php @@ -0,0 +1,156 @@ +setTitelTekst($titelTekst) + ->setFormatNavn($formatNavn) + ->setFormularIndhold($formularIndhold) + ->setFormularXML($formularXML); + } + /** + * Get TitelTekst value + * @return string + */ + public function getTitelTekst(): string + { + return $this->TitelTekst; + } + /** + * Set TitelTekst value + * @param string $titelTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularType + */ + public function setTitelTekst(string $titelTekst): self + { + // validation for constraint: string + if (!is_null($titelTekst) && !is_string($titelTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($titelTekst, true), gettype($titelTekst)), __LINE__); + } + $this->TitelTekst = $titelTekst; + + return $this; + } + /** + * Get FormatNavn value + * @return string + */ + public function getFormatNavn(): string + { + return $this->FormatNavn; + } + /** + * Set FormatNavn value + * @param string $formatNavn + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularType + */ + public function setFormatNavn(string $formatNavn): self + { + // validation for constraint: string + if (!is_null($formatNavn) && !is_string($formatNavn)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($formatNavn, true), gettype($formatNavn)), __LINE__); + } + $this->FormatNavn = $formatNavn; + + return $this; + } + /** + * Get FormularIndhold value + * @return string + */ + public function getFormularIndhold(): string + { + return $this->FormularIndhold; + } + /** + * Set FormularIndhold value + * @param string $formularIndhold + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularType + */ + public function setFormularIndhold(string $formularIndhold): self + { + // validation for constraint: string + if (!is_null($formularIndhold) && !is_string($formularIndhold)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($formularIndhold, true), gettype($formularIndhold)), __LINE__); + } + $this->FormularIndhold = $formularIndhold; + + return $this; + } + /** + * Get FormularXML value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularXMLType + */ + public function getFormularXML(): \ItkDev\Serviceplatformen\SF2900\StructType\FormularXMLType + { + return $this->FormularXML; + } + /** + * Set FormularXML value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FormularXMLType $formularXML + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularType + */ + public function setFormularXML(\ItkDev\Serviceplatformen\SF2900\StructType\FormularXMLType $formularXML): self + { + $this->FormularXML = $formularXML; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularXMLType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularXMLType.php new file mode 100644 index 00000000..ec4308a7 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/FormularXMLType.php @@ -0,0 +1,65 @@ +setAny($any); + } + /** + * Get any value + * @uses \DOMDocument::loadXML() + * @param bool $asDomDocument true: returns \DOMDocument, false: returns XML string + * @return \DOMDocument|string|null + */ + public function getAny(bool $asDomDocument = false) + { + $domDocument = null; + if (!empty($this->any) && $asDomDocument) { + $domDocument = new \DOMDocument('1.0', 'UTF-8'); + $domDocument->loadXML($this->any); + } + return $asDomDocument ? $domDocument : $this->any; + } + /** + * Set any value + * @uses \DOMDocument::hasChildNodes() + * @uses \DOMDocument::saveXML() + * @uses \DOMNode::item() + * @param \DOMDocument|string|null $any + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularXMLType + */ + public function setAny($any = null): self + { + // validation for constraint: xml + if (!is_null($any) && !$any instanceof \DOMDocument && (!is_string($any) || (is_string($any) && (empty($any) || (($anyDoc = new \DOMDocument()) && false === $anyDoc->loadXML($any)))))) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a valid XML string', var_export($any, true)), __LINE__); + } + $this->any = ($any instanceof \DOMDocument) ? $any->saveXML($any->hasChildNodes() ? $any->childNodes->item(0) : null) : $any; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ForretningskvitteringType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ForretningskvitteringType.php new file mode 100644 index 00000000..05489e69 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ForretningskvitteringType.php @@ -0,0 +1,162 @@ +setForretningsValideringsKode($forretningsValideringsKode) + ->setKvitteringstype($kvitteringstype) + ->setBegrundelse($begrundelse) + ->setFejlListe($fejlListe); + } + /** + * Get ForretningsValideringsKode value + * @return string + */ + public function getForretningsValideringsKode(): string + { + return $this->ForretningsValideringsKode; + } + /** + * Set ForretningsValideringsKode value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\ForretningsValideringsKodeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\ForretningsValideringsKodeType::getValidValues() + * @throws InvalidArgumentException + * @param string $forretningsValideringsKode + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function setForretningsValideringsKode(string $forretningsValideringsKode): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\ForretningsValideringsKodeType::valueIsValid($forretningsValideringsKode)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\ForretningsValideringsKodeType', is_array($forretningsValideringsKode) ? implode(', ', $forretningsValideringsKode) : var_export($forretningsValideringsKode, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\ForretningsValideringsKodeType::getValidValues())), __LINE__); + } + $this->ForretningsValideringsKode = $forretningsValideringsKode; + + return $this; + } + /** + * Get Kvitteringstype value + * @return string + */ + public function getKvitteringstype(): string + { + return $this->Kvitteringstype; + } + /** + * Set Kvitteringstype value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\KvitteringstypeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\KvitteringstypeType::getValidValues() + * @throws InvalidArgumentException + * @param string $kvitteringstype + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function setKvitteringstype(string $kvitteringstype): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\KvitteringstypeType::valueIsValid($kvitteringstype)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\KvitteringstypeType', is_array($kvitteringstype) ? implode(', ', $kvitteringstype) : var_export($kvitteringstype, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\KvitteringstypeType::getValidValues())), __LINE__); + } + $this->Kvitteringstype = $kvitteringstype; + + return $this; + } + /** + * Get Begrundelse value + * @return string|null + */ + public function getBegrundelse(): ?string + { + return $this->Begrundelse; + } + /** + * Set Begrundelse value + * @param string $begrundelse + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function setBegrundelse(?string $begrundelse = null): self + { + // validation for constraint: string + if (!is_null($begrundelse) && !is_string($begrundelse)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($begrundelse, true), gettype($begrundelse)), __LINE__); + } + $this->Begrundelse = $begrundelse; + + return $this; + } + /** + * Get FejlListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType|null + */ + public function getFejlListe(): ?\ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType + { + return $this->FejlListe; + } + /** + * Set FejlListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType $fejlListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ForretningskvitteringType + */ + public function setFejlListe(?\ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType $fejlListe = null): self + { + $this->FejlListe = $fejlListe; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalNotatEgenskaberType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalNotatEgenskaberType.php new file mode 100644 index 00000000..8a1549c0 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalNotatEgenskaberType.php @@ -0,0 +1,92 @@ +setNotat($notat) + ->setTitel($titel); + } + /** + * Get Notat value + * @return string + */ + public function getNotat(): string + { + return $this->Notat; + } + /** + * Set Notat value + * @param string $notat + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType + */ + public function setNotat(string $notat): self + { + // validation for constraint: string + if (!is_null($notat) && !is_string($notat)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($notat, true), gettype($notat)), __LINE__); + } + $this->Notat = $notat; + + return $this; + } + /** + * Get Titel value + * @return string|null + */ + public function getTitel(): ?string + { + return $this->Titel; + } + /** + * Set Titel value + * @param string $titel + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType + */ + public function setTitel(?string $titel = null): self + { + // validation for constraint: string + if (!is_null($titel) && !is_string($titel)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($titel, true), gettype($titel)), __LINE__); + } + $this->Titel = $titel; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPartType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPartType.php new file mode 100644 index 00000000..2509e428 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPartType.php @@ -0,0 +1,91 @@ +setObjekttype($objekttype) + ->setReferenceID($referenceID); + } + /** + * Get Objekttype value + * @return string + */ + public function getObjekttype(): string + { + return $this->Objekttype; + } + /** + * Set Objekttype value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPartObjekttypeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPartObjekttypeType::getValidValues() + * @throws InvalidArgumentException + * @param string $objekttype + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPartType + */ + public function setObjekttype(string $objekttype): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\JournalPartObjekttypeType::valueIsValid($objekttype)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPartObjekttypeType', is_array($objekttype) ? implode(', ', $objekttype) : var_export($objekttype, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPartObjekttypeType::getValidValues())), __LINE__); + } + $this->Objekttype = $objekttype; + + return $this; + } + /** + * Get ReferenceID value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + */ + public function getReferenceID(): \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + { + return $this->ReferenceID; + } + /** + * Set ReferenceID value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $referenceID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPartType + */ + public function setReferenceID(\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $referenceID): self + { + $this->ReferenceID = $referenceID; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRegistreringType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRegistreringType.php new file mode 100644 index 00000000..47482884 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRegistreringType.php @@ -0,0 +1,219 @@ +setFraTidsPunkt($fraTidsPunkt) + ->setLivscyklusKode($livscyklusKode) + ->setRegistreringItSystem($registreringItSystem) + ->setRelationListe($relationListe) + ->setImportTidspunkt($importTidspunkt) + ->setBrugerRef($brugerRef); + } + /** + * Get FraTidsPunkt value + * @return string + */ + public function getFraTidsPunkt(): string + { + return $this->FraTidsPunkt; + } + /** + * Set FraTidsPunkt value + * @param string $fraTidsPunkt + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function setFraTidsPunkt(string $fraTidsPunkt): self + { + // validation for constraint: string + if (!is_null($fraTidsPunkt) && !is_string($fraTidsPunkt)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fraTidsPunkt, true), gettype($fraTidsPunkt)), __LINE__); + } + $this->FraTidsPunkt = $fraTidsPunkt; + + return $this; + } + /** + * Get LivscyklusKode value + * @return string + */ + public function getLivscyklusKode(): string + { + return $this->LivscyklusKode; + } + /** + * Set LivscyklusKode value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::getValidValues() + * @throws InvalidArgumentException + * @param string $livscyklusKode + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function setLivscyklusKode(string $livscyklusKode): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::valueIsValid($livscyklusKode)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType', is_array($livscyklusKode) ? implode(', ', $livscyklusKode) : var_export($livscyklusKode, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType::getValidValues())), __LINE__); + } + $this->LivscyklusKode = $livscyklusKode; + + return $this; + } + /** + * Get RegistreringItSystem value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + */ + public function getRegistreringItSystem(): \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + { + return $this->RegistreringItSystem; + } + /** + * Set RegistreringItSystem value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $registreringItSystem + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function setRegistreringItSystem(\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $registreringItSystem): self + { + $this->RegistreringItSystem = $registreringItSystem; + + return $this; + } + /** + * Get RelationListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType + */ + public function getRelationListe(): \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType + { + return $this->RelationListe; + } + /** + * Set RelationListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType $relationListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function setRelationListe(\ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType $relationListe): self + { + $this->RelationListe = $relationListe; + + return $this; + } + /** + * Get ImportTidspunkt value + * @return string|null + */ + public function getImportTidspunkt(): ?string + { + return $this->ImportTidspunkt; + } + /** + * Set ImportTidspunkt value + * @param string $importTidspunkt + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function setImportTidspunkt(?string $importTidspunkt = null): self + { + // validation for constraint: string + if (!is_null($importTidspunkt) && !is_string($importTidspunkt)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($importTidspunkt, true), gettype($importTidspunkt)), __LINE__); + } + $this->ImportTidspunkt = $importTidspunkt; + + return $this; + } + /** + * Get BrugerRef value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN|null + */ + public function getBrugerRef(): ?\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + { + return $this->BrugerRef; + } + /** + * Set BrugerRef value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $brugerRef + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType + */ + public function setBrugerRef(?\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $brugerRef = null): self + { + $this->BrugerRef = $brugerRef; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRelationsListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRelationsListeType.php new file mode 100644 index 00000000..87a51d23 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostRelationsListeType.php @@ -0,0 +1,102 @@ +setJournalPost($journalPost); + } + /** + * Get JournalPost value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType[] + */ + public function getJournalPost(): array + { + return $this->JournalPost; + } + /** + * This method is responsible for validating the value(s) passed to the setJournalPost method + * This method is willingly generated in order to preserve the one-line inline validation within the setJournalPost method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateJournalPostForArrayConstraintFromSetJournalPost(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $journalPostRelationsListeTypeJournalPostItem) { + // validation for constraint: itemType + if (!$journalPostRelationsListeTypeJournalPostItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType) { + $invalidValues[] = is_object($journalPostRelationsListeTypeJournalPostItem) ? get_class($journalPostRelationsListeTypeJournalPostItem) : sprintf('%s(%s)', gettype($journalPostRelationsListeTypeJournalPostItem), var_export($journalPostRelationsListeTypeJournalPostItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The JournalPost property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set JournalPost value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType[] $journalPost + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType + */ + public function setJournalPost(array $journalPost): self + { + // validation for constraint: array + if ('' !== ($journalPostArrayErrorMessage = self::validateJournalPostForArrayConstraintFromSetJournalPost($journalPost))) { + throw new InvalidArgumentException($journalPostArrayErrorMessage, __LINE__); + } + $this->JournalPost = $journalPost; + + return $this; + } + /** + * Add item to JournalPost value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType + */ + public function addToJournalPost(\ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType) { + throw new InvalidArgumentException(sprintf('The JournalPost property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->JournalPost[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostType.php new file mode 100644 index 00000000..675e57b0 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalPostType.php @@ -0,0 +1,215 @@ +setVirkning($virkning) + ->setRolle($rolle) + ->setIndeks($indeks) + ->setJournalnotatAttributter($journalnotatAttributter) + ->setDokument($dokument) + ->setJournalpostAttributter($journalpostAttributter); + } + /** + * Get Virkning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function getVirkning(): \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + { + return $this->Virkning; + } + /** + * Set Virkning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType + */ + public function setVirkning(\ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning): self + { + $this->Virkning = $virkning; + + return $this; + } + /** + * Get Rolle value + * @return string + */ + public function getRolle(): string + { + return $this->Rolle; + } + /** + * Set Rolle value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPostRolleType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPostRolleType::getValidValues() + * @throws InvalidArgumentException + * @param string $rolle + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType + */ + public function setRolle(string $rolle): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\JournalPostRolleType::valueIsValid($rolle)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPostRolleType', is_array($rolle) ? implode(', ', $rolle) : var_export($rolle, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\JournalPostRolleType::getValidValues())), __LINE__); + } + $this->Rolle = $rolle; + + return $this; + } + /** + * Get Indeks value + * @return string + */ + public function getIndeks(): string + { + return $this->Indeks; + } + /** + * Set Indeks value + * @param string $indeks + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType + */ + public function setIndeks(string $indeks): self + { + // validation for constraint: string + if (!is_null($indeks) && !is_string($indeks)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($indeks, true), gettype($indeks)), __LINE__); + } + $this->Indeks = $indeks; + + return $this; + } + /** + * Get JournalnotatAttributter value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType + */ + public function getJournalnotatAttributter(): \ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType + { + return $this->JournalnotatAttributter; + } + /** + * Set JournalnotatAttributter value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType $journalnotatAttributter + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType + */ + public function setJournalnotatAttributter(\ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType $journalnotatAttributter): self + { + $this->JournalnotatAttributter = $journalnotatAttributter; + + return $this; + } + /** + * Get Dokument value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPartType|null + */ + public function getDokument(): ?\ItkDev\Serviceplatformen\SF2900\StructType\JournalPartType + { + return $this->Dokument; + } + /** + * Set Dokument value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalPartType $dokument + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType + */ + public function setDokument(?\ItkDev\Serviceplatformen\SF2900\StructType\JournalPartType $dokument = null): self + { + $this->Dokument = $dokument; + + return $this; + } + /** + * Get JournalpostAttributter value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalpostEgenskaberType|null + */ + public function getJournalpostAttributter(): ?\ItkDev\Serviceplatformen\SF2900\StructType\JournalpostEgenskaberType + { + return $this->JournalpostAttributter; + } + /** + * Set JournalpostAttributter value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\JournalpostEgenskaberType $journalpostAttributter + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType + */ + public function setJournalpostAttributter(?\ItkDev\Serviceplatformen\SF2900\StructType\JournalpostEgenskaberType $journalpostAttributter = null): self + { + $this->JournalpostAttributter = $journalpostAttributter; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalpostEgenskaberType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalpostEgenskaberType.php new file mode 100644 index 00000000..7c599c5f --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/JournalpostEgenskaberType.php @@ -0,0 +1,88 @@ +setDokumenttitel($dokumenttitel) + ->setOffentlighedUndtaget($offentlighedUndtaget); + } + /** + * Get Dokumenttitel value + * @return string|null + */ + public function getDokumenttitel(): ?string + { + return $this->Dokumenttitel; + } + /** + * Set Dokumenttitel value + * @param string $dokumenttitel + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalpostEgenskaberType + */ + public function setDokumenttitel(?string $dokumenttitel = null): self + { + // validation for constraint: string + if (!is_null($dokumenttitel) && !is_string($dokumenttitel)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($dokumenttitel, true), gettype($dokumenttitel)), __LINE__); + } + $this->Dokumenttitel = $dokumenttitel; + + return $this; + } + /** + * Get OffentlighedUndtaget value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType|null + */ + public function getOffentlighedUndtaget(): ?\ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType + { + return $this->OffentlighedUndtaget; + } + /** + * Set OffentlighedUndtaget value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType $offentlighedUndtaget + * @return \ItkDev\Serviceplatformen\SF2900\StructType\JournalpostEgenskaberType + */ + public function setOffentlighedUndtaget(?\ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType $offentlighedUndtaget = null): self + { + $this->OffentlighedUndtaget = $offentlighedUndtaget; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/MeddelelseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/MeddelelseType.php new file mode 100644 index 00000000..fd681f41 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/MeddelelseType.php @@ -0,0 +1,88 @@ +setFormularType($formularType) + ->setFormular($formular); + } + /** + * Get FormularType value + * @return string + */ + public function getFormularType(): string + { + return $this->FormularType; + } + /** + * Set FormularType value + * @param string $formularType + * @return \ItkDev\Serviceplatformen\SF2900\StructType\MeddelelseType + */ + public function setFormularType(string $formularType): self + { + // validation for constraint: string + if (!is_null($formularType) && !is_string($formularType)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($formularType, true), gettype($formularType)), __LINE__); + } + $this->FormularType = $formularType; + + return $this; + } + /** + * Get Formular value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FormularType + */ + public function getFormular(): \ItkDev\Serviceplatformen\SF2900\StructType\FormularType + { + return $this->Formular; + } + /** + * Set Formular value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FormularType $formular + * @return \ItkDev\Serviceplatformen\SF2900\StructType\MeddelelseType + */ + public function setFormular(\ItkDev\Serviceplatformen\SF2900\StructType\FormularType $formular): self + { + $this->Formular = $formular; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ModtagerMedEndpointType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ModtagerMedEndpointType.php new file mode 100644 index 00000000..f318ee35 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ModtagerMedEndpointType.php @@ -0,0 +1,218 @@ +setSystemMyndighed($systemMyndighed) + ->setSystemUUID($systemUUID) + ->setSystemNavn($systemNavn) + ->setRoutingKLEEmne($routingKLEEmne) + ->setRoutingHandlingFacet($routingHandlingFacet); + } + /** + * Get SystemMyndighed value + * @return string + */ + public function getSystemMyndighed(): string + { + return $this->SystemMyndighed; + } + /** + * Set SystemMyndighed value + * @param string $systemMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType + */ + public function setSystemMyndighed(string $systemMyndighed): self + { + // validation for constraint: string + if (!is_null($systemMyndighed) && !is_string($systemMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($systemMyndighed, true), gettype($systemMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($systemMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $systemMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($systemMyndighed, true)), __LINE__); + } + $this->SystemMyndighed = $systemMyndighed; + + return $this; + } + /** + * Get SystemUUID value + * @return string + */ + public function getSystemUUID(): string + { + return $this->SystemUUID; + } + /** + * Set SystemUUID value + * @param string $systemUUID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType + */ + public function setSystemUUID(string $systemUUID): self + { + // validation for constraint: string + if (!is_null($systemUUID) && !is_string($systemUUID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($systemUUID, true), gettype($systemUUID)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($systemUUID) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $systemUUID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($systemUUID, true)), __LINE__); + } + $this->SystemUUID = $systemUUID; + + return $this; + } + /** + * Get SystemNavn value + * @return string + */ + public function getSystemNavn(): string + { + return $this->SystemNavn; + } + /** + * Set SystemNavn value + * @param string $systemNavn + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType + */ + public function setSystemNavn(string $systemNavn): self + { + // validation for constraint: string + if (!is_null($systemNavn) && !is_string($systemNavn)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($systemNavn, true), gettype($systemNavn)), __LINE__); + } + $this->SystemNavn = $systemNavn; + + return $this; + } + /** + * Get RoutingKLEEmne value + * @return string + */ + public function getRoutingKLEEmne(): string + { + return $this->RoutingKLEEmne; + } + /** + * Set RoutingKLEEmne value + * @param string $routingKLEEmne + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType + */ + public function setRoutingKLEEmne(string $routingKLEEmne): self + { + // validation for constraint: string + if (!is_null($routingKLEEmne) && !is_string($routingKLEEmne)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingKLEEmne, true), gettype($routingKLEEmne)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][.][0-9][0-9][.][0-9][0-9]) + if (!is_null($routingKLEEmne) && !preg_match('/[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', (string) $routingKLEEmne)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', var_export($routingKLEEmne, true)), __LINE__); + } + $this->RoutingKLEEmne = $routingKLEEmne; + + return $this; + } + /** + * Get RoutingHandlingFacet value + * @return string|null + */ + public function getRoutingHandlingFacet(): ?string + { + return $this->RoutingHandlingFacet; + } + /** + * Set RoutingHandlingFacet value + * @param string $routingHandlingFacet + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType + */ + public function setRoutingHandlingFacet(?string $routingHandlingFacet = null): self + { + // validation for constraint: string + if (!is_null($routingHandlingFacet) && !is_string($routingHandlingFacet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingHandlingFacet, true), gettype($routingHandlingFacet)), __LINE__); + } + // validation for constraint: pattern([A-Z,Æ,Ø,Å][0-9][0-9]) + if (!is_null($routingHandlingFacet) && !preg_match('/[A-Z,Æ,Ø,Å][0-9][0-9]/', (string) $routingHandlingFacet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z,Æ,Ø,Å][0-9][0-9]/', var_export($routingHandlingFacet, true)), __LINE__); + } + $this->RoutingHandlingFacet = $routingHandlingFacet; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ObjektIndholdType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ObjektIndholdType.php new file mode 100644 index 00000000..3e189dad --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/ObjektIndholdType.php @@ -0,0 +1,240 @@ +setDistributionDokument($distributionDokument) + ->setDistributionJournalPost($distributionJournalPost) + ->setDistributionFormular($distributionFormular); + } + /** + * Get DistributionDokument value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType|null + */ + public function getDistributionDokument(): ?\ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType + { + return $this->DistributionDokument ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setDistributionDokument method + * This method is willingly generated in order to preserve the one-line inline validation within the setDistributionDokument method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateDistributionDokumentForChoiceConstraintFromSetDistributionDokument($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'DistributionJournalPost', + 'DistributionFormular', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property DistributionDokument can\'t be set as the property %s is already set. Only one property must be set among these properties: DistributionDokument, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set DistributionDokument value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType $distributionDokument + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType + */ + public function setDistributionDokument(?\ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType $distributionDokument = null): self + { + // validation for constraint: choice(DistributionDokument, DistributionJournalPost, DistributionFormular) + if ('' !== ($distributionDokumentChoiceErrorMessage = self::validateDistributionDokumentForChoiceConstraintFromSetDistributionDokument($distributionDokument))) { + throw new InvalidArgumentException($distributionDokumentChoiceErrorMessage, __LINE__); + } + if (is_null($distributionDokument) || (is_array($distributionDokument) && empty($distributionDokument))) { + unset($this->DistributionDokument); + } else { + $this->DistributionDokument = $distributionDokument; + } + + return $this; + } + /** + * Get DistributionJournalPost value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType|null + */ + public function getDistributionJournalPost(): ?\ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType + { + return $this->DistributionJournalPost ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setDistributionJournalPost method + * This method is willingly generated in order to preserve the one-line inline validation within the setDistributionJournalPost method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateDistributionJournalPostForChoiceConstraintFromSetDistributionJournalPost($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'DistributionDokument', + 'DistributionFormular', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property DistributionJournalPost can\'t be set as the property %s is already set. Only one property must be set among these properties: DistributionJournalPost, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set DistributionJournalPost value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType $distributionJournalPost + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType + */ + public function setDistributionJournalPost(?\ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType $distributionJournalPost = null): self + { + // validation for constraint: choice(DistributionDokument, DistributionJournalPost, DistributionFormular) + if ('' !== ($distributionJournalPostChoiceErrorMessage = self::validateDistributionJournalPostForChoiceConstraintFromSetDistributionJournalPost($distributionJournalPost))) { + throw new InvalidArgumentException($distributionJournalPostChoiceErrorMessage, __LINE__); + } + if (is_null($distributionJournalPost) || (is_array($distributionJournalPost) && empty($distributionJournalPost))) { + unset($this->DistributionJournalPost); + } else { + $this->DistributionJournalPost = $distributionJournalPost; + } + + return $this; + } + /** + * Get DistributionFormular value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType|null + */ + public function getDistributionFormular(): ?\ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType + { + return $this->DistributionFormular ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setDistributionFormular method + * This method is willingly generated in order to preserve the one-line inline validation within the setDistributionFormular method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateDistributionFormularForChoiceConstraintFromSetDistributionFormular($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'DistributionDokument', + 'DistributionJournalPost', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property DistributionFormular can\'t be set as the property %s is already set. Only one property must be set among these properties: DistributionFormular, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set DistributionFormular value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType $distributionFormular + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType + */ + public function setDistributionFormular(?\ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType $distributionFormular = null): self + { + // validation for constraint: choice(DistributionDokument, DistributionJournalPost, DistributionFormular) + if ('' !== ($distributionFormularChoiceErrorMessage = self::validateDistributionFormularForChoiceConstraintFromSetDistributionFormular($distributionFormular))) { + throw new InvalidArgumentException($distributionFormularChoiceErrorMessage, __LINE__); + } + if (is_null($distributionFormular) || (is_array($distributionFormular) && empty($distributionFormular))) { + unset($this->DistributionFormular); + } else { + $this->DistributionFormular = $distributionFormular; + } + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/OffentlighedUndtagetType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/OffentlighedUndtagetType.php new file mode 100644 index 00000000..e364876b --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/OffentlighedUndtagetType.php @@ -0,0 +1,92 @@ +setTitelAlternativTekst($titelAlternativTekst) + ->setHjemmelTekst($hjemmelTekst); + } + /** + * Get TitelAlternativTekst value + * @return string + */ + public function getTitelAlternativTekst(): string + { + return $this->TitelAlternativTekst; + } + /** + * Set TitelAlternativTekst value + * @param string $titelAlternativTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType + */ + public function setTitelAlternativTekst(string $titelAlternativTekst): self + { + // validation for constraint: string + if (!is_null($titelAlternativTekst) && !is_string($titelAlternativTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($titelAlternativTekst, true), gettype($titelAlternativTekst)), __LINE__); + } + $this->TitelAlternativTekst = $titelAlternativTekst; + + return $this; + } + /** + * Get HjemmelTekst value + * @return string + */ + public function getHjemmelTekst(): string + { + return $this->HjemmelTekst; + } + /** + * Set HjemmelTekst value + * @param string $hjemmelTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\OffentlighedUndtagetType + */ + public function setHjemmelTekst(string $hjemmelTekst): self + { + // validation for constraint: string + if (!is_null($hjemmelTekst) && !is_string($hjemmelTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($hjemmelTekst, true), gettype($hjemmelTekst)), __LINE__); + } + $this->HjemmelTekst = $hjemmelTekst; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/PartType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/PartType.php new file mode 100644 index 00000000..a480efb3 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/PartType.php @@ -0,0 +1,91 @@ +setObjektType($objektType) + ->setReferenceID($referenceID); + } + /** + * Get ObjektType value + * @return string + */ + public function getObjektType(): string + { + return $this->ObjektType; + } + /** + * Set ObjektType value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\PartObjektTypeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\PartObjektTypeType::getValidValues() + * @throws InvalidArgumentException + * @param string $objektType + * @return \ItkDev\Serviceplatformen\SF2900\StructType\PartType + */ + public function setObjektType(string $objektType): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\PartObjektTypeType::valueIsValid($objektType)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\PartObjektTypeType', is_array($objektType) ? implode(', ', $objektType) : var_export($objektType, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\PartObjektTypeType::getValidValues())), __LINE__); + } + $this->ObjektType = $objektType; + + return $this; + } + /** + * Get ReferenceID value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst + */ + public function getReferenceID(): \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst + { + return $this->ReferenceID; + } + /** + * Set ReferenceID value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst $referenceID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\PartType + */ + public function setReferenceID(\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst $referenceID): self + { + $this->ReferenceID = $referenceID; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RelationsListe.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RelationsListe.php new file mode 100644 index 00000000..fe5b6cbc --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RelationsListe.php @@ -0,0 +1,84 @@ +setVariantListe($variantListe) + ->setDokumentPartListe($dokumentPartListe); + } + /** + * Get VariantListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType + */ + public function getVariantListe(): \ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType + { + return $this->VariantListe; + } + /** + * Set VariantListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType $variantListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe + */ + public function setVariantListe(\ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType $variantListe): self + { + $this->VariantListe = $variantListe; + + return $this; + } + /** + * Get DokumentPartListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartListeType|null + */ + public function getDokumentPartListe(): ?\ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartListeType + { + return $this->DokumentPartListe; + } + /** + * Set DokumentPartListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartListeType $dokumentPartListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe + */ + public function setDokumentPartListe(?\ItkDev\Serviceplatformen\SF2900\StructType\DokumentPartListeType $dokumentPartListe = null): self + { + $this->DokumentPartListe = $dokumentPartListe; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingKLEInfo.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingKLEInfo.php new file mode 100644 index 00000000..45d2a0b8 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingKLEInfo.php @@ -0,0 +1,104 @@ +setRoutingKLEEmne($routingKLEEmne) + ->setRoutingHandlingFacet($routingHandlingFacet); + } + /** + * Get RoutingKLEEmne value + * @return string + */ + public function getRoutingKLEEmne(): string + { + return $this->RoutingKLEEmne; + } + /** + * Set RoutingKLEEmne value + * @param string $routingKLEEmne + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo + */ + public function setRoutingKLEEmne(string $routingKLEEmne): self + { + // validation for constraint: string + if (!is_null($routingKLEEmne) && !is_string($routingKLEEmne)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingKLEEmne, true), gettype($routingKLEEmne)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][.][0-9][0-9][.][0-9][0-9]) + if (!is_null($routingKLEEmne) && !preg_match('/[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', (string) $routingKLEEmne)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][.][0-9][0-9][.][0-9][0-9]/', var_export($routingKLEEmne, true)), __LINE__); + } + $this->RoutingKLEEmne = $routingKLEEmne; + + return $this; + } + /** + * Get RoutingHandlingFacet value + * @return string|null + */ + public function getRoutingHandlingFacet(): ?string + { + return $this->RoutingHandlingFacet; + } + /** + * Set RoutingHandlingFacet value + * @param string $routingHandlingFacet + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo + */ + public function setRoutingHandlingFacet(?string $routingHandlingFacet = null): self + { + // validation for constraint: string + if (!is_null($routingHandlingFacet) && !is_string($routingHandlingFacet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingHandlingFacet, true), gettype($routingHandlingFacet)), __LINE__); + } + // validation for constraint: pattern([A-Z,Æ,Ø,Å][0-9][0-9]) + if (!is_null($routingHandlingFacet) && !preg_match('/[A-Z,Æ,Ø,Å][0-9][0-9]/', (string) $routingHandlingFacet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z,Æ,Ø,Å][0-9][0-9]/', var_export($routingHandlingFacet, true)), __LINE__); + } + $this->RoutingHandlingFacet = $routingHandlingFacet; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingListeType.php new file mode 100644 index 00000000..c7ea97a8 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingListeType.php @@ -0,0 +1,102 @@ +setRouting($routing); + } + /** + * Get Routing value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType[] + */ + public function getRouting(): array + { + return $this->Routing; + } + /** + * This method is responsible for validating the value(s) passed to the setRouting method + * This method is willingly generated in order to preserve the one-line inline validation within the setRouting method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateRoutingForArrayConstraintFromSetRouting(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $routingListeTypeRoutingItem) { + // validation for constraint: itemType + if (!$routingListeTypeRoutingItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType) { + $invalidValues[] = is_object($routingListeTypeRoutingItem) ? get_class($routingListeTypeRoutingItem) : sprintf('%s(%s)', gettype($routingListeTypeRoutingItem), var_export($routingListeTypeRoutingItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The Routing property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set Routing value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType[] $routing + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingListeType + */ + public function setRouting(array $routing): self + { + // validation for constraint: array + if ('' !== ($routingArrayErrorMessage = self::validateRoutingForArrayConstraintFromSetRouting($routing))) { + throw new InvalidArgumentException($routingArrayErrorMessage, __LINE__); + } + $this->Routing = $routing; + + return $this; + } + /** + * Add item to Routing value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingListeType + */ + public function addToRouting(\ItkDev\Serviceplatformen\SF2900\StructType\RoutingType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType) { + throw new InvalidArgumentException(sprintf('The Routing property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->Routing[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResponseType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResponseType.php new file mode 100644 index 00000000..a8067e80 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResponseType.php @@ -0,0 +1,138 @@ +setRoutingMyndighed($routingMyndighed) + ->setRoutingModtagerAktoer($routingModtagerAktoer) + ->setKanModtage($kanModtage); + } + /** + * Get RoutingMyndighed value + * @return string + */ + public function getRoutingMyndighed(): string + { + return $this->RoutingMyndighed; + } + /** + * Set RoutingMyndighed value + * @param string $routingMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType + */ + public function setRoutingMyndighed(string $routingMyndighed): self + { + // validation for constraint: string + if (!is_null($routingMyndighed) && !is_string($routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingMyndighed, true), gettype($routingMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($routingMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($routingMyndighed, true)), __LINE__); + } + $this->RoutingMyndighed = $routingMyndighed; + + return $this; + } + /** + * Get RoutingModtagerAktoer value + * @return string + */ + public function getRoutingModtagerAktoer(): string + { + return $this->RoutingModtagerAktoer; + } + /** + * Set RoutingModtagerAktoer value + * @param string $routingModtagerAktoer + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType + */ + public function setRoutingModtagerAktoer(string $routingModtagerAktoer): self + { + // validation for constraint: string + if (!is_null($routingModtagerAktoer) && !is_string($routingModtagerAktoer)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingModtagerAktoer, true), gettype($routingModtagerAktoer)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($routingModtagerAktoer) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $routingModtagerAktoer)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($routingModtagerAktoer, true)), __LINE__); + } + $this->RoutingModtagerAktoer = $routingModtagerAktoer; + + return $this; + } + /** + * Get KanModtage value + * @return bool + */ + public function getKanModtage(): bool + { + return $this->KanModtage; + } + /** + * Set KanModtage value + * @param bool $kanModtage + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType + */ + public function setKanModtage(bool $kanModtage): self + { + // validation for constraint: boolean + if (!is_null($kanModtage) && !is_bool($kanModtage)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($kanModtage, true), gettype($kanModtage)), __LINE__); + } + $this->KanModtage = $kanModtage; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResposneListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResposneListeType.php new file mode 100644 index 00000000..ccc2b300 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingResposneListeType.php @@ -0,0 +1,102 @@ +setRoutingModtager($routingModtager); + } + /** + * Get RoutingModtager value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType[] + */ + public function getRoutingModtager(): array + { + return $this->RoutingModtager; + } + /** + * This method is responsible for validating the value(s) passed to the setRoutingModtager method + * This method is willingly generated in order to preserve the one-line inline validation within the setRoutingModtager method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateRoutingModtagerForArrayConstraintFromSetRoutingModtager(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $routingResposneListeTypeRoutingModtagerItem) { + // validation for constraint: itemType + if (!$routingResposneListeTypeRoutingModtagerItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType) { + $invalidValues[] = is_object($routingResposneListeTypeRoutingModtagerItem) ? get_class($routingResposneListeTypeRoutingModtagerItem) : sprintf('%s(%s)', gettype($routingResposneListeTypeRoutingModtagerItem), var_export($routingResposneListeTypeRoutingModtagerItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The RoutingModtager property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set RoutingModtager value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType[] $routingModtager + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResposneListeType + */ + public function setRoutingModtager(array $routingModtager): self + { + // validation for constraint: array + if ('' !== ($routingModtagerArrayErrorMessage = self::validateRoutingModtagerForArrayConstraintFromSetRoutingModtager($routingModtager))) { + throw new InvalidArgumentException($routingModtagerArrayErrorMessage, __LINE__); + } + $this->RoutingModtager = $routingModtager; + + return $this; + } + /** + * Add item to RoutingModtager value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResposneListeType + */ + public function addToRoutingModtager(\ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType) { + throw new InvalidArgumentException(sprintf('The RoutingModtager property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\RoutingResponseType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->RoutingModtager[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingType.php new file mode 100644 index 00000000..59fadb6b --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingType.php @@ -0,0 +1,104 @@ +setRoutingMyndighed($routingMyndighed) + ->setRoutingModtagerAktoer($routingModtagerAktoer); + } + /** + * Get RoutingMyndighed value + * @return string + */ + public function getRoutingMyndighed(): string + { + return $this->RoutingMyndighed; + } + /** + * Set RoutingMyndighed value + * @param string $routingMyndighed + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType + */ + public function setRoutingMyndighed(string $routingMyndighed): self + { + // validation for constraint: string + if (!is_null($routingMyndighed) && !is_string($routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingMyndighed, true), gettype($routingMyndighed)), __LINE__); + } + // validation for constraint: pattern([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + if (!is_null($routingMyndighed) && !preg_match('/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', (string) $routingMyndighed)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/', var_export($routingMyndighed, true)), __LINE__); + } + $this->RoutingMyndighed = $routingMyndighed; + + return $this; + } + /** + * Get RoutingModtagerAktoer value + * @return string + */ + public function getRoutingModtagerAktoer(): string + { + return $this->RoutingModtagerAktoer; + } + /** + * Set RoutingModtagerAktoer value + * @param string $routingModtagerAktoer + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingType + */ + public function setRoutingModtagerAktoer(string $routingModtagerAktoer): self + { + // validation for constraint: string + if (!is_null($routingModtagerAktoer) && !is_string($routingModtagerAktoer)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingModtagerAktoer, true), gettype($routingModtagerAktoer)), __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($routingModtagerAktoer) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $routingModtagerAktoer)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($routingModtagerAktoer, true)), __LINE__); + } + $this->RoutingModtagerAktoer = $routingModtagerAktoer; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingValg.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingValg.php new file mode 100644 index 00000000..ffe80a49 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/RoutingValg.php @@ -0,0 +1,180 @@ +setRoutingKLEEmneHandling($routingKLEEmneHandling) + ->setRoutingModtagerAktoer($routingModtagerAktoer); + } + /** + * Get RoutingKLEEmneHandling value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo|null + */ + public function getRoutingKLEEmneHandling(): ?\ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo + { + return $this->RoutingKLEEmneHandling ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setRoutingKLEEmneHandling method + * This method is willingly generated in order to preserve the one-line inline validation within the setRoutingKLEEmneHandling method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateRoutingKLEEmneHandlingForChoiceConstraintFromSetRoutingKLEEmneHandling($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'RoutingModtagerAktoer', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property RoutingKLEEmneHandling can\'t be set as the property %s is already set. Only one property must be set among these properties: RoutingKLEEmneHandling, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set RoutingKLEEmneHandling value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo $routingKLEEmneHandling + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg + */ + public function setRoutingKLEEmneHandling(\ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo $routingKLEEmneHandling = null): self + { + // validation for constraint: choice(RoutingKLEEmneHandling, RoutingModtagerAktoer) + if ('' !== ($routingKLEEmneHandlingChoiceErrorMessage = self::validateRoutingKLEEmneHandlingForChoiceConstraintFromSetRoutingKLEEmneHandling($routingKLEEmneHandling))) { + throw new InvalidArgumentException($routingKLEEmneHandlingChoiceErrorMessage, __LINE__); + } + if (is_null($routingKLEEmneHandling) || (is_array($routingKLEEmneHandling) && empty($routingKLEEmneHandling))) { + unset($this->RoutingKLEEmneHandling); + } else { + $this->RoutingKLEEmneHandling = $routingKLEEmneHandling; + } + + return $this; + } + /** + * Get RoutingModtagerAktoer value + * @return string|null + */ + public function getRoutingModtagerAktoer(): ?string + { + return $this->RoutingModtagerAktoer ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setRoutingModtagerAktoer method + * This method is willingly generated in order to preserve the one-line inline validation within the setRoutingModtagerAktoer method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateRoutingModtagerAktoerForChoiceConstraintFromSetRoutingModtagerAktoer($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'RoutingKLEEmneHandling', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property RoutingModtagerAktoer can\'t be set as the property %s is already set. Only one property must be set among these properties: RoutingModtagerAktoer, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set RoutingModtagerAktoer value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param string $routingModtagerAktoer + * @return \ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg + */ + public function setRoutingModtagerAktoer(string $routingModtagerAktoer = null): self + { + // validation for constraint: string + if (!is_null($routingModtagerAktoer) && !is_string($routingModtagerAktoer)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($routingModtagerAktoer, true), gettype($routingModtagerAktoer)), __LINE__); + } + // validation for constraint: choice(RoutingKLEEmneHandling, RoutingModtagerAktoer) + if ('' !== ($routingModtagerAktoerChoiceErrorMessage = self::validateRoutingModtagerAktoerForChoiceConstraintFromSetRoutingModtagerAktoer($routingModtagerAktoer))) { + throw new InvalidArgumentException($routingModtagerAktoerChoiceErrorMessage, __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($routingModtagerAktoer) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $routingModtagerAktoer)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($routingModtagerAktoer, true)), __LINE__); + } + if (is_null($routingModtagerAktoer) || (is_array($routingModtagerAktoer) && empty($routingModtagerAktoer))) { + unset($this->RoutingModtagerAktoer); + } else { + $this->RoutingModtagerAktoer = $routingModtagerAktoer; + } + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilgaengeligeModtagereType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilgaengeligeModtagereType.php new file mode 100644 index 00000000..d618e9e0 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilgaengeligeModtagereType.php @@ -0,0 +1,102 @@ +setSystem($system); + } + /** + * Get System value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType[] + */ + public function getSystem(): ?array + { + return $this->System; + } + /** + * This method is responsible for validating the value(s) passed to the setSystem method + * This method is willingly generated in order to preserve the one-line inline validation within the setSystem method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateSystemForArrayConstraintFromSetSystem(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $tilgaengeligeModtagereTypeSystemItem) { + // validation for constraint: itemType + if (!$tilgaengeligeModtagereTypeSystemItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType) { + $invalidValues[] = is_object($tilgaengeligeModtagereTypeSystemItem) ? get_class($tilgaengeligeModtagereTypeSystemItem) : sprintf('%s(%s)', gettype($tilgaengeligeModtagereTypeSystemItem), var_export($tilgaengeligeModtagereTypeSystemItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The System property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set System value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType[] $system + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilgaengeligeModtagereType + */ + public function setSystem(?array $system = null): self + { + // validation for constraint: array + if ('' !== ($systemArrayErrorMessage = self::validateSystemForArrayConstraintFromSetSystem($system))) { + throw new InvalidArgumentException($systemArrayErrorMessage, __LINE__); + } + $this->System = $system; + + return $this; + } + /** + * Add item to System value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilgaengeligeModtagereType + */ + public function addToSystem(\ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType) { + throw new InvalidArgumentException(sprintf('The System property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\ModtagerMedEndpointType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->System[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandListeType.php new file mode 100644 index 00000000..944e7b60 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandListeType.php @@ -0,0 +1,102 @@ +setTilstand($tilstand); + } + /** + * Get Tilstand value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType[] + */ + public function getTilstand(): array + { + return $this->Tilstand; + } + /** + * This method is responsible for validating the value(s) passed to the setTilstand method + * This method is willingly generated in order to preserve the one-line inline validation within the setTilstand method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateTilstandForArrayConstraintFromSetTilstand(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $tilstandListeTypeTilstandItem) { + // validation for constraint: itemType + if (!$tilstandListeTypeTilstandItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType) { + $invalidValues[] = is_object($tilstandListeTypeTilstandItem) ? get_class($tilstandListeTypeTilstandItem) : sprintf('%s(%s)', gettype($tilstandListeTypeTilstandItem), var_export($tilstandListeTypeTilstandItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The Tilstand property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set Tilstand value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType[] $tilstand + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType + */ + public function setTilstand(array $tilstand): self + { + // validation for constraint: array + if ('' !== ($tilstandArrayErrorMessage = self::validateTilstandForArrayConstraintFromSetTilstand($tilstand))) { + throw new InvalidArgumentException($tilstandArrayErrorMessage, __LINE__); + } + $this->Tilstand = $tilstand; + + return $this; + } + /** + * Add item to Tilstand value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType + */ + public function addToTilstand(\ItkDev\Serviceplatformen\SF2900\StructType\TilstandType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType) { + throw new InvalidArgumentException(sprintf('The Tilstand property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->Tilstand[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandType.php new file mode 100644 index 00000000..ea939b2a --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TilstandType.php @@ -0,0 +1,91 @@ +setFremdrift($fremdrift) + ->setVirkning($virkning); + } + /** + * Get Fremdrift value + * @return string + */ + public function getFremdrift(): string + { + return $this->Fremdrift; + } + /** + * Set Fremdrift value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\FremdriftType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\FremdriftType::getValidValues() + * @throws InvalidArgumentException + * @param string $fremdrift + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType + */ + public function setFremdrift(string $fremdrift): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\FremdriftType::valueIsValid($fremdrift)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\FremdriftType', is_array($fremdrift) ? implode(', ', $fremdrift) : var_export($fremdrift, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\FremdriftType::getValidValues())), __LINE__); + } + $this->Fremdrift = $fremdrift; + + return $this; + } + /** + * Get Virkning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function getVirkning(): \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + { + return $this->Virkning; + } + /** + * Set Virkning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TilstandType + */ + public function setVirkning(\ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning): self + { + $this->Virkning = $virkning; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TransportkvitteringType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TransportkvitteringType.php new file mode 100644 index 00000000..11cafabb --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/TransportkvitteringType.php @@ -0,0 +1,125 @@ +setTransportValideringsKode($transportValideringsKode) + ->setBegrundelse($begrundelse) + ->setFejlListe($fejlListe); + } + /** + * Get TransportValideringsKode value + * @return string + */ + public function getTransportValideringsKode(): string + { + return $this->TransportValideringsKode; + } + /** + * Set TransportValideringsKode value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\TransportValideringsKodeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\TransportValideringsKodeType::getValidValues() + * @throws InvalidArgumentException + * @param string $transportValideringsKode + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TransportkvitteringType + */ + public function setTransportValideringsKode(string $transportValideringsKode): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\TransportValideringsKodeType::valueIsValid($transportValideringsKode)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\TransportValideringsKodeType', is_array($transportValideringsKode) ? implode(', ', $transportValideringsKode) : var_export($transportValideringsKode, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\TransportValideringsKodeType::getValidValues())), __LINE__); + } + $this->TransportValideringsKode = $transportValideringsKode; + + return $this; + } + /** + * Get Begrundelse value + * @return string|null + */ + public function getBegrundelse(): ?string + { + return $this->Begrundelse; + } + /** + * Set Begrundelse value + * @param string $begrundelse + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TransportkvitteringType + */ + public function setBegrundelse(?string $begrundelse = null): self + { + // validation for constraint: string + if (!is_null($begrundelse) && !is_string($begrundelse)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($begrundelse, true), gettype($begrundelse)), __LINE__); + } + $this->Begrundelse = $begrundelse; + + return $this; + } + /** + * Get FejlListe value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType|null + */ + public function getFejlListe(): ?\ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType + { + return $this->FejlListe; + } + /** + * Set FejlListe value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType $fejlListe + * @return \ItkDev\Serviceplatformen\SF2900\StructType\TransportkvitteringType + */ + public function setFejlListe(?\ItkDev\Serviceplatformen\SF2900\StructType\FejlListeType $fejlListe = null): self + { + $this->FejlListe = $fejlListe; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN.php new file mode 100644 index 00000000..6365dfe7 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN.php @@ -0,0 +1,186 @@ +setUUID($uUID) + ->setURN($uRN); + } + /** + * Get UUID value + * @return string|null + */ + public function getUUID(): ?string + { + return $this->UUID ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setUUID method + * This method is willingly generated in order to preserve the one-line inline validation within the setUUID method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateUUIDForChoiceConstraintFromSetUUID($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'URN', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property UUID can\'t be set as the property %s is already set. Only one property must be set among these properties: UUID, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set UUID value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param string $uUID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + */ + public function setUUID(?string $uUID = null): self + { + // validation for constraint: string + if (!is_null($uUID) && !is_string($uUID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uUID, true), gettype($uUID)), __LINE__); + } + // validation for constraint: choice(UUID, URN) + if ('' !== ($uUIDChoiceErrorMessage = self::validateUUIDForChoiceConstraintFromSetUUID($uUID))) { + throw new InvalidArgumentException($uUIDChoiceErrorMessage, __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($uUID) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $uUID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($uUID, true)), __LINE__); + } + if (is_null($uUID) || (is_array($uUID) && empty($uUID))) { + unset($this->UUID); + } else { + $this->UUID = $uUID; + } + + return $this; + } + /** + * Get URN value + * @return string|null + */ + public function getURN(): ?string + { + return $this->URN ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setURN method + * This method is willingly generated in order to preserve the one-line inline validation within the setURN method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateURNForChoiceConstraintFromSetURN($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'UUID', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property URN can\'t be set as the property %s is already set. Only one property must be set among these properties: URN, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set URN value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param string $uRN + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + */ + public function setURN(?string $uRN = null): self + { + // validation for constraint: string + if (!is_null($uRN) && !is_string($uRN)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uRN, true), gettype($uRN)), __LINE__); + } + // validation for constraint: choice(UUID, URN) + if ('' !== ($uRNChoiceErrorMessage = self::validateURNForChoiceConstraintFromSetURN($uRN))) { + throw new InvalidArgumentException($uRNChoiceErrorMessage, __LINE__); + } + // validation for constraint: pattern([uU][rR][nN]:[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]:[a-zA-Z0-9\(\)+,\\\-.:=@;$_!*'%/?#]+) + if (!is_null($uRN) && !preg_match('/[uU][rR][nN]:[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]:[a-zA-Z0-9\\(\\)+,\\\\\\-.:=@;$_!*\'%\/?#]+/', (string) $uRN)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[uU][rR][nN]:[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]:[a-zA-Z0-9\\(\\)+,\\\\\\-.:=@;$_!*\'%\/?#]+/', var_export($uRN, true)), __LINE__); + } + if (is_null($uRN) || (is_array($uRN) && empty($uRN))) { + unset($this->URN); + } else { + $this->URN = $uRN; + } + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN_Tekst.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN_Tekst.php new file mode 100644 index 00000000..4bfe4ab8 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/UUID_URN_Tekst.php @@ -0,0 +1,264 @@ +setUUID($uUID) + ->setURN($uRN) + ->setTekst($tekst); + } + /** + * Get UUID value + * @return string|null + */ + public function getUUID(): ?string + { + return $this->UUID ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setUUID method + * This method is willingly generated in order to preserve the one-line inline validation within the setUUID method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateUUIDForChoiceConstraintFromSetUUID($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'URN', + 'Tekst', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property UUID can\'t be set as the property %s is already set. Only one property must be set among these properties: UUID, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set UUID value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param string $uUID + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst + */ + public function setUUID(?string $uUID = null): self + { + // validation for constraint: string + if (!is_null($uUID) && !is_string($uUID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uUID, true), gettype($uUID)), __LINE__); + } + // validation for constraint: choice(UUID, URN, Tekst) + if ('' !== ($uUIDChoiceErrorMessage = self::validateUUIDForChoiceConstraintFromSetUUID($uUID))) { + throw new InvalidArgumentException($uUIDChoiceErrorMessage, __LINE__); + } + // validation for constraint: pattern([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}) + if (!is_null($uUID) && !preg_match('/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', (string) $uUID)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', var_export($uUID, true)), __LINE__); + } + if (is_null($uUID) || (is_array($uUID) && empty($uUID))) { + unset($this->UUID); + } else { + $this->UUID = $uUID; + } + + return $this; + } + /** + * Get URN value + * @return string|null + */ + public function getURN(): ?string + { + return $this->URN ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setURN method + * This method is willingly generated in order to preserve the one-line inline validation within the setURN method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateURNForChoiceConstraintFromSetURN($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'UUID', + 'Tekst', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property URN can\'t be set as the property %s is already set. Only one property must be set among these properties: URN, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set URN value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param string $uRN + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst + */ + public function setURN(?string $uRN = null): self + { + // validation for constraint: string + if (!is_null($uRN) && !is_string($uRN)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uRN, true), gettype($uRN)), __LINE__); + } + // validation for constraint: choice(UUID, URN, Tekst) + if ('' !== ($uRNChoiceErrorMessage = self::validateURNForChoiceConstraintFromSetURN($uRN))) { + throw new InvalidArgumentException($uRNChoiceErrorMessage, __LINE__); + } + // validation for constraint: pattern([uU][rR][nN]:[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]:[a-zA-Z0-9\(\)+,\\\-.:=@;$_!*'%/?#]+) + if (!is_null($uRN) && !preg_match('/[uU][rR][nN]:[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]:[a-zA-Z0-9\\(\\)+,\\\\\\-.:=@;$_!*\'%\/?#]+/', (string) $uRN)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression /[uU][rR][nN]:[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]:[a-zA-Z0-9\\(\\)+,\\\\\\-.:=@;$_!*\'%\/?#]+/', var_export($uRN, true)), __LINE__); + } + if (is_null($uRN) || (is_array($uRN) && empty($uRN))) { + unset($this->URN); + } else { + $this->URN = $uRN; + } + + return $this; + } + /** + * Get Tekst value + * @return string|null + */ + public function getTekst(): ?string + { + return $this->Tekst ?? null; + } + /** + * This method is responsible for validating the value(s) passed to the setTekst method + * This method is willingly generated in order to preserve the one-line inline validation within the setTekst method + * This has to validate that the property which is being set is the only one among the given choices + * @param mixed $value + * @return string A non-empty message if the values does not match the validation rules + */ + public function validateTekstForChoiceConstraintFromSetTekst($value): string + { + $message = ''; + if (is_null($value)) { + return $message; + } + $properties = [ + 'UUID', + 'URN', + ]; + try { + foreach ($properties as $property) { + if (isset($this->{$property})) { + throw new InvalidArgumentException(sprintf('The property Tekst can\'t be set as the property %s is already set. Only one property must be set among these properties: Tekst, %s.', $property, implode(', ', $properties)), __LINE__); + } + } + } catch (InvalidArgumentException $e) { + $message = $e->getMessage(); + } + + return $message; + } + /** + * Set Tekst value + * This property belongs to a choice that allows only one property to exist. It is + * therefore removable from the request, consequently if the value assigned to this + * property is null, the property is removed from this object + * @throws InvalidArgumentException + * @param string $tekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN_Tekst + */ + public function setTekst(?string $tekst = null): self + { + // validation for constraint: string + if (!is_null($tekst) && !is_string($tekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($tekst, true), gettype($tekst)), __LINE__); + } + // validation for constraint: choice(UUID, URN, Tekst) + if ('' !== ($tekstChoiceErrorMessage = self::validateTekstForChoiceConstraintFromSetTekst($tekst))) { + throw new InvalidArgumentException($tekstChoiceErrorMessage, __LINE__); + } + if (is_null($tekst) || (is_array($tekst) && empty($tekst))) { + unset($this->Tekst); + } else { + $this->Tekst = $tekst; + } + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantAttributterType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantAttributterType.php new file mode 100644 index 00000000..81b1704c --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantAttributterType.php @@ -0,0 +1,194 @@ +setVariantType($variantType) + ->setProduktion($produktion) + ->setOffentliggoerelse($offentliggoerelse) + ->setArkivering($arkivering) + ->setDelvistScannet($delvistScannet); + } + /** + * Get VariantType value + * @return string + */ + public function getVariantType(): string + { + return $this->VariantType; + } + /** + * Set VariantType value + * @param string $variantType + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + */ + public function setVariantType(string $variantType): self + { + // validation for constraint: string + if (!is_null($variantType) && !is_string($variantType)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($variantType, true), gettype($variantType)), __LINE__); + } + $this->VariantType = $variantType; + + return $this; + } + /** + * Get Produktion value + * @return string|null + */ + public function getProduktion(): ?string + { + return $this->Produktion; + } + /** + * Set Produktion value + * @param string $produktion + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + */ + public function setProduktion(?string $produktion = null): self + { + // validation for constraint: string + if (!is_null($produktion) && !is_string($produktion)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($produktion, true), gettype($produktion)), __LINE__); + } + $this->Produktion = $produktion; + + return $this; + } + /** + * Get Offentliggoerelse value + * @return bool|null + */ + public function getOffentliggoerelse(): ?bool + { + return $this->Offentliggoerelse; + } + /** + * Set Offentliggoerelse value + * @param bool $offentliggoerelse + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + */ + public function setOffentliggoerelse(?bool $offentliggoerelse = null): self + { + // validation for constraint: boolean + if (!is_null($offentliggoerelse) && !is_bool($offentliggoerelse)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($offentliggoerelse, true), gettype($offentliggoerelse)), __LINE__); + } + $this->Offentliggoerelse = $offentliggoerelse; + + return $this; + } + /** + * Get Arkivering value + * @return bool|null + */ + public function getArkivering(): ?bool + { + return $this->Arkivering; + } + /** + * Set Arkivering value + * @param bool $arkivering + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + */ + public function setArkivering(?bool $arkivering = null): self + { + // validation for constraint: boolean + if (!is_null($arkivering) && !is_bool($arkivering)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($arkivering, true), gettype($arkivering)), __LINE__); + } + $this->Arkivering = $arkivering; + + return $this; + } + /** + * Get DelvistScannet value + * @return bool|null + */ + public function getDelvistScannet(): ?bool + { + return $this->DelvistScannet; + } + /** + * Set DelvistScannet value + * @param bool $delvistScannet + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + */ + public function setDelvistScannet(?bool $delvistScannet = null): self + { + // validation for constraint: boolean + if (!is_null($delvistScannet) && !is_bool($delvistScannet)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($delvistScannet, true), gettype($delvistScannet)), __LINE__); + } + $this->DelvistScannet = $delvistScannet; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantListeType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantListeType.php new file mode 100644 index 00000000..2a588aff --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantListeType.php @@ -0,0 +1,102 @@ +setVariant($variant); + } + /** + * Get Variant value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantType[] + */ + public function getVariant(): array + { + return $this->Variant; + } + /** + * This method is responsible for validating the value(s) passed to the setVariant method + * This method is willingly generated in order to preserve the one-line inline validation within the setVariant method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateVariantForArrayConstraintFromSetVariant(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $variantListeTypeVariantItem) { + // validation for constraint: itemType + if (!$variantListeTypeVariantItem instanceof \ItkDev\Serviceplatformen\SF2900\StructType\VariantType) { + $invalidValues[] = is_object($variantListeTypeVariantItem) ? get_class($variantListeTypeVariantItem) : sprintf('%s(%s)', gettype($variantListeTypeVariantItem), var_export($variantListeTypeVariantItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The Variant property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\VariantType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set Variant value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VariantType[] $variant + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType + */ + public function setVariant(array $variant): self + { + // validation for constraint: array + if ('' !== ($variantArrayErrorMessage = self::validateVariantForArrayConstraintFromSetVariant($variant))) { + throw new InvalidArgumentException($variantArrayErrorMessage, __LINE__); + } + $this->Variant = $variant; + + return $this; + } + /** + * Add item to Variant value + * @throws InvalidArgumentException + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VariantType $item + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType + */ + public function addToVariant(\ItkDev\Serviceplatformen\SF2900\StructType\VariantType $item): self + { + // validation for constraint: itemType + if (!$item instanceof \ItkDev\Serviceplatformen\SF2900\StructType\VariantType) { + throw new InvalidArgumentException(sprintf('The Variant property can only contain items of type \ItkDev\Serviceplatformen\SF2900\StructType\VariantType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->Variant[] = $item; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantType.php new file mode 100644 index 00000000..e67f00ff --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VariantType.php @@ -0,0 +1,185 @@ +setVirkning($virkning) + ->setRolle($rolle) + ->setIndeks($indeks) + ->setVariantAttributter($variantAttributter) + ->setDelAttributter($delAttributter); + } + /** + * Get Virkning value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function getVirkning(): \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + { + return $this->Virkning; + } + /** + * Set Virkning value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantType + */ + public function setVirkning(\ItkDev\Serviceplatformen\SF2900\StructType\VirkningType $virkning): self + { + $this->Virkning = $virkning; + + return $this; + } + /** + * Get Rolle value + * @return string + */ + public function getRolle(): string + { + return $this->Rolle; + } + /** + * Set Rolle value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\VariantRolleType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\VariantRolleType::getValidValues() + * @throws InvalidArgumentException + * @param string $rolle + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantType + */ + public function setRolle(string $rolle): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\VariantRolleType::valueIsValid($rolle)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\VariantRolleType', is_array($rolle) ? implode(', ', $rolle) : var_export($rolle, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\VariantRolleType::getValidValues())), __LINE__); + } + $this->Rolle = $rolle; + + return $this; + } + /** + * Get Indeks value + * @return string + */ + public function getIndeks(): string + { + return $this->Indeks; + } + /** + * Set Indeks value + * @param string $indeks + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantType + */ + public function setIndeks(string $indeks): self + { + // validation for constraint: string + if (!is_null($indeks) && !is_string($indeks)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($indeks, true), gettype($indeks)), __LINE__); + } + $this->Indeks = $indeks; + + return $this; + } + /** + * Get VariantAttributter value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + */ + public function getVariantAttributter(): \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType + { + return $this->VariantAttributter; + } + /** + * Set VariantAttributter value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType $variantAttributter + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantType + */ + public function setVariantAttributter(\ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType $variantAttributter): self + { + $this->VariantAttributter = $variantAttributter; + + return $this; + } + /** + * Get DelAttributter value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + */ + public function getDelAttributter(): \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType + { + return $this->DelAttributter; + } + /** + * Set DelAttributter value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType $delAttributter + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VariantType + */ + public function setDelAttributter(\ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType $delAttributter): self + { + $this->DelAttributter = $delAttributter; + + return $this; + } +} diff --git a/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VirkningType.php b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VirkningType.php new file mode 100644 index 00000000..9fda3702 --- /dev/null +++ b/generated-classes/ItkDev/Serviceplatformen/SF2900/StructType/VirkningType.php @@ -0,0 +1,193 @@ +setAktoer($aktoer) + ->setAktoerType($aktoerType) + ->setFraTidspunkt($fraTidspunkt) + ->setTilTidspunkt($tilTidspunkt) + ->setNoteTekst($noteTekst); + } + /** + * Get Aktoer value + * @return \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + */ + public function getAktoer(): \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN + { + return $this->Aktoer; + } + /** + * Set Aktoer value + * @param \ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $aktoer + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function setAktoer(\ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN $aktoer): self + { + $this->Aktoer = $aktoer; + + return $this; + } + /** + * Get AktoerType value + * @return string + */ + public function getAktoerType(): string + { + return $this->AktoerType; + } + /** + * Set AktoerType value + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\AktoerTypeType::valueIsValid() + * @uses \ItkDev\Serviceplatformen\SF2900\EnumType\AktoerTypeType::getValidValues() + * @throws InvalidArgumentException + * @param string $aktoerType + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function setAktoerType(string $aktoerType): self + { + // validation for constraint: enumeration + if (!\ItkDev\Serviceplatformen\SF2900\EnumType\AktoerTypeType::valueIsValid($aktoerType)) { + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \ItkDev\Serviceplatformen\SF2900\EnumType\AktoerTypeType', is_array($aktoerType) ? implode(', ', $aktoerType) : var_export($aktoerType, true), implode(', ', \ItkDev\Serviceplatformen\SF2900\EnumType\AktoerTypeType::getValidValues())), __LINE__); + } + $this->AktoerType = $aktoerType; + + return $this; + } + /** + * Get FraTidspunkt value + * @return string|null + */ + public function getFraTidspunkt(): ?string + { + return $this->FraTidspunkt; + } + /** + * Set FraTidspunkt value + * @param string $fraTidspunkt + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function setFraTidspunkt(?string $fraTidspunkt = null): self + { + // validation for constraint: string + if (!is_null($fraTidspunkt) && !is_string($fraTidspunkt)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fraTidspunkt, true), gettype($fraTidspunkt)), __LINE__); + } + $this->FraTidspunkt = $fraTidspunkt; + + return $this; + } + /** + * Get TilTidspunkt value + * @return string|null + */ + public function getTilTidspunkt(): ?string + { + return $this->TilTidspunkt; + } + /** + * Set TilTidspunkt value + * @param string $tilTidspunkt + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function setTilTidspunkt(?string $tilTidspunkt = null): self + { + // validation for constraint: string + if (!is_null($tilTidspunkt) && !is_string($tilTidspunkt)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($tilTidspunkt, true), gettype($tilTidspunkt)), __LINE__); + } + $this->TilTidspunkt = $tilTidspunkt; + + return $this; + } + /** + * Get NoteTekst value + * @return string|null + */ + public function getNoteTekst(): ?string + { + return $this->NoteTekst; + } + /** + * Set NoteTekst value + * @param string $noteTekst + * @return \ItkDev\Serviceplatformen\SF2900\StructType\VirkningType + */ + public function setNoteTekst(?string $noteTekst = null): self + { + // validation for constraint: string + if (!is_null($noteTekst) && !is_string($noteTekst)) { + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($noteTekst, true), gettype($noteTekst)), __LINE__); + } + $this->NoteTekst = $noteTekst; + + return $this; + } +} diff --git a/resources/sf2900/DistributionServiceMsg.xsd b/resources/sf2900/DistributionServiceMsg.xsd new file mode 100644 index 00000000..e1d529bc --- /dev/null +++ b/resources/sf2900/DistributionServiceMsg.xsd @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceAnvenderV2.wsdl b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceAnvenderV2.wsdl new file mode 100644 index 00000000..0aece94a --- /dev/null +++ b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceAnvenderV2.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceModtagerV2.wsdl b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceModtagerV2.wsdl new file mode 100644 index 00000000..820feeae --- /dev/null +++ b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceModtagerV2.wsdl @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceMsgV2.xsd b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceMsgV2.xsd new file mode 100644 index 00000000..b650b15a --- /dev/null +++ b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceMsgV2.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceTypesV2.xsd b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceTypesV2.xsd new file mode 100644 index 00000000..480238ef --- /dev/null +++ b/resources/sf2900/SF2900_EP_MS1-2/DistributionServiceTypesV2.xsd @@ -0,0 +1,550 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/sp/AuthorityContext_1.xsd b/resources/sf2900/sp/AuthorityContext_1.xsd new file mode 100644 index 00000000..53462455 --- /dev/null +++ b/resources/sf2900/sp/AuthorityContext_1.xsd @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/sf2900/sp/CallContext_1.xsd b/resources/sf2900/sp/CallContext_1.xsd new file mode 100644 index 00000000..545b0bef --- /dev/null +++ b/resources/sf2900/sp/CallContext_1.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/sp/InvocationContext_1.xsd b/resources/sf2900/sp/InvocationContext_1.xsd new file mode 100644 index 00000000..e7ab2230 --- /dev/null +++ b/resources/sf2900/sp/InvocationContext_1.xsd @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/sf2900/sp/Kvittering_1.xsd b/resources/sf2900/sp/Kvittering_1.xsd new file mode 100644 index 00000000..7a7ed234 --- /dev/null +++ b/resources/sf2900/sp/Kvittering_1.xsd @@ -0,0 +1,70 @@ + + + + + + Version 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/sf2900/sp/ServiceplatformFaultMessage_1.wsdl b/resources/sf2900/sp/ServiceplatformFaultMessage_1.wsdl new file mode 100644 index 00000000..d0d05928 --- /dev/null +++ b/resources/sf2900/sp/ServiceplatformFaultMessage_1.wsdl @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/resources/sf2900/sp/ServiceplatformFault_1.xsd b/resources/sf2900/sp/ServiceplatformFault_1.xsd new file mode 100644 index 00000000..92b85d47 --- /dev/null +++ b/resources/sf2900/sp/ServiceplatformFault_1.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/sf2900/sp/TransportKvitteringFaultMessage_1.wsdl b/resources/sf2900/sp/TransportKvitteringFaultMessage_1.wsdl new file mode 100644 index 00000000..e2b694bf --- /dev/null +++ b/resources/sf2900/sp/TransportKvitteringFaultMessage_1.wsdl @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/resources/sf2900/sp/service.properties b/resources/sf2900/sp/service.properties new file mode 100644 index 00000000..566997c0 --- /dev/null +++ b/resources/sf2900/sp/service.properties @@ -0,0 +1,2 @@ +service.uuid=74d3c5f5-1b3c-4c6d-8366-1241f055d332 +service.entityID=http://sp.serviceplatformen.dk/service/fordeling/3 \ No newline at end of file diff --git a/resources/sf2900/wsdl/context/DistributionService.wsdl b/resources/sf2900/wsdl/context/DistributionService.wsdl new file mode 100644 index 00000000..8122fd25 --- /dev/null +++ b/resources/sf2900/wsdl/context/DistributionService.wsdl @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/wsdl/context/policies.wsdl b/resources/sf2900/wsdl/context/policies.wsdl new file mode 100644 index 00000000..fb482aab --- /dev/null +++ b/resources/sf2900/wsdl/context/policies.wsdl @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/sf2900/wsdl/token/DistributionService.wsdl b/resources/sf2900/wsdl/token/DistributionService.wsdl new file mode 100644 index 00000000..8122fd25 --- /dev/null +++ b/resources/sf2900/wsdl/token/DistributionService.wsdl @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sf2900/wsdl/token/policies.wsdl b/resources/sf2900/wsdl/token/policies.wsdl new file mode 100644 index 00000000..635b7af4 --- /dev/null +++ b/resources/sf2900/wsdl/token/policies.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/sf2900/xsd/DistributionServiceTypes.xsd b/resources/sf2900/xsd/DistributionServiceTypes.xsd new file mode 100644 index 00000000..17e40cdb --- /dev/null +++ b/resources/sf2900/xsd/DistributionServiceTypes.xsd @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 503b5b10dd6b9879a361cb7b6e563882929ad578 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 21 Oct 2025 10:23:32 +0200 Subject: [PATCH 4/9] =?UTF-8?q?Tried=20to=20call=20sf2900=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +- Taskfile.yml | 20 + compose.yaml | 16 +- composer.json | 2 + docs/SF2900.md | 10 + src/Command/SF2900/AbstractCommand.php | 200 +++++++++ .../SF2900/FordelingsmodtagerListCommand.php | 67 +++ .../SF2900/FordelingsobjektAfsendCommand.php | 69 +++ src/Service/SF1514/SAMLTokenSoapTemplate.xml | 2 +- src/Service/SF1514/SF1514.php | 4 + src/Service/SF2900/SF2900.php | 392 ++++++++++++++++++ src/Service/SF2900/SF2900XMLBuilder.php | 267 ++++++++++++ src/Service/SF2900/SoapClient.php | 70 ++++ src/Service/SF2900/SoapClientBase.php | 58 +++ src/Service/SF2900/Type.php | 9 + .../SF2900/resources/insert-token.xslt | 18 + 16 files changed, 1205 insertions(+), 16 deletions(-) create mode 100644 docs/SF2900.md create mode 100644 src/Command/SF2900/AbstractCommand.php create mode 100644 src/Command/SF2900/FordelingsmodtagerListCommand.php create mode 100644 src/Command/SF2900/FordelingsobjektAfsendCommand.php create mode 100644 src/Service/SF2900/SF2900.php create mode 100644 src/Service/SF2900/SF2900XMLBuilder.php create mode 100644 src/Service/SF2900/SoapClient.php create mode 100644 src/Service/SF2900/SoapClientBase.php create mode 100644 src/Service/SF2900/Type.php create mode 100644 src/Service/SF2900/resources/insert-token.xslt diff --git a/README.md b/README.md index 69212c00..1c719e93 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Library for interacting with services on [Serviceplatformen](https://www.service * Parts of [Afsend post (SF1601): https://digitaliseringskataloget.dk/integration/sf1601](https://digitaliseringskataloget.dk/integration/sf1601). See [SF1601: Afsend post](docs/SF1601.md) for details. +* [Fordelingskomponenten (SF2900): https://digitaliseringskataloget.dk/integration/sf2900](https://digitaliseringskataloget.dk/integration/sf2900) ## Updating resources and classes @@ -18,11 +19,7 @@ generate PHP classes for talking to SOAP services. To update [resources](./resources) and [generated classes](./generated-classes), run ``` shell -docker compose run --rm phpfpm composer install -# Update WSDL resources. -docker compose run --rm phpfpm bin/generate resources -# Generate PHP classes from WSDL resources. -docker compose run --rm phpfpm bin/generate classes +task generate ``` ## Test commands @@ -71,7 +68,7 @@ Install the dependencies: ``` shell cd serviceplatformen -composer install +docker compose run --rm phpfpm composer install ``` ## Running the tests @@ -93,13 +90,13 @@ docker compose run --rm phpfpm composer tests/end-to-end PHP_CodeSniffer ``` shell -composer coding-standards-check/phpcs +docker compose run --rm phpfpm composer coding-standards-check/phpcs ``` PHP-CS-Fixer ``` shell -composer coding-standards-check/php-cs-fixer +docker compose run --rm phpfpm composer coding-standards-check/php-cs-fixer ``` ### Static code analysis @@ -107,13 +104,13 @@ composer coding-standards-check/php-cs-fixer Phan ``` shell -composer static-code-analysis/phan +docker compose run --rm phpfpm composer static-code-analysis/phan ``` ## Deployment ``` shell -composer require itk-dev/serviceplatformen +docker compose run --rm phpfpm composer require itk-dev/serviceplatformen ``` ## Usage diff --git a/Taskfile.yml b/Taskfile.yml index 71b319c5..410d80bf 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -20,3 +20,23 @@ tasks: cmds: - docker compose {{.COMPOSE_ARGS}} {{.CLI_ARGS}} internal: true + + php: + # https://taskfile.dev/docs/reference/templating#task-1 + desc: Run PHP inside docker compose setup, e.g. `task {{.TASK}} -- bin/serviceplatformen-sf2900-fordelingsobjekt-list` + cmds: + - task: compose + vars: + COMPOSE_ARGS: run --rm phpfpm php + + debug:php: + desc: Run PHP inside docker compose setup with Xdebug enabled, e.g. `task {{.TASK}} -- bin/serviceplatformen-sf2900-fordelingsobjekt-list` + cmds: + - task: compose + vars: + COMPOSE_ARGS: run --env PHP_XDEBUG_MODE=debug --env PHP_XDEBUG_WITH_REQUEST=yes --rm phpfpm php + + default: + cmds: + - task --list + silent: true diff --git a/compose.yaml b/compose.yaml index 68029acd..96ac5ee3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,13 +2,19 @@ services: phpfpm: image: itkdev/php8.3-fpm:latest user: ${COMPOSE_USER:-deploy} - profiles: - - dev + extra_hosts: + - "host.docker.internal:host-gateway" + environment: + - PHP_XDEBUG_MODE=${PHP_XDEBUG_MODE:-off} + - PHP_MAX_EXECUTION_TIME=30 + - PHP_MEMORY_LIMIT=256M + # - DOCKER_HOST_DOMAIN=${COMPOSE_DOMAIN} + - PHP_IDE_CONFIG=serverName=localhost volumes: - .:/app - environment: - PHP_MEMORY_LIMIT: 512M - COMPOSER_MEMORY_LIMIT: -1 + # environment: + # PHP_MEMORY_LIMIT: 512M + # COMPOSER_MEMORY_LIMIT: -1 # Code checks tools markdownlint: diff --git a/composer.json b/composer.json index 30cfd091..a162edc1 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "ext-openssl": "*", "ext-simplexml": "*", "ext-soap": "*", + "ext-xsl": "*", "composer-runtime-api": "^2.2", "goetas-webservices/xsd2php-runtime": "^0.2.16", "http-interop/http-factory-guzzle": "^1.2", @@ -64,6 +65,7 @@ "ItkDev\\Serviceplatformen\\": "src/", "ItkDev\\Serviceplatformen\\SF1500\\": "generated-classes/ItkDev/Serviceplatformen/SF1500/", "ItkDev\\Serviceplatformen\\SF1600\\": "generated-classes/ItkDev/Serviceplatformen/SF1600/", + "ItkDev\\Serviceplatformen\\SF2900\\": "generated-classes/ItkDev/Serviceplatformen/SF2900/", "KleOnlineDk\\": "lib/KleOnlineDk/", "MotorregisterSkatDk\\": "lib/MotorregisterSkatDk/", "Oio\\": "lib/Oio/", diff --git a/docs/SF2900.md b/docs/SF2900.md new file mode 100644 index 00000000..24a7348c --- /dev/null +++ b/docs/SF2900.md @@ -0,0 +1,10 @@ +# SF2900: Fordelingskomponenten + + + +> Servicen er udstillet med følgende sikkerhedsmodeller: +> +> - AuthorityContext +> - SAML-token + +() diff --git a/src/Command/SF2900/AbstractCommand.php b/src/Command/SF2900/AbstractCommand.php new file mode 100644 index 00000000..b8cae01e --- /dev/null +++ b/src/Command/SF2900/AbstractCommand.php @@ -0,0 +1,200 @@ +baseOptions = []; + $this->commandOptionNames = []; + + // Index by option name. + $options = array_filter($definition, static fn ($item) => $item instanceof InputOption); + foreach ($options as $option) { + $name = $option->getName(); + if (in_array($name, $this->commandOptionNames)) { + $this->commandOptionNames[$name] = $option; + } else { + $this->baseOptions[$name] = $option; + } + } + } + + /** + * @return (InputOption|InputArgument)[] + */ + protected function getDefinitionItems(): array + { + return [ + new InputOption('production', null, InputOption::VALUE_NONE, 'production mode'), + new InputOption('sender-id', null, InputOption::VALUE_REQUIRED, 'sender-id (CVR)'), + new InputOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate or a query string with Azure Key Vault information (see help for details)'), + new InputOption('certificate-passphrase', null, InputOption::VALUE_REQUIRED, 'certificate passphrase', ''), + new InputOption('routing-kle', null, InputOption::VALUE_REQUIRED, 'routing-kle'), + new InputOption('routing-handling-facet', null, InputOption::VALUE_REQUIRED, 'routing-handling-facet'), + ]; + } + + protected function configure() + { + $definition = $this->getDefinitionItems(); + $this->setDefinition(new InputDefinition($definition)); + + $help = $this->buildHelp(); + $this->setHelp(str_replace( + [ + '%certificate_options%', + ], + [ + $this->getOptionsDetails($this->getCertificateOptionsResolver(), ' '), + ], + $help + )); + + $this->buildOptions($definition); + } + + protected function buildHelp(): string + { + return <<getAccessToken() + ); + + return new AzureKeyVaultCertificateLocator( + $vault, + $options['secret'], + $options['version'], + $passphrase + ); + } else { + $certificatepath = realpath($spec) ?: null; + if (null === $certificatepath) { + throw new InvalidOptionException(sprintf('Invalid path %s', $spec)); + } + + return new FilesystemCertificateLocator($certificatepath, $passphrase); + } + } + + protected function getCertificateOptionsResolver(): OptionsResolver + { + $resolver = new OptionsResolver(); + $resolver + ->setRequired([ + 'tenant-id', + 'client-id', + 'client-secret', + 'name', + 'secret', + 'version', + ]) + ->setInfo('tenant-id', 'The tenant id') + ->setInfo('client-id', 'The client id') + ->setInfo('client-secret', 'The client secret') + ->setInfo('name', 'The certificate name') + ->setInfo('secret', 'The certificate secret') + ->setInfo('version', 'The certificate version') + ; + + return $resolver; + } + + protected function resolveOptions(array $options): array + { + return $this->configureOptions(new OptionsResolver())->resolve($options); + } + + protected function configureOptions(OptionsResolver $resolver): OptionsResolver + { + return $resolver + ->setRequired([ + 'certificate', + 'sender-id', + ]) + ->setDefaults([ + 'certificate-passphrase' => '', + 'production' => false, + 'routing-kle' => '', + 'routing-handling-facet' => '', + ]) + ; + } + + protected function getOptionsDetails(OptionsResolver $resolver, string $indent = '') + { + $lines = []; + $options = $resolver->getDefinedOptions(); + + $maxOptionLength = max(...array_map('strlen', $options)); + foreach ($options as $option) { + $info = $resolver->getInfo($option); + $lines[] = $info ? sprintf('%s %s', str_pad($option, $maxOptionLength), $info) : $option; + } + + return implode(PHP_EOL, array_map(static function ($line) use ($indent) { + return $indent.$line; + }, $lines)); + } +} diff --git a/src/Command/SF2900/FordelingsmodtagerListCommand.php b/src/Command/SF2900/FordelingsmodtagerListCommand.php new file mode 100644 index 00000000..9d157d0a --- /dev/null +++ b/src/Command/SF2900/FordelingsmodtagerListCommand.php @@ -0,0 +1,67 @@ +resolveOptions( + array_filter( + $input->getOptions(), + fn (string $name) => isset($this->baseOptions[$name]) || isset($this->commandOptions[$name]), + ARRAY_FILTER_USE_KEY + ) + ); + + if (null === $options['routing-kle']) { + throw new InvalidOptionException('Option "routing-kle" is required.'); + } + + $io = new SymfonyStyle($input, $output); + + $certificateLocator = $this->getCertificateLocator($options['certificate'], $options['certificate-passphrase']); + + $soapClient = new SoapClient([ + 'cache_expiration_time' => ['-1 hour'], + ]); + + $serviceOptions = [ + 'certificate_locator' => $certificateLocator, + 'authority_cvr' => $options['sender-id'], + 'sts_applies_to' => SF2900::ENTITY_ID, + 'test_mode' => !$options['production'], + ]; + + $sf1514 = new SF1514($soapClient, $serviceOptions); + + $sf2900 = new SF2900( + $sf1514, + [ + 'authority_cvr' => $options['sender-id'], + 'certificate_locator' => $certificateLocator, + 'test_mode' => !$options['production'], + ] + ); + $sf2900->getModtagerList( + routingMyndighed: $options['sender-id'], + routingKLEEmne: $options['routing-kle'], + routingHandlingFacet: $options['routing-handling-facet'], + ); + + return Command::SUCCESS; + } +} diff --git a/src/Command/SF2900/FordelingsobjektAfsendCommand.php b/src/Command/SF2900/FordelingsobjektAfsendCommand.php new file mode 100644 index 00000000..51e25655 --- /dev/null +++ b/src/Command/SF2900/FordelingsobjektAfsendCommand.php @@ -0,0 +1,69 @@ +value), + ] + ); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $options = $this->resolveOptions( + array_filter( + array_filter($input->getOptions()), + fn (string $name) => isset($this->baseOptions[$name]), + ARRAY_FILTER_USE_KEY + ) + ); + + $io = new SymfonyStyle($input, $output); + $certificateLocator = $this->getCertificateLocator($options['certificate'], $options['certificate-passphrase']); + + $sf2900 = new SF2900([ + 'authority_cvr' => $options['sender-id'], + 'certificate_locator' => $certificateLocator, + 'test_mode' => !$options['production'], + ]); + $transactionId = Serializer::createUuid(); + $sf2900->afsend( + $transactionId, + Type::Journalnotat, + routingMyndighed: $options['sender-id'], + routingKLEEmne: $options['routing-kle'] ?? '' + ); + + return Command::SUCCESS; + } +} diff --git a/src/Service/SF1514/SAMLTokenSoapTemplate.xml b/src/Service/SF1514/SAMLTokenSoapTemplate.xml index 901f836e..55bf27b0 100644 --- a/src/Service/SF1514/SAMLTokenSoapTemplate.xml +++ b/src/Service/SF1514/SAMLTokenSoapTemplate.xml @@ -81,7 +81,7 @@ http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue - http://stoettesystemerne.dk/service/organisation/3 + diff --git a/src/Service/SF1514/SF1514.php b/src/Service/SF1514/SF1514.php index 660734b3..4ab7f887 100644 --- a/src/Service/SF1514/SF1514.php +++ b/src/Service/SF1514/SF1514.php @@ -220,6 +220,10 @@ public function buildSAMLTokenRequestXML($cert, $privKey, $cvr, $appliesTo) $this->handleReference($xpath, $toElement, $toId, 'to_id'); + // AppliesTo Address. + $appliesToAddressElement = $this->getElement($xpath, '//wsp:AppliesTo/wsa:EndpointReference/wsa:Address'); + $appliesToAddressElement->nodeValue = $appliesTo; + // ReplyTo. $replyToId = '_'.$this->generateUuid(); $replyToElement = $this->getElement($xpath, '//wsa:ReplyTo'); diff --git a/src/Service/SF2900/SF2900.php b/src/Service/SF2900/SF2900.php new file mode 100644 index 00000000..43db99be --- /dev/null +++ b/src/Service/SF2900/SF2900.php @@ -0,0 +1,392 @@ +sf1514 = $sf1514; + $this->xmlBuilder = new SF2900XMLBuilder(); + $this->options = $this->resolveOptions($options); + + if (!self::$shutdownFunctionRegistered) { + register_shutdown_function(self::shutdown(...)); + self::$shutdownFunctionRegistered = true; + } + } + + // #[\Override] + // protected function configureOptions(OptionsResolver $resolver) + // { + // // @todo https://digitaliseringskataloget.dk/integration/sf2900#:~:text=Servicen%20er%20udstillet%20med%20f%C3%B8lgende%20sikkerhedsmodeller + // parent::configureOptions($resolver); + // // https://digitaliseringskataloget.dk/integration/sf2900 + // $resolver->setDefaults([ + // 'svc_entity_id' => 'http://sp.serviceplatformen.dk/service/fordeling/3', + // 'svc_endpoint' => static function (Options $options) { + // return $options['test_mode'] + // ? 'https://exttest.serviceplatformen.dk/service/SP/Distribution/3' + // : 'https://prod.serviceplatformen.dk/service/SP/Distribution/3'; + // }, + // ]); + // } + + public function getModtagerList( + string $routingMyndighed, + string $routingKLEEmne, + ?string $routingHandlingFacet = null, + ): FordelingsmodtagerListResponseType|bool { + $request = $this->buildFordelingsmodtagerListRequest( + routingMyndighed: $routingMyndighed, + routingKLEEmne: $routingKLEEmne, + routingHandlingFacet: $routingHandlingFacet + ); + + $service = (new Fordelingsmodtager([ + SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', + SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), + ])) + ->setSF2900($this); + $result = $service->FordelingsmodtagerList($request); + + return $result; + + $entityId = $this->getOption('svc_entity_id'); + $url = $this->getOption('svc_endpoint'); + + // $url = 'https://fordelingskomponent-itkdev.aarhuskommune.dk/fordelingskomponent/'; + + $client = new \SoapClient(__DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', [ + 'location' => $url, + 'trace' => true, + ]); + try { + $outputHeaders = []; + $result = $client->__soapCall('FordelingsmodtagerList', args: [$request], outputHeaders: $outputHeaders); + + return $result; + } catch (\SoapFault $exception) { + $req = $client->__getLastRequest(); + $res = $client->__getLastResponse(); + $exceptionMessage = $exception->getMessage(); + + throw $exception; + } + } + + private function buildFordelingsmodtagerListRequest( + string $routingMyndighed, + ?string $routingKLEEmne, + ?string $routingHandlingFacet = null, + ?string $afsendendeMyndighed = null, + ): FordelingsmodtagerListRequestType { + $afsendendeMyndighed ??= $this->options['authority_cvr']; + + $routing = new FordelingsmodtagerListRequest( + afsendendeMyndighed: $afsendendeMyndighed, + routingMyndighed: $routingMyndighed, + routingKLEEmne: $routingKLEEmne, + routingHandlingFacet: $routingHandlingFacet + ); + + return new FordelingsmodtagerListRequestType(routing: $routing); + } + + public function afsend( + string $transactionId, + Type $type, + string $routingMyndighed, + string $routingKLEEmne, + ?string $routingHandlingFacet = null, + ): ResponseInterface { + $document = $this->buildFordelingsobjektAfsendRequest( + $transactionId, + $type, + routingMyndighed: $routingMyndighed, + routingKLEEmne: $routingKLEEmne, + routingHandlingFacet: $routingHandlingFacet + ); + + header('content-type: text/plain'); + echo var_export($document, true); + exit(__FILE__.':'.__LINE__.':'.__METHOD__); + + $entityId = $this->getOption('svc_entity_id'); + $url = $this->getOption('svc_endpoint'); + $response = $this->call($entityId, 'POST', $url, [ + 'headers' => [ + 'content-type' => 'application/xml', + 'accept' => 'application/xml', + ], + 'body' => $document->saveXML(), + 'transactionId' => $transactionId, + ]); + + return $response; + } + + private function buildFordelingsobjektAfsendRequest( + string $transactionId, + Type $type, + string $routingMyndighed, + string $routingKLEEmne, + ?string $routingHandlingFacet = null, + ?string $afsendendeMyndighed = null, + ): FordelingsobjektAfsendRequestType { + $t = new FordelingsobjektAfsendRequestType(); + // $t->getAnmodning()->setDistributionContext(); + $t->getAnmodning()->getDistributionObject()->setObjektType($type->value); + $t->getCallContext()->setPropertyValue('cpr', '0123456789'); + + return $t; + } + + /** + * Gets SAML token from SF1514. + * + * @throws SAMLTokenException + */ + private function getSAMLToken(): string + { + return $this->sf1514->getSAMLToken(); + } + + private function getPrivateKey(): string + { + return $this->getCertificatePart('pkey'); + } + + private function getCertificatePart(string $part): string + { + $certificateLocator = $this->options['certificate_locator']; + assert($certificateLocator instanceof CertificateLocatorInterface); + $certificates = $certificateLocator->getCertificates(); + + if (isset($certificates[$part])) { + return $certificates[$part]; + } + + throw new \RuntimeException(sprintf('Cannot get certificate part %s', $part)); + } + + private function resolveOptions(array $options): array + { + return (new OptionsResolver()) + ->setRequired([ + 'certificate_locator', + 'authority_cvr', + ]) + ->setDefaults([ + 'debug' => false, + 'test_mode' => true, + 'cache' => static function (Options $options) { + return new FilesystemAdapter(); + }, + 'certificate_passphrase' => '', + 'saml_token_svc' => static function (Options $options) { + return $options['test_mode'] + ? 'https://n2adgangsstyring.eksterntest-stoettesystemerne.dk/runtime/services/kombittrust/14/certificatemixed' + : 'https://n2adgangsstyring.stoettesystemerne.dk/runtime/services/kombittrust/14/certificatemixed'; + }, + 'saml_token_expiration_time_offset' => '-15 minutes', + 'service_endpoint_domain' => static function (Options $options) { + return $options['test_mode'] + ? 'https://exttest.serviceplatformen.dk' + : 'https://prod.serviceplatformen.dk'; + }, + 'soap_request_cache_expiration_time' => ['+1 hour'], + 'soap_service_version' => '3', + 'organisation-funktion-manager-id' => '46c73630-f7ad-4000-9624-c06131cde671', + ]) + ->setInfo('saml_token_expiration_time_offset', 'Offset used when checking if SAML token is expired. By default the SAML token expires 8 hours after being issued.') + ->setAllowedTypes('certificate_locator', CertificateLocatorInterface::class) + ->setAllowedTypes('cache', CacheInterface::class) + ->setAllowedTypes('soap_request_cache_expiration_time', 'string[]') + ->setAllowedTypes('soap_service_version', 'string') + ->resolve($options) + ; + } + + public function getSoapLocation(string $location): string + { + $domain = $this->options['service_endpoint_domain']; + + $path = preg_replace('@^.*(?=/service/SP/Distribution/)@', '', $location); + + $soapLocation = $domain.$path; + // @todo '/'.$this->options['soap_service_version'].'/'; + + return $soapLocation; + } + + private const NS_SOAP_ENVELOPE = 'http://www.w3.org/2003/05/soap-envelope'; + private const NS_SAGDOK = 'urn:oio:sagdok:3.0.0'; + private const STATUS_KODE_OK = '20'; + + public function formatSoapRequest( + string $request, + string $location, + string $action, + int $version, + bool $oneWay = false, + ): string { + $doc = Serializer::loadXML($request); + + // Set an id. + /** @var \DOMElement $body */ + $body = $doc->getElementsByTagNameNS(self::NS_SOAP_ENVELOPE, 'Body')[0]; + $body->setAttributeNS( + 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd', + 'u:Id', + '_1' + ); + + $token = $this->getSAMLToken(); + $this->xmlBuilder->buildSoapHeader($doc->getElementsByTagNameNS(self::NS_SOAP_ENVELOPE, 'Header')[0], $location, $action, $token); + + // HACK! + // @see self::getTokenXSLTProcessor(). + $request = self::getTokenXSLTProcessor($token)->transformToXml($doc); + + return $this->xmlBuilder->buildSignedRequest($request, $this->getPrivateKey()); + } + + private static array $tokenXSLTProcessors = []; + + /** + * @see https://bugs.php.net/bug.php?id=55294 + */ + private static function getTokenXSLTProcessor(string $token): \XSLTProcessor + { + if (!isset(self::$tokenXSLTProcessors[$token])) { + $xsldoc = new \DOMDocument(); + $xsldoc->load(__DIR__.'/resources/insert-token.xslt'); + + $tokenPath = tempnam(sys_get_temp_dir(), sha1($token).'.token.xml'); + file_put_contents($tokenPath, $token); + $xsl = new \XSLTProcessor(); + $xsl->importStylesheet($xsldoc); + $xsl->setParameter('', 'token-path', $tokenPath); + + self::$tokenXSLTProcessors[$token] = [ + 'xsltprocessor' => $xsl, + 'tokenpath' => $tokenPath, + ]; + } + + return self::$tokenXSLTProcessors[$token]['xsltprocessor']; + } + + private static function shutdown() + { + foreach (self::$tokenXSLTProcessors as $processor) { + if ($path = ($processor['tokenpath'] ?? null)) { + if (file_exists($path)) { + unlink($path); + } + } + } + } + + public function cacheSoapRequest(array $cacheKeys, callable $callable) + { + $cache = $this->getCache(); + $cacheKey = $this->getSoapRequestCacheKey(__METHOD__, $cacheKeys); + $expirationTime = $this->getSoapRequestCacheExpirationDateTime(); + + return $cache->get($cacheKey, function (ItemInterface $item) use ($callable, $expirationTime) { + $response = $callable(); + + if (!is_string($response) || $this->preventCaching($response)) { + $expirationTime = new \DateTimeImmutable('-1 day'); + } + + $item->expiresAt($expirationTime); + + return $response; + }); + } + + private function preventCaching(string $response): bool + { + try { + $document = Serializer::loadXML($response); + // Prevent caching if we have a SOAP fault. + if ($document->getElementsByTagNameNS(self::NS_SOAP_ENVELOPE, 'Fault')->count() > 0) { + return true; + } + + // Prevent caching if we get a "not OK" status code. + $statusKode = $document->getElementsByTagNameNS(self::NS_SAGDOK, 'StatusKode')->item(0); + if (null !== $statusKode && self::STATUS_KODE_OK !== $statusKode->nodeValue) { + return true; + } + } catch (\Throwable) { + // Ignore any exceptions. + } + + return false; + } + + private function getCache(): CacheInterface + { + return $this->options['cache']; + } + + private function getSoapRequestCacheKey(string $key, array $payload): string + { + return preg_replace( + '#[{}()/\\\\@:]+#', + '_', + $key.'|'.sha1(json_encode($payload + $this->options)) + ); + } + + public function getSoapRequestCacheExpirationDateTime(): ?\DateTimeImmutable + { + $now = new \DateTimeImmutable('now'); + $times = []; + foreach ($this->options['soap_request_cache_expiration_time'] as $spec) { + $time = $now->modify($spec); + if ($time > $now) { + $times[] = $time; + } + } + + return empty($times) ? null : min([...$times]); + } +} diff --git a/src/Service/SF2900/SF2900XMLBuilder.php b/src/Service/SF2900/SF2900XMLBuilder.php new file mode 100644 index 00000000..451bf5cb --- /dev/null +++ b/src/Service/SF2900/SF2900XMLBuilder.php @@ -0,0 +1,267 @@ +ownerDocument; + $createdAt = $this->getTimestamp(); + $expiresAt = $this->getTimestamp(300); + + $frameworkElement = $document->createElementNS(self::NS_SBF, 'sbf:Framework'); + $frameworkElement->setAttribute('version', '2.0'); + $frameworkElement->setAttributeNS(self::NS_PROFILE, 'profile:profile', 'urn:liberty:sb:profile:basic'); + $header->appendChild($frameworkElement); + + $actionElement = $document->createElementNS(self::NS_A, 'a:Action'); + $actionElement->setAttributeNS(self::NS_S, 's:mustUnderstand', '1'); + $actionElement->setAttributeNS(self::NS_U, 'u:Id', '_2'); + $actionElement->nodeValue = $action; + $header->appendChild($actionElement); + + $requestHeaderElement = $document->createElementNS(self::NS_H, 'h:RequestHeader'); + $transactionUUIDElement = $document->createElementNS(self::NS_H, 'h:TransactionUUID'); + $transactionUUIDElement->nodeValue = $this->generateUuid(); + $requestHeaderElement->appendChild($transactionUUIDElement); + $header->appendChild($requestHeaderElement); + + $messageElement = $document->createElementNS(self::NS_A, 'a:MessageID'); + $messageElement->setAttributeNS(self::NS_U, 'u:Id', '_3'); + $messageElement->nodeValue = 'urn:uuid:'.$this->generateUuid(); + $header->appendChild($messageElement); + + $replyElement = $document->createElementNS(self::NS_A, 'a:ReplyTo'); + $replyElement->setAttributeNS(self::NS_U, 'u:Id', '_4'); + $addressElement = $document->createElementNS(self::NS_A, 'a:Address'); + $addressElement->nodeValue = 'http://www.w3.org/2005/08/addressing/anonymous'; + $replyElement->appendChild($addressElement); + $header->appendChild($replyElement); + + $toElement = $document->createElementNS(self::NS_A, 'a:To'); + $toElement->setAttributeNS(self::NS_S, 's:mustUnderstand', '1'); + $toElement->setAttributeNS(self::NS_U, 'u:Id', '_5'); + $toElement->nodeValue = $to; + $header->appendChild($toElement); + + $securityElement = $document->createElementNS(self::NS_O, 'o:Security'); + $securityElement->setAttributeNS(self::NS_S, 's:mustUnderstand', '1'); + + $timestampElement = $document->createElementNS(self::NS_U, 'u:Timestamp'); + $timestampElement->setAttributeNS(self::NS_U, 'Id', 'uuid-'.$this->generateUuid()); + $createdElement = $document->createElementNS(self::NS_U, 'u:Created'); + $createdElement->nodeValue = $createdAt; + $timestampElement->appendChild($createdElement); + $expiresElement = $document->createElementNS(self::NS_U, 'u:Expires'); + $expiresElement->nodeValue = $expiresAt; + $timestampElement->appendChild($expiresElement); + $securityElement->appendChild($timestampElement); + + $tokenDocument = Serializer::loadXML($tokenXml); + $tokenElement = $document->importNode($tokenDocument->documentElement, true); + $tokenUuid = $this->getElementId($tokenElement); + + // @see https://bugs.php.net/bug.php?id=55294 + $tokenElement = $document->createElementNS(self::NS_ASSERTION, 'assertion:insert-token-here'); + $tokenElement->nodeValue = 'INSERT TOKEN HERE'; + + $securityElement->appendChild($tokenElement); + + $securityTokenReferenceElement = $document->createElementNS(self::NS_O, 'o:SecurityTokenReference'); + $securityTokenReferenceElement->setAttributeNS(self::NS_U, 'u:Id', '_str'.$tokenUuid); + $securityTokenReferenceElement->setAttributeNS(self::NS_B, 'b:TokenType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0'); + $keyIdentifierElement = $document->createElementNS(self::NS_O, 'o:KeyIdentifier'); + $keyIdentifierElement->setAttribute('ValueType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID'); + $keyIdentifierElement->nodeValue = $tokenUuid; + $securityTokenReferenceElement->appendChild($keyIdentifierElement); + $securityElement->appendChild($securityTokenReferenceElement); + + $signatureElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:Signature'); + $signedInfoElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:SignedInfo'); + $canonicalizationMethodElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:CanonicalizationMethod'); + $canonicalizationMethodElement->setAttribute('Algorithm', 'http://www.w3.org/2001/10/xml-exc-c14n#'); + $signedInfoElement->appendChild($canonicalizationMethodElement); + $signatureMethodElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:SignatureMethod'); + $signatureMethodElement->setAttribute('Algorithm', 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'); + $signedInfoElement->appendChild($signatureMethodElement); + $signatureElement->appendChild($signedInfoElement); + + $signatureValueElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:SignatureValue'); + $signatureElement->appendChild($signatureValueElement); + $securityElement->appendChild($signatureElement); + + $keyInfoElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:KeyInfo'); + $securityTokenReferenceElement = $document->createElementNS(self::NS_O, 'o:SecurityTokenReference'); + $securityTokenReferenceElement->setAttributeNS(self::NS_B, 'b:TokenType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0'); + $keyIdentifierElement = $document->createElementNS(self::NS_O, 'o:KeyIdentifier'); + $keyIdentifierElement->setAttribute('ValueType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID'); + $keyIdentifierElement->nodeValue = $tokenUuid; + $securityTokenReferenceElement->appendChild($keyIdentifierElement); + $keyInfoElement->appendChild($securityTokenReferenceElement); + $signatureElement->appendChild($keyInfoElement); + + $securityElement->appendChild($signatureElement); + + $header->appendChild($securityElement); + } + + /** + * Signs request. + * + * @internal + */ + public function buildSignedRequest(string $requestSimple, string $privKey) + { + $documentRequest = new \DOMDocument('1.0', 'utf-8'); + $documentRequest->preserveWhiteSpace = false; + $documentRequest->formatOutput = false; + Serializer::loadXML($requestSimple, $documentRequest); + + $signatureElement = $documentRequest->getElementsByTagName('Signature')[1]; + $signedInfoElement = $signatureElement->getElementsByTagName('SignedInfo')[0]; + + $referenceIds = [ + 'Body', + 'Action', + 'MessageID', + 'ReplyTo', + 'To', + 'Timestamp', + 'SecurityTokenReference', + ]; + + foreach ($referenceIds as &$value) { + $isSTR = ('SecurityTokenReference' === $value); + + $tags = $documentRequest->getElementsByTagName($value); + + $tag = $tags[0]; + $tagId = $this->getElementId($tag); + + if ($isSTR) { + $tag = $documentRequest->getElementsByTagName('Assertion')[0]; + } + + $canonicalXml = mb_convert_encoding($tag->C14N(true, false), 'UTF-8'); + + $digestValue = base64_encode(openssl_digest($canonicalXml, 'sha256', true)); + + $reference = $signedInfoElement->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'Reference')); + $reference->setAttribute('URI', "#{$tagId}"); + $transforms = $reference->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'Transforms')); + $transform = $transforms->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'Transform')); + + if ($isSTR) { + $transform->setAttribute('Algorithm', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform'); + $transformationParameter = $transform->appendChild($documentRequest->createElementNS('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'TransformationParameters')); + $canonicalizationMethod = $transformationParameter->appendChild($documentRequest->createELementNS('http://www.w3.org/2000/09/xmldsig#', 'CanonicalizationMethod')); + $canonicalizationMethod->setAttribute('Algorithm', 'http://www.w3.org/2001/10/xml-exc-c14n#'); + } else { + $transform->setAttribute('Algorithm', 'http://www.w3.org/2001/10/xml-exc-c14n#'); + } + + $method = $reference->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'DigestMethod')); + $method->setAttribute('Algorithm', 'http://www.w3.org/2001/04/xmlenc#sha256'); + $reference->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'DigestValue', $digestValue)); + } + + $signedInfoElementCanonical = $signedInfoElement->C14N(true, false); + + // OPENSSL_ALGO_SHA256 OR 'RSA-SHA256' OR 'sha256WithRSAEncryption'. + openssl_sign($signedInfoElementCanonical, $signatureValue, $privKey, 'sha256WithRSAEncryption'); + $signatureValue = base64_encode($signatureValue); + + // Insert signaturevalue. + $signatureElement->getElementsByTagName('SignatureValue')[0]->nodeValue = $signatureValue; + + return $documentRequest->saveXML($documentRequest->documentElement); + } + + /** + * Extract "Id" attribute from xml data. + * + * @internal + */ + public function getElementId(\DOMNode $element) + { + if ($element instanceof \DOMElement) { + /** @var \DOMAttr $attribute */ + foreach ($element->attributes as $attribute) { + if (false !== strpos($attribute->name, 'Id') || false !== strpos($attribute->name, 'ID')) { + return $attribute->value; + } + } + } + + return null; + } + + /** + * Computes timestamp. + * + * @internal + */ + public function getTimestamp($offset = 0) + { + return gmdate("Y-m-d\TH:i:s\Z", time() + $offset); + } + + /** + * Generates uuid. + * + * @internal + */ + public function generateUuid() + { + return sprintf( + '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', + // 32 bits for "time_low" + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF), + // 16 bits for "time_mid" + mt_rand(0, 0xFFFF), + // 16 bits for "time_hi_and_version", + // four most significant bits holds version number 4 + mt_rand(0, 0x0FFF) | 0x4000, + // 16 bits, 8 bits for "clk_seq_hi_res", + // 8 bits for "clk_seq_low", + // two most significant bits holds zero and one for variant DCE1.1 + mt_rand(0, 0x3FFF) | 0x8000, + // 48 bits for "node" + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF), + mt_rand(0, 0xFFFF) + ); + } +} diff --git a/src/Service/SF2900/SoapClient.php b/src/Service/SF2900/SoapClient.php new file mode 100644 index 00000000..66693fa2 --- /dev/null +++ b/src/Service/SF2900/SoapClient.php @@ -0,0 +1,70 @@ +disableCache = (bool) ($options[SoapClientBase::SOAP_DISABLE_CACHE] ?? false); + unset($options[SoapClientBase::SOAP_DISABLE_CACHE]); + + parent::__construct($wsdl, $options); + } + + /** + * TODO: Update signature cf. https://www.php.net/manual/en/soapclient.dorequest.php. + */ + #[\ReturnTypeWillChange] + public function __doRequest($request, $location, $action, $version, $oneWay = null) + { + $this->lastRequest = $request; + + $location = $this->sf2900->getSoapLocation($location); + + return $this->disableCache + ? $this->doRequest($request, $location, $action, $version, $oneWay) + : $this->sf2900->cacheSoapRequest( + [__METHOD__, $request, $location, $action, $version], + fn () => $this->doRequest($request, $location, $action, $version, $oneWay) + ); + } + + private function doRequest( + string $request, + string $location, + string $action, + int $version, + bool $oneWay = false, + ): ?string { + $formattedRequest = $this->sf2900->formatSoapRequest($request, $location, $action, $version, $oneWay); + $this->lastFormattedRequest = $formattedRequest; + + return parent::__doRequest($formattedRequest, $location, $action, $version, $oneWay); + } + + #[\ReturnTypeWillChange] + public function __getLastRequest() + { + return $this->lastRequest ?? parent::__getLastRequest(); + } + + public function __getLastFormattedRequest(): ?string + { + return $this->lastFormattedRequest; + } +} diff --git a/src/Service/SF2900/SoapClientBase.php b/src/Service/SF2900/SoapClientBase.php new file mode 100644 index 00000000..6d606f1d --- /dev/null +++ b/src/Service/SF2900/SoapClientBase.php @@ -0,0 +1,58 @@ + SOAP_1_2, + ] + parent::getDefaultWsdlOptions(); + } + + public function setSF2900(SF2900 $sf2900): self + { + $this->sf2900 = $sf2900; + + return $this; + } + + public function getSoapClient(): ?SoapClient + { + $soapClient = parent::getSoapClient(); + assert($soapClient instanceof SoapClient); + $soapClient->sf2900 = $this->sf2900; + + return $soapClient; + } + + public function saveLastError(string $methodName, \SoapFault $soapFault): self + { + // Throw a SOAP exception rather than just storing a SOAP fault as the parent class does. + throw new SoapException($soapFault, $this->getLastRequest(), $this->getLastResponse()); + } +} diff --git a/src/Service/SF2900/Type.php b/src/Service/SF2900/Type.php new file mode 100644 index 00000000..1081ad90 --- /dev/null +++ b/src/Service/SF2900/Type.php @@ -0,0 +1,9 @@ + + + + + + + + + + + + + + + + + From 48bea731d04683a6e92e1356a0bc525f816c36fe Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 21 Oct 2025 11:29:10 +0200 Subject: [PATCH 5/9] Cleaned up --- src/Command/SF1500/SF1500SearchCommand.php | 4 +- .../SF2900/FordelingsobjektAfsendCommand.php | 38 +++++- src/Service/SF2900/SF2900.php | 116 ++++++++---------- src/Service/SF2900/SoapClientBase.php | 4 +- 4 files changed, 89 insertions(+), 73 deletions(-) diff --git a/src/Command/SF1500/SF1500SearchCommand.php b/src/Command/SF1500/SF1500SearchCommand.php index 5d671387..b6a43621 100644 --- a/src/Command/SF1500/SF1500SearchCommand.php +++ b/src/Command/SF1500/SF1500SearchCommand.php @@ -36,8 +36,8 @@ protected function configure() '' ), new InputOption('authority-cvr', null, InputOption::VALUE_REQUIRED, 'authority cvr'), - new InputArgument('type', InputArgument::REQUIRED, 'The object type', null, ['user', 'hest']), - new InputArgument('query', InputArgument::REQUIRED, 'The search query'), + new InputArgument('type', InputArgument::REQUIRED, 'The object type, e.g. \'bruger\'', null, ['user', 'hest']), + new InputArgument('query', InputArgument::REQUIRED, 'The search query as JSON, e.g. \'{"brugernavn": "…"}\''), new InputOption('fields', null, InputOption::VALUE_REQUIRED, 'List of fields to include'), ]; $this->setDefinition(new InputDefinition($definition)); diff --git a/src/Command/SF2900/FordelingsobjektAfsendCommand.php b/src/Command/SF2900/FordelingsobjektAfsendCommand.php index 51e25655..e48aa6d1 100644 --- a/src/Command/SF2900/FordelingsobjektAfsendCommand.php +++ b/src/Command/SF2900/FordelingsobjektAfsendCommand.php @@ -4,11 +4,14 @@ namespace ItkDev\Serviceplatformen\Command\SF2900; +use ItkDev\Serviceplatformen\Service\SF1514\SF1514; use ItkDev\Serviceplatformen\Service\SF1601\Serializer; use ItkDev\Serviceplatformen\Service\SF2900\SF2900; use ItkDev\Serviceplatformen\Service\SF2900\Type; +use ItkDev\Serviceplatformen\Service\SoapClient; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Exception\InvalidOptionException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -42,26 +45,49 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $options = $this->resolveOptions( array_filter( - array_filter($input->getOptions()), - fn (string $name) => isset($this->baseOptions[$name]), + $input->getOptions(), + fn (string $name) => isset($this->baseOptions[$name]) || isset($this->commandOptions[$name]), ARRAY_FILTER_USE_KEY ) ); + if (null === $options['routing-kle']) { + throw new InvalidOptionException('Option "routing-kle" is required.'); + } + $io = new SymfonyStyle($input, $output); + $certificateLocator = $this->getCertificateLocator($options['certificate'], $options['certificate-passphrase']); - $sf2900 = new SF2900([ - 'authority_cvr' => $options['sender-id'], + $soapClient = new SoapClient([ + 'cache_expiration_time' => ['-1 hour'], + ]); + + $serviceOptions = [ 'certificate_locator' => $certificateLocator, + 'authority_cvr' => $options['sender-id'], + 'sts_applies_to' => SF2900::ENTITY_ID, 'test_mode' => !$options['production'], - ]); + ]; + + $sf1514 = new SF1514($soapClient, $serviceOptions); + + $sf2900 = new SF2900( + $sf1514, + [ + 'authority_cvr' => $options['sender-id'], + 'certificate_locator' => $certificateLocator, + 'test_mode' => !$options['production'], + ] + ); + $transactionId = Serializer::createUuid(); $sf2900->afsend( $transactionId, Type::Journalnotat, routingMyndighed: $options['sender-id'], - routingKLEEmne: $options['routing-kle'] ?? '' + routingKLEEmne: $options['routing-kle'], + routingHandlingFacet: $options['routing-handling-facet'], ); return Command::SUCCESS; diff --git a/src/Service/SF2900/SF2900.php b/src/Service/SF2900/SF2900.php index 43db99be..dd9d7be4 100644 --- a/src/Service/SF2900/SF2900.php +++ b/src/Service/SF2900/SF2900.php @@ -11,20 +11,27 @@ namespace ItkDev\Serviceplatformen\Service\SF2900; use ItkDev\Serviceplatformen\Certificate\CertificateLocatorInterface; +use ItkDev\Serviceplatformen\Service\Exception\SAMLTokenException; use ItkDev\Serviceplatformen\Service\SF1514\SF1514; use ItkDev\Serviceplatformen\Service\SF1601\Serializer; use ItkDev\Serviceplatformen\SF2900\ClassMap; use ItkDev\Serviceplatformen\SF2900\ServiceType\Fordelingsmodtager; +use ItkDev\Serviceplatformen\SF2900\ServiceType\Fordelingsobjekt; +use ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequestType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListResponseType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendRequestType; +use ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType; +use ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo; +use ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Cache\CacheInterface; use Symfony\Contracts\Cache\ItemInterface; -use Symfony\Contracts\HttpClient\ResponseInterface; class SF2900 { @@ -49,22 +56,6 @@ public function __construct(SF1514 $sf1514, array $options) } } - // #[\Override] - // protected function configureOptions(OptionsResolver $resolver) - // { - // // @todo https://digitaliseringskataloget.dk/integration/sf2900#:~:text=Servicen%20er%20udstillet%20med%20f%C3%B8lgende%20sikkerhedsmodeller - // parent::configureOptions($resolver); - // // https://digitaliseringskataloget.dk/integration/sf2900 - // $resolver->setDefaults([ - // 'svc_entity_id' => 'http://sp.serviceplatformen.dk/service/fordeling/3', - // 'svc_endpoint' => static function (Options $options) { - // return $options['test_mode'] - // ? 'https://exttest.serviceplatformen.dk/service/SP/Distribution/3' - // : 'https://prod.serviceplatformen.dk/service/SP/Distribution/3'; - // }, - // ]); - // } - public function getModtagerList( string $routingMyndighed, string $routingKLEEmne, @@ -80,32 +71,11 @@ public function getModtagerList( SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), ])) - ->setSF2900($this); + ->setSF2900($this); + $result = $service->FordelingsmodtagerList($request); return $result; - - $entityId = $this->getOption('svc_entity_id'); - $url = $this->getOption('svc_endpoint'); - - // $url = 'https://fordelingskomponent-itkdev.aarhuskommune.dk/fordelingskomponent/'; - - $client = new \SoapClient(__DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', [ - 'location' => $url, - 'trace' => true, - ]); - try { - $outputHeaders = []; - $result = $client->__soapCall('FordelingsmodtagerList', args: [$request], outputHeaders: $outputHeaders); - - return $result; - } catch (\SoapFault $exception) { - $req = $client->__getLastRequest(); - $res = $client->__getLastResponse(); - $exceptionMessage = $exception->getMessage(); - - throw $exception; - } } private function buildFordelingsmodtagerListRequest( @@ -132,8 +102,8 @@ public function afsend( string $routingMyndighed, string $routingKLEEmne, ?string $routingHandlingFacet = null, - ): ResponseInterface { - $document = $this->buildFordelingsobjektAfsendRequest( + ): FordelingsobjektAfsendRequestType|bool { + $request = $this->buildFordelingsobjektAfsendRequest( $transactionId, $type, routingMyndighed: $routingMyndighed, @@ -141,22 +111,15 @@ public function afsend( routingHandlingFacet: $routingHandlingFacet ); - header('content-type: text/plain'); - echo var_export($document, true); - exit(__FILE__.':'.__LINE__.':'.__METHOD__); - - $entityId = $this->getOption('svc_entity_id'); - $url = $this->getOption('svc_endpoint'); - $response = $this->call($entityId, 'POST', $url, [ - 'headers' => [ - 'content-type' => 'application/xml', - 'accept' => 'application/xml', - ], - 'body' => $document->saveXML(), - 'transactionId' => $transactionId, - ]); - - return $response; + $service = (new Fordelingsobjekt([ + SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', + SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), + ])) + ->setSF2900($this); + + $result = $service->FordelingsobjektAfsend($request); + + return $result; } private function buildFordelingsobjektAfsendRequest( @@ -167,12 +130,39 @@ private function buildFordelingsobjektAfsendRequest( ?string $routingHandlingFacet = null, ?string $afsendendeMyndighed = null, ): FordelingsobjektAfsendRequestType { - $t = new FordelingsobjektAfsendRequestType(); - // $t->getAnmodning()->setDistributionContext(); - $t->getAnmodning()->getDistributionObject()->setObjektType($type->value); - $t->getCallContext()->setPropertyValue('cpr', '0123456789'); + $afsendendeMyndighed ??= $this->options['authority_cvr']; + + $objectIndhold = new ObjektIndholdType( + // distributionDokument: null + ); + $distributionObject = new DistributionObjectType( + objektType: $type->value, + objektIndhold: $objectIndhold, + ); + $distributionContext = new DistributionContextType( + anvenderTransaktionsID: $transactionId, + afsendendeMyndighed: $afsendendeMyndighed, + routingMyndighed: $routingMyndighed, + routingValg: new RoutingValg( + new RoutingKLEInfo( + routingKLEEmne: $routingKLEEmne, + routingHandlingFacet: $routingHandlingFacet, + ) + ), + distributionTransktionsID: null, + digitalPostMeddelelsesID: null, + dokumentFilNavn: null + ); + $anmodning = new AnmodRequestType( + distributionContext: $distributionContext, + distributionObject: $distributionObject, + ); - return $t; + return new FordelingsobjektAfsendRequestType( + anmodning: $anmodning, + callContext: null, + authorityContext: null, + ); } /** diff --git a/src/Service/SF2900/SoapClientBase.php b/src/Service/SF2900/SoapClientBase.php index 6d606f1d..dc26fd67 100644 --- a/src/Service/SF2900/SoapClientBase.php +++ b/src/Service/SF2900/SoapClientBase.php @@ -34,7 +34,7 @@ public static function getDefaultWsdlOptions(): array ] + parent::getDefaultWsdlOptions(); } - public function setSF2900(SF2900 $sf2900): self + public function setSF2900(SF2900 $sf2900): static { $this->sf2900 = $sf2900; @@ -50,7 +50,7 @@ public function getSoapClient(): ?SoapClient return $soapClient; } - public function saveLastError(string $methodName, \SoapFault $soapFault): self + public function saveLastError(string $methodName, \SoapFault $soapFault): static { // Throw a SOAP exception rather than just storing a SOAP fault as the parent class does. throw new SoapException($soapFault, $this->getLastRequest(), $this->getLastResponse()); From 9802bc4a6131b86db0e7f9c8c3169b7ec4e46a0f Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 23 Oct 2025 09:37:28 +0200 Subject: [PATCH 6/9] The big purge --- Taskfile.yml | 7 + ...eplatformen-sf2900-fordelingsmodtager-list | 24 ++ ...eplatformen-sf2900-fordelingsobjekt-afsend | 24 ++ composer.json | 2 +- docs/SF2900.md | 48 ++++ .../SF2900/FordelingsmodtagerListCommand.php | 31 +- .../SF2900/FordelingsobjektAfsendCommand.php | 1 - src/Service/SF2900/SF2900.php | 240 +++------------- src/Service/SF2900/SF2900XMLBuilder.php | 267 ------------------ src/Service/SF2900/SoapClient.php | 41 +-- src/Service/SF2900/SoapClientBase.php | 4 +- .../SF2900/resources/insert-token.xslt | 18 -- 12 files changed, 164 insertions(+), 543 deletions(-) create mode 100755 bin/serviceplatformen-sf2900-fordelingsmodtager-list create mode 100755 bin/serviceplatformen-sf2900-fordelingsobjekt-afsend delete mode 100644 src/Service/SF2900/SF2900XMLBuilder.php delete mode 100644 src/Service/SF2900/resources/insert-token.xslt diff --git a/Taskfile.yml b/Taskfile.yml index 410d80bf..e22de012 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -21,6 +21,13 @@ tasks: - docker compose {{.COMPOSE_ARGS}} {{.CLI_ARGS}} internal: true + composer: + desc: Run composer inside docker compose setup, e.g. `task {{.TASK}} -- install` + cmds: + - task: compose + vars: + COMPOSE_ARGS: run --rm phpfpm composer + php: # https://taskfile.dev/docs/reference/templating#task-1 desc: Run PHP inside docker compose setup, e.g. `task {{.TASK}} -- bin/serviceplatformen-sf2900-fordelingsobjekt-list` diff --git a/bin/serviceplatformen-sf2900-fordelingsmodtager-list b/bin/serviceplatformen-sf2900-fordelingsmodtager-list new file mode 100755 index 00000000..5fb45f43 --- /dev/null +++ b/bin/serviceplatformen-sf2900-fordelingsmodtager-list @@ -0,0 +1,24 @@ +#!/usr/bin/env php +add($command); + +$application->setDefaultCommand($command->getName(), true); +$application->run(); diff --git a/bin/serviceplatformen-sf2900-fordelingsobjekt-afsend b/bin/serviceplatformen-sf2900-fordelingsobjekt-afsend new file mode 100755 index 00000000..298ce057 --- /dev/null +++ b/bin/serviceplatformen-sf2900-fordelingsobjekt-afsend @@ -0,0 +1,24 @@ +#!/usr/bin/env php +add($command); + +$application->setDefaultCommand($command->getName(), true); +$application->run(); diff --git a/composer.json b/composer.json index a162edc1..c3bfda52 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "require-dev": { "ergebnis/composer-normalize": "^2.48", "friendsofphp/php-cs-fixer": "^3.11", - "goetas-webservices/xsd2php": "dev-feature-xml-namespace-prefix", + "goetas-webservices/xsd2php": "dev-feature-xml-namespace-prefix#itk-0.4.14", "phan/phan": "^5.4", "phpstan/phpstan": "^1.8", "phpunit/phpunit": "^9.0", diff --git a/docs/SF2900.md b/docs/SF2900.md index 24a7348c..921b5dcb 100644 --- a/docs/SF2900.md +++ b/docs/SF2900.md @@ -8,3 +8,51 @@ > - SAML-token () + +## `FordelingsmodtagerList` + +Example request: + +``` shell name=test-FordelingsmodtagerList +curl https://exttest.serviceplatformen.dk/service/SP/Distribution/3 \ + --cert-type p12 \ + --cert '«path to your certificate»:«certificate password»' \ + --header 'content-type: text/xml;charset=UTF-8' \ + --data @- <<'XML' + + + + + + 55133018 + + + 55133018 + 👻 + 01.01.01 + + + + + +XML +``` + +Response: + +``` xml + + + + + + 👻 + fordelingskomponent-itkdev.aarhuskommune.dk + 01.01.* + A00 + + + + + +``` diff --git a/src/Command/SF2900/FordelingsmodtagerListCommand.php b/src/Command/SF2900/FordelingsmodtagerListCommand.php index 9d157d0a..250f5887 100644 --- a/src/Command/SF2900/FordelingsmodtagerListCommand.php +++ b/src/Command/SF2900/FordelingsmodtagerListCommand.php @@ -4,21 +4,22 @@ namespace ItkDev\Serviceplatformen\Command\SF2900; -use ItkDev\Serviceplatformen\Service\SF1514\SF1514; use ItkDev\Serviceplatformen\Service\SF2900\SF2900; -use ItkDev\Serviceplatformen\Service\SoapClient; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\InvalidOptionException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Yaml; #[AsCommand(name: 'serviceplatformen:sf2900:fordelingsmodtager-list', description: 'Helper script for testing “FordelingsmodtagerList”.')] final class FordelingsmodtagerListCommand extends AbstractCommand { protected function execute(InputInterface $input, OutputInterface $output): int { + $io = new SymfonyStyle($input, $output); + $options = $this->resolveOptions( array_filter( $input->getOptions(), @@ -31,37 +32,29 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw new InvalidOptionException('Option "routing-kle" is required.'); } - $io = new SymfonyStyle($input, $output); - $certificateLocator = $this->getCertificateLocator($options['certificate'], $options['certificate-passphrase']); - $soapClient = new SoapClient([ - 'cache_expiration_time' => ['-1 hour'], - ]); - - $serviceOptions = [ - 'certificate_locator' => $certificateLocator, - 'authority_cvr' => $options['sender-id'], - 'sts_applies_to' => SF2900::ENTITY_ID, - 'test_mode' => !$options['production'], - ]; - - $sf1514 = new SF1514($soapClient, $serviceOptions); - $sf2900 = new SF2900( - $sf1514, [ 'authority_cvr' => $options['sender-id'], 'certificate_locator' => $certificateLocator, 'test_mode' => !$options['production'], ] ); - $sf2900->getModtagerList( + + $result = $sf2900->getModtagerList( routingMyndighed: $options['sender-id'], routingKLEEmne: $options['routing-kle'], routingHandlingFacet: $options['routing-handling-facet'], ); + assert(null !== $result); + + foreach ($result->getSystemer()->getSystem() as $system) { + $io->section($system->getSystemNavn()); + $io->writeln(Yaml::dump(json_decode(json_encode($system), true))); + } + return Command::SUCCESS; } } diff --git a/src/Command/SF2900/FordelingsobjektAfsendCommand.php b/src/Command/SF2900/FordelingsobjektAfsendCommand.php index e48aa6d1..cececb6a 100644 --- a/src/Command/SF2900/FordelingsobjektAfsendCommand.php +++ b/src/Command/SF2900/FordelingsobjektAfsendCommand.php @@ -73,7 +73,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $sf1514 = new SF1514($soapClient, $serviceOptions); $sf2900 = new SF2900( - $sf1514, [ 'authority_cvr' => $options['sender-id'], 'certificate_locator' => $certificateLocator, diff --git a/src/Service/SF2900/SF2900.php b/src/Service/SF2900/SF2900.php index dd9d7be4..d0044d5b 100644 --- a/src/Service/SF2900/SF2900.php +++ b/src/Service/SF2900/SF2900.php @@ -11,13 +11,11 @@ namespace ItkDev\Serviceplatformen\Service\SF2900; use ItkDev\Serviceplatformen\Certificate\CertificateLocatorInterface; -use ItkDev\Serviceplatformen\Service\Exception\SAMLTokenException; -use ItkDev\Serviceplatformen\Service\SF1514\SF1514; -use ItkDev\Serviceplatformen\Service\SF1601\Serializer; use ItkDev\Serviceplatformen\SF2900\ClassMap; use ItkDev\Serviceplatformen\SF2900\ServiceType\Fordelingsmodtager; use ItkDev\Serviceplatformen\SF2900\ServiceType\Fordelingsobjekt; use ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType; +use ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType; use ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType; use ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest; @@ -31,51 +29,47 @@ use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Cache\CacheInterface; -use Symfony\Contracts\Cache\ItemInterface; class SF2900 { // https://digitaliseringskataloget.dk/integration/sf2900 public const ENTITY_ID = 'http://sp.serviceplatformen.dk/service/fordeling/3'; - private SF2900XMLBuilder $xmlBuilder; - private SF1514 $sf1514; protected array $options; - private static ?bool $shutdownFunctionRegistered = null; - - public function __construct(SF1514 $sf1514, array $options) + public function __construct(array $options) { - $this->sf1514 = $sf1514; - $this->xmlBuilder = new SF2900XMLBuilder(); $this->options = $this->resolveOptions($options); - - if (!self::$shutdownFunctionRegistered) { - register_shutdown_function(self::shutdown(...)); - self::$shutdownFunctionRegistered = true; - } } public function getModtagerList( string $routingMyndighed, string $routingKLEEmne, ?string $routingHandlingFacet = null, - ): FordelingsmodtagerListResponseType|bool { + ): ?FordelingsmodtagerListResponseType { $request = $this->buildFordelingsmodtagerListRequest( routingMyndighed: $routingMyndighed, routingKLEEmne: $routingKLEEmne, routingHandlingFacet: $routingHandlingFacet ); - $service = (new Fordelingsmodtager([ - SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', - SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), - ])) - ->setSF2900($this); - - $result = $service->FordelingsmodtagerList($request); + [$localCert, $passphrase] = $this->getLocalCert(); - return $result; + try { + $service = (new Fordelingsmodtager([ + SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', + SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), + SoapClientBase::WSDL_LOCAL_CERT => $localCert, + SoapClientBase::WSDL_PASSPHRASE => $passphrase, + ])) + ->setSF2900($this); + + return $service->FordelingsmodtagerList($request) ?: null; + } finally { + if (file_exists($localCert)) { + unlink($localCert); + } + } } private function buildFordelingsmodtagerListRequest( @@ -83,8 +77,10 @@ private function buildFordelingsmodtagerListRequest( ?string $routingKLEEmne, ?string $routingHandlingFacet = null, ?string $afsendendeMyndighed = null, + ?string $authorityContextMunicipalityCVR = null, ): FordelingsmodtagerListRequestType { $afsendendeMyndighed ??= $this->options['authority_cvr']; + $authorityContextMunicipalityCVR ??= $afsendendeMyndighed; $routing = new FordelingsmodtagerListRequest( afsendendeMyndighed: $afsendendeMyndighed, @@ -92,8 +88,12 @@ private function buildFordelingsmodtagerListRequest( routingKLEEmne: $routingKLEEmne, routingHandlingFacet: $routingHandlingFacet ); + $authorityContext = new AuthorityContextType($authorityContextMunicipalityCVR); - return new FordelingsmodtagerListRequestType(routing: $routing); + return new FordelingsmodtagerListRequestType( + routing: $routing, + authorityContext: $authorityContext + ); } public function afsend( @@ -165,34 +165,6 @@ private function buildFordelingsobjektAfsendRequest( ); } - /** - * Gets SAML token from SF1514. - * - * @throws SAMLTokenException - */ - private function getSAMLToken(): string - { - return $this->sf1514->getSAMLToken(); - } - - private function getPrivateKey(): string - { - return $this->getCertificatePart('pkey'); - } - - private function getCertificatePart(string $part): string - { - $certificateLocator = $this->options['certificate_locator']; - assert($certificateLocator instanceof CertificateLocatorInterface); - $certificates = $certificateLocator->getCertificates(); - - if (isset($certificates[$part])) { - return $certificates[$part]; - } - - throw new \RuntimeException(sprintf('Cannot get certificate part %s', $part)); - } - private function resolveOptions(array $options): array { return (new OptionsResolver()) @@ -233,150 +205,26 @@ private function resolveOptions(array $options): array public function getSoapLocation(string $location): string { - $domain = $this->options['service_endpoint_domain']; - - $path = preg_replace('@^.*(?=/service/SP/Distribution/)@', '', $location); - - $soapLocation = $domain.$path; - // @todo '/'.$this->options['soap_service_version'].'/'; - - return $soapLocation; - } - - private const NS_SOAP_ENVELOPE = 'http://www.w3.org/2003/05/soap-envelope'; - private const NS_SAGDOK = 'urn:oio:sagdok:3.0.0'; - private const STATUS_KODE_OK = '20'; - - public function formatSoapRequest( - string $request, - string $location, - string $action, - int $version, - bool $oneWay = false, - ): string { - $doc = Serializer::loadXML($request); - - // Set an id. - /** @var \DOMElement $body */ - $body = $doc->getElementsByTagNameNS(self::NS_SOAP_ENVELOPE, 'Body')[0]; - $body->setAttributeNS( - 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd', - 'u:Id', - '_1' - ); - - $token = $this->getSAMLToken(); - $this->xmlBuilder->buildSoapHeader($doc->getElementsByTagNameNS(self::NS_SOAP_ENVELOPE, 'Header')[0], $location, $action, $token); - - // HACK! - // @see self::getTokenXSLTProcessor(). - $request = self::getTokenXSLTProcessor($token)->transformToXml($doc); - - return $this->xmlBuilder->buildSignedRequest($request, $this->getPrivateKey()); - } - - private static array $tokenXSLTProcessors = []; - - /** - * @see https://bugs.php.net/bug.php?id=55294 - */ - private static function getTokenXSLTProcessor(string $token): \XSLTProcessor - { - if (!isset(self::$tokenXSLTProcessors[$token])) { - $xsldoc = new \DOMDocument(); - $xsldoc->load(__DIR__.'/resources/insert-token.xslt'); - - $tokenPath = tempnam(sys_get_temp_dir(), sha1($token).'.token.xml'); - file_put_contents($tokenPath, $token); - $xsl = new \XSLTProcessor(); - $xsl->importStylesheet($xsldoc); - $xsl->setParameter('', 'token-path', $tokenPath); - - self::$tokenXSLTProcessors[$token] = [ - 'xsltprocessor' => $xsl, - 'tokenpath' => $tokenPath, - ]; - } - - return self::$tokenXSLTProcessors[$token]['xsltprocessor']; - } - - private static function shutdown() - { - foreach (self::$tokenXSLTProcessors as $processor) { - if ($path = ($processor['tokenpath'] ?? null)) { - if (file_exists($path)) { - unlink($path); - } - } - } + return $this->options['service_endpoint_domain'] + .parse_url($location, PHP_URL_PATH); } - public function cacheSoapRequest(array $cacheKeys, callable $callable) + private function getLocalCert(): array { - $cache = $this->getCache(); - $cacheKey = $this->getSoapRequestCacheKey(__METHOD__, $cacheKeys); - $expirationTime = $this->getSoapRequestCacheExpirationDateTime(); - - return $cache->get($cacheKey, function (ItemInterface $item) use ($callable, $expirationTime) { - $response = $callable(); - - if (!is_string($response) || $this->preventCaching($response)) { - $expirationTime = new \DateTimeImmutable('-1 day'); - } - - $item->expiresAt($expirationTime); - - return $response; - }); - } - - private function preventCaching(string $response): bool - { - try { - $document = Serializer::loadXML($response); - // Prevent caching if we have a SOAP fault. - if ($document->getElementsByTagNameNS(self::NS_SOAP_ENVELOPE, 'Fault')->count() > 0) { - return true; - } - - // Prevent caching if we get a "not OK" status code. - $statusKode = $document->getElementsByTagNameNS(self::NS_SAGDOK, 'StatusKode')->item(0); - if (null !== $statusKode && self::STATUS_KODE_OK !== $statusKode->nodeValue) { - return true; - } - } catch (\Throwable) { - // Ignore any exceptions. - } - - return false; - } - - private function getCache(): CacheInterface - { - return $this->options['cache']; - } - - private function getSoapRequestCacheKey(string $key, array $payload): string - { - return preg_replace( - '#[{}()/\\\\@:]+#', - '_', - $key.'|'.sha1(json_encode($payload + $this->options)) - ); - } - - public function getSoapRequestCacheExpirationDateTime(): ?\DateTimeImmutable - { - $now = new \DateTimeImmutable('now'); - $times = []; - foreach ($this->options['soap_request_cache_expiration_time'] as $spec) { - $time = $now->modify($spec); - if ($time > $now) { - $times[] = $time; - } - } - - return empty($times) ? null : min([...$times]); + // @todo Does this only work with a file system certificate locator?! + $certificateLocator = $this->options['certificate_locator']; + assert($certificateLocator instanceof CertificateLocatorInterface); + $certificates = $certificateLocator->getCertificates(); + $passphrase = ''; + $output = [null, null]; + openssl_x509_export($certificates['cert'], $output[0]); + openssl_pkey_export($certificates['pkey'], $output[1], $passphrase); + $localCertFilename = tempnam(sys_get_temp_dir(), 'cert'); + file_put_contents($localCertFilename, join(PHP_EOL, $output)); + + return [ + $localCertFilename, + $passphrase, + ]; } } diff --git a/src/Service/SF2900/SF2900XMLBuilder.php b/src/Service/SF2900/SF2900XMLBuilder.php deleted file mode 100644 index 451bf5cb..00000000 --- a/src/Service/SF2900/SF2900XMLBuilder.php +++ /dev/null @@ -1,267 +0,0 @@ -ownerDocument; - $createdAt = $this->getTimestamp(); - $expiresAt = $this->getTimestamp(300); - - $frameworkElement = $document->createElementNS(self::NS_SBF, 'sbf:Framework'); - $frameworkElement->setAttribute('version', '2.0'); - $frameworkElement->setAttributeNS(self::NS_PROFILE, 'profile:profile', 'urn:liberty:sb:profile:basic'); - $header->appendChild($frameworkElement); - - $actionElement = $document->createElementNS(self::NS_A, 'a:Action'); - $actionElement->setAttributeNS(self::NS_S, 's:mustUnderstand', '1'); - $actionElement->setAttributeNS(self::NS_U, 'u:Id', '_2'); - $actionElement->nodeValue = $action; - $header->appendChild($actionElement); - - $requestHeaderElement = $document->createElementNS(self::NS_H, 'h:RequestHeader'); - $transactionUUIDElement = $document->createElementNS(self::NS_H, 'h:TransactionUUID'); - $transactionUUIDElement->nodeValue = $this->generateUuid(); - $requestHeaderElement->appendChild($transactionUUIDElement); - $header->appendChild($requestHeaderElement); - - $messageElement = $document->createElementNS(self::NS_A, 'a:MessageID'); - $messageElement->setAttributeNS(self::NS_U, 'u:Id', '_3'); - $messageElement->nodeValue = 'urn:uuid:'.$this->generateUuid(); - $header->appendChild($messageElement); - - $replyElement = $document->createElementNS(self::NS_A, 'a:ReplyTo'); - $replyElement->setAttributeNS(self::NS_U, 'u:Id', '_4'); - $addressElement = $document->createElementNS(self::NS_A, 'a:Address'); - $addressElement->nodeValue = 'http://www.w3.org/2005/08/addressing/anonymous'; - $replyElement->appendChild($addressElement); - $header->appendChild($replyElement); - - $toElement = $document->createElementNS(self::NS_A, 'a:To'); - $toElement->setAttributeNS(self::NS_S, 's:mustUnderstand', '1'); - $toElement->setAttributeNS(self::NS_U, 'u:Id', '_5'); - $toElement->nodeValue = $to; - $header->appendChild($toElement); - - $securityElement = $document->createElementNS(self::NS_O, 'o:Security'); - $securityElement->setAttributeNS(self::NS_S, 's:mustUnderstand', '1'); - - $timestampElement = $document->createElementNS(self::NS_U, 'u:Timestamp'); - $timestampElement->setAttributeNS(self::NS_U, 'Id', 'uuid-'.$this->generateUuid()); - $createdElement = $document->createElementNS(self::NS_U, 'u:Created'); - $createdElement->nodeValue = $createdAt; - $timestampElement->appendChild($createdElement); - $expiresElement = $document->createElementNS(self::NS_U, 'u:Expires'); - $expiresElement->nodeValue = $expiresAt; - $timestampElement->appendChild($expiresElement); - $securityElement->appendChild($timestampElement); - - $tokenDocument = Serializer::loadXML($tokenXml); - $tokenElement = $document->importNode($tokenDocument->documentElement, true); - $tokenUuid = $this->getElementId($tokenElement); - - // @see https://bugs.php.net/bug.php?id=55294 - $tokenElement = $document->createElementNS(self::NS_ASSERTION, 'assertion:insert-token-here'); - $tokenElement->nodeValue = 'INSERT TOKEN HERE'; - - $securityElement->appendChild($tokenElement); - - $securityTokenReferenceElement = $document->createElementNS(self::NS_O, 'o:SecurityTokenReference'); - $securityTokenReferenceElement->setAttributeNS(self::NS_U, 'u:Id', '_str'.$tokenUuid); - $securityTokenReferenceElement->setAttributeNS(self::NS_B, 'b:TokenType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0'); - $keyIdentifierElement = $document->createElementNS(self::NS_O, 'o:KeyIdentifier'); - $keyIdentifierElement->setAttribute('ValueType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID'); - $keyIdentifierElement->nodeValue = $tokenUuid; - $securityTokenReferenceElement->appendChild($keyIdentifierElement); - $securityElement->appendChild($securityTokenReferenceElement); - - $signatureElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:Signature'); - $signedInfoElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:SignedInfo'); - $canonicalizationMethodElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:CanonicalizationMethod'); - $canonicalizationMethodElement->setAttribute('Algorithm', 'http://www.w3.org/2001/10/xml-exc-c14n#'); - $signedInfoElement->appendChild($canonicalizationMethodElement); - $signatureMethodElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:SignatureMethod'); - $signatureMethodElement->setAttribute('Algorithm', 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'); - $signedInfoElement->appendChild($signatureMethodElement); - $signatureElement->appendChild($signedInfoElement); - - $signatureValueElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:SignatureValue'); - $signatureElement->appendChild($signatureValueElement); - $securityElement->appendChild($signatureElement); - - $keyInfoElement = $document->createElementNS(self::NS_XMLDSIG, 'xmlsdig:KeyInfo'); - $securityTokenReferenceElement = $document->createElementNS(self::NS_O, 'o:SecurityTokenReference'); - $securityTokenReferenceElement->setAttributeNS(self::NS_B, 'b:TokenType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0'); - $keyIdentifierElement = $document->createElementNS(self::NS_O, 'o:KeyIdentifier'); - $keyIdentifierElement->setAttribute('ValueType', 'http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID'); - $keyIdentifierElement->nodeValue = $tokenUuid; - $securityTokenReferenceElement->appendChild($keyIdentifierElement); - $keyInfoElement->appendChild($securityTokenReferenceElement); - $signatureElement->appendChild($keyInfoElement); - - $securityElement->appendChild($signatureElement); - - $header->appendChild($securityElement); - } - - /** - * Signs request. - * - * @internal - */ - public function buildSignedRequest(string $requestSimple, string $privKey) - { - $documentRequest = new \DOMDocument('1.0', 'utf-8'); - $documentRequest->preserveWhiteSpace = false; - $documentRequest->formatOutput = false; - Serializer::loadXML($requestSimple, $documentRequest); - - $signatureElement = $documentRequest->getElementsByTagName('Signature')[1]; - $signedInfoElement = $signatureElement->getElementsByTagName('SignedInfo')[0]; - - $referenceIds = [ - 'Body', - 'Action', - 'MessageID', - 'ReplyTo', - 'To', - 'Timestamp', - 'SecurityTokenReference', - ]; - - foreach ($referenceIds as &$value) { - $isSTR = ('SecurityTokenReference' === $value); - - $tags = $documentRequest->getElementsByTagName($value); - - $tag = $tags[0]; - $tagId = $this->getElementId($tag); - - if ($isSTR) { - $tag = $documentRequest->getElementsByTagName('Assertion')[0]; - } - - $canonicalXml = mb_convert_encoding($tag->C14N(true, false), 'UTF-8'); - - $digestValue = base64_encode(openssl_digest($canonicalXml, 'sha256', true)); - - $reference = $signedInfoElement->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'Reference')); - $reference->setAttribute('URI', "#{$tagId}"); - $transforms = $reference->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'Transforms')); - $transform = $transforms->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'Transform')); - - if ($isSTR) { - $transform->setAttribute('Algorithm', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform'); - $transformationParameter = $transform->appendChild($documentRequest->createElementNS('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'TransformationParameters')); - $canonicalizationMethod = $transformationParameter->appendChild($documentRequest->createELementNS('http://www.w3.org/2000/09/xmldsig#', 'CanonicalizationMethod')); - $canonicalizationMethod->setAttribute('Algorithm', 'http://www.w3.org/2001/10/xml-exc-c14n#'); - } else { - $transform->setAttribute('Algorithm', 'http://www.w3.org/2001/10/xml-exc-c14n#'); - } - - $method = $reference->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'DigestMethod')); - $method->setAttribute('Algorithm', 'http://www.w3.org/2001/04/xmlenc#sha256'); - $reference->appendChild($documentRequest->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'DigestValue', $digestValue)); - } - - $signedInfoElementCanonical = $signedInfoElement->C14N(true, false); - - // OPENSSL_ALGO_SHA256 OR 'RSA-SHA256' OR 'sha256WithRSAEncryption'. - openssl_sign($signedInfoElementCanonical, $signatureValue, $privKey, 'sha256WithRSAEncryption'); - $signatureValue = base64_encode($signatureValue); - - // Insert signaturevalue. - $signatureElement->getElementsByTagName('SignatureValue')[0]->nodeValue = $signatureValue; - - return $documentRequest->saveXML($documentRequest->documentElement); - } - - /** - * Extract "Id" attribute from xml data. - * - * @internal - */ - public function getElementId(\DOMNode $element) - { - if ($element instanceof \DOMElement) { - /** @var \DOMAttr $attribute */ - foreach ($element->attributes as $attribute) { - if (false !== strpos($attribute->name, 'Id') || false !== strpos($attribute->name, 'ID')) { - return $attribute->value; - } - } - } - - return null; - } - - /** - * Computes timestamp. - * - * @internal - */ - public function getTimestamp($offset = 0) - { - return gmdate("Y-m-d\TH:i:s\Z", time() + $offset); - } - - /** - * Generates uuid. - * - * @internal - */ - public function generateUuid() - { - return sprintf( - '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', - // 32 bits for "time_low" - mt_rand(0, 0xFFFF), - mt_rand(0, 0xFFFF), - // 16 bits for "time_mid" - mt_rand(0, 0xFFFF), - // 16 bits for "time_hi_and_version", - // four most significant bits holds version number 4 - mt_rand(0, 0x0FFF) | 0x4000, - // 16 bits, 8 bits for "clk_seq_hi_res", - // 8 bits for "clk_seq_low", - // two most significant bits holds zero and one for variant DCE1.1 - mt_rand(0, 0x3FFF) | 0x8000, - // 48 bits for "node" - mt_rand(0, 0xFFFF), - mt_rand(0, 0xFFFF), - mt_rand(0, 0xFFFF) - ); - } -} diff --git a/src/Service/SF2900/SoapClient.php b/src/Service/SF2900/SoapClient.php index 66693fa2..cde57138 100644 --- a/src/Service/SF2900/SoapClient.php +++ b/src/Service/SF2900/SoapClient.php @@ -15,56 +15,21 @@ class SoapClient extends \SoapClient public SF2900 $sf2900; private ?string $lastRequest; - private ?string $lastFormattedRequest; - private bool $disableCache; - - public function __construct(?string $wsdl, ?array $options = null) - { - $this->disableCache = (bool) ($options[SoapClientBase::SOAP_DISABLE_CACHE] ?? false); - unset($options[SoapClientBase::SOAP_DISABLE_CACHE]); - - parent::__construct($wsdl, $options); - } /** * TODO: Update signature cf. https://www.php.net/manual/en/soapclient.dorequest.php. */ - #[\ReturnTypeWillChange] - public function __doRequest($request, $location, $action, $version, $oneWay = null) + public function __doRequest($request, $location, $action, $version, $oneWay = null): ?string { $this->lastRequest = $request; $location = $this->sf2900->getSoapLocation($location); - return $this->disableCache - ? $this->doRequest($request, $location, $action, $version, $oneWay) - : $this->sf2900->cacheSoapRequest( - [__METHOD__, $request, $location, $action, $version], - fn () => $this->doRequest($request, $location, $action, $version, $oneWay) - ); - } - - private function doRequest( - string $request, - string $location, - string $action, - int $version, - bool $oneWay = false, - ): ?string { - $formattedRequest = $this->sf2900->formatSoapRequest($request, $location, $action, $version, $oneWay); - $this->lastFormattedRequest = $formattedRequest; - - return parent::__doRequest($formattedRequest, $location, $action, $version, $oneWay); + return parent::__doRequest($request, $location, $action, $version, $oneWay); } - #[\ReturnTypeWillChange] - public function __getLastRequest() + public function __getLastRequest(): ?string { return $this->lastRequest ?? parent::__getLastRequest(); } - - public function __getLastFormattedRequest(): ?string - { - return $this->lastFormattedRequest; - } } diff --git a/src/Service/SF2900/SoapClientBase.php b/src/Service/SF2900/SoapClientBase.php index dc26fd67..ff54bf2c 100644 --- a/src/Service/SF2900/SoapClientBase.php +++ b/src/Service/SF2900/SoapClientBase.php @@ -20,8 +20,6 @@ class SoapClientBase extends AbstractSoapClientBase { protected SF2900 $sf2900; - public const SOAP_DISABLE_CACHE = 'soap_disable_cache'; - public function getSoapClientClassName(?string $soapClientClassName = null): string { return parent::getSoapClientClassName(SoapClient::class); @@ -30,7 +28,7 @@ public function getSoapClientClassName(?string $soapClientClassName = null): str public static function getDefaultWsdlOptions(): array { return [ - self::WSDL_SOAP_VERSION => SOAP_1_2, + self::WSDL_SOAP_VERSION => SOAP_1_1, ] + parent::getDefaultWsdlOptions(); } diff --git a/src/Service/SF2900/resources/insert-token.xslt b/src/Service/SF2900/resources/insert-token.xslt deleted file mode 100644 index eed56134..00000000 --- a/src/Service/SF2900/resources/insert-token.xslt +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - From f303b46004f0a26a9e247818febcc1504ed627a1 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 24 Oct 2025 09:43:42 +0200 Subject: [PATCH 7/9] Afsend experiments --- docs/SF2900.md | 9 + .../SF2900/FordelingsobjektAfsendCommand.php | 211 +++++++++++++++--- src/Service/SF2900/SF2900.php | 105 ++++++--- src/Service/SF2900/Type.php | 9 - 4 files changed, 269 insertions(+), 65 deletions(-) delete mode 100644 src/Service/SF2900/Type.php diff --git a/docs/SF2900.md b/docs/SF2900.md index 921b5dcb..893baea0 100644 --- a/docs/SF2900.md +++ b/docs/SF2900.md @@ -7,6 +7,15 @@ > - AuthorityContext > - SAML-token +``` + [SoapFault] + Security model for the called operation was not provided. The following are supported: [KombitToken, AuthorityContext] + + For further information contact Serviceplatformen Helpdesk and inform: + CallUUID: cca459ba-ee11-4030-8ae1-25ea95b0318c + Received: 2025-10-23T13:06:14.306Z +``` + () ## `FordelingsmodtagerList` diff --git a/src/Command/SF2900/FordelingsobjektAfsendCommand.php b/src/Command/SF2900/FordelingsobjektAfsendCommand.php index cececb6a..ac53e063 100644 --- a/src/Command/SF2900/FordelingsobjektAfsendCommand.php +++ b/src/Command/SF2900/FordelingsobjektAfsendCommand.php @@ -4,18 +4,45 @@ namespace ItkDev\Serviceplatformen\Command\SF2900; -use ItkDev\Serviceplatformen\Service\SF1514\SF1514; +use ItkDev\Serviceplatformen\Service\Exception\SoapException; use ItkDev\Serviceplatformen\Service\SF1601\Serializer; use ItkDev\Serviceplatformen\Service\SF2900\SF2900; -use ItkDev\Serviceplatformen\Service\SF2900\Type; -use ItkDev\Serviceplatformen\Service\SoapClient; +use ItkDev\Serviceplatformen\SF2900\EnumType\AktoerTypeType; +use ItkDev\Serviceplatformen\SF2900\EnumType\DokumenttypeType; +use ItkDev\Serviceplatformen\SF2900\EnumType\FremdriftType; +use ItkDev\Serviceplatformen\SF2900\EnumType\JournalPostRolleType; +use ItkDev\Serviceplatformen\SF2900\EnumType\LivscyklusKodeType; +use ItkDev\Serviceplatformen\SF2900\EnumType\ObjektTypeType; +use ItkDev\Serviceplatformen\SF2900\EnumType\RetningType; +use ItkDev\Serviceplatformen\SF2900\EnumType\VariantRolleType; +use ItkDev\Serviceplatformen\SF2900\StructType\AttributterListeType; +use ItkDev\Serviceplatformen\SF2900\StructType\AttributterType; +use ItkDev\Serviceplatformen\SF2900\StructType\DelAttributterType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType; +use ItkDev\Serviceplatformen\SF2900\StructType\DokumentRegistreringType; +use ItkDev\Serviceplatformen\SF2900\StructType\JournalNotatEgenskaberType; +use ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRegistreringType; +use ItkDev\Serviceplatformen\SF2900\StructType\JournalPostRelationsListeType; +use ItkDev\Serviceplatformen\SF2900\StructType\JournalPostType; +use ItkDev\Serviceplatformen\SF2900\StructType\RelationsListe; +use ItkDev\Serviceplatformen\SF2900\StructType\TilstandListeType; +use ItkDev\Serviceplatformen\SF2900\StructType\TilstandType; +use ItkDev\Serviceplatformen\SF2900\StructType\UUID_URN; +use ItkDev\Serviceplatformen\SF2900\StructType\VariantAttributterType; +use ItkDev\Serviceplatformen\SF2900\StructType\VariantListeType; +use ItkDev\Serviceplatformen\SF2900\StructType\VariantType; +use ItkDev\Serviceplatformen\SF2900\StructType\VirkningType; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\InvalidOptionException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Uid\Uuid; #[AsCommand(name: 'serviceplatformen:sf2900:fordelingsobjekt-afsend', description: 'Helper script for testing “FordelingsobjektAfsend”.')] final class FordelingsobjektAfsendCommand extends AbstractCommand @@ -36,13 +63,17 @@ protected function getDefinitionItems(): array return array_merge( parent::getDefinitionItems(), [ - new InputOption('type', null, InputOption::VALUE_REQUIRED, 'type', Type::Journalnotat->value), + new InputOption('type', null, InputOption::VALUE_REQUIRED, 'type', ObjektTypeType::VALUE_JOURNALPOST), + new InputOption('routing-modtager-aktoer', null, InputOption::VALUE_REQUIRED, 'routing-modtager-aktoer'), + new InputOption('registrering-it-system', null, InputOption::VALUE_REQUIRED, 'registrering-it-system'), ] ); } protected function execute(InputInterface $input, OutputInterface $output): int { + $io = new SymfonyStyle($input, $output); + $options = $this->resolveOptions( array_filter( $input->getOptions(), @@ -55,23 +86,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw new InvalidOptionException('Option "routing-kle" is required.'); } - $io = new SymfonyStyle($input, $output); - $certificateLocator = $this->getCertificateLocator($options['certificate'], $options['certificate-passphrase']); - $soapClient = new SoapClient([ - 'cache_expiration_time' => ['-1 hour'], - ]); - - $serviceOptions = [ - 'certificate_locator' => $certificateLocator, - 'authority_cvr' => $options['sender-id'], - 'sts_applies_to' => SF2900::ENTITY_ID, - 'test_mode' => !$options['production'], - ]; - - $sf1514 = new SF1514($soapClient, $serviceOptions); - $sf2900 = new SF2900( [ 'authority_cvr' => $options['sender-id'], @@ -80,15 +96,158 @@ protected function execute(InputInterface $input, OutputInterface $output): int ] ); + $registreringItSystem = $options['registrering-it-system']; + + $aktoer = $registreringItSystem; + $id = Serializer::createUuid(); + $now = new \DateTimeImmutable(); + $type = $options['type']; + $document = match ($type) { + ObjektTypeType::VALUE_JOURNALPOST => new DistributionJournalPostType( + iD: $id, + kLEEmneForslag: $options['routing-kle'], + registrering: new JournalPostRegistreringType( + fraTidsPunkt: $now->format($sf2900::DATETIME_FORMAT), + livscyklusKode: LivscyklusKodeType::VALUE_OPRETTET, + registreringItSystem: new UUID_URN($registreringItSystem), + relationListe: new JournalPostRelationsListeType([ + new JournalPostType( + virkning: new VirkningType( + aktoer: new UUID_URN($aktoer), + aktoerType: AktoerTypeType::VALUE_IT_SYSTEM, + // fraTidsPunkt: null, + // tilTidspunkt: null, + // noteTekst: null, + ), + rolle: JournalPostRolleType::VALUE_JOURNALPOST, + indeks: __FILE__, + journalnotatAttributter: new JournalNotatEgenskaberType( + notat: __FILE__, + titel: __METHOD__, + ) + ), + ]) + ), + ), + ObjektTypeType::VALUE_DOKUMENT => new DistributionDokumentType( + iD: $id, + kLEEmneForslag: $options['routing-kle'], + // handlingFacetForslag: null, + registrering: new DokumentRegistreringType( + fraTidsPunkt: $now->format($sf2900::DATETIME_FORMAT), + livscyklusKode: LivscyklusKodeType::VALUE_OPRETTET, + registreringItSystem: new UUID_URN($registreringItSystem), + relationListe: new RelationsListe( + variantListe: new VariantListeType([ + new VariantType( + virkning: new VirkningType( + aktoer: new UUID_URN($aktoer), + aktoerType: AktoerTypeType::VALUE_IT_SYSTEM, + // fraTidsPunkt: null, + // tilTidspunkt: null, + // noteTekst: null, + ), + rolle: VariantRolleType::VALUE_VARIANT, + indeks: __FILE__, + variantAttributter: new VariantAttributterType( + variantType: __FILE__, + ), + delAttributter: new DelAttributterType( + delTekst: __FILE__, + ), + ), + ]), + ), + tilstandsListe: [ + new TilstandListeType( + tilstand: [ + new TilstandType( + // @todo + fremdrift: FremdriftType::VALUE_AFLEVERET, + virkning: new VirkningType( + aktoer: new UUID_URN($aktoer), + aktoerType: AktoerTypeType::VALUE_IT_SYSTEM, + // fraTidsPunkt: null, + // tilTidspunkt: null, + // noteTekst: null, + ), + ), + ] + ), + ], + attributListe: new AttributterListeType([ + new AttributterType( + brugervendtNoegleTekst: __FILE__, + titelTekst: __FILE__, + beskrivelseTekst: __FILE__, + dokumenttype: DokumenttypeType::VALUE_NOTAT, + retning: RetningType::VALUE_UDGAAENDE, + brevdato: $now->format($sf2900::DATE_FORMAT), + virkning: new VirkningType( + aktoer: new UUID_URN($aktoer), + aktoerType: AktoerTypeType::VALUE_IT_SYSTEM, + // fraTidsPunkt: null, + // tilTidspunkt: null, + // noteTekst: null, + ), + ), + ]), + // importTidspunkt: null, + // brugerRef: null, + ) + ), + ObjektTypeType::VALUE_FORMULAR => '', + default => throw new InvalidArgumentException(sprintf('Invalid type: %s', $type)), + }; + $transactionId = Serializer::createUuid(); - $sf2900->afsend( - $transactionId, - Type::Journalnotat, - routingMyndighed: $options['sender-id'], - routingKLEEmne: $options['routing-kle'], - routingHandlingFacet: $options['routing-handling-facet'], - ); + try { + $result = $sf2900->afsend( + transactionId: $transactionId, + type: $type, + document: $document, + routingMyndighed: $options['sender-id'], + routingKLEEmne: $options['routing-kle'], + routingHandlingFacet: $options['routing-handling-facet'], + routingModtagerAktoer: $options['routing-modtager-aktoer'], + ); + $io->writeln(var_export($result, true)); + } catch (SoapException $exception) { + $io->writeln($exception->getRequest()); + $io->error($exception->getResponse()); + + throw $exception; + } return Command::SUCCESS; } + + protected function configureOptions(OptionsResolver $resolver): OptionsResolver + { + return parent::configureOptions($resolver) + ->setDefault('type', ObjektTypeType::VALUE_JOURNALPOST) + ->setDefault('routing-modtager-aktoer', null) + ->setAllowedValues('routing-modtager-aktoer', static function (?string $value): bool { + if (null !== $value) { + try { + new Uuid($value); + } catch (\Exception) { + return false; + } + } + + return true; + }) + ->setRequired('registrering-it-system') + ->setAllowedTypes('registrering-it-system', 'string') + ->setAllowedValues('registrering-it-system', static function (string $value): bool { + try { + new Uuid($value); + } catch (\Exception) { + return false; + } + + return true; + }); + } } diff --git a/src/Service/SF2900/SF2900.php b/src/Service/SF2900/SF2900.php index d0044d5b..8ef11b0d 100644 --- a/src/Service/SF2900/SF2900.php +++ b/src/Service/SF2900/SF2900.php @@ -17,11 +17,15 @@ use ItkDev\Serviceplatformen\SF2900\StructType\AnmodRequestType; use ItkDev\Serviceplatformen\SF2900\StructType\AuthorityContextType; use ItkDev\Serviceplatformen\SF2900\StructType\DistributionContextType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionDokumentType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionFormularType; +use ItkDev\Serviceplatformen\SF2900\StructType\DistributionJournalPostType; use ItkDev\Serviceplatformen\SF2900\StructType\DistributionObjectType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequest; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListRequestType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsmodtagerListResponseType; use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendRequestType; +use ItkDev\Serviceplatformen\SF2900\StructType\FordelingsobjektAfsendResponseType; use ItkDev\Serviceplatformen\SF2900\StructType\ObjektIndholdType; use ItkDev\Serviceplatformen\SF2900\StructType\RoutingKLEInfo; use ItkDev\Serviceplatformen\SF2900\StructType\RoutingValg; @@ -29,11 +33,14 @@ use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Cache\CacheInterface; +use WsdlToPhp\PackageBase\SoapClientInterface; class SF2900 { // https://digitaliseringskataloget.dk/integration/sf2900 - public const ENTITY_ID = 'http://sp.serviceplatformen.dk/service/fordeling/3'; + public const string ENTITY_ID = 'http://sp.serviceplatformen.dk/service/fordeling/3'; + public const string DATETIME_FORMAT = \DateTimeInterface::ATOM; + public const string DATE_FORMAT = 'Y-m-d'; protected array $options; @@ -57,10 +64,10 @@ public function getModtagerList( try { $service = (new Fordelingsmodtager([ - SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', - SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), - SoapClientBase::WSDL_LOCAL_CERT => $localCert, - SoapClientBase::WSDL_PASSPHRASE => $passphrase, + SoapClientInterface::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', + SoapClientInterface::WSDL_CLASSMAP => ClassMap::get(), + SoapClientInterface::WSDL_LOCAL_CERT => $localCert, + SoapClientInterface::WSDL_PASSPHRASE => $passphrase, ])) ->setSF2900($this); @@ -98,57 +105,93 @@ private function buildFordelingsmodtagerListRequest( public function afsend( string $transactionId, - Type $type, + string $type, + DistributionDokumentType|DistributionJournalPostType|DistributionFormularType $document, string $routingMyndighed, string $routingKLEEmne, ?string $routingHandlingFacet = null, - ): FordelingsobjektAfsendRequestType|bool { + ?string $routingModtagerAktoer = null, + ): ?FordelingsobjektAfsendResponseType { $request = $this->buildFordelingsobjektAfsendRequest( - $transactionId, - $type, + transactionId: $transactionId, + type: $type, + document: $document, routingMyndighed: $routingMyndighed, routingKLEEmne: $routingKLEEmne, - routingHandlingFacet: $routingHandlingFacet + routingHandlingFacet: $routingHandlingFacet, + routingModtagerAktoer: $routingModtagerAktoer, ); - $service = (new Fordelingsobjekt([ - SoapClientBase::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', - SoapClientBase::WSDL_CLASSMAP => ClassMap::get(), - ])) - ->setSF2900($this); + [$localCert, $passphrase] = $this->getLocalCert(); + + try { + $service = (new Fordelingsobjekt([ + SoapClientInterface::WSDL_URL => __DIR__.'/../../../resources/sf2900/wsdl/context/DistributionService.wsdl', + SoapClientInterface::WSDL_CLASSMAP => ClassMap::get(), + SoapClientInterface::WSDL_LOCAL_CERT => $localCert, + SoapClientInterface::WSDL_PASSPHRASE => $passphrase, - $result = $service->FordelingsobjektAfsend($request); + SoapClientInterface::WSDL_TRACE => true, + // SoapClientInterface::WSDL_EXCEPTIONS => false, + ])) + ->setSF2900($this); - return $result; + return $service->FordelingsobjektAfsend($request) ?: null; + } finally { + if (file_exists($localCert)) { + unlink($localCert); + } + } } private function buildFordelingsobjektAfsendRequest( string $transactionId, - Type $type, + string $type, + DistributionDokumentType|DistributionJournalPostType|DistributionFormularType $document, string $routingMyndighed, string $routingKLEEmne, ?string $routingHandlingFacet = null, ?string $afsendendeMyndighed = null, + ?string $authorityContextMunicipalityCVR = null, + ?string $routingModtagerAktoer = null, ): FordelingsobjektAfsendRequestType { $afsendendeMyndighed ??= $this->options['authority_cvr']; + $authorityContextMunicipalityCVR ??= $afsendendeMyndighed; + + $objectIndhold = new ObjektIndholdType(); + switch ($document::class) { + case DistributionDokumentType::class: + $objectIndhold->setDistributionDokument($document); + break; + case DistributionJournalPostType::class: + $objectIndhold->setDistributionJournalPost($document); + break; + case DistributionFormularType::class: + $objectIndhold->setDistributionFormular($document); + break; + default: + throw new \Exception(__FILE__); + } - $objectIndhold = new ObjektIndholdType( - // distributionDokument: null - ); $distributionObject = new DistributionObjectType( - objektType: $type->value, + objektType: $type, objektIndhold: $objectIndhold, ); + + $routingValg = null !== $routingModtagerAktoer + ? new RoutingValg(routingModtagerAktoer: $routingModtagerAktoer) + : new RoutingValg( + routingKLEEmneHandling: new RoutingKLEInfo( + routingKLEEmne: $routingKLEEmne, + routingHandlingFacet: $routingHandlingFacet, + ), + ); + $distributionContext = new DistributionContextType( anvenderTransaktionsID: $transactionId, afsendendeMyndighed: $afsendendeMyndighed, routingMyndighed: $routingMyndighed, - routingValg: new RoutingValg( - new RoutingKLEInfo( - routingKLEEmne: $routingKLEEmne, - routingHandlingFacet: $routingHandlingFacet, - ) - ), + routingValg: $routingValg, distributionTransktionsID: null, digitalPostMeddelelsesID: null, dokumentFilNavn: null @@ -158,10 +201,12 @@ private function buildFordelingsobjektAfsendRequest( distributionObject: $distributionObject, ); + $authorityContext = new AuthorityContextType($authorityContextMunicipalityCVR); + return new FordelingsobjektAfsendRequestType( anmodning: $anmodning, - callContext: null, - authorityContext: null, + // callContext: null, + authorityContext: $authorityContext, ); } diff --git a/src/Service/SF2900/Type.php b/src/Service/SF2900/Type.php deleted file mode 100644 index 1081ad90..00000000 --- a/src/Service/SF2900/Type.php +++ /dev/null @@ -1,9 +0,0 @@ - Date: Fri, 24 Oct 2025 09:50:48 +0200 Subject: [PATCH 8/9] Added support for Symfony 7 --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index c3bfda52..3c35c4c8 100644 --- a/composer.json +++ b/composer.json @@ -28,12 +28,12 @@ "itk-dev/azure-key-vault-php": "^1.0", "jms/serializer": "^3.18", "php-http/guzzle7-adapter": "^1.0", - "symfony/cache": "^5.4 || ^6.0", - "symfony/http-client": "^5.4 || ^6.0", - "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/property-access": "^4.4 || ^5.4 || ^6.0", - "symfony/string": "^5.4 || ^6.0", - "symfony/uid": "^5.4 || ^6.0", + "symfony/cache": "^5.4 || ^6.0 || ^7.0", + "symfony/http-client": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/property-access": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/string": "^5.4 || ^6.0 || ^7.0", + "symfony/uid": "^5.4 || ^6.0 || ^7.0", "wsdltophp/packagebase": "^5.0" }, "require-dev": { @@ -44,8 +44,8 @@ "phpstan/phpstan": "^1.8", "phpunit/phpunit": "^9.0", "squizlabs/php_codesniffer": "^3.7", - "symfony/console": "^5.4 || ^6.0", - "symfony/mime": "^5.4 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/mime": "^5.4 || ^6.0 || ^7.0", "wsdltophp/packagegenerator": "^4.1" }, "repositories": { From 3cceaca469b448c2cf8dd3ebb0672e3990f6e3e0 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Sat, 25 Oct 2025 12:59:33 +0200 Subject: [PATCH 9/9] Added certificate locator helper --- src/Certificate/CertificateLocatorHelper.php | 83 ++++++++++++++++++ src/Command/SF2900/AbstractCommand.php | 85 +------------------ .../SF2900/FordelingsobjektAfsendCommand.php | 22 +++-- src/Service/SF2900/SF2900.php | 3 +- 4 files changed, 101 insertions(+), 92 deletions(-) create mode 100644 src/Certificate/CertificateLocatorHelper.php diff --git a/src/Certificate/CertificateLocatorHelper.php b/src/Certificate/CertificateLocatorHelper.php new file mode 100644 index 00000000..a790b25a --- /dev/null +++ b/src/Certificate/CertificateLocatorHelper.php @@ -0,0 +1,83 @@ +getCertificateLocator($spec, $passphrase); + } + + private function getCertificateLocator(string $spec, string $passphrase): CertificateLocatorInterface + { + if (str_contains($spec, '=')) { + parse_str($spec, $options); + $resolver = $this->getCertificateOptionsResolver(); + $options = $resolver->resolve($options); + + $httpClient = new GuzzleAdapter(new Client()); + $requestFactory = new RequestFactory(); + + $vaultToken = new VaultToken($httpClient, $requestFactory); + + $token = $vaultToken->getToken( + $options['tenant-id'], + $options['client-id'], + $options['client-secret'], + ); + + $vault = new VaultSecret( + $httpClient, + $requestFactory, + $options['name'], + $token->getAccessToken() + ); + + return new AzureKeyVaultCertificateLocator( + $vault, + $options['secret'], + $options['version'], + $passphrase + ); + } else { + $path = realpath($spec) ?: null; + if (null === $path) { + throw new InvalidOptionException(sprintf('Invalid path %s', $spec)); + } + + return new FilesystemCertificateLocator($path, $passphrase); + } + } + + private function getCertificateOptionsResolver(): OptionsResolver + { + $resolver = new OptionsResolver(); + $resolver + ->setRequired([ + 'tenant-id', + 'client-id', + 'client-secret', + 'name', + 'secret', + 'version', + ]) + ->setInfo('tenant-id', 'The tenant id') + ->setInfo('client-id', 'The client id') + ->setInfo('client-secret', 'The client secret') + ->setInfo('name', 'The certificate name') + ->setInfo('secret', 'The certificate secret') + ->setInfo('version', 'The certificate version') + ; + + return $resolver; + } +} diff --git a/src/Command/SF2900/AbstractCommand.php b/src/Command/SF2900/AbstractCommand.php index b8cae01e..7625fb79 100644 --- a/src/Command/SF2900/AbstractCommand.php +++ b/src/Command/SF2900/AbstractCommand.php @@ -2,16 +2,9 @@ namespace ItkDev\Serviceplatformen\Command\SF2900; -use GuzzleHttp\Client; -use Http\Adapter\Guzzle7\Client as GuzzleAdapter; -use Http\Factory\Guzzle\RequestFactory; -use ItkDev\AzureKeyVault\Authorisation\VaultToken; -use ItkDev\AzureKeyVault\KeyVault\VaultSecret; -use ItkDev\Serviceplatformen\Certificate\AzureKeyVaultCertificateLocator; +use ItkDev\Serviceplatformen\Certificate\CertificateLocatorHelper; use ItkDev\Serviceplatformen\Certificate\CertificateLocatorInterface; -use ItkDev\Serviceplatformen\Certificate\FilesystemCertificateLocator; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Exception\InvalidOptionException; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; @@ -63,16 +56,7 @@ protected function configure() $this->setDefinition(new InputDefinition($definition)); $help = $this->buildHelp(); - $this->setHelp(str_replace( - [ - '%certificate_options%', - ], - [ - $this->getOptionsDetails($this->getCertificateOptionsResolver(), ' '), - ], - $help - )); - + $this->setHelp($help); $this->buildOptions($definition); } @@ -90,75 +74,12 @@ protected function buildHelp(): string &secret=test &version=bbcbd812-0d7c-420b-9b93-7318e3769578 -Certificate options - -%certificate_options% - HELP; } protected function getCertificateLocator(string $spec, string $passphrase): CertificateLocatorInterface { - if (false !== strpos($spec, '=')) { - parse_str($spec, $options); - $resolver = $this->getCertificateOptionsResolver(); - $options = $resolver->resolve($options); - - $httpClient = new GuzzleAdapter(new Client()); - $requestFactory = new RequestFactory(); - - $vaultToken = new VaultToken($httpClient, $requestFactory); - - $token = $vaultToken->getToken( - $options['tenant-id'], - $options['client-id'], - $options['client-secret'], - ); - - $vault = new VaultSecret( - $httpClient, - $requestFactory, - $options['name'], - $token->getAccessToken() - ); - - return new AzureKeyVaultCertificateLocator( - $vault, - $options['secret'], - $options['version'], - $passphrase - ); - } else { - $certificatepath = realpath($spec) ?: null; - if (null === $certificatepath) { - throw new InvalidOptionException(sprintf('Invalid path %s', $spec)); - } - - return new FilesystemCertificateLocator($certificatepath, $passphrase); - } - } - - protected function getCertificateOptionsResolver(): OptionsResolver - { - $resolver = new OptionsResolver(); - $resolver - ->setRequired([ - 'tenant-id', - 'client-id', - 'client-secret', - 'name', - 'secret', - 'version', - ]) - ->setInfo('tenant-id', 'The tenant id') - ->setInfo('client-id', 'The client id') - ->setInfo('client-secret', 'The client secret') - ->setInfo('name', 'The certificate name') - ->setInfo('secret', 'The certificate secret') - ->setInfo('version', 'The certificate version') - ; - - return $resolver; + return CertificateLocatorHelper::createCertificateLocator($spec, $passphrase); } protected function resolveOptions(array $options): array diff --git a/src/Command/SF2900/FordelingsobjektAfsendCommand.php b/src/Command/SF2900/FordelingsobjektAfsendCommand.php index ac53e063..2bcd3079 100644 --- a/src/Command/SF2900/FordelingsobjektAfsendCommand.php +++ b/src/Command/SF2900/FordelingsobjektAfsendCommand.php @@ -97,8 +97,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); $registreringItSystem = $options['registrering-it-system']; - $aktoer = $registreringItSystem; + $id = Serializer::createUuid(); $now = new \DateTimeImmutable(); $type = $options['type']; @@ -120,7 +120,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int // noteTekst: null, ), rolle: JournalPostRolleType::VALUE_JOURNALPOST, - indeks: __FILE__, + // @todo What is "indeks"? + indeks: '1', journalnotatAttributter: new JournalNotatEgenskaberType( notat: __FILE__, titel: __METHOD__, @@ -129,6 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ]) ), ), + ObjektTypeType::VALUE_DOKUMENT => new DistributionDokumentType( iD: $id, kLEEmneForslag: $options['routing-kle'], @@ -148,12 +150,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int // noteTekst: null, ), rolle: VariantRolleType::VALUE_VARIANT, - indeks: __FILE__, + indeks: '1', variantAttributter: new VariantAttributterType( - variantType: __FILE__, + variantType: 'PDF', ), delAttributter: new DelAttributterType( - delTekst: __FILE__, + delTekst: 'Hele dokumentet', ), ), ]), @@ -163,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int tilstand: [ new TilstandType( // @todo - fremdrift: FremdriftType::VALUE_AFLEVERET, + fremdrift: FremdriftType::VALUE_ENDELIGT, virkning: new VirkningType( aktoer: new UUID_URN($aktoer), aktoerType: AktoerTypeType::VALUE_IT_SYSTEM, @@ -177,10 +179,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int ], attributListe: new AttributterListeType([ new AttributterType( - brugervendtNoegleTekst: __FILE__, + brugervendtNoegleTekst: __METHOD__, titelTekst: __FILE__, beskrivelseTekst: __FILE__, - dokumenttype: DokumenttypeType::VALUE_NOTAT, + dokumenttype: DokumenttypeType::VALUE_ANDEN, retning: RetningType::VALUE_UDGAAENDE, brevdato: $now->format($sf2900::DATE_FORMAT), virkning: new VirkningType( @@ -196,7 +198,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int // brugerRef: null, ) ), - ObjektTypeType::VALUE_FORMULAR => '', + + // ObjektTypeType::VALUE_FORMULAR => '', + default => throw new InvalidArgumentException(sprintf('Invalid type: %s', $type)), }; diff --git a/src/Service/SF2900/SF2900.php b/src/Service/SF2900/SF2900.php index 8ef11b0d..8c7e501c 100644 --- a/src/Service/SF2900/SF2900.php +++ b/src/Service/SF2900/SF2900.php @@ -194,7 +194,8 @@ private function buildFordelingsobjektAfsendRequest( routingValg: $routingValg, distributionTransktionsID: null, digitalPostMeddelelsesID: null, - dokumentFilNavn: null + // @todo + dokumentFilNavn: 'test.pdf', ); $anmodning = new AnmodRequestType( distributionContext: $distributionContext,