diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to .github/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..f55b8ca8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,22 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: mikaelcom + +--- + +**Describe the bug** +A clear and concise description of what the bug is. Ideally the WSDL URL. If not public, feel free to send it to contact@mikael-delsol.fr. + +**To Reproduce** +Steps to reproduce the behavior: +- During the package generation? +- During the usage of the generated package? + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..82ce790a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: mikaelcom + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de715e6a..80aeba6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,6 @@ jobs: strategy: matrix: php-version: - - 5.6 - 7.4 steps: @@ -71,7 +70,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.GITHUB_REF_NAME }} - release_name: ${{ env.GITHUB_REF_NAME }} - PHP ${{ matrix.php-version }} + release_name: ${{ env.GITHUB_REF_NAME }} draft: true body: TODO @@ -82,7 +81,7 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./bin/wsdltophp.phar - asset_name: wsdltophp-${{ env.GITHUB_REF_NAME_SLUG }}-${{ matrix.php-version }}.phar + asset_name: wsdltophp-${{ env.GITHUB_REF_NAME_SLUG }}.phar asset_content_type: application/octet-stream - name: Configure GPG key and sign phar @@ -103,22 +102,19 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./wsdltophp.phar.asc - asset_name: wsdltophp-${{ env.GITHUB_REF_NAME_SLUG }}-${{ matrix.php-version }}.phar.asc + asset_name: wsdltophp-${{ env.GITHUB_REF_NAME_SLUG }}.phar.asc asset_content_type: application/octet-stream - name: Setup Buildx - if: startsWith(matrix.php-version, '7') uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - if: startsWith(matrix.php-version, '7') uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_SECRET }} - name: Build and push to Docker - if: startsWith(matrix.php-version, '7') uses: docker/build-push-action@v2 with: context: . diff --git a/.gitignore b/.gitignore index dfaf2b25..88e72fcd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ -vendor/ +vendor composer.lock composer.phar phpunit.xml wsdltophp.yml -bin/ +bin tests/resources/generated +coverage +.phpunit.result.cache diff --git a/.php_cs b/.php_cs index 02c970be..2ec4e342 100755 --- a/.php_cs +++ b/.php_cs @@ -8,14 +8,6 @@ $finder = PhpCsFixer\Finder::create() return PhpCsFixer\Config::create() ->setUsingCache(false) ->setRules(array( - '@PSR2' => true, - 'array_syntax' => [ - 'syntax' => 'short', - ], - 'binary_operator_spaces' => true, - 'no_whitespace_in_blank_line' => true, - 'ternary_operator_spaces' => true, - 'cast_spaces' => true, - 'trailing_comma_in_multiline_array' => true + '@PhpCsFixer' => true, )) ->setFinder($finder); diff --git a/.travis.yml b/.travis.yml index 39cd4494..d195cc9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,27 +2,6 @@ language: php jobs: include: - - name: 'Tests under PHP 5.4' - php: '5.4' - dist: trusty - - name: 'Tests under PHP 5.5' - php: '5.5' - dist: trusty - - name: 'Tests under PHP 5.6' - php: '5.6' - dist: trusty - - name: 'Tests under PHP 7.0' - php: '7.0' - dist: xenial - - name: 'Tests under PHP 7.1' - php: '7.1' - dist: bionic - - name: 'Tests under PHP 7.2' - php: '7.2' - dist: bionic - - name: 'Tests under PHP 7.3' - php: '7.3' - dist: bionic - name: 'Tests under PHP 7.4' php: '7.4' dist: bionic @@ -42,14 +21,14 @@ cache: - $HOME/.composer/cache install: - - composer install + - composer install script: - - php -dmemory_limit=-1 ./vendor/phpunit/phpunit/phpunit --coverage-text --coverage-clover=coverage.clover + - php -dmemory_limit=-1 -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php -dmemory_limit=-1 ocular.phar code-coverage:upload --format=php-clover coverage.clover + - wget https://scrutinizer-ci.com/ocular.phar + - php -dmemory_limit=-1 ocular.phar code-coverage:upload --format=php-clover coverage.clover after_success: - - bash <(curl -s https://codecov.io/bash) + - bash <(curl -s https://codecov.io/bash) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc3b3f3d..578502bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # CHANGELOG +## 4.0.0 - 2021-xx-xx +- issue #124 - PHP >= 7.4 tasks + - Code requires PHP >= 7.4 + - Generated code requires PHP >= 7.4 + - Code cleaning + - Update README + - Add [MANIFEST.md](/MANIFEST.md) explaining how files are generated and how they should be used + - Update Travis CI settings + - Update PHPUnit settings + - Update LICENSE file + - BC: read [UPGRADE-4.0.md](/UPGRADE-4.0.md) + - Version 2.0 is no more maintained + ## 3.3.4 - 2021-01-25 - issue #230 - Avoid repeated meta value within generated meta documentation - issue #217 - Inherited struct methods should not be overwritten diff --git a/MANIFEST.md b/MANIFEST.md new file mode 100644 index 00000000..fcfedd76 --- /dev/null +++ b/MANIFEST.md @@ -0,0 +1,135 @@ +# Manifest + +This file intends to explain the way the files are generated and why. Moreover, it gives tips on how the generated classes should be used. + +## TL;DR +When everything goes well, you must end up with the folders and files structures as below (basic usage): + +```markdown +{destination} +|──── src # can be removed if necessary, read src-dirname option +|─────|──── ArrayType # generated only if Array Structs are declared +|─────|──── | .... + |──── EnumType # generated only if Enumerations are declared + |─────| .... + |──── ServiceType # contains ServiceType classes + |─────| .... + |──── StructType # contains Struct classes, used to construct request parameters + |─────| .... + |──── ClassMap.php # generated in order to map generated Struct classes to Soap Structs +|──── vendor # generated by composer if standalone option is enabled, true by default +|──── | .... +|──── composer.json # generated if standalone option is enabled, true by default +|──── composer.lock # generated by composer if standalone option is enabled, true by default +|──── tutorial.php # generated if gentutorial option is enabled, true by default +``` + +Read next to learn about the classes goal, their usage and how to customize them. + +## PHP files and classes +- Files and classes are generated using our own [PhpGenerator](https://github.com/WsdlToPhp/PhpGenerator) library. The [PhpGenerator](https://github.com/WsdlToPhp/PhpGenerator) is independent and not tweaked specifically for this project, it can be used freely and for any purpose. +- Classes are generated under the `src` folder within the `destination` folder based on their `category` and their `namespace`. + - Read the [src folder option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#src-dirname) for more information. + - Read the [destination option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#destination) for more information. + - Read the [category option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#category) for more information. +- Classes are not namespaced by default. + - Read the [namespace option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#namespace) for more information. +- Classes are **named after the element name** all with respecting the **PHP class naming constraints**. Generated names can be prefixed and suffixed if needed. + - Read the [prefix option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#prefix) for more information. + - Read the [suffix option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#suffix) for more information. +- Classes are generated with predefined comments and annotations. You can add your proper annotations. + - Read the [classes comments option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#classes-comments) for more information. +- Classes require **PHP >= 7.4** as of **PackageGenerator >= 4.0**. + +### Struct classes +- Classes represent any parameter that can be sent to the Soap server within the Soap request as soon as the parameter is not a scalar value. +- Classes are generated under the `src/StructType` folder by default. + - Read the [structs folder option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#structs-folder) for more information. +- Classes extend the [AbstractStructBase](https://github.com/WsdlToPhp/PackageBase#abstractstructbase) class from the [PackageBase](https://github.com/WsdlToPhp/PackageBase) dependency in order to benefit from [generic methods](https://github.com/WsdlToPhp/PackageBase#abstractstructbase). + - Read the [struct option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#struct) for more information. +- Struct properties are: + - **Named after the element name** all with respecting the **PHP class property naming constraints**. + - **Typed** based on their definition. + - **null** by default, if not an array and not detected as *required*. + - With their proper **setter and getter**. You are **strongly** encouraged to **always** use the setter for the following reasons: + - **Chained calls**: The setters are **fluent** (return the current object instance), so you can chain the calls such as `$object->setFirstname('Bob')->setLastname('Barfield')`. + - **Parameter type**: The setter parameter is **typed based on the element type** declaration. This way you're assured that the XML request will be well-generated. + - Read the [xsd types option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#xsd-types-mapping) for more information. + - **Validation rules**: The setter contains **validation rules** based on the element declaration avoiding you from making a mistake that would lead to a wrong XML request. An [InvalidArgumentException](https://www.php.net/manual/en/class.invalidargumentexception.php) exception is thrown with an explicit message if you made a mistake. + - Read the [validation option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#validation) for more information. + - **Removable property**: The setter **removes the property** from the object if it is declared as removable from the request (`nillable=true` + `minOccurs=0`). Passing `null` or an *empty array* to the setter removes the property from the object thus the XML request does not contain the element, which is often required by the Soap Server which handles the request. + - **Enhanced** with methods: + - **Array property**: If the property is detected as an array, you end up with a fluent-typed `addTo{PropertyName}(?{propertyType} $item)` method. + - **List property**: If the property is detected as a list of value (`xs:list`): + - The setter allows you to pass either a string or an array. + - If the values are restricted to an enumeration of values, a validation rule is applied on the parameter value to ensure you pass the right values. + - If you pass an array, the values are concatenated into a string with a space within each value. + - **XML Any** (``): If the property is detected as an XML string: + - The setter allows you to pass either a string or a [DOMDocument](https://www.php.net/manual/en/class.domdocument.php) object that is converted to string for the XML request. + - The getter is adapted (`get{PropertyName}(bool $asDomDocument = false)`) and allows you to get a [DOMDocument](https://www.php.net/manual/en/class.domdocument.php) object from the XML string of the property returned by the XML response. + +### StructArray classes +- Classes are an **extension of Struct Classes** and are generated with the same benefits. +- Classes represent an element that contains only one array-type property. +- Classes are generated under the `src/ArrayType` folder by default. + - Read the [arrays folder option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#arrays-folder) for more information. +- Classes extend the [AbstractStructArrayBase](https://github.com/WsdlToPhp/PackageBase#abstractstructarraybase) class from the [PackageBase](https://github.com/WsdlToPhp/PackageBase) dependency in order to benefit from [generic methods](https://github.com/WsdlToPhp/PackageBase#abstractstructarraybase). + - Read the [struct array option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#structarray) for more information. +- Classes are **empowered** thanks to [AbstractStructArrayBase](https://github.com/WsdlToPhp/PackageBase#abstractstructarraybase) class: + - They are [Traversable](https://www.php.net/manual/en/class.traversable.php), [Countable](https://www.php.net/manual/en/class.countable.php) and they also implement the [ArrayAccess](https://www.php.net/manual/en/class.arrayaccess.php) interface. + - They always contain the `getAttributeName(): string` method that returns the property name that is an array. +- Classes contain return-typed methods to ease the manipulation of the array property (in addition to the [AbstractStructArrayBase](https://github.com/WsdlToPhp/PackageBase#abstractstructarraybase) methods): + - **current(): ?{childElementType}**: returns the [current](https://www.php.net/manual/en/iterator.current.php) iteration element. + - **item($index): ?{childElementType}**: returns the item at the given position (alias of [offsetGet](https://www.php.net/manual/en/arrayaccess.offsetget.php)). + - **first(): ?{childElementType}**: returns the first element. + - **last(): ?{childElementType}**: returns the last element. + - **offsetGet($offset): ?{childElementType}**: returns the last element. + - **add(?{childElementType} $item): self**: adds the item to the current array property. + +### StructEnum classes +- Classes represent any enumeration declared by the WSDL. They contain constants that **should** be used to define the value of a Struct property marked as an enumeration value or enumeration-typed values within an array-typed property. + - Read the [constants naming option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#constants-naming) for more information. +- Classes are generated under the `src/StructEnumType` folder by default. + - Read the [enums folder option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#enums-folder) for more information. +- Classes extend the [AbstractStructEnumBase](https://github.com/WsdlToPhp/PackageBase#abstractstructenumbase) class from the [PackageBase](https://github.com/WsdlToPhp/PackageBase) dependency in order to benefit from [generic methods](https://github.com/WsdlToPhp/PackageBase#abstractstructenumbase). + - Read the [struct enum option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#structenum) for more information. +- Classes are **empowered** thanks to [AbstractStructEnumBase](https://github.com/WsdlToPhp/PackageBase#abstractstructenumbase) class: + - They always contain the `getValidValues(): array` method that returns the constants values contained by the class. + - The `valueIsValid($value): bool` method allows checking if the value is a valid value declared by the enumeration (used by a validation rule within a Struct's setter). + +### Service classes +- Classes are generated in order to gather Soap operations named similarly in one or many classes based on your choice. + - Read the [gather operations option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#gather-operations-methods) for more information. +- Classes are generated under the `src/ServiceType` folder by default. + - Read the [services folder option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#services-folder) for more information. +- Classes extend the [AbstractSoapClientBase](https://github.com/WsdlToPhp/PackageBase#abstractsoapclientbase) class from the [PackageBase](https://github.com/WsdlToPhp/PackageBase) dependency in order to benefit from [generic methods](https://github.com/WsdlToPhp/PackageBase#abstractsoapclientbase). + - Read the [soapclient option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#soapclient) for more information. +- Classes contain custom method(s) in order to define the Soap Header(s) based on what is defined in the WSDL. + - Methods are named `setSoapHeader{SoapHeaderName}({SoapHeaderType} ${SoapHeaderName}, string $namespace = '{soapHeadernamespace}'}, bool $mustUnderstand = false, ?string $actor = null)`. +- Classes contain one method per Soap operation **named after the operation name** all with respecting the **PHP method naming constraints**. The method returns: + - `false`: + - This means there is an error with the request or the Soap Server that has triggered a SoapFault (be sure that `WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE`=`true`). + - Use `getLastError(string $methodName): ?SoapFault` to get the [SoapFault](https://www.php.net/manual/en/class.soapfault.php) thrown when the method cas called. + - `$methodName` has the form `{fully qualified classname}::{__FUNCTION__}` aka `__METHOD__`. + - A `{returnType}` object/value result: + - The `getResult` method is annotated with the `@return` annotation listing all the possible return types. + - Be sure to check the result type before using the returned result. + +### ClassMap class +- `ClassMap` class is generated under the `src` folder. +- `ClassMap` class has a unique-final-static method named `get` which returns the array to be used as the [`classmap`](https://www.php.net/manual/en/soapclient.construct.php#refsect1-soapclient.construct-parameters) option for the SoapClient class. + +## composer.json +- composer.json file is generated when `standalone` option is enabled under the `destination` folder. + - Read the [standalone option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#standalone) for more information. +- composer.json `name` can be set. + - Read the [composer name option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#composer-name) for more information. +- composer.json settings can be customized. + - Read the [composer settings option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#composer-settings) for more information. + +## tutorial.php +- tutorial.php file is generated under the `destination` folder if it is enabled (`true` by default). + - Read the [tutorial option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#generate-tutorial) for more information. +- tutorial.php file is a boilerplate demonstrating how to instantiate each generated ServiceType class. +- tutorial.php demonstrates how to call each `setSoapHeader{SoapHeaderName}` method. +- tutorial.php demonstrates how to call each operation generated per ServiceType class. diff --git a/README.md b/README.md index bfe0cbe8..3ff17d88 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License](https://poser.pugx.org/wsdltophp/packagegenerator/license)](https://packagist.org/packages/wsdltophp/packagegenerator) [![Latest Stable Version](https://poser.pugx.org/wsdltophp/packagegenerator/version.png)](https://packagist.org/packages/wsdltophp/packagegenerator) -[![Build Status](https://api.travis-ci.org/WsdlToPhp/PackageGenerator.svg)](https://travis-ci.org/WsdlToPhp/PackageGenerator) +[![Build Status](https://travis-ci.com/WsdlToPhp/PackageGenerator.svg)](https://travis-ci.com/github/WsdlToPhp/PackageGenerator) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/) [![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/) [![Total Downloads](https://poser.pugx.org/wsdltophp/packagegenerator/downloads)](https://packagist.org/packages/wsdltophp/packagegenerator) @@ -15,6 +15,8 @@ Package Generator generates a PHP SDK from any WSDL so you can easily consume an Package Generator provides many options to generate your package even if a few are required. This project has been tested with many WSDL and is currently used on the platform [Providr.IO](https://providr.io). +Package Generator generates files that are detailed in the [MANIFEST](/MANIFEST.md). **You are encouraged to read it to understand how and why the files are generated in addition to the way the generated classes are supposed to be used.** + ## Installation ### In a project: @@ -25,16 +27,6 @@ composer require wsdltophp/packagegenerator --dev ### With command line: -#### For PHP5 - -```bash -$ wget https://phar.wsdltophp.com/wsdltophp-php5.phar -$ chmod +x wsdltophp-php5.phar -$ mv wsdltophp-php5.phar /usr/local/bin/wsdltophp -``` - -#### For PHP7 - ```bash $ wget https://phar.wsdltophp.com/wsdltophp-php7.phar $ chmod +x wsdltophp-php7.phar @@ -104,10 +96,15 @@ _In order to see all the used options, just remove the `--force` argument._ ## Versions +### 4.0 +First released on xx xxx 2021, maintained until version 6.0 is released. Please read the [UPGRADE-4.0](UPGRADE-4.0.md) note in order to acknowledge the main changes. + ### 3.0 First released on 04 May 2018, maintained until version 5.0 is released. Please read the [UPGRADE-3.0](UPGRADE-3.0.md) note in order to acknowledge the main changes. ### 2.0 +**Not maintained since 2021/xx/xx.** + First released on 29 Apr 2016, maintained until version 4.0 is released. ### 1.0 @@ -119,19 +116,13 @@ Not maintained anymore # launch all tests $ phpunit -# launch a testsuite: command, configuration, utils, wsdlhandler, model, container, parser, file, packagegenerator +# launch a testsuite: command, configuration, utils, model, container, parser, file, packagegenerator $ phpunit --testsuite=model ``` ## Testing using [Docker](https://www.docker.com/) Thanks to the [Docker image](https://hub.docker.com/r/splitbrain/phpfarm) of [phpfarm](https://github.com/fpoirotte/phpfarm), tests can be run locally under *any* PHP version using the cli: -- php-5.4 -- php-5.5 -- php-5.6 -- php-7.0 -- php-7.1 -- php-7.2 -- php-7.3 +- php-7.4 First of all, you need to create your container which you can do using [docker-compose](https://docs.docker.com/compose/) by running the below command line from the root directory of the project: ```bash @@ -141,14 +132,14 @@ $ docker-compose up -d --build You then have a container named `package_generator` in which you can run `composer` commands and `php cli` commands such as: ```bash # install deps in container (using update ensure it does use the composer.lock file if there is any) -$ docker exec -it package_generator php-7.2 /usr/bin/composer update +$ docker exec -it package_generator php-7.4 /usr/bin/composer update # run tests in container -$ docker exec -it package_generator php-7.2 -dmemory_limit=-1 vendor/bin/phpunit +$ docker exec -it package_generator php-7.4 -dmemory_limit=-1 vendor/bin/phpunit ``` ## Contributing -Please see [CONTRIBUTING](CONTRIBUTING.md) for details. In addition, code documentation is at [doc.wsdltophp.com](http://doc.wsdltophp.com). +Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. In addition, code documentation is at [doc.wsdltophp.com](http://doc.wsdltophp.com). ## Credits diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md new file mode 100644 index 00000000..e6e33cbe --- /dev/null +++ b/UPGRADE-4.0.md @@ -0,0 +1,17 @@ +# UPGRADE FROM 3.* to 4.* + +1. **PHP >= 7.4**: + - **Required** to run the generator library + - **Required** to run the generated package +2. **Generated classes**: + - **Properties are now all typed** + - Properties are now **protected** if validation rules are enabled (default `true`), you MUST use the setters and getters. Even if validation rules are disabled, **you're strongly encouraged to use the setters and getters**, please read the [MANIFEST](MANIFEST.md#struct-classes) for more information. + - If you want to keep the arrow notation to set and get, you must disable the validation rules ([validation option](https://github.com/WsdlToPhp/PackageGenerator/wiki/Options#validation)) before generating the package. + - A **[TypeError](https://www.php.net/manual/en/class.typeerror.php)** is thrown if you try to set to `null` a non-nullable property (`required` by the WSDL). An **[InvalidArgumentException](https://www.php.net/manual/en/class.invalidargumentexception.php)** was previously thrown for an invalid value type when validation rules were enabled. + - **The directive** `declare(strict_types=1)` is placed at top of each file ensuring that the class is well-defined and behaves as declared. + - **Method** `get{PropertyName}(bool $asString = true)` becomes `get{PropertyName}(bool $asDomDocument = false)` when the property is supposed to be an XML string (`any`). Be sure to pass `true` instead of `false` if you still need to get the **[DOMDocument](https://www.php.net/manual/en/class.domdocument.php)** as returned value. + - Classes **directory** is now based on the defined namespace. If the namespace was `SoapApi`: + - **Before**: the `Request` Struct class was located at `src/StructType/Request.php` + - **Now**: the `Request` Struct class is located at `src/SoapApi/StructType/Request.php`. So on for the `EnumType`, `ArrayType`, `ServiceType` and the `ClassMap` classes. +3. **WsdlHandler** classes: they have been exported to an independent project at **[WsdlTophp/Wsdlhandler](https://github.com/WsdlToPhp/Wsdlhandler)**. It's now loaded as a composer dependency. +4. The [PackageBase](https://github.com/WsdlToPhp/PackageBase) version is now >= 5.0. diff --git a/composer-php8.json b/composer-php8.json deleted file mode 100644 index 8e523bbb..00000000 --- a/composer-php8.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "name": "wsdltophp/packagegenerator", - "description": "Generate hierarchical PHP classes based on a WSDL", - "type": "library", - "keywords" : ["soap","wsdl","php","generator"], - "homepage" : "https://github.com/WsdlToPhp/PackageGenerator", - "license" : "MIT", - "authors" : [ - { - "name": "Mikaël DELSOL", - "email": "contact@wsdltophp.com", - "homepage": "https://www.wsdltophp.com", - "role": "Owner" - }, - { - "name": "Gemorroj", - "email": "wapinet@mail.ru", - "role": "Contributor" - }, - { - "name": "ceeram", - "email": "c33ram@gmail.com", - "role": "Contributor" - }, - { - "name": "GroxExMachine", - "email": "grox@mail.ru", - "role": "Contributor" - }, - { - "name": "Jan Zaeske", - "email": "mail@jzaeske.de", - "role": "Contributor" - }, - { - "name": "Tom Mottram", - "email": "tom@pay4later.com", - "role": "Contributor" - }, - { - "name": "Catirau Mihail", - "email": "ustmaestro@gmail.com", - "role": "Contributor" - }, - { - "name": "Alexander M. Turek", - "email": "me@derrabus.de", - "role": "Contributor" - }, - { - "name": "Valérian Girard", - "email": "waldo2188@gmail.com", - "role": "Contributor" - }, - { - "name": "hordijk", - "role": "Contributor" - }, - { - "name": "Andreas Möller", - "email": "am@localheinz.com", - "role": "Contributor" - }, - { - "name": "Andreas Kintzinger", - "role": "Contributor" - }, - { - "name": "Hendrik Luup", - "email": "hendrik@luup.info", - "role": "Contributor" - }, - { - "name": "Jacob Dreesen", - "email": "jacob.dreesen@gmail.com", - "role": "Contributor" - } - ], - "support" : { - "email" : "contact@wsdltophp.com" - }, - "require": { - "php": ">=5.4.0", - "ext-soap": "*", - "ext-dom": "*", - "ext-libxml": "*", - "ext-json": "*", - "ext-mbstring": "*", - "composer/composer": "^1.0 || ^2.0", - "symfony/console": ">=2", - "symfony/yaml": ">=2", - "wsdltophp/domhandler": "^1.0", - "wsdltophp/packagebase": "^2.0", - "wsdltophp/phpgenerator": "^1.0" - }, - "scripts": { - "test": "vendor/bin/phpunit", - "lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose", - "build": "box build --verbose" - }, - "require-dev": { - "phpunit/phpunit": "^3|^4|^5|^6|^7|^8" - }, - "autoload": { - "psr-4": { - "WsdlToPhp\\PackageGenerator\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "WsdlToPhp\\PackageGenerator\\Tests\\": "tests" - } - }, - "config": { - "sort-packages": true - } -} diff --git a/composer.json b/composer.json index 10cd99f7..8c6bbb08 100644 --- a/composer.json +++ b/composer.json @@ -80,18 +80,18 @@ "email" : "contact@wsdltophp.com" }, "require": { - "php": ">=5.4.0", + "php": ">=7.4", "ext-soap": "*", "ext-dom": "*", "ext-libxml": "*", "ext-json": "*", "ext-mbstring": "*", - "composer/composer": "^1.0 || ^2.0", - "symfony/console": ">=2", - "symfony/yaml": ">=2", - "wsdltophp/domhandler": "^1.0", - "wsdltophp/packagebase": "^2.0", - "wsdltophp/phpgenerator": "^1.0" + "composer/composer": "^2.0", + "symfony/console": "^4.0|^5.0", + "symfony/yaml": "^4.0|^5.0", + "wsdltophp/packagebase": "^5.0", + "wsdltophp/phpgenerator": "^4.0", + "wsdltophp/wsdlhandler": "^1.0" }, "scripts": { "test": "vendor/bin/phpunit", @@ -100,7 +100,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", - "phpunit/phpunit": "^3|^4|^5|^6|^7|^8" + "phpunit/phpunit": "^9" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1c132de3..7d620e67 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,72 +1,51 @@ - - - - - - - - ./tests/Command/ - ./tests/ConfigurationReader/ - ./tests/Generator - ./tests/WsdlHandler/WsdlHandlerTest.php - ./tests/WsdlHandler/Tag/ - ./tests/File - ./tests/Model/ - ./tests/Container/ - ./tests/Parser/ - - - - ./tests/Command/ - - - - ./tests/ConfigurationReader/ - - - - ./tests/Generator/UtilsTest.php - - - - ./tests/Generator/GeneratorTest.php - - - - ./tests/File/ - - - - ./tests/WsdlHandler/WsdlHandlerTest.php - ./tests/WsdlHandler/Tag/ - - - - ./tests/Model/ - - - - ./tests/Container/ - - - - ./tests/Parser/ - - - - - - ./ - - ./src/resources - ./tests - ./vendor - - - + + + + ./ + + + ./src/resources + ./tests + ./vendor + + + + + + + + ./tests/Command/ + ./tests/ConfigurationReader/ + ./tests/Generator + ./tests/File + ./tests/Model/ + ./tests/Container/ + ./tests/Parser/ + + + ./tests/Command/ + + + ./tests/ConfigurationReader/ + + + ./tests/Generator/UtilsTest.php + + + ./tests/Generator/GeneratorTest.php + + + ./tests/File/ + + + ./tests/Model/ + + + ./tests/Container/ + + + ./tests/Parser/ + + diff --git a/src/Command/AbstractCommand.php b/src/Command/AbstractCommand.php index 9aaf2a9c..37b77eb8 100644 --- a/src/Command/AbstractCommand.php +++ b/src/Command/AbstractCommand.php @@ -1,66 +1,51 @@ addOption('force', null, InputOption::VALUE_NONE, 'If true, then package is really generated otherwise debug information are displayed'); + $this->addOption( + 'force', + null, + InputOption::VALUE_NONE, + 'If true, then package is really generated otherwise debug information are displayed' + ); } - /** - * @see \Symfony\Component\Console\Command\Command::execute() - */ - protected function execute(InputInterface $input, OutputInterface $output) + + protected function execute(InputInterface $input, OutputInterface $output): int { $this->input = $input; $this->output = $output; + return self::EXIT_OK; } - /** - * @return bool - */ - protected function canExecute() + + protected function canExecute(): bool { - return (bool) $this->getOptionValue('force') === true; + return true === (bool) $this->getOptionValue('force'); } - /** - * @param string|array $messages - * @param int $type - */ - protected function writeLn($messages, $type = OutputInterface::OUTPUT_NORMAL) + + protected function writeLn($messages, int $type = OutputInterface::OUTPUT_NORMAL): void { $this->output->writeln($messages, $type); } - /** - * @param string $name - * @return string|string[]|bool|null - */ - protected function getOptionValue($name) + + protected function getOptionValue(string $name) { return $this->input->getOption($name); } diff --git a/src/Command/GeneratePackageCommand.php b/src/Command/GeneratePackageCommand.php index 6b4bab8c..3916c7bb 100644 --- a/src/Command/GeneratePackageCommand.php +++ b/src/Command/GeneratePackageCommand.php @@ -1,123 +1,293 @@ generator; } - /** - * @param Generator $generator - * @return GeneratePackageCommand - */ - protected function setGenerator(Generator $generator) + + public function getGeneratorOptionsConfigOption() + { + return $this->getOptionValue(self::GENERATOR_OPTIONS_CONFIG_OPTION); + } + + public function resolveGeneratorOptionsConfigPath(): ?string + { + $path = null; + $possibilities = $this->getGeneratorOptionsPossibilities(); + foreach ($possibilities as $possibility) { + if (!empty($possibility) && is_file($possibility)) { + $path = $possibility; + + break; + } + } + + return $path; + } + + public function getGeneratorOptionsPossibilities(): array + { + return [ + $this->getGeneratorOptionsConfigOption(), + sprintf('%s/%s', getcwd(), self::PROPER_USER_CONFIGURATION), + sprintf('%s/%s', getcwd(), self::DEFAULT_CONFIGURATION_FILE), + GeneratorOptions::getDefaultConfigurationPath(), + ]; + } + + protected function setGenerator(Generator $generator): self { $this->generator = $generator; + return $this; } - /** - * @return GeneratePackageCommand - */ - protected function initGenerator() + + protected function initGenerator(): self { return $this->setGenerator(new Generator($this->generatorOptions)); } - /** - * @see \WsdlToPhp\PackageGenerator\Command\AbstractCommand::configure() - */ - protected function configure() + + protected function configure(): void { parent::configure(); - $this->setName('generate:package') + $this + ->setName('generate:package') ->setDescription('Generate package based on options') - ->addOption('urlorpath', null, InputOption::VALUE_REQUIRED, 'Url or path to WSDL') - ->addOption('destination', null, InputOption::VALUE_REQUIRED, 'Path to destination directory, where the package will be generated') - ->addOption('login', null, InputOption::VALUE_OPTIONAL, 'Basic authentication login required to access the WSDL url, can be avoided mot of the time') - ->addOption('password', null, InputOption::VALUE_OPTIONAL, 'Basic authentication password required to access the WSDL url, can be avoided mot of the time') - ->addOption('proxy-host', null, InputOption::VALUE_OPTIONAL, 'Use proxy url') - ->addOption('proxy-port', null, InputOption::VALUE_OPTIONAL, 'Use proxy port') - ->addOption('proxy-login', null, InputOption::VALUE_OPTIONAL, 'Use proxy login') - ->addOption('proxy-password', null, InputOption::VALUE_OPTIONAL, 'Use proxy password') - ->addOption('prefix', null, InputOption::VALUE_REQUIRED, 'Prepend generated classes') - ->addOption('suffix', null, InputOption::VALUE_REQUIRED, 'Append generated classes') - ->addOption('namespace', null, InputOption::VALUE_OPTIONAL, 'Package classes\' namespace') - ->addOption('category', null, InputOption::VALUE_OPTIONAL, 'First level directory name generation mode (start, end, cat, none)') - ->addOption('gathermethods', null, InputOption::VALUE_OPTIONAL, 'Gather methods based on operation name mode (start, end)') - ->addOption('gentutorial', null, InputOption::VALUE_OPTIONAL, 'Enable/Disable tutorial file, you should enable this option only on dev') - ->addOption('genericconstants', null, InputOption::VALUE_OPTIONAL, 'Enable/Disable usage of generic constants name (ex : ENUM_VALUE_0, ENUM_VALUE_1, etc) or contextual values (ex : VALUE_STRING, VALUE_YES, VALUES_NO, etc)') - ->addOption('addcomments', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Set comments to be used within each generated file') - ->addOption('standalone', null, InputOption::VALUE_OPTIONAL, 'By default, the generated package can be used as a standalone. Otherwise, you must add wsdltophp/packagebase:dev-master to your main composer.json.') - ->addOption('validation', null, InputOption::VALUE_OPTIONAL, 'Enable/Disable the generation of validation rules in every generated setter.') - ->addOption('struct', null, InputOption::VALUE_OPTIONAL, 'Use this class as parent class for any StructType class. Default class is \WsdlToPhp\PackageBase\AbstractStructBase from wsdltophp/packagebase package') - ->addOption('structarray', null, InputOption::VALUE_OPTIONAL, 'Use this class as parent class for any StructArrayType class. Default class is \WsdlToPhp\PackageBase\AbstractStructArrayBase from wsdltophp/packagebase package') - ->addOption('structenum', null, InputOption::VALUE_OPTIONAL, 'Use this class as parent class for any StructEnumType class. Default class is \WsdlToPhp\PackageBase\AbstractStructEnumBase from wsdltophp/packagebase package') - ->addOption('soapclient', null, InputOption::VALUE_OPTIONAL, 'Use this class as parent class for any ServiceType class. Default class is \WsdlToPhp\PackageBase\AbstractSoapClientBase from wsdltophp/packagebase package') - ->addOption('composer-name', null, InputOption::VALUE_REQUIRED, 'Composer name of the generated package') - ->addOption('composer-settings', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Composer settings of the generated package') - ->addOption('structs-folder', null, InputOption::VALUE_OPTIONAL, 'Structs folder name (default: SructType)') - ->addOption('arrays-folder', null, InputOption::VALUE_OPTIONAL, 'Arrays folder name (default: ArrayType)') - ->addOption('enums-folder', null, InputOption::VALUE_OPTIONAL, 'Enumerations folder name (default: EnumType)') - ->addOption('services-folder', null, InputOption::VALUE_OPTIONAL, 'Services class folder name (default: ServiceType)') - ->addOption('src-dirname', null, InputOption::VALUE_OPTIONAL, 'Source directory subfolder oof destination directory (default: src)') - ->addOption('xsd-types-path', null, InputOption::VALUE_OPTIONAL, 'Path to the xsd types configuration file to load') - ->addOption(self::GENERATOR_OPTIONS_CONFIG_OPTION, null, InputOption::VALUE_OPTIONAL, 'Path to the generator\'s configuration file to load'); + ->addOption( + 'urlorpath', + null, + InputOption::VALUE_REQUIRED, + 'Url or path to WSDL' + ) + ->addOption( + 'destination', + null, + InputOption::VALUE_REQUIRED, + 'Path to destination directory, where the package will be generated' + ) + ->addOption( + 'login', + null, + InputOption::VALUE_OPTIONAL, + 'Basic authentication login required to access the WSDL url, can be avoided mot of the time' + ) + ->addOption( + 'password', + null, + InputOption::VALUE_OPTIONAL, + 'Basic authentication password required to access the WSDL url, can be avoided mot of the time' + ) + ->addOption( + 'proxy-host', + null, + InputOption::VALUE_OPTIONAL, + 'Use proxy url' + ) + ->addOption( + 'proxy-port', + null, + InputOption::VALUE_OPTIONAL, + 'Use proxy port' + ) + ->addOption( + 'proxy-login', + null, + InputOption::VALUE_OPTIONAL, + 'Use proxy login' + ) + ->addOption( + 'proxy-password', + null, + InputOption::VALUE_OPTIONAL, + 'Use proxy password' + ) + ->addOption( + 'prefix', + null, + InputOption::VALUE_REQUIRED, + 'Prepend generated classes' + ) + ->addOption( + 'suffix', + null, + InputOption::VALUE_REQUIRED, + 'Append generated classes' + ) + ->addOption( + 'namespace', + null, + InputOption::VALUE_OPTIONAL, + 'Package classes\' namespace' + ) + ->addOption( + 'category', + null, + InputOption::VALUE_OPTIONAL, + 'First level directory name generation mode (start, end, cat, none)' + ) + ->addOption( + 'gathermethods', + null, + InputOption::VALUE_OPTIONAL, + 'Gather methods based on operation name mode (start, end)' + ) + ->addOption( + 'gentutorial', + null, + InputOption::VALUE_OPTIONAL, + 'Enable/Disable tutorial file, you should enable this option only on dev' + ) + ->addOption( + 'genericconstants', + null, + InputOption::VALUE_OPTIONAL, + 'Enable/Disable usage of generic constants name (ex : ENUM_VALUE_0, ENUM_VALUE_1, etc) or contextual values (ex : VALUE_STRING, VALUE_YES, VALUES_NO, etc)' + ) + ->addOption( + 'addcomments', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + 'Set comments to be used within each generated file' + ) + ->addOption( + 'standalone', + null, + InputOption::VALUE_OPTIONAL, + 'By default, the generated package can be used as a standalone. Otherwise, you must add wsdltophp/packagebase:dev-master to your main composer.json.' + ) + ->addOption( + 'validation', + null, + InputOption::VALUE_OPTIONAL, + 'Enable/Disable the generation of validation rules in every generated setter.' + ) + ->addOption( + 'struct', + null, + InputOption::VALUE_OPTIONAL, + sprintf('Use this class as parent class for any StructType class. Default class is %s from wsdltophp/packagebase package', AbstractStructBase::class) + ) + ->addOption( + 'structarray', + null, + InputOption::VALUE_OPTIONAL, + sprintf('Use this class as parent class for any StructArrayType class. Default class is %s from wsdltophp/packagebase package', AbstractStructArrayBase::class) + ) + ->addOption( + 'structenum', + null, + InputOption::VALUE_OPTIONAL, + sprintf('Use this class as parent class for any StructEnumType class. Default class is %s from wsdltophp/packagebase package', AbstractStructEnumBase::class) + ) + ->addOption( + 'soapclient', + null, + InputOption::VALUE_OPTIONAL, + sprintf('Use this class as parent class for any ServiceType class. Default class is %s from wsdltophp/packagebase package', AbstractSoapClientBase::class) + ) + ->addOption( + 'composer-name', + null, + InputOption::VALUE_REQUIRED, + 'Composer name of the generated package' + ) + ->addOption( + 'composer-settings', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + 'Composer settings of the generated package' + ) + ->addOption( + 'structs-folder', + null, + InputOption::VALUE_OPTIONAL, + 'Structs folder name (default: SructType)' + ) + ->addOption( + 'arrays-folder', + null, + InputOption::VALUE_OPTIONAL, + 'Arrays folder name (default: ArrayType)' + ) + ->addOption( + 'enums-folder', + null, + InputOption::VALUE_OPTIONAL, + 'Enumerations folder name (default: EnumType)' + ) + ->addOption( + 'services-folder', + null, + InputOption::VALUE_OPTIONAL, + 'Services class folder name (default: ServiceType)' + ) + ->addOption( + 'src-dirname', + null, + InputOption::VALUE_OPTIONAL, + 'Source directory subfolder oof destination directory (default: src)' + ) + ->addOption( + 'xsd-types-path', + null, + InputOption::VALUE_OPTIONAL, + 'Path to the xsd types configuration file to load' + ) + ->addOption( + self::GENERATOR_OPTIONS_CONFIG_OPTION, + null, + InputOption::VALUE_OPTIONAL, + 'Path to the generator\'s configuration file to load' + ) + ; } - /** - * @see Symfony\Component\Console\Command\Command::execute() - */ - protected function execute(InputInterface $input, OutputInterface $output) + + protected function execute(InputInterface $input, OutputInterface $output): int { parent::execute($input, $output); - $start = new \DateTime(); - $this->writeLn(sprintf(" Start at %s", $start->format('Y-m-d H:i:s'))); + $start = new DateTime(); + $this->writeLn(sprintf(' Start at %s', $start->format('Y-m-d H:i:s'))); $this->initGeneratorOptions(); if ($this->canExecute()) { $this->initGenerator()->getGenerator()->generatePackage(); } else { - $this->writeLn(" Generation not launched, use \"--force\" option to force generation"); + $this->writeLn(' Generation not launched, use "--force" option to force generation'); $this->writeLn(sprintf(" Generator's option file used: %s", $this->resolveGeneratorOptionsConfigPath())); $this->writeLn(" Used generator's options:"); - $this->writeLn(" " . implode(PHP_EOL . ' ', $this->formatArrayForConsole($this->generatorOptions->toArray()))); + $this->writeLn(' '.implode(PHP_EOL.' ', $this->formatArrayForConsole($this->generatorOptions->toArray()))); } - $end = new \DateTime(); - $this->writeLn(sprintf(" End at %s, duration: %s", $end->format('Y-m-d H:i:s'), $start->diff($end)->format('%H:%I:%S'))); + $end = new DateTime(); + $this->writeLn(sprintf(' End at %s, duration: %s', $end->format('Y-m-d H:i:s'), $start->diff($end)->format('%H:%I:%S'))); + return self::EXIT_OK; } - /** - * @return array - */ - protected function getPackageGenerationCommandLineOptions() + + protected function getPackageGenerationCommandLineOptions(): array { return [ 'addcomments' => 'AddComments', @@ -152,15 +322,14 @@ protected function getPackageGenerationCommandLineOptions() 'xsd-types-path' => 'XsdTypesPath', ]; } - /** - * @return GeneratePackageCommand - */ - protected function initGeneratorOptions() + + protected function initGeneratorOptions(): self { $generatorOptions = GeneratorOptions::instance($this->resolveGeneratorOptionsConfigPath()); + foreach ($this->getPackageGenerationCommandLineOptions() as $optionName => $optionMethod) { $optionValue = $this->formatOptionValue($this->input->getOption($optionName)); - if ($optionValue !== null) { + if (null !== $optionValue) { call_user_func_array([ $generatorOptions, sprintf('set%s', $optionMethod), @@ -170,65 +339,31 @@ protected function initGeneratorOptions() } } $this->generatorOptions = $generatorOptions; + return $this; } - /** - * @param mixed $optionValue - * @return boolean|mixed - */ + protected function formatOptionValue($optionValue) { - if ($optionValue === 'true' || (is_numeric($optionValue) && (int) $optionValue === 1)) { + if ('true' === $optionValue || (is_numeric($optionValue) && 1 === (int) $optionValue)) { return true; - } elseif ($optionValue === 'false' || (is_numeric($optionValue) && (int) $optionValue === 0)) { + } + if ('false' === $optionValue || (is_numeric($optionValue) && 0 === (int) $optionValue)) { return false; } + return $optionValue; } + /** - * Utility method to return readable array based on "key: value" - * @param array $array - * @return array + * Utility method to return readable array based on "key: value". */ - protected function formatArrayForConsole($array) + protected function formatArrayForConsole(array $array): array { array_walk($array, function (&$value, $index) { - $value = sprintf("%s: %s", $index, json_encode($value)); + $value = sprintf('%s: %s', $index, json_encode($value)); }); + return $array; } - /** - * @return string|string[]|bool|null - */ - public function getGeneratorOptionsConfigOption() - { - return $this->getOptionValue(self::GENERATOR_OPTIONS_CONFIG_OPTION); - } - /** - * @return string|null - */ - public function resolveGeneratorOptionsConfigPath() - { - $path = null; - $possibilities = $this->getGeneratorOptionsPossibilities(); - foreach ($possibilities as $possibility) { - if (!empty($possibility) && is_file($possibility)) { - $path = $possibility; - break; - } - } - return $path; - } - /** - * @return string[] - */ - public function getGeneratorOptionsPossibilities() - { - return [ - $this->getGeneratorOptionsConfigOption(), - sprintf('%s/%s', getcwd(), self::PROPER_USER_CONFIGURATION), - sprintf('%s/%s', getcwd(), self::DEFAULT_CONFIGURATION_FILE), - GeneratorOptions::getDefaultConfigurationPath(), - ]; - } } diff --git a/src/ConfigurationReader/AbstractReservedWord.php b/src/ConfigurationReader/AbstractReservedWord.php index 0a4db772..f90fe802 100644 --- a/src/ConfigurationReader/AbstractReservedWord.php +++ b/src/ConfigurationReader/AbstractReservedWord.php @@ -1,39 +1,29 @@ keywords = []; $this->parseReservedKeywords($filename); } - /** - * @param string $filename - * @return AbstractReservedWord - */ - protected function parseReservedKeywords($filename) + + public function is(string $keyword): bool + { + return in_array($keyword, $this->keywords[self::CASE_SENSITIVE_KEY], true) || in_array(mb_strtolower($keyword), $this->keywords[self::CASE_INSENSITIVE_KEY], true); + } + + protected function parseReservedKeywords(string $filename): AbstractReservedWord { $allKeywords = $this->parseSimpleArray($filename, self::MAIN_KEY); $caseSensitiveKeywords = $allKeywords[self::CASE_SENSITIVE_KEY]; @@ -42,23 +32,7 @@ protected function parseReservedKeywords($filename) self::CASE_SENSITIVE_KEY => $caseSensitiveKeywords, self::CASE_INSENSITIVE_KEY => $caseInsensitiveKeywords, ]); + return $this; } - /** - * @throws \InvalidArgumentException - * @param string $filename options's file to parse - * @return AbstractReservedWord - */ - public static function instance($filename = null) - { - return parent::instance($filename); - } - /** - * @param string $keyword - * @return bool - */ - public function is($keyword) - { - return in_array($keyword, $this->keywords[self::CASE_SENSITIVE_KEY], true) || in_array(mb_strtolower($keyword), $this->keywords[self::CASE_INSENSITIVE_KEY], true); - } } diff --git a/src/ConfigurationReader/AbstractYamlReader.php b/src/ConfigurationReader/AbstractYamlReader.php index e09fa90b..fcf88ef4 100644 --- a/src/ConfigurationReader/AbstractYamlReader.php +++ b/src/ConfigurationReader/AbstractYamlReader.php @@ -1,69 +1,59 @@ parse(file_get_contents($filename)); - } - /** - * @throws \InvalidArgumentException - * @param string $filename options's file to parse - * @return AbstractYamlReader - */ - public static function instance($filename = null) + protected static array $instances; + + protected string $filename; + + abstract protected function __construct(string $filename); + + abstract public static function getDefaultConfigurationPath(): string; + + public static function instance(?string $filename = null): self { - if (empty($filename) || !is_file($filename)) { - throw new \InvalidArgumentException(sprintf('Unable to locate file "%s"', $filename), __LINE__); + $loadFilename = empty($filename) ? static::getDefaultConfigurationPath() : $filename; + if (empty($loadFilename) || !is_file($loadFilename)) { + throw new InvalidArgumentException(sprintf('Unable to locate file "%s"', $loadFilename), __LINE__); } - $key = sprintf('%s_%s', get_called_class(), $filename); + + $key = sprintf('%s_%s', get_called_class(), $loadFilename); if (!isset(self::$instances[$key])) { - self::$instances[$key] = new static($filename); + self::$instances[$key] = new static($loadFilename); } + return self::$instances[$key]; } + /** - * @param string $filename - * @param string $mainKey - * @throws \InvalidArgumentException - * @return array + * For tests purpose only! */ - protected function parseSimpleArray($filename, $mainKey) + public static function resetInstances(): void + { + self::$instances = []; + } + + protected function loadYaml(string $filename) + { + $ymlParser = new Parser(); + + return $ymlParser->parse(file_get_contents($filename)); + } + + protected function parseSimpleArray(string $filename, string $mainKey): array { $values = $this->loadYaml($filename); if (!array_key_exists($mainKey, $values)) { - throw new \InvalidArgumentException(sprintf('Unable to find section "%s" in "%s"', $mainKey, $filename), __LINE__); + throw new InvalidArgumentException(sprintf('Unable to find section "%s" in "%s"', $mainKey, $filename), __LINE__); } + return $values[$mainKey]; } - /** - * For tests purpose only! - */ - public static function resetInstances() - { - self::$instances = []; - } } diff --git a/src/ConfigurationReader/GeneratorOptions.php b/src/ConfigurationReader/GeneratorOptions.php index 52204d57..3a8907a5 100644 --- a/src/ConfigurationReader/GeneratorOptions.php +++ b/src/ConfigurationReader/GeneratorOptions.php @@ -1,614 +1,724 @@ options = []; $this->parseOptions($filename); } - /** - * Parse options for generator - * @param string $filename options's file to parse - * @return GeneratorOptions - */ - protected function parseOptions($filename) - { - $options = $this->loadYaml($filename); - if (is_array($options)) { - $this->options = $options; - } else { - throw new \InvalidArgumentException(sprintf('Settings contained by "%s" are not valid as the settings are not contained by an array: "%s"', $filename, gettype($options)), __LINE__); - } - return $this; - } - /** - * Returns the option value - * @throws \InvalidArgumentException - * @param string $optionName - * @return mixed - */ - public function getOptionValue($optionName) + + public function getOptionValue(string $optionName) { - if (!isset($this->options[$optionName])) { - throw new \InvalidArgumentException(sprintf('Invalid option name "%s", possible options: %s', $optionName, implode(', ', array_keys($this->options))), __LINE__); + if (!array_key_exists($optionName, $this->options)) { + throw new InvalidArgumentException(sprintf('Invalid option name "%s", possible options: %s', $optionName, implode(', ', array_keys($this->options))), __LINE__); } + return array_key_exists('value', $this->options[$optionName]) ? $this->options[$optionName]['value'] : $this->options[$optionName]['default']; } - /** - * Allows to add an option and set its value - * @throws \InvalidArgumentException - * @param string $optionName - * @param mixed $optionValue - * @param array $values - * @return GeneratorOptions - */ - public function setOptionValue($optionName, $optionValue, array $values = []) + + public function setOptionValue(string $optionName, $optionValue, array $values = []): self { - if (!isset($this->options[$optionName])) { + if (!array_key_exists($optionName, $this->options)) { $this->options[$optionName] = [ 'value' => $optionValue, 'values' => $values, ]; } elseif (!empty($this->options[$optionName]['values']) && !in_array($optionValue, $this->options[$optionName]['values'], true)) { - throw new \InvalidArgumentException(sprintf('Invalid value "%s" for option "%s", possible values: %s', $optionValue, $optionName, implode(', ', $this->options[$optionName]['values'])), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value "%s" for option "%s", possible values: %s', $optionValue, $optionName, implode(', ', $this->options[$optionName]['values'])), __LINE__); } else { $this->options[$optionName]['value'] = $optionValue; } + return $this; } - /** - * @throws \InvalidArgumentException - * @param string $filename options's file to parse - * @return GeneratorOptions - */ - public static function instance($filename = null) - { - return parent::instance(empty($filename) ? self::getDefaultConfigurationPath() : $filename); - } - /** - * @return string - */ - public static function getDefaultConfigurationPath() + + public static function getDefaultConfigurationPath(): string { - return __DIR__ . '/../resources/config/generator_options.yml'; + return __DIR__.'/../resources/config/generator_options.yml'; } - /** - * Get category option value - * @return string - */ - public function getCategory() + + public function getCategory(): string { return $this->getOptionValue(self::CATEGORY); } + /** - * Set current category option value - * @throws \InvalidArgumentException + * Set current category option value. + * * @param string $category + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setCategory($category) { return $this->setOptionValue(self::CATEGORY, $category); } + /** - * Get add comments option value + * Get add comments option value. + * * @return array */ public function getAddComments() { return $this->getOptionValue(self::ADD_COMMENTS); } + /** - * Set current add comments option value - * @throws \InvalidArgumentException - * @param array $addComments + * Set current add comments option value. + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setAddComments(array $addComments = []) { /** - * If array is type array("author:john Doe","Release:1",) + * If array is type array("author:john Doe","Release:1",). */ $comments = []; foreach ($addComments as $index => $value) { if (is_numeric($index) && mb_strpos($value, ':') > 0) { - list($tag, $val) = explode(':', $value); + [$tag, $val] = explode(':', $value); $comments[$tag] = $val; } else { $comments[$index] = $value; } } + return $this->setOptionValue(self::ADD_COMMENTS, $comments); } + /** - * Get gather methods option value + * Get gather methods option value. + * * @return string */ public function getGatherMethods() { return $this->getOptionValue(self::GATHER_METHODS); } + /** - * Set current gather methods option value - * @throws \InvalidArgumentException + * Set current gather methods option value. + * * @param string $gatherMethods + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setGatherMethods($gatherMethods) { return $this->setOptionValue(self::GATHER_METHODS, $gatherMethods); } + /** - * Get generate tutorial file option value + * Get generate tutorial file option value. + * * @return bool */ public function getGenerateTutorialFile() { return $this->getOptionValue(self::GENERATE_TUTORIAL_FILE); } + /** - * Set current generate tutorial file option value - * @throws \InvalidArgumentException + * Set current generate tutorial file option value. + * * @param bool $generateTutorialFile + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setGenerateTutorialFile($generateTutorialFile) { return $this->setOptionValue(self::GENERATE_TUTORIAL_FILE, $generateTutorialFile); } + /** - * Get namespace option value + * Get namespace option value. + * * @return string */ public function getNamespace() { return $this->getOptionValue(self::NAMESPACE_PREFIX); } + /** - * Set current namespace option value - * @throws \InvalidArgumentException + * Set current namespace option value. + * * @param string $namespace + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setNamespace($namespace) { return $this->setOptionValue(self::NAMESPACE_PREFIX, $namespace); } + /** - * Get generic constants name option value + * Get generic constants name option value. + * * @return bool */ public function getGenericConstantsName() { return $this->getOptionValue(self::GENERIC_CONSTANTS_NAME); } + /** - * Set current generic constants name option value - * @throws \InvalidArgumentException + * Set current generic constants name option value. + * * @param bool $genericConstantsName + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setGenericConstantsName($genericConstantsName) { return $this->setOptionValue(self::GENERIC_CONSTANTS_NAME, $genericConstantsName); } + /** - * Get standalone option value + * Get standalone option value. + * * @return bool */ public function getStandalone() { return $this->getOptionValue(self::STANDALONE); } + /** - * Set current standalone option value - * @throws \InvalidArgumentException + * Set current standalone option value. + * * @param bool $standalone + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setStandalone($standalone) { return $this->setOptionValue(self::STANDALONE, $standalone); } + /** - * Get validation option value + * Get validation option value. + * * @return bool */ public function getValidation() { return $this->getOptionValue(self::VALIDATION); } + /** - * Set current validation option value - * @throws \InvalidArgumentException + * Set current validation option value. + * * @param bool $validation + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setValidation($validation) { return $this->setOptionValue(self::VALIDATION, $validation); } + /** - * Get struct class option value + * Get struct class option value. + * * @return string */ public function getStructClass() { return $this->getOptionValue(self::STRUCT_CLASS); } + /** - * Set current struct class option value - * @throws \InvalidArgumentException + * Set current struct class option value. + * * @param string $structClass + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setStructClass($structClass) { return $this->setOptionValue(self::STRUCT_CLASS, $structClass); } + /** - * Get struct array class option value + * Get struct array class option value. + * * @return string */ public function getStructArrayClass() { return $this->getOptionValue(self::STRUCT_ARRAY_CLASS); } + /** - * Set current struct array class option value - * @throws \InvalidArgumentException + * Set current struct array class option value. + * * @param string $structArrayClass + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setStructArrayClass($structArrayClass) { return $this->setOptionValue(self::STRUCT_ARRAY_CLASS, $structArrayClass); } + /** - * Get struct enum class option value + * Get struct enum class option value. + * * @return string */ public function getStructEnumClass() { return $this->getOptionValue(self::STRUCT_ENUM_CLASS); } + /** - * Set current struct enum class option value - * @throws \InvalidArgumentException + * Set current struct enum class option value. + * * @param string $structEnumClass + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setStructEnumClass($structEnumClass) { return $this->setOptionValue(self::STRUCT_ENUM_CLASS, $structEnumClass); } + /** - * Get struct array class option value + * Get struct array class option value. + * * @return string */ public function getSoapClientClass() { return $this->getOptionValue(self::SOAP_CLIENT_CLASS); } + /** - * Set current struct array class option value - * @throws \InvalidArgumentException + * Set current struct array class option value. + * * @param string $soapClientClass + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setSoapClientClass($soapClientClass) { return $this->setOptionValue(self::SOAP_CLIENT_CLASS, $soapClientClass); } + /** - * Get origin option value + * Get origin option value. + * * @return string */ public function getOrigin() { return $this->getOptionValue(self::ORIGIN); } + /** - * Set current origin option value - * @throws \InvalidArgumentException + * Set current origin option value. + * * @param string $origin + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setOrigin($origin) { return $this->setOptionValue(self::ORIGIN, $origin); } + /** - * Get destination option value + * Get destination option value. + * * @return string */ public function getDestination() { return $this->getOptionValue(self::DESTINATION); } + /** - * Set current destination option value - * @throws \InvalidArgumentException + * Set current destination option value. + * * @param string $destination + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setDestination($destination) { return $this->setOptionValue(self::DESTINATION, $destination); } + /** - * Get src dirname option value + * Get src dirname option value. + * * @return string */ public function getSrcDirname() { return $this->getOptionValue(self::SRC_DIRNAME); } + /** - * Set current src dirname option value - * @throws \InvalidArgumentException + * Set current src dirname option value. + * * @param string $srcDirname + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setSrcDirname($srcDirname) { return $this->setOptionValue(self::SRC_DIRNAME, $srcDirname); } + /** - * Get prefix option value + * Get prefix option value. + * * @return string */ public function getPrefix() { return $this->getOptionValue(self::PREFIX); } + /** - * Set current prefix option value - * @throws \InvalidArgumentException + * Set current prefix option value. + * * @param string $prefix + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setPrefix($prefix) { return $this->setOptionValue(self::PREFIX, $prefix); } + /** - * Get suffix option value + * Get suffix option value. + * * @return string */ public function getSuffix() { return $this->getOptionValue(self::SUFFIX); } + /** - * Set current suffix option value - * @throws \InvalidArgumentException + * Set current suffix option value. + * * @param string $suffix + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setSuffix($suffix) { return $this->setOptionValue(self::SUFFIX, $suffix); } + /** - * Get basic login option value + * Get basic login option value. + * * @return string */ public function getBasicLogin() { return $this->getOptionValue(self::BASIC_LOGIN); } + /** - * Set current basic login option value - * @throws \InvalidArgumentException + * Set current basic login option value. + * * @param string $basicLogin + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setBasicLogin($basicLogin) { return $this->setOptionValue(self::BASIC_LOGIN, $basicLogin); } + /** - * Get basic password option value + * Get basic password option value. + * * @return string */ public function getBasicPassword() { return $this->getOptionValue(self::BASIC_PASSWORD); } + /** - * Set current basic password option value - * @throws \InvalidArgumentException + * Set current basic password option value. + * * @param string $basicPassword + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setBasicPassword($basicPassword) { return $this->setOptionValue(self::BASIC_PASSWORD, $basicPassword); } + /** - * Get basic proxy host option value + * Get basic proxy host option value. + * * @return string */ public function getProxyHost() { return $this->getOptionValue(self::PROXY_HOST); } + /** - * Set current proxy host option value - * @throws \InvalidArgumentException + * Set current proxy host option value. + * * @param string $proxyHost + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setProxyHost($proxyHost) { return $this->setOptionValue(self::PROXY_HOST, $proxyHost); } + /** - * Get basic proxy port option value + * Get basic proxy port option value. + * * @return string */ public function getProxyPort() { return $this->getOptionValue(self::PROXY_PORT); } + /** - * Set current proxy port option value - * @throws \InvalidArgumentException + * Set current proxy port option value. + * * @param string $proxyPort + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setProxyPort($proxyPort) { return $this->setOptionValue(self::PROXY_PORT, $proxyPort); } + /** - * Get basic proxy login option value + * Get basic proxy login option value. + * * @return string */ public function getProxyLogin() { return $this->getOptionValue(self::PROXY_LOGIN); } + /** - * Set current proxy login option value - * @throws \InvalidArgumentException + * Set current proxy login option value. + * * @param string $proxyLogin + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setProxyLogin($proxyLogin) { return $this->setOptionValue(self::PROXY_LOGIN, $proxyLogin); } + /** - * Get basic proxy password option value + * Get basic proxy password option value. + * * @return string */ public function getProxyPassword() { return $this->getOptionValue(self::PROXY_PASSWORD); } + /** - * Set current proxy password option value - * @throws \InvalidArgumentException + * Set current proxy password option value. + * * @param string $proxyPassword + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setProxyPassword($proxyPassword) { return $this->setOptionValue(self::PROXY_PASSWORD, $proxyPassword); } + /** - * Get basic soap options option value + * Get basic soap options option value. + * * @return array */ public function getSoapOptions() { return $this->getOptionValue(self::SOAP_OPTIONS); } + /** - * Set current soap options option value - * @throws \InvalidArgumentException - * @param array $soapOptions + * Set current soap options option value. + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setSoapOptions(array $soapOptions) { return $this->setOptionValue(self::SOAP_OPTIONS, $soapOptions); } + /** - * Get composer name option value + * Get composer name option value. + * * @return string */ public function getComposerName() { return $this->getOptionValue(self::COMPOSER_NAME); } + /** - * Set current composer name option value - * @throws \InvalidArgumentException + * Set current composer name option value. + * * @param string $composerName + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setComposerName($composerName) { return $this->setOptionValue(self::COMPOSER_NAME, $composerName); } + /** - * Get composer settings option value + * Get composer settings option value. + * * @return array */ public function getComposerSettings() { return $this->getOptionValue(self::COMPOSER_SETTINGS); } + /** - * Set current composer settings option value - * @throws \InvalidArgumentException - * @param array $composerSettings + * Set current composer settings option value. + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setComposerSettings(array $composerSettings = []) { /** - * If array is type array("config.value:true","require:library/src",) + * If array is type array("config.value:true","require:library/src",). */ $settings = []; foreach ($composerSettings as $index => $value) { @@ -620,161 +730,217 @@ public function setComposerSettings(array $composerSettings = []) $settings[$index] = $value; } } + return $this->setOptionValue(self::COMPOSER_SETTINGS, $settings); } + /** - * turns my.key.path to array('my' => array('key' => array('path' => $value))) - * @param string $string - * @param mixed $value - * @param array $array - */ - protected static function dotNotationToArray($string, $value, array &$array) - { - $keys = explode('.', $string); - foreach ($keys as $key) { - $array = &$array[$key]; - } - $array = ($value === 'true' || $value === 'false') ? $value === 'true' : $value; - } - /** - * Get structs folder option value + * Get structs folder option value. + * * @return string */ public function getStructsFolder() { return $this->getOptionValue(self::STRUCTS_FOLDER); } + /** - * Set current structs folder option value - * @throws \InvalidArgumentException + * Set current structs folder option value. + * * @param string $structsFolder + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setStructsFolder($structsFolder) { return $this->setOptionValue(self::STRUCTS_FOLDER, $structsFolder); } + /** - * Get arrays folder option value + * Get arrays folder option value. + * * @return string */ public function getArraysFolder() { return $this->getOptionValue(self::ARRAYS_FOLDER); } + /** - * Set current arrays folder option value - * @throws \InvalidArgumentException + * Set current arrays folder option value. + * * @param string $arraysFolder + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setArraysFolder($arraysFolder) { return $this->setOptionValue(self::ARRAYS_FOLDER, $arraysFolder); } + /** - * Get enums folder option value + * Get enums folder option value. + * * @return string */ public function getEnumsFolder() { return $this->getOptionValue(self::ENUMS_FOLDER); } + /** - * Set current enums folder option value - * @throws \InvalidArgumentException + * Set current enums folder option value. + * * @param string $enumsFolder + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setEnumsFolder($enumsFolder) { return $this->setOptionValue(self::ENUMS_FOLDER, $enumsFolder); } + /** - * Get services folder option value + * Get services folder option value. + * * @return string */ public function getServicesFolder() { return $this->getOptionValue(self::SERVICES_FOLDER); } + /** - * Set current services folder option value - * @throws \InvalidArgumentException + * Set current services folder option value. + * * @param string $servicesFolder + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setServicesFolder($servicesFolder) { return $this->setOptionValue(self::SERVICES_FOLDER, $servicesFolder); } + /** - * Get schemas save option value + * Get schemas save option value. + * * @return bool */ public function getSchemasSave() { return $this->getOptionValue(self::SCHEMAS_SAVE); } + /** - * Set schemas save option value - * @throws \InvalidArgumentException + * Set schemas save option value. + * * @param bool $saveSchemas + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setSchemasSave($saveSchemas) { return $this->setOptionValue(self::SCHEMAS_SAVE, $saveSchemas); } + /** - * Get schemas folder option value + * Get schemas folder option value. + * * @return string */ public function getSchemasFolder() { return $this->getOptionValue(self::SCHEMAS_FOLDER); } + /** - * Set schemas folder option value - * @throws \InvalidArgumentException + * Set schemas folder option value. + * * @param string $schemasFolder + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setSchemasFolder($schemasFolder) { return $this->setOptionValue(self::SCHEMAS_FOLDER, $schemasFolder); } + /** - * Get xsd types path option value + * Get xsd types path option value. + * * @return string */ public function getXsdTypesPath() { return $this->getOptionValue(self::XSD_TYPES_PATH); } + /** - * Set xsd types path option value - * @throws \InvalidArgumentException + * Set xsd types path option value. + * * @param string $xsdTypesPath + * + * @throws InvalidArgumentException + * * @return GeneratorOptions */ public function setXsdTypesPath($xsdTypesPath) { return $this->setOptionValue(self::XSD_TYPES_PATH, $xsdTypesPath); } - /** - * @return string[] - */ - public function toArray() + + public function toArray(): array { $options = []; foreach (array_keys($this->options) as $name) { $options[$name] = $this->getOptionValue($name); } + return $options; } - public function jsonSerialize() + + public function jsonSerialize(): array { return $this->toArray(); } + + protected function parseOptions(string $filename): self + { + $options = $this->loadYaml($filename); + if (is_array($options)) { + $this->options = $options; + } else { + throw new InvalidArgumentException(sprintf('Settings contained by "%s" are not valid as the settings are not contained by an array: "%s"', $filename, gettype($options)), __LINE__); + } + + return $this; + } + + /** + * turns my.key.path to array('my' => array('key' => array('path' => $value))). + * + * @param string $string + * @param mixed $value + */ + protected static function dotNotationToArray($string, $value, array &$array) + { + $keys = explode('.', $string); + foreach ($keys as $key) { + $array = &$array[$key]; + } + $array = ('true' === $value || 'false' === $value) ? 'true' === $value : $value; + } } diff --git a/src/ConfigurationReader/PhpReservedKeyword.php b/src/ConfigurationReader/PhpReservedKeyword.php index 1e195280..fe101b13 100644 --- a/src/ConfigurationReader/PhpReservedKeyword.php +++ b/src/ConfigurationReader/PhpReservedKeyword.php @@ -1,23 +1,13 @@ parseReservedKeywords(parent::getDefaultConfigurationPath()); - } - /** - * @throws \InvalidArgumentException - * @param string $filename options's file to parse - * @return StructArrayReservedMethod - */ - public static function instance($filename = null) - { - return parent::instance(empty($filename) ? self::getDefaultArrayConfigurationPath() : $filename); - } - /** - * @return string - */ - public static function getDefaultArrayConfigurationPath() + public static function getDefaultConfigurationPath(): string { - return __DIR__ . '/../resources/config/struct_array_reserved_keywords.yml'; + return __DIR__.'/../resources/config/struct_array_reserved_keywords.yml'; } } diff --git a/src/ConfigurationReader/StructReservedMethod.php b/src/ConfigurationReader/StructReservedMethod.php index 87d29e18..6ae4cf22 100644 --- a/src/ConfigurationReader/StructReservedMethod.php +++ b/src/ConfigurationReader/StructReservedMethod.php @@ -1,23 +1,13 @@ types = []; $this->parseXsdTypes($filename); } - /** - * @param string $filename - * @return XsdTypes - */ - protected function parseXsdTypes($filename) - { - $this->types = $this->parseSimpleArray($filename, self::MAIN_KEY); - return $this; - } - /** - * @param string $filename options's file to parse - * @return XsdTypes - */ - public static function instance($filename = null) + + public static function getDefaultConfigurationPath(): string { - return parent::instance(empty($filename) ? __DIR__ . '/../resources/config/xsd_types.yml' : $filename); + return __DIR__.'/../resources/config/xsd_types.yml'; } - /** - * @param string $xsdType - * @return bool - */ - public function isXsd($xsdType) + + public function isXsd(string $xsdType): bool { return array_key_exists($xsdType, $this->types) || self::isAnonymous($xsdType); } - /** - * @param string $xsdType - * @return bool - */ - public static function isAnonymous($xsdType) + + public static function isAnonymous(string $xsdType): bool { return (bool) preg_match(self::ANONYMOUS_TYPE, $xsdType); } - /** - * @param string $xsdType - * @return string - */ - public function phpType($xsdType) + + public function phpType(string $xsdType): string { return $this->isAnonymous($xsdType) ? $this->types[self::ANONYMOUS_KEY] : ($this->isXsd($xsdType) ? $this->types[$xsdType] : ''); } + + protected function parseXsdTypes(string $filename): self + { + $this->types = $this->parseSimpleArray($filename, self::MAIN_KEY); + + return $this; + } } diff --git a/src/Container/AbstractObjectContainer.php b/src/Container/AbstractObjectContainer.php index 2adb6f0d..9c188c90 100644 --- a/src/Container/AbstractObjectContainer.php +++ b/src/Container/AbstractObjectContainer.php @@ -1,172 +1,142 @@ objects, $offset, 1); + return !empty($element); } - /** - * @param int $offset - * @return mixed - */ + public function offsetGet($offset) { $element = array_slice($this->objects, $offset, 1); + return $this->offsetExists($offset) ? array_shift($element) : null; } - /** - * @param int $offset - * @param mixed $value - * @return AbstractObjectContainer - */ + public function offsetSet($offset, $value) { - throw new \InvalidArgumentException('This method can\'t be used as object are stored with a string as array index', __LINE__); + throw new InvalidArgumentException('This method can\'t be used as object are stored with a string as array index', __LINE__); } - /** - * @param int $offset - * @return void - */ + public function offsetUnset($offset) { if ($this->offsetExists($offset)) { unset($this->objects[$this->getObjectKey($this->offsetGet($offset))]); } } - /** - * @return mixed - */ + public function current() { $current = array_slice($this->objects, $this->offset, 1); + return array_shift($current); } - /** - * @return void - */ + public function next() { - $this->offset++; + ++$this->offset; } - /** - * @return int - */ + public function key() { return $this->offset; } - /** - * @return bool - */ - public function valid() + + public function valid(): bool { - return count(array_slice($this->objects, $this->offset, 1)) > 0; + return 0 < count(array_slice($this->objects, $this->offset, 1)); } - /** - * @return void - */ + public function rewind() { $this->offset = 0; } - /** - * @return int - */ + public function count() { return count($this->objects); } + + public function add(object $object): self + { + $this->beforeObjectIsStored($object); + $this->objects[$this->getObjectKey($object)] = $object; + + return $this; + } + + public function get($value) + { + if (!is_scalar($value)) { + throw new InvalidArgumentException(sprintf('Value "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($value, true), get_class($this)), __LINE__); + } + + return array_key_exists($value, $this->objects) ? $this->objects[$value] : null; + } + + public function jsonSerialize(): array + { + return array_values($this->objects); + } + /** - * Must return the object class name that this container is made to contain - * @return string + * Must return the object class name that this container is made to contain. */ - abstract protected function objectClass(); + abstract protected function objectClass(): string; + /** - * Must return the object class name that this container is made to contain - * @return string + * Must return the object class name that this container is made to contain. */ - abstract protected function objectProperty(); + abstract protected function objectProperty(): string; + /** - * This method is called before the object has been stored - * @throws \InvalidArgumentException + * This method is called before the object has been stored. + * * @param mixed $object + * + * @throws InvalidArgumentException */ - protected function beforeObjectIsStored($object) + protected function beforeObjectIsStored(object $object): void { - if (!is_object($object)) { - throw new \InvalidArgumentException(sprintf('You must only pass object to this container (%s), "%s" passed as parameter!', get_called_class(), gettype($object)), __LINE__); - } $objectClass = $this->objectClass(); + if (!$object instanceof $objectClass) { - throw new \InvalidArgumentException(sprintf('Model of type "%s" does not match the object contained by this class: "%s"', get_class($object), $objectClass), __LINE__); + throw new InvalidArgumentException(sprintf('Model of type "%s" does not match the object contained by this class: "%s"', get_class($object), $objectClass), __LINE__); } } - /** - * @param object $object - * @throws \InvalidArgumentException - * @return string - */ - protected function getObjectKey($object) + + protected function getObjectKey(object $object) { $get = sprintf('get%s', ucfirst($this->objectProperty())); if (!method_exists($object, $get)) { - throw new \InvalidArgumentException(sprintf('Method "%s" is required in "%s" in order to be stored in "%s"', $get, get_class($object), get_class($this)), __LINE__); + throw new InvalidArgumentException(sprintf('Method "%s" is required in "%s" in order to be stored in "%s"', $get, get_class($object), get_class($this)), __LINE__); } - $key = $object->$get(); + + $key = $object->{$get}(); if (!is_scalar($key)) { - throw new \InvalidArgumentException(sprintf('Property "%s" of "%s" must be scalar, "%s" returned', $this->objectProperty(), get_class($object), gettype($key)), __LINE__); + throw new InvalidArgumentException(sprintf('Property "%s" of "%s" must be scalar, "%s" returned', $this->objectProperty(), get_class($object), gettype($key)), __LINE__); } + return $key; } - /** - * @throws \InvalidArgumentException - * @param mixed $object - * @return AbstractObjectContainer - */ - public function add($object) - { - $this->beforeObjectIsStored($object); - $this->objects[$this->getObjectKey($object)] = $object; - return $this; - } - /** - * @param string $value - * @return mixed - */ - public function get($value) - { - if (!is_scalar($value)) { - throw new \InvalidArgumentException(sprintf('Value "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($value, true), get_class($this)), __LINE__); - } - return array_key_exists($value, $this->objects) ? $this->objects[$value] : null; - } - /** - * @return array - */ - public function jsonSerialize() - { - return array_values($this->objects); - } } diff --git a/src/Container/Model/AbstractModel.php b/src/Container/Model/AbstractModel.php index f1ac244f..ad1fcb6c 100644 --- a/src/Container/Model/AbstractModel.php +++ b/src/Container/Model/AbstractModel.php @@ -1,16 +1,14 @@ get($name); } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() - * @param string $value - * @return Model|null - */ - public function get($value) + + public function get($value): ?Model { foreach ($this->objects as $object) { - if ($object instanceof Model && $object->getName() === $value) { + if ($object instanceof Model && $value === $object->getName()) { return $object; } } + return null; } + + protected function objectClass(): string + { + return Model::class; + } + + protected function objectProperty(): string + { + return 'methodName'; + } } diff --git a/src/Container/Model/Schema.php b/src/Container/Model/Schema.php index 24a2fa19..18c9d59e 100644 --- a/src/Container/Model/Schema.php +++ b/src/Container/Model/Schema.php @@ -1,34 +1,20 @@ get($name); } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() - * @param string $value - * @return Model|null - */ - public function get($value) + + protected function objectClass(): string { - return parent::get($value); + return Model::class; } } diff --git a/src/Container/Model/Service.php b/src/Container/Model/Service.php index b467a720..d02b0cbf 100644 --- a/src/Container/Model/Service.php +++ b/src/Container/Model/Service.php @@ -1,69 +1,40 @@ get($serviceName) instanceof Model) { $this->add(new Model($this->generator, $serviceName)); } $serviceMethod = $this->get($serviceName)->getMethod($methodName); - /** - * Service method does not already exist, register it - */ + + // Service method does not already exist, register it if (!$serviceMethod instanceof MethodModel) { $this->get($serviceName)->addMethod($methodName, $methodParameter, $methodReturn); - } elseif ($serviceMethod->getParameterType() != $methodParameter) { - /** - * Service method exists with a different signature, register it too by identifying the service functions as non unique functions - */ + } + // Service method exists with a different signature, register it too by identifying the service functions as non unique functions + elseif ($methodParameter !== $serviceMethod->getParameterType()) { $serviceMethod->setUnique(false); $this->get($serviceName)->addMethod($methodName, $methodParameter, $methodReturn, false); } + return $this; } - /** - * @param string $name - * @return Model|null - */ - public function getServiceByName($name) + + public function getServiceByName(string $name): ?Model { return $this->get($name); } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() - * @param string $value - * @return Model|null - */ - public function get($value) - { - return parent::get($value); - } - /** - * @return MethodModel[] - */ - public function getMethods() + + public function getMethods(): Method { $methods = new Method($this->generator); /** @var Model $service */ @@ -72,6 +43,12 @@ public function getMethods() $methods->add($method); } } + return $methods; } + + protected function objectClass(): string + { + return Model::class; + } } diff --git a/src/Container/Model/Struct.php b/src/Container/Model/Struct.php index 20e353b0..044290d8 100644 --- a/src/Container/Model/Struct.php +++ b/src/Container/Model/Struct.php @@ -1,178 +1,116 @@ get($name); } - /** - * @param string $name - * @param string $type - * @return Model|null - */ - public function getStructByNameAndType($name, $type) + + public function getStructByNameAndType(string $name, string $type): ?Model { return $this->getByType($name, $type); } - /** - * Adds a virtual struct - * @param string $structName the original struct name - * @param string $structType the original struct type - * @return Struct - */ - public function addVirtualStruct($structName, $structType = '') + + public function addVirtualStruct(string $structName, string $structType = ''): self { return $this->addStruct($structName, false, $structType); } - /** - * Adds type to structs - * @param string $structName the original struct name - * @param bool $isStruct whether the Struct has to be generated or not - * @param string $structType the original struct type - * @return Struct - */ - public function addStruct($structName, $isStruct = true, $structType = '') + + public function addStruct(string $structName, bool $isStruct = true, string $structType = ''): self { if (null === (empty($structType) ? $this->get($structName) : $this->getByType($structName, $structType))) { $model = new Model($this->generator, $structName, $isStruct); $this->add($model->setInheritance($structType)); } + return $this; } - /** - * Adds type to structs and its attribute - * @param string $structName the original struct name - * @param string $attributeName the attribute name - * @param string $attributeType the attribute type - * @return Struct - */ - public function addStructWithAttribute($structName, $attributeName, $attributeType) + + public function addStructWithAttribute(string $structName, string $attributeName, string $attributeType): self { $this->addStruct($structName); if (($struct = $this->getStructByName($structName)) instanceof Model) { $struct->addAttribute($attributeName, $attributeType); } + return $this; } - /** - * Adds a union struct - * @param string $structName - * @param string[] $types - * @return Struct - */ - public function addUnionStruct($structName, $types) + + public function addUnionStruct(string $structName, array $types): self { $this->addVirtualStruct($structName); if (($struct = $this->getStructByName($structName)) instanceof Model) { $struct->setTypes($types); } + return $this; } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() - * @param string $value - * @return Model|null - */ - public function get($value) - { - return parent::get($value); - } - /** - * @see parent::get() - * @throws \InvalidArgumentException - * @param string $value - * @return mixed - */ - public function getVirtual($value) + + public function getVirtual(string $value): ?Model { if (!is_scalar($value)) { - throw new \InvalidArgumentException(sprintf('Value "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($value, true), __CLASS__), __LINE__); + throw new InvalidArgumentException(sprintf('Value "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($value, true), __CLASS__), __LINE__); } + $key = $this->getVirtualKey($value); + return array_key_exists($key, $this->virtualObjects) ? $this->virtualObjects[$key] : null; } - /** - * @see parent::get() - * @throws \InvalidArgumentException - * @param string $value - * @param string $type - * @return mixed - */ - public function getByType($value, $type) + + public function getByType(string $value, string $type): ?Model { - if (!is_scalar($value)) { - throw new \InvalidArgumentException(sprintf('Value "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($value, true), __CLASS__), __LINE__); - } - if (!is_scalar($type)) { - throw new \InvalidArgumentException(sprintf('Type "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($type, true), __CLASS__), __LINE__); - } $key = $this->getTypeKey($value, $type); + return array_key_exists($key, $this->objects) ? $this->objects[$key] : null; } - /** - * @param $object - * @param $type - * @return string - */ - public function getObjectKeyWithType($object, $type) + + public function getObjectKeyWithType(object $object, string $type): string { return $this->getTypeKey($this->getObjectKey($object), $type); } - /** - * @param $object - * @return string - */ - public function getObjectKeyWithVirtual($object) + + public function getObjectKeyWithVirtual(object $object): string { return $this->getVirtualKey($this->getObjectKey($object)); } + /** - * The key must not conflict with possible key values - * @param $name - * @param $type - * @return string + * The key must not conflict with possible key values. */ - public function getTypeKey($name, $type) + public function getTypeKey(string $name, string $type): string { return sprintf('struct_name_%s-type_%s', $name, $type); } + /** - * The key must not conflict with possible key values - * @param $type - * @return string + * The key must not conflict with possible key values. */ - public function getVirtualKey($name) + public function getVirtualKey(string $name): string { return sprintf('virtual_struct_name_%s', $name); } + /** * By overriding this method, we ensure that each time a new object is stored, it is stored with our new key if the inheritance is defined. + * * @param Model $object + * * @return Struct */ - public function add($object) + public function add(object $object): self { $inheritance = $object->getInheritance(); if (!empty($inheritance)) { @@ -180,6 +118,12 @@ public function add($object) } else { parent::add($object); } + return $this; } + + protected function objectClass(): string + { + return Model::class; + } } diff --git a/src/Container/Model/StructAttribute.php b/src/Container/Model/StructAttribute.php index 4dff6370..a41991e6 100644 --- a/src/Container/Model/StructAttribute.php +++ b/src/Container/Model/StructAttribute.php @@ -1,57 +1,39 @@ get($name); } - /** - * @param string $cleanedName - * @return Model|null - */ - public function getStructAttributeByCleanName($cleanedName) + + public function getStructAttributeByCleanName(string $cleanedName): ?Model { return $this->getByCleanName($cleanedName); } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() - * @param string $value - * @return Model|null - */ - public function get($value) - { - return parent::get($value); - } - /** - * @param string $cleanedName - * @return Model - */ - public function getByCleanName($cleanedName) + + public function getByCleanName(string $cleanedName): ?Model { $attribute = null; foreach ($this->objects as $object) { if ($object instanceof Model && $cleanedName === $object->getCleanName()) { $attribute = $object; + break; } } + return $attribute; } + + protected function objectClass(): string + { + return Model::class; + } } diff --git a/src/Container/Model/StructValue.php b/src/Container/Model/StructValue.php index 47a665e3..dcbbc1df 100644 --- a/src/Container/Model/StructValue.php +++ b/src/Container/Model/StructValue.php @@ -1,34 +1,20 @@ get($name); } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() - * @param string $value - * @return Model|null - */ - public function get($value) + + protected function objectClass(): string { - return parent::get($value); + return Model::class; } } diff --git a/src/Container/Parser.php b/src/Container/Parser.php index 7e01aee3..c1ad8e8f 100644 --- a/src/Container/Parser.php +++ b/src/Container/Parser.php @@ -1,33 +1,25 @@ get($name); } - /** - * @see \WsdlToPhp\PackageGenerator\Container\AbstractObjectContainer::objectProperty() - * @return string - */ - protected function objectProperty() + + protected function objectClass(): string { - return self::PROPERTY_NAME; + return AbstractParser::class; } - /** - * @param string $name - * @return AbstractParser|null - */ - public function getParserByName($name) + + protected function objectProperty(): string { - return $this->get($name); + return self::PROPERTY_NAME; } } diff --git a/src/Container/PhpElement/AbstractPhpElement.php b/src/Container/PhpElement/AbstractPhpElement.php index e63b1e24..5ad92526 100644 --- a/src/Container/PhpElement/AbstractPhpElement.php +++ b/src/Container/PhpElement/AbstractPhpElement.php @@ -1,16 +1,14 @@ setFile(new PhpFile($name))->setGenerator($generator); + $this + ->setFile(new PhpFile($name)) + ->setGenerator($generator) + ; } - /** - * @param Generator $generator - * @return AbstractFile - */ - public function setGenerator(Generator $generator) + + public function setGenerator(Generator $generator): self { $this->generator = $generator; + return $this; } - /** - * @return Generator - */ - public function getGenerator() + + public function getGenerator(): Generator { return $this->generator; } - /** - * @return void - */ - public function write() + + public function write(): void { $this->writeFile(); } - /** - * @return void - */ - protected function writeFile() + + public function getFileName(): string { - file_put_contents($this->getFileName(), $this->getFile()->toString(), LOCK_EX); + return sprintf('%s%s.%s', $this->getFileDestination(), $this->getFile()->getMainElement()->getName(), $this->getFileExtension()); } - /** - * @return string - */ - public function getFileName() + + public function getFileExtension(): string { - return sprintf('%s%s.%s', $this->getFileDestination(), $this->getFile()->getMainElement()->getName(), $this->getFileExtension()); + return self::PHP_FILE_EXTENSION; } - /** - * @return string - */ - protected function getFileDestination() + + public function getFile(): PhpFile { - return $this->getGenerator()->getOptionDestination(); + return $this->file; } - /** - * @return string - */ - public function getFileExtension() + + protected function writeFile(): void { - return self::PHP_FILE_EXTENSION; + file_put_contents($this->getFileName(), $this->getFile()->toString(), LOCK_EX); } - /** - * @param PhpFile $file - * @return AbstractFile - */ - protected function setFile($file) + + protected function getFileDestination(): string { - $this->file = $file; - return $this; + return $this->getGenerator()->getOptionDestination(); } - /** - * @return PhpFile - */ - public function getFile() + + protected function setFile(PhpFile $file): self { - return $this->file; + $this->file = $file; + + return $this; } } diff --git a/src/File/AbstractModelFile.php b/src/File/AbstractModelFile.php index dd9cb773..6b204c41 100644 --- a/src/File/AbstractModelFile.php +++ b/src/File/AbstractModelFile.php @@ -1,154 +1,233 @@ getDestinationFolder($withSrc), $this->getModel()->getSubDirectory(), $this->getModel()->getSubDirectory() !== '' ? '/' : ''); + return sprintf( + '%s%s%s', + $this->getDestinationFolder($withSrc), + $this->getModel()->getSubDirectory(), + !empty($this->getModel()->getSubDirectory()) ? '/' : '' + ); } - /** - * @param bool $withSrc - * @return string - */ - public function getDestinationFolder($withSrc = true) + + public function getDestinationFolder(bool $withSrc = true): string { $src = rtrim($this->generator->getOptionSrcDirname(), DIRECTORY_SEPARATOR); - return sprintf('%s%s', $this->getGenerator()->getOptionDestination(), (bool) $withSrc && !empty($src) ? $src . DIRECTORY_SEPARATOR : ''); + + return sprintf( + '%s%s%s%s', + $this->getGenerator()->getOptionDestination(), + (bool) $withSrc && !empty($src) ? $src.DIRECTORY_SEPARATOR : '', + str_replace('\\', DIRECTORY_SEPARATOR, $this->getGenerator()->getOptionNamespacePrefix()), + $this->getGenerator()->getOptionNamespacePrefix() ? DIRECTORY_SEPARATOR : '' + ); } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractFile::writeFile() - * @param bool $withSrc - * @return void - */ - public function writeFile($withSrc = true) + + public function writeFile(bool $withSrc = true): void { if (!$this->getModel()) { - throw new \InvalidArgumentException('You MUST define the model before being able to generate the file', __LINE__); + throw new InvalidArgumentException('You MUST define the model before being able to generate the file', __LINE__); } + GeneratorUtils::createDirectory($this->getFileDestination($withSrc)); - $this->defineNamespace()->defineUseStatement()->addAnnotationBlock()->addClassElement(); + + $this + ->addDeclareDirective() + ->defineNamespace() + ->defineUseStatements() + ->addAnnotationBlock() + ->addClassElement() + ; + parent::writeFile(); } - /** - * @return AbstractModelFile - */ - protected function addAnnotationBlock() + + public function setModel(AbstractModel $model): self { - $this->getFile()->addAnnotationBlockElement($this->getClassAnnotationBlock()); + $this->model = $model; + + $this + ->getFile() + ->getMainElement() + ->setName($model->getPackagedName()) + ; + return $this; } - /** - * @param AbstractModel $model - * @return AbstractModelFile - */ - public function setModel(AbstractModel $model) + + public function getModel(): ?AbstractModel { - $this->model = $model; - $this->getFile()->getMainElement()->setName($model->getPackagedName()); - return $this; + return $this->model; + } + + public function getModelFromStructAttribute(StructAttributeModel $attribute = null): ?StructModel + { + return $this->getStructAttribute($attribute)->getTypeStruct(); + } + + public function getRestrictionFromStructAttribute(StructAttributeModel $attribute = null): ?StructModel + { + $model = $this->getModelFromStructAttribute($attribute); + if ($model instanceof StructModel) { + // list are mainly scalar values of basic types (string, int, etc.) or of Restriction values + if ($model->isList()) { + $subModel = $this->getModelByName($model->getList()); + if ($subModel && $subModel->isRestriction()) { + $model = $subModel; + } elseif (!$model->isRestriction()) { + $model = null; + } + } elseif (!$model->isRestriction()) { + $model = null; + } + } + + return $model; } + + public function getStructAttributeType(StructAttributeModel $attribute = null, bool $namespaced = false, bool $returnArrayType = true): string + { + $attribute = $this->getStructAttribute($attribute); + + if (!$attribute instanceof StructAttributeModel) { + throw new InvalidArgumentException(sprintf('Couldn\'t not find any valid StructAttribute')); + } + + if ($returnArrayType && ($attribute->isArray())) { + return self::TYPE_ARRAY; + } + + $inheritance = $attribute->getInheritance(); + $type = empty($inheritance) ? $attribute->getType() : $inheritance; + + if (!empty($type) && ($struct = $this->getGenerator()->getStructByName($type))) { + $inheritance = $struct->getTopInheritance(); + if (!empty($inheritance)) { + $type = str_replace('[]', '', $inheritance); + } else { + $type = $struct->getPackagedName($namespaced); + } + } + + $model = $this->getModelFromStructAttribute($attribute); + if ($model instanceof StructModel) { + // issue #84: union is considered as string as it would be difficult to have a method that accepts multiple object types. + // If the property has to be an object of multiple types => new issue... + if ($model->isRestriction() || $model->isUnion()) { + $type = self::TYPE_STRING; + } elseif ($model->isStruct()) { + $type = $model->getPackagedName($namespaced); + } elseif ($model->isArray() && ($inheritanceStruct = $model->getInheritanceStruct()) instanceof StructModel) { + $type = $inheritanceStruct->getPackagedName($namespaced); + } + } + + return $type; + } + + public function getStructAttributeTypeAsPhpType(StructAttributeModel $fromAttribute = null, bool $returnArrayType = true): string + { + $attribute = $this->getStructAttribute($fromAttribute); + + if (!$attribute instanceof StructAttributeModel) { + throw new InvalidArgumentException(sprintf('Couldn\'t not find any valid StructAttribute')); + } + + $attributeType = $this->getStructAttributeType($attribute, true, $returnArrayType); + if (XsdTypes::instance($this->getGenerator()->getOptionXsdTypesPath())->isXsd($attributeType)) { + $attributeType = self::getPhpType($attributeType, $this->getGenerator()->getOptionXsdTypesPath()); + } + + return $attributeType; + } + /** - * @return AbstractModel + * See http://php.net/manual/fr/language.oop5.typehinting.php for these cases + * Also see http://www.w3schools.com/schema/schema_dtypes_numeric.asp. + * + * @param mixed $type + * @param null $xsdTypesPath + * @param mixed $fallback + * + * @return mixed */ - public function getModel() + public static function getValidType($type, $xsdTypesPath = null, $fallback = null) { - return $this->model; + return XsdTypes::instance($xsdTypesPath)->isXsd(str_replace('[]', '', $type)) ? $fallback : $type; } + /** - * @param string $name - * @return StructModel|null + * See http://php.net/manual/fr/language.oop5.typehinting.php for these cases + * Also see http://www.w3schools.com/schema/schema_dtypes_numeric.asp. + * + * @param mixed $type + * @param null $xsdTypesPath + * @param mixed $fallback + * + * @return mixed */ - protected function getModelByName($name) + public static function getPhpType($type, $xsdTypesPath = null, $fallback = self::TYPE_STRING) + { + return XsdTypes::instance($xsdTypesPath)->isXsd(str_replace('[]', '', $type)) ? XsdTypes::instance($xsdTypesPath)->phpType($type) : $fallback; + } + + protected function addAnnotationBlock(): AbstractModelFile + { + $this->getFile()->addAnnotationBlockElement($this->getClassAnnotationBlock()); + + return $this; + } + + protected function getModelByName(string $name): ?StructModel { return $this->getGenerator()->getStructByName($name); } - /** - * @param PhpAnnotationBlock $block - * @return AbstractModelFile - */ - protected function definePackageAnnotations(PhpAnnotationBlock $block) + + protected function definePackageAnnotations(PhpAnnotationBlock $block): self { $packageName = $this->getPackageName(); if (!empty($packageName)) { @@ -157,107 +236,100 @@ protected function definePackageAnnotations(PhpAnnotationBlock $block) if (count($this->getModel()->getDocSubPackages()) > 0) { $block->addChild(new PhpAnnotation(self::ANNOTATION_SUB_PACKAGE, implode(',', $this->getModel()->getDocSubPackages()))); } + return $this; } - /** - * @return string - */ - protected function getPackageName() + + protected function getPackageName(): string { $packageName = ''; - if ($this->getGenerator()->getOptionPrefix() !== '') { + if (!empty($this->getGenerator()->getOptionPrefix())) { $packageName = $this->getGenerator()->getOptionPrefix(); - } elseif ($this->getGenerator()->getOptionSuffix() !== '') { + } elseif (!empty($this->getGenerator()->getOptionSuffix())) { $packageName = $this->getGenerator()->getOptionSuffix(); } + return $packageName; } - /** - * @param PhpAnnotationBlock $block - * @return AbstractModelFile - */ - protected function defineGeneralAnnotations(PhpAnnotationBlock $block) + + protected function defineGeneralAnnotations(PhpAnnotationBlock $block): self { foreach ($this->getGenerator()->getOptionAddComments() as $tagName => $tagValue) { $block->addChild(new PhpAnnotation($tagName, $tagValue)); } + return $this; } - /** - * @return PhpAnnotationBlock - */ - protected function getClassAnnotationBlock() + + protected function getClassAnnotationBlock(): PhpAnnotationBlock { $block = new PhpAnnotationBlock(); $block->addChild($this->getClassDeclarationLine()); $this->defineModelAnnotationsFromWsdl($block)->definePackageAnnotations($block)->defineGeneralAnnotations($block); + return $block; } - /** - * @return string - */ - protected function getClassDeclarationLine() + + protected function getClassDeclarationLine(): string { return sprintf($this->getClassDeclarationLineText(), $this->getModel()->getName(), $this->getModel()->getContextualPart()); } - /** - * @return string - */ - protected function getClassDeclarationLineText() + + protected function getClassDeclarationLineText(): string { return 'This class stands for %s %s'; } - /** - * @param PhpAnnotationBlock $block - * @param AbstractModel $model - * @return AbstractModelFile - */ - protected function defineModelAnnotationsFromWsdl(PhpAnnotationBlock $block, AbstractModel $model = null) + + protected function defineModelAnnotationsFromWsdl(PhpAnnotationBlock $block, AbstractModel $model = null): self { FileUtils::defineModelAnnotationsFromWsdl($block, $model instanceof AbstractModel ? $model : $this->getModel()); + return $this; } - /** - * @return AbstractModelFile - */ - protected function addClassElement() + + protected function addClassElement(): AbstractModelFile { - $class = new PhpClass($this->getModel()->getPackagedName(), $this->getModel()->isAbstract(), $this->getModel()->getExtendsClassName() === '' ? null : $this->getModel()->getExtendsClassName()); - $this->defineConstants($class) + $class = new PhpClass($this->getModel()->getPackagedName(), $this->getModel()->isAbstract(), '' === $this->getModel()->getExtendsClassName() ? null : $this->getModel()->getExtendsClassName()); + $this + ->defineConstants($class) ->defineProperties($class) ->defineMethods($class) ->getFile() - ->addClassComponent($class); + ->addClassComponent($class) + ; + return $this; } - /** - * @return AbstractModelFile - */ - protected function defineNamespace() + + protected function addDeclareDirective(): self + { + $this->getFile()->setDeclare(PhpDeclare::DIRECTIVE_STRICT_TYPES, 1); + + return $this; + } + + protected function defineNamespace(): self { - if ($this->getModel()->getNamespace() !== '') { + if (!empty($this->getModel()->getNamespace())) { $this->getFile()->setNamespace($this->getModel()->getNamespace()); } + return $this; } - /** - * @return AbstractModelFile - */ - protected function defineUseStatement() + + protected function defineUseStatements(): self { - if ($this->getModel()->getExtends() !== '') { + if (!empty($this->getModel()->getExtends())) { $this->getFile()->addUse($this->getModel()->getExtends(), null, true); } + return $this; } - /** - * @param PhpClass $class - * @return AbstractModelFile - */ - protected function defineConstants(PhpClass $class) + + protected function defineConstants(PhpClass $class): self { $constants = new Constant($this->getGenerator()); - $this->getClassConstants($constants); + $this->fillClassConstants($constants); foreach ($constants as $constant) { $annotationBlock = $this->getConstantAnnotationBlock($constant); if (!empty($annotationBlock)) { @@ -265,16 +337,14 @@ protected function defineConstants(PhpClass $class) } $class->addConstantElement($constant); } + return $this; } - /** - * @param PhpClass $class - * @return AbstractModelFile - */ - protected function defineProperties(PhpClass $class) + + protected function defineProperties(PhpClass $class): self { $properties = new Property($this->getGenerator()); - $this->getClassProperties($properties); + $this->fillClassProperties($properties); foreach ($properties as $property) { $annotationBlock = $this->getPropertyAnnotationBlock($property); if (!empty($annotationBlock)) { @@ -282,13 +352,11 @@ protected function defineProperties(PhpClass $class) } $class->addPropertyElement($property); } + return $this; } - /** - * @param PhpClass $class - * @return AbstractModelFile - */ - protected function defineMethods(PhpClass $class) + + protected function defineMethods(PhpClass $class): self { $this->methods = new Method($this->getGenerator()); $this->fillClassMethods(); @@ -299,192 +367,65 @@ protected function defineMethods(PhpClass $class) } $class->addMethodElement($method); } + return $this; } - /** - * @param Constant $constants - */ - abstract protected function getClassConstants(Constant $constants); - /** - * @param PhpConstant $constant - * @return PhpAnnotationBlock|null - */ - abstract protected function getConstantAnnotationBlock(PhpConstant $constant); - /** - * @param Property $properties - */ - abstract protected function getClassProperties(Property $properties); - /** - * @param PhpProperty $property - * @return PhpAnnotationBlock|null - */ - abstract protected function getPropertyAnnotationBlock(PhpProperty $property); - /** - * This method is responsible for filling in the $methods property with appropriate methods for the current model - * @return void - */ - abstract protected function fillClassMethods(); - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock|null - */ - abstract protected function getMethodAnnotationBlock(PhpMethod $method); - /** - * @param StructAttributeModel|null $attribute - * @return StructAttributeModel - */ - protected function getStructAttribute(StructAttributeModel $attribute = null) + + abstract protected function fillClassConstants(Constant $constants): void; + + abstract protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock; + + abstract protected function fillClassProperties(Property $properties): void; + + abstract protected function getPropertyAnnotationBlock(PhpProperty $property): ?PhpAnnotationBlock; + + abstract protected function fillClassMethods(): void; + + abstract protected function getMethodAnnotationBlock(PhpMethod $method): ?PhpAnnotationBlock; + + protected function getStructAttribute(StructAttributeModel $attribute = null): ?StructAttributeModel { $struct = $this->getModel(); - if (empty($attribute) && $struct instanceof StructModel && $struct->getAttributes()->count() === 1) { + if (empty($attribute) && $struct instanceof StructModel && 1 === $struct->getAttributes()->count()) { $attribute = $struct->getAttributes()->offsetGet(0); } + return $attribute; } - /** - * @param StructAttributeModel|null $attribute - * @return StructModel|null - */ - public function getModelFromStructAttribute(StructAttributeModel $attribute = null) - { - return $this->getStructAttribute($attribute)->getTypeStruct(); - } - /** - * @param StructAttributeModel|null $attribute - * @return StructModel|null - */ - public function getRestrictionFromStructAttribute(StructAttributeModel $attribute = null) - { - $model = $this->getModelFromStructAttribute($attribute); - if ($model instanceof StructModel) { - // list are mainly scalar values of basic types (string, int, etc.) or of Restriction values - if ($model->isList()) { - $subModel = $this->getModelByName($model->getList()); - if ($subModel && $subModel->isRestriction()) { - $model = $subModel; - } elseif (!$model->isRestriction()) { - $model = null; - } - } elseif (!$model->isRestriction()) { - $model = null; - } - } - return $model; - } - /** - * @param StructAttributeModel|null $attribute - * @return bool - */ - public function isAttributeAList(StructAttributeModel $attribute = null) - { - return $this->getStructAttribute($attribute)->isList(); - } - /** - * @param StructAttributeModel|null $attribute - * @param bool $namespaced - * @return string - */ - public function getStructAttributeType(StructAttributeModel $attribute = null, $namespaced = false) + + protected function getStructAttributeTypeGetAnnotation(StructAttributeModel $attribute = null, bool $returnArrayType = true, bool $nullableItemType = false): string { $attribute = $this->getStructAttribute($attribute); - $inheritance = $attribute->getInheritance(); - $type = empty($inheritance) ? $attribute->getType() : $inheritance; - if (!empty($type) && ($struct = $this->getGenerator()->getStructByName($type))) { - $inheritance = $struct->getTopInheritance(); - if (!empty($inheritance)) { - $type = str_replace('[]', '', $inheritance); - } else { - $type = $struct->getPackagedName($namespaced); - } + if ($attribute->isXml()) { + return '\\DOMDocument|string|null'; } - $model = $this->getModelFromStructAttribute($attribute); - if ($model instanceof StructModel) { - // issue #84: union is considered as string as it would be difficult to have a method that accepts multiple object types. - // If the property has to be an object of multiple types => new issue... - if ($model->isRestriction() || $model->isUnion()) { - $type = self::TYPE_STRING; - } elseif ($model->isStruct()) { - $type = $model->getPackagedName($namespaced); - } elseif ($model->isArray() && ($inheritanceStruct = $model->getInheritanceStruct()) instanceof StructModel) { - $type = $inheritanceStruct->getPackagedName($namespaced); - } - } - return $type; + return sprintf('%s%s%s', $this->getStructAttributeTypeAsPhpType($attribute, false), $this->useBrackets($attribute, $returnArrayType) ? '[]' : '', !$nullableItemType && ($attribute->isRequired() || $attribute->isArray() || $attribute->isList()) ? '' : '|null'); } - /** - * @param StructAttributeModel|null $attribute - * @param bool $returnArrayType - * @return string - */ - protected function getStructAttributeTypeGetAnnotation(StructAttributeModel $attribute = null, $returnArrayType = true) - { - $attribute = $this->getStructAttribute($attribute); - return sprintf('%s%s%s', $this->getStructAttributeTypeAsPhpType($attribute), $this->useBrackets($attribute, $returnArrayType) ? '[]' : '', $attribute->isRequired() ? '' : '|null'); - } - /** - * @param StructAttributeModel|null $attribute - * @param bool $returnArrayType - * @return string - */ - protected function getStructAttributeTypeSetAnnotation(StructAttributeModel $attribute = null, $returnArrayType = true) - { - $attribute = $this->getStructAttribute($attribute); - return sprintf('%s%s', $this->getStructAttributeTypeAsPhpType($attribute), $this->useBrackets($attribute, $returnArrayType) ? '[]' : ''); - } - /** - * @param StructAttributeModel $attribute - * @param bool $returnArrayType - * @return bool - */ - protected function useBrackets(StructAttributeModel $attribute, $returnArrayType = true) - { - return $returnArrayType && ($attribute->isArray() || $this->isAttributeAList($attribute)); - } - /** - * @param StructAttributeModel|null $attribute - * @param bool $returnArrayType - * @return string - */ - protected function getStructAttributeTypeHint(StructAttributeModel $attribute = null, $returnArrayType = true) - { - $attribute = $this->getStructAttribute($attribute); - return ($returnArrayType && ($attribute->isArray() || $this->isAttributeAList($attribute))) ? self::TYPE_ARRAY : $this->getStructAttributeType($attribute, true); - } - /** - * @param StructAttributeModel|null $attribute - * @return string - */ - public function getStructAttributeTypeAsPhpType(StructAttributeModel $attribute = null) + + protected function getStructAttributeTypeSetAnnotation(StructAttributeModel $attribute, bool $returnArrayType = true, bool $itemType = false): string { - $attribute = $this->getStructAttribute($attribute); - $attributeType = $this->getStructAttributeType($attribute, true); - if (XsdTypes::instance($this->getGenerator()->getOptionXsdTypesPath())->isXsd($attributeType)) { - $attributeType = self::getPhpType($attributeType, $this->getGenerator()->getOptionXsdTypesPath()); + if ($attribute->isXml()) { + return '\\DOMDocument|string|null'; } - return $attributeType; + + if ($attribute->isList()) { + return 'array|string'; + } + + return sprintf('%s%s', $this->getStructAttributeTypeAsPhpType($attribute, $returnArrayType), $this->useBrackets($attribute, !$itemType) ? '[]' : ''); } - /** - * See http://php.net/manual/fr/language.oop5.typehinting.php for these cases - * Also see http://www.w3schools.com/schema/schema_dtypes_numeric.asp - * @param mixed $type - * @param mixed $fallback - * @return mixed - */ - public static function getValidType($type, $xsdTypesPath = null, $fallback = null) + + protected function useBrackets(StructAttributeModel $attribute, bool $returnArrayType = true): bool { - return XsdTypes::instance($xsdTypesPath)->isXsd(str_replace('[]', '', $type)) ? $fallback : $type; + return $returnArrayType && $attribute->isArray(); } - /** - * See http://php.net/manual/fr/language.oop5.typehinting.php for these cases - * Also see http://www.w3schools.com/schema/schema_dtypes_numeric.asp - * @param mixed $type - * @param mixed $fallback - * @return mixed - */ - public static function getPhpType($type, $xsdTypesPath = null, $fallback = self::TYPE_STRING) + + protected function getStructAttributeTypeHint(StructAttributeModel $attribute = null, bool $returnArrayType = true): string { - return XsdTypes::instance($xsdTypesPath)->isXsd(str_replace('[]', '', $type)) ? XsdTypes::instance($xsdTypesPath)->phpType($type) : $fallback; + $attribute = $this->getStructAttribute($attribute); + + return ($returnArrayType && ($attribute->isArray() || $attribute->isList())) ? self::TYPE_ARRAY : $this->getStructAttributeType($attribute, true); } } diff --git a/src/File/AbstractOperation.php b/src/File/AbstractOperation.php index 698bb1ec..7f530875 100644 --- a/src/File/AbstractOperation.php +++ b/src/File/AbstractOperation.php @@ -1,7 +1,10 @@ setMethod($method)->setGenerator($generator); + $this + ->setMethod($method) + ->setGenerator($generator) + ; + } + + public function setGenerator(Generator $generator): self + { + $this->generator = $generator; + + return $this; + } + + public function getGenerator(): Generator + { + return $this->generator; } - /** - * @return StructModel|null - */ - protected function getParameterTypeModel() + + public function setMethod(MethodModel $method): self + { + $this->method = $method; + + return $this; + } + + public function getMethod(): MethodModel + { + return $this->method; + } + + protected function getParameterTypeModel(): ?StructModel { return $this->isParameterTypeAString() ? $this->getGenerator()->getStructByName($this->getMethod()->getParameterType()) : null; } - /** - * @return bool - */ - protected function isParameterTypeEmpty() + + protected function isParameterTypeEmpty(): bool { $parameterType = $this->getMethod()->getParameterType(); + return empty($parameterType); } - /** - * @return bool - */ - protected function isParameterTypeAnArray() + + protected function isParameterTypeAnArray(): bool { return is_array($this->getMethod()->getParameterType()); } - /** - * @param bool $methodUsage - * @return string[] - */ - protected function getParameterTypeArrayTypes($methodUsage = false) + + protected function getParameterTypeArrayTypes(bool $methodUsage = false): array { $types = []; $parameterTypes = $this->getMethod()->getParameterType(); - if (is_array($parameterTypes)) { - foreach ($parameterTypes as $parameterName => $parameterType) { - $type = $methodUsage ? null : self::DEFAULT_TYPE; - if (($model = $this->getGenerator()->getStructByName($parameterType)) instanceof StructModel) { - if ($model->isStruct() && !$model->isRestriction()) { - $type = $model->getPackagedName(true); - } elseif (!$model->isStruct() && $model->isArray()) { - if ($methodUsage) { - $type = self::ARRAY_TYPE; - } else { - $type = ($struct = $model->getTopInheritanceStruct()) ? sprintf('%s[]', $struct->getPackagedName(true)) : $model->getTopInheritance(); - } + if (!is_array($parameterTypes)) { + return []; + } + + foreach ($parameterTypes as $parameterName => $parameterType) { + $type = $methodUsage ? null : AbstractModelFile::TYPE_STRING; + + if (($model = $this->getGenerator()->getStructByName($parameterType)) instanceof StructModel) { + if ($model->isStruct() && !$model->isRestriction()) { + $type = $model->getPackagedName(true); + } elseif (!$model->isStruct() && $model->isArray()) { + if ($methodUsage) { + $type = AbstractModelFile::TYPE_ARRAY; + } else { + $type = ($struct = $model->getTopInheritanceStruct()) ? sprintf('%s[]', $struct->getPackagedName(true)) : $model->getTopInheritance(); } } - $types[$parameterName] = $type; } + $types[$parameterName] = $type; } + return $types; } - /** - * @return bool - */ - protected function isParameterTypeAString() + + protected function isParameterTypeAString(): bool { return is_string($this->getMethod()->getParameterType()); } - /** - * @return bool - */ - protected function isParameterTypeAModel() + + protected function isParameterTypeAModel(): bool { return $this->getParameterTypeModel() instanceof StructModel; } - /** - * @param string $name - * @return string - */ - protected function getParameterName($name) + + protected function getParameterName(string $name): string { return lcfirst(AbstractModel::cleanString($name)); } - /** - * @param string $name - * @param string $type - * @return PhpFunctionParameter - */ - protected function getMethodParameter($name, $type = null) + + protected function getMethodParameter(string $name, ?string $type = null): PhpFunctionParameter { try { return new PhpFunctionParameter($name, PhpFunctionParameter::NO_VALUE, $type); - } catch (\InvalidArgumentException $exception) { - throw new \InvalidArgumentException(sprintf('Unable to create function parameter for method "%s" with type "%s" and name "%s"', $this->getMethod()->getName(), var_export($type, true), $name), __LINE__, $exception); + } catch (InvalidArgumentException $exception) { + throw new InvalidArgumentException(sprintf('Unable to create function parameter for method "%s" with type "%s" and name "%s"', $this->getMethod()->getName(), var_export($type, true), $name), __LINE__, $exception); } } - /** - * @param Generator $generator - * @return AbstractOperation - */ - public function setGenerator(Generator $generator) - { - $this->generator = $generator; - return $this; - } - /** - * @return Generator - */ - public function getGenerator() - { - return $this->generator; - } - /** - * @param MethodModel $method - * @return AbstractOperation - */ - public function setMethod(MethodModel $method) - { - $this->method = $method; - return $this; - } - /** - * @return MethodModel - */ - public function getMethod() - { - return $this->method; - } - /** - * @param string $name - * @return StructModel|null - */ - protected function getModelByName($name) + + protected function getModelByName(string $name): ?StructModel { return $this->getGenerator()->getStructByName($name); } diff --git a/src/File/ClassMap.php b/src/File/ClassMap.php index 5cd70725..9c1165f2 100644 --- a/src/File/ClassMap.php +++ b/src/File/ClassMap.php @@ -1,59 +1,46 @@ addMethodBody($method); $this->methods->add($method); } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock|null - */ - protected function getMethodAnnotationBlock(PhpMethod $method) + + protected function getMethodAnnotationBlock(PhpMethod $method): ?PhpAnnotationBlock { return new PhpAnnotationBlock([ 'Returns the mapping between the WSDL Structs and generated Structs\' classes', @@ -61,50 +48,46 @@ protected function getMethodAnnotationBlock(PhpMethod $method) new PhpAnnotation(AbstractModelFile::ANNOTATION_RETURN, 'string[]'), ]); } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getClassAnnotationBlock() - * @return PhpAnnotationBlock - */ - protected function getClassAnnotationBlock() + + protected function getClassAnnotationBlock(): PhpAnnotationBlock { - return new PhpAnnotationBlock([ + $annotations = [ 'Class which returns the class map definition', - new PhpAnnotation(self::ANNOTATION_PACKAGE, $this->getGenerator()->getOptionPrefix()), - ]); + ]; + + if (!empty($this->getGenerator()->getOptionPrefix())) { + $annotations[] = new PhpAnnotation(self::ANNOTATION_PACKAGE, $this->getGenerator()->getOptionPrefix()); + } + + return new PhpAnnotationBlock($annotations); } - /** - * @param PhpMethod $method - * @return ClassMap - */ - protected function addMethodBody(PhpMethod $method) + + protected function addMethodBody(PhpMethod $method): self { if ($this->getGenerator()->getStructs()->count() > 0) { - $method->addChild('return array('); + $method->addChild('return ['); foreach ($this->getGenerator()->getStructs() as $struct) { $this->addStructToClassMapList($method, $struct); } - $method->addChild(');'); + $method->addChild('];'); } + return $this; } - /** - * @param PhpMethod $method - * @param StructModel $struct - * @return ClassMap - */ - protected function addStructToClassMapList(PhpMethod $method, StructModel $struct) + + protected function addStructToClassMapList(PhpMethod $method, StructModel $struct): self { if ($struct->isStruct() && !$struct->isRestriction()) { $method->addChild($method->getIndentedString(sprintf('\'%s\' => \'%s\',', $struct->getName(), $this->getStructName($struct)), 1)); } + return $this; } + /** - * work around for https://bugs.php.net/bug.php?id=69280 - * @param StructModel $struct - * @return string + * Work around for https://bugs.php.net/bug.php?id=69280. */ - protected function getStructName(StructModel $struct) + protected function getStructName(StructModel $struct): string { return str_replace('\\', '\\\\', $struct->getPackagedName(true)); } diff --git a/src/File/Composer.php b/src/File/Composer.php index 32f59e6f..ea740b90 100644 --- a/src/File/Composer.php +++ b/src/File/Composer.php @@ -1,24 +1,40 @@ runComposerUpdate = $runComposerUpdate; + + return $this; + } + + public function getRunComposerUpdate(): bool + { + return $this->runComposerUpdate; + } + + public function getFileExtension(): string + { + return self::JSON_FILE_EXTENSION; + } + + protected function writeFile(): void { $composer = new Application(); $composer->setAutoExit(false); @@ -29,16 +45,19 @@ protected function writeFile() '--name' => $this->getGenerator()->getOptionComposerName(), '--description' => sprintf('Package generated from %s using wsdltophp/packagegenerator', $this->getGenerator()->getWsdl()->getName()), '--require' => [ - 'php:>=5.3.3', - 'ext-soap:*', + 'php:>=7.4', + 'ext-dom:*', 'ext-mbstring:*', - 'wsdltophp/packagebase:~2.0', + 'ext-soap:*', + 'wsdltophp/packagebase:~5.0', ], '--working-dir' => $this->getGenerator()->getOptionDestination(), ])); + $this->completeComposerJson(); - if ($this->getRunComposerUpdate() === true) { - return $composer->run(new ArrayInput([ + + if ($this->getRunComposerUpdate()) { + $composer->run(new ArrayInput([ 'command' => 'update', '--verbose' => true, '--optimize-autoloader' => true, @@ -47,111 +66,83 @@ protected function writeFile() ])); } } - /** - * @return Composer - */ - protected function completeComposerJson() + + protected function completeComposerJson(): Composer { $content = $this->getComposerFileContent(); if (is_array($content) && !empty($content)) { - $this->addAutoloadToComposerJson($content)->addComposerSettings($content); + $this + ->addAutoloadToComposerJson($content) + ->addComposerSettings($content) + ; } + return $this->setComposerFileContent($content); } - /** - * @return Composer - */ - protected function addAutoloadToComposerJson(array &$content) + + protected function addAutoloadToComposerJson(array &$content): Composer { $content['autoload'] = [ 'psr-4' => $this->getPsr4Autoload(), ]; + return $this; } - /** - * @return Composer - */ - protected function addComposerSettings(array &$content) + + protected function addComposerSettings(array &$content): Composer { $content = array_merge_recursive($content, $this->getGenerator()->getOptionComposerSettings()); + return $this; } - /** - * @return array - */ - protected function getPsr4Autoload() + + protected function getPsr4Autoload(): array { $namespace = new EmptyModel($this->getGenerator(), ''); - if ($namespace->getNamespace() !== '') { + if (!empty($namespace->getNamespace())) { $namespaceKey = sprintf('%s\\', $namespace->getNamespace()); } else { $namespaceKey = ''; } $src = rtrim($this->generator->getOptionSrcDirname(), DIRECTORY_SEPARATOR); + return [ - $namespaceKey => sprintf('./%s', empty($src) ? '' : $src . DIRECTORY_SEPARATOR), + $namespaceKey => sprintf( + './%s%s', + empty($src) ? '' : $src.DIRECTORY_SEPARATOR, + str_replace('\\', DIRECTORY_SEPARATOR, $namespace->getNamespace()) + ), ]; } - /** - * @return array - */ - protected function getComposerFileContent() + + protected function getComposerFileContent(): array { $content = []; $composerFilePath = $this->getComposerFilePath(); if (!empty($composerFilePath)) { $content = json_decode(file_get_contents($composerFilePath), true); } + return $content; } - /** - * @param array $content - * @return Composer - */ - protected function setComposerFileContent(array $content) + + protected function setComposerFileContent(array $content): Composer { $composerFilePath = $this->getComposerFilePath(); if (!empty($composerFilePath)) { file_put_contents($composerFilePath, self::encodeToJson($content)); } + return $this; } - /** - * @param array $content - * @return string - */ - protected static function encodeToJson($content) + + protected static function encodeToJson(array $content): string { return json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } - /** - * @return string - */ - protected function getComposerFilePath() + + protected function getComposerFilePath(): string { return realpath(sprintf('%s/composer.json', $this->getGenerator()->getOptionDestination())); } - /** - * @param bool $runComposerUpdate - * @return Composer - */ - public function setRunComposerUpdate($runComposerUpdate) - { - $this->runComposerUpdate = $runComposerUpdate; - return $this; - } - /** - * @return bool - */ - public function getRunComposerUpdate() - { - return $this->runComposerUpdate; - } - /** - * @return string - */ - public function getFileExtension() - { - return self::JSON_FILE_EXTENSION; - } } diff --git a/src/File/Element/PhpFunctionParameter.php b/src/File/Element/PhpFunctionParameter.php index 65e498a2..55ae18c6 100644 --- a/src/File/Element/PhpFunctionParameter.php +++ b/src/File/Element/PhpFunctionParameter.php @@ -1,47 +1,30 @@ model = $model; } - /** - * @param AbstractModel $model - * @return PhpFunctionParameter - */ - public function setModel(AbstractModel $model) + public function setModel(AbstractModel $model): self { $this->model = $model; + return $this; } - /** - * @return null|StructModel|StructAttributeModel - */ - public function getModel() + public function getModel(): ?AbstractModel { return $this->model; } diff --git a/src/File/FileInterface.php b/src/File/FileInterface.php index adaa1d65..1ef7f9b2 100644 --- a/src/File/FileInterface.php +++ b/src/File/FileInterface.php @@ -1,20 +1,18 @@ getMethod()->getMethodName()); - $this->defineParameters($phpMethod)->defineBody($phpMethod); + $phpMethod = new PhpMethod($this->getMethod()->getMethodName(), []); + $this + ->defineParameters($phpMethod) + ->defineBody($phpMethod) + ; + return $phpMethod; } - /** - * @param PhpMethod $method - * @return Operation - */ - protected function defineParameters(PhpMethod $method) + + protected function defineParameters(PhpMethod $method): self { return $this->defineParametersFromArray($method)->defineParametersFromModel($method)->defineParametersFromString($method); } - /** - * @param PhpMethod $method - * @return Operation - */ - protected function defineParametersFromArray(PhpMethod $method) + + protected function defineParametersFromArray(PhpMethod $method): self { if ($this->isParameterTypeAnArray()) { $parameters = []; @@ -37,13 +34,11 @@ protected function defineParametersFromArray(PhpMethod $method) } $method->setParameters($parameters); } + return $this; } - /** - * @param PhpMethod $method - * @return Operation - */ - protected function defineParametersFromModel(PhpMethod $method) + + protected function defineParametersFromModel(PhpMethod $method): self { if ($this->isParameterTypeAModel()) { if ($this->getParameterTypeModel()->getAttributes(true, true)->count() > 0) { @@ -52,80 +47,73 @@ protected function defineParametersFromModel(PhpMethod $method) ]); } } + return $this; } - /** - * @param PhpMethod $method - * @return Operation - */ - protected function defineParametersFromString(PhpMethod $method) + + protected function defineParametersFromString(PhpMethod $method): self { if ($this->isParameterTypeAString() && !$this->isParameterTypeAModel()) { $method->setParameters([ $this->getMethodParameter($this->getParameterName($this->getMethod()->getParameterType())), ]); } + return $this; } - /** - * @param PhpMethod $method - * @return Operation - */ - protected function defineBody(PhpMethod $method) + + protected function defineBody(PhpMethod $method): self { - $method->addChild('try {') - ->addChild($method->getIndentedString(sprintf('$this->setResult($this->getSoapClient()->%s%s));', $this->getSoapCallName(), $this->getOperationCallParameters($method)), 1)) - ->addChild($method->getIndentedString('return $this->getResult();', 1)) - ->addChild('} catch (\SoapFault $soapFault) {') + $resultVariableName = sprintf('$result%s', ucfirst($this->getMethod()->getCleanName(false))); + $method + ->addChild('try {') + ->addChild($method->getIndentedString(sprintf('$this->setResult(%s = $this->getSoapClient()->%s%s));', $resultVariableName, $this->getSoapCallName(), $this->getOperationCallParameters($method)), 1)) + ->addChild('') + ->addChild($method->getIndentedString(sprintf('return %s;', $resultVariableName), 1)) + ->addChild('} catch (SoapFault $soapFault) {') ->addChild($method->getIndentedString('$this->saveLastError(__METHOD__, $soapFault);', 1)) + ->addChild('') ->addChild($method->getIndentedString('return false;', 1)) - ->addChild('}'); + ->addChild('}') + ; + return $this; } - /** - * @return string - */ - protected function getSoapCallName() + + protected function getSoapCallName(): string { return sprintf('%s(\'%s\'%s', self::SOAP_CALL_NAME, $this->getMethod()->getName(), $this->getOperationCallParametersStarting()); } - /** - * @param PhpMethod $method - * @return string - */ - protected function getOperationCallParameters(PhpMethod $method) + + protected function getOperationCallParameters(PhpMethod $method): string { $parameters = []; foreach ($method->getParameters() as $parameter) { - if ($parameter instanceof PhpFunctionParameter) { - $parameters[] = $this->getOperationCallParameterName($parameter, $method); + if (!$parameter instanceof PhpFunctionParameter) { + continue; } + + $parameters[] = $this->getOperationCallParameterName($parameter, $method); } - return sprintf('%s%s, array(), array(), $this->outputHeaders', implode('', $parameters), $this->isParameterTypeEmpty() ? '' : PhpMethod::BREAK_LINE_CHAR . ')'); + + return sprintf('%s%s, [], [], $this->outputHeaders', implode('', $parameters), $this->isParameterTypeEmpty() ? '' : PhpMethod::BREAK_LINE_CHAR.']'); } - /** - * @return string - */ - protected function getOperationCallParametersStarting() + + protected function getOperationCallParametersStarting(): string { - return $this->isParameterTypeAnArray() ? ', array(' : ($this->isParameterTypeEmpty() ? ', array()' : ', array('); + return $this->isParameterTypeAnArray() ? ', [' : ($this->isParameterTypeEmpty() ? ', []' : ', ['); } - /** - * @return string - */ - protected function getOperationCallParametersEnding() + + protected function getOperationCallParametersEnding(): string { - return sprintf('%s)', PhpMethod::BREAK_LINE_CHAR); + return sprintf('%s]', PhpMethod::BREAK_LINE_CHAR); } - /** - * @param PhpFunctionParameter $parameter - * @param PhpMethod $method - * @return string - */ - protected function getOperationCallParameterName(PhpFunctionParameter $parameter, PhpMethod $method) + + protected function getOperationCallParameterName(PhpFunctionParameter $parameter, PhpMethod $method): string { $cloneParameter = clone $parameter; $cloneParameter->setType(null); + return sprintf('%s%s', PhpMethod::BREAK_LINE_CHAR, $method->getIndentedString(sprintf('%s,', $cloneParameter->getPhpDeclaration()), 1)); } } diff --git a/src/File/OperationAnnotationBlock.php b/src/File/OperationAnnotationBlock.php index 26b673a5..e20370da 100644 --- a/src/File/OperationAnnotationBlock.php +++ b/src/File/OperationAnnotationBlock.php @@ -1,57 +1,55 @@ addOperationMethodDeclaration($annotationBlock) + $this + ->addOperationMethodDeclaration($annotationBlock) ->addOperationMethodMetaInformation($annotationBlock) ->addOperationMethodUses($annotationBlock) ->addOperationMethodParam($annotationBlock) - ->addOperationMethodReturn($annotationBlock); + ->addOperationMethodReturn($annotationBlock) + ; + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodDeclaration(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodDeclaration(PhpAnnotationBlock $annotationBlock): self { $annotationBlock->addChild(sprintf('Method to call the operation originally named %s', $this->getMethod()->getName())); if (!$this->getMethod()->isUnique()) { $annotationBlock->addChild('This method has been renamed because it is defined several times but with different signature'); } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodMetaInformation(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodMetaInformation(PhpAnnotationBlock $annotationBlock): self { $soapHeaderNames = $this->getMethod()->getMetaValue(TagHeader::META_SOAP_HEADER_NAMES, []); $soapHeaderTypes = $this->getMethod()->getMetaValue(TagHeader::META_SOAP_HEADER_TYPES, []); $soapHeaderNamespaces = $this->getMethod()->getMetaValue(TagHeader::META_SOAP_HEADER_NAMESPACES, []); $soapHeaders = $this->getMethod()->getMetaValue(TagHeader::META_SOAP_HEADERS, []); if (!empty($soapHeaderNames) && !empty($soapHeaderTypes) && !empty($soapHeaderNamespaces)) { - $annotationBlock->addChild('Meta information extracted from the WSDL') + $annotationBlock + ->addChild('Meta information extracted from the WSDL') ->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('- SOAPHeaderNames: %s', implode(', ', $soapHeaderNames)), AbstractModelFile::ANNOTATION_LONG_LENGTH)) ->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('- SOAPHeaderNamespaces: %s', implode(', ', $soapHeaderNamespaces)), AbstractModelFile::ANNOTATION_LONG_LENGTH)) ->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('- SOAPHeaderTypes: %s', implode(', ', $this->getSoapHeaderTypesTypes($soapHeaderTypes))), AbstractModelFile::ANNOTATION_LONG_LENGTH)) - ->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('- SOAPHeaders: %s', implode(', ', $soapHeaders)), AbstractModelFile::ANNOTATION_LONG_LENGTH)); + ->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('- SOAPHeaders: %s', implode(', ', $soapHeaders)), AbstractModelFile::ANNOTATION_LONG_LENGTH)) + ; } FileUtils::defineModelAnnotationsFromWsdl($annotationBlock, $this->getMethod(), [ TagHeader::META_SOAP_HEADER_NAMES, @@ -59,113 +57,91 @@ protected function addOperationMethodMetaInformation(PhpAnnotationBlock $annotat TagHeader::META_SOAP_HEADER_TYPES, TagHeader::META_SOAP_HEADERS, ]); + return $this; } - /** - * @param array $soapHeaderTypes - * @return string[] - */ - protected function getSoapHeaderTypesTypes(array $soapHeaderTypes) + + protected function getSoapHeaderTypesTypes(array $soapHeaderTypes): array { $soapHeaderTypesTypes = []; foreach ($soapHeaderTypes as $soapHeaderType) { $soapHeaderTypesTypes[] = $this->getSoapHeaderTypeType($soapHeaderType, true); } + return $soapHeaderTypesTypes; } - /** - * @param string $soapHeaderType - * @param bool $namespaced - * @return string - */ - protected function getSoapHeaderTypeType($soapHeaderType, $namespaced = false) + + protected function getSoapHeaderTypeType(string $soapHeaderType, bool $namespaced = false): string { $type = $soapHeaderType; $model = $this->getModelByName($soapHeaderType); if ($model instanceof AbstractModel) { $type = $model->getPackagedName($namespaced); } + return $type; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodUses(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodUses(PhpAnnotationBlock $annotationBlock): self { - $annotationBlock->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_USES, sprintf('%s::getSoapClient()', $this->getMethod()->getOwner()->getExtends(true)))) + $annotationBlock + ->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_USES, sprintf('%s::getSoapClient()', $this->getMethod()->getOwner()->getExtends(true)))) ->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_USES, sprintf('%s::setResult()', $this->getMethod()->getOwner()->getExtends(true)))) - ->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_USES, sprintf('%s::getResult()', $this->getMethod()->getOwner()->getExtends(true)))) - ->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_USES, sprintf('%s::saveLastError()', $this->getMethod()->getOwner()->getExtends(true)))); + ->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_USES, sprintf('%s::saveLastError()', $this->getMethod()->getOwner()->getExtends(true)))) + ; + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodParam(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodParam(PhpAnnotationBlock $annotationBlock): self { $this->addOperationMethodParamFromArray($annotationBlock)->addOperationMethodParamFromModel($annotationBlock)->addOperationMethodParamFromString($annotationBlock); + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodParamFromArray(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodParamFromArray(PhpAnnotationBlock $annotationBlock): self { if ($this->isParameterTypeAnArray()) { foreach ($this->getParameterTypeArrayTypes() as $parameterName => $parameterType) { $annotationBlock->addChild($this->getOperationMethodParam($parameterType, $this->getParameterName($parameterName))); } } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodParamFromModel(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodParamFromModel(PhpAnnotationBlock $annotationBlock): self { if ($this->isParameterTypeAModel()) { $annotationBlock->addChild($this->getOperationMethodParam($this->getParameterTypeModel()->getPackagedName(true), $this->getParameterName($this->getParameterTypeModel()->getPackagedName()))); } + return $this; } - /** - * @param string $type - * @param string $name - * @return PhpAnnotation - */ - protected function getOperationMethodParam($type, $name) + + protected function getOperationMethodParam(string $type, string $name): PhpAnnotation { return new PhpAnnotation(AbstractModelFile::ANNOTATION_PARAM, sprintf('%s $%s', $type, $name)); } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodParamFromString(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodParamFromString(PhpAnnotationBlock $annotationBlock): self { if ($this->isParameterTypeAString() && !$this->isParameterTypeAModel()) { $annotationBlock->addChild($this->getOperationMethodParam($this->getMethod()->getParameterType(), lcfirst($this->getMethod()->getParameterType()))); } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return OperationAnnotationBlock - */ - protected function addOperationMethodReturn(PhpAnnotationBlock $annotationBlock) + + protected function addOperationMethodReturn(PhpAnnotationBlock $annotationBlock): self { $annotationBlock->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_RETURN, sprintf('%s|bool', $this->getOperationMethodReturnType($this->getMethod())))); + return $this; } - /** - * @param MethodModel $method - * @return string - */ - protected function getOperationMethodReturnType(MethodModel $method) + + protected function getOperationMethodReturnType(MethodModel $method): string { return Service::getOperationMethodReturnType($method, $this->getGenerator()); } diff --git a/src/File/Service.php b/src/File/Service.php index bab366ca..edcc134d 100644 --- a/src/File/Service.php +++ b/src/File/Service.php @@ -1,112 +1,125 @@ getReturnType(); + + if (is_null($returnType)) { + return 'null'; + } + + if ((($struct = $generator->getStructByName($returnType)) instanceof StructModel) && !$struct->isRestriction()) { + if ($struct->isStruct()) { + $returnType = $struct->getPackagedName(true); + } elseif ($struct->isArray()) { + if (($structInheritance = $struct->getInheritanceStruct()) instanceof StructModel) { + $returnType = sprintf('%s[]', $structInheritance->getPackagedName(true)); + } else { + $returnType = $struct->getInheritance(); + } + } + } + + return $returnType; } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getConstantAnnotationBlock() - */ - protected function getConstantAnnotationBlock(PhpConstant $constant) + + public function setModel(AbstractModel $model): self { + if (!$model instanceof ServiceModel) { + throw new InvalidArgumentException('Model must be an instance of a Service', __LINE__); + } + + return parent::setModel($model); } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getClassProperties() - */ - protected function getClassProperties(PropertyContainer $properties) + + protected function fillClassConstants(ConstantContainer $constants): void { } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getPropertyAnnotationBlock() - */ - protected function getPropertyAnnotationBlock(PhpProperty $property) + + protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock { } - /** - * @return string - */ - protected function getClassDeclarationLineText() + + protected function fillClassProperties(PropertyContainer $properties): void { - return $this->getGenerator()->getOptionGatherMethods() === GeneratorOptions::VALUE_NONE ? 'This class stands for all operations' : parent::getClassDeclarationLineText(); } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::fillClassMethods() - */ - protected function fillClassMethods() + + protected function getPropertyAnnotationBlock(PhpProperty $property): ?PhpAnnotationBlock + { + } + + protected function defineUseStatements(): AbstractModelFile + { + $this->getFile()->addUse(SoapFault::class); + + return parent::defineUseStatements(); + } + + protected function getClassDeclarationLineText(): string + { + return GeneratorOptions::VALUE_NONE === $this->getGenerator()->getOptionGatherMethods() ? 'This class stands for all operations' : parent::getClassDeclarationLineText(); + } + + protected function fillClassMethods(): void { $this ->addSoapHeaderMethods() ->addOperationsMethods() - ->addGetResultMethod(); + ->addGetResultMethod() + ; } - /** - * @return Service - */ - protected function addSoapHeaderMethods() + + protected function addSoapHeaderMethods(): self { foreach ($this->getModel()->getMethods() as $method) { $this->addSoapHeaderFromMethod($method); } + return $this; } - /** - * @param MethodModel $method - * @return Service - */ - protected function addSoapHeaderFromMethod(MethodModel $method) + + protected function addSoapHeaderFromMethod(MethodModel $method): self { $soapHeaderNames = $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMES, []); $soapHeaderNamespaces = $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMESPACES, []); @@ -114,31 +127,27 @@ protected function addSoapHeaderFromMethod(MethodModel $method) if (is_array($soapHeaderNames) && is_array($soapHeaderNamespaces) && is_array($soapHeaderTypes)) { foreach ($soapHeaderNames as $index => $soapHeaderName) { $methodName = $this->getSoapHeaderMethodName($soapHeaderName); - if ($this->methods->get($methodName) === null) { + if (is_null($this->methods->get($methodName))) { $soapHeaderNamespace = array_key_exists($index, $soapHeaderNamespaces) ? $soapHeaderNamespaces[$index] : null; $soapHeaderType = array_key_exists($index, $soapHeaderTypes) ? $soapHeaderTypes[$index] : null; $this->methods->add($this->getSoapHeaderMethod($methodName, $soapHeaderName, $soapHeaderNamespace, $soapHeaderType)); } } } + return $this; } - /** - * @param string $methodName - * @param string $soapHeaderName - * @param string $soapHeaderNamespace - * @param string $soapHeaderType - * @return PhpMethod - */ - protected function getSoapHeaderMethod($methodName, $soapHeaderName, $soapHeaderNamespace, $soapHeaderType) + + protected function getSoapHeaderMethod(string $methodName, string $soapHeaderName, string $soapHeaderNamespace, string $soapHeaderType): PhpMethod { try { $method = new PhpMethod($methodName, [ $firstParameter = new PhpFunctionParameter(lcfirst($soapHeaderName), PhpFunctionParameterBase::NO_VALUE, $this->getTypeFromName($soapHeaderType)), - new PhpFunctionParameterBase(self::PARAM_SET_HEADER_NAMESPACE, $soapHeaderNamespace), - new PhpFunctionParameterBase(self::PARAM_SET_HEADER_MUSTUNDERSTAND, false), - new PhpFunctionParameterBase(self::PARAM_SET_HEADER_ACTOR, null), - ]); + new PhpFunctionParameterBase(self::PARAM_SET_HEADER_NAMESPACE, $soapHeaderNamespace, self::TYPE_STRING), + new PhpFunctionParameterBase(self::PARAM_SET_HEADER_MUSTUNDERSTAND, false, self::TYPE_BOOL), + new PhpFunctionParameterBase(self::PARAM_SET_HEADER_ACTOR, null, '?'.self::TYPE_STRING), + ], self::TYPE_SELF); + $model = $this->getModelByName($soapHeaderType); if ($model instanceof StructModel) { $rules = new Rules($this, $method, new StructAttributeModel($model->getGenerator(), $soapHeaderType, $model->getName(), $model), $this->methods); @@ -146,80 +155,70 @@ protected function getSoapHeaderMethod($methodName, $soapHeaderName, $soapHeader $firstParameter->setModel($model); } $method->addChild(sprintf('return $this->%s($%s, \'%s\', $%s, $%s, $%s);', self::METHOD_SET_HEADER_PREFIX, self::PARAM_SET_HEADER_NAMESPACE, $soapHeaderName, lcfirst($soapHeaderName), self::PARAM_SET_HEADER_MUSTUNDERSTAND, self::PARAM_SET_HEADER_ACTOR)); - } catch (\InvalidArgumentException $exception) { - throw new \InvalidArgumentException(sprintf('Unable to create function parameter for service "%s" with type "%s"', $this->getModel()->getName(), var_export($this->getTypeFromName($soapHeaderName), true)), __LINE__, $exception); + } catch (InvalidArgumentException $exception) { + throw new InvalidArgumentException(sprintf('Unable to create function parameter for service "%s" with type "%s"', $this->getModel()->getName(), var_export($this->getTypeFromName($soapHeaderName), true)), __LINE__, $exception); } + return $method; } - /** - * @param string $name - * @return string - */ - protected function getTypeFromName($name) + + protected function getTypeFromName(string $name): ?string { - return self::getValidType($this->getStructAttributeTypeAsPhpType(new StructAttributeModel($this->generator, 'any', $name)), $this->getGenerator()->getOptionXsdTypesPath()); + return self::getPhpType( + $this->getStructAttributeTypeAsPhpType(new StructAttributeModel($this->generator, 'any', $name)), + $this->getGenerator()->getOptionXsdTypesPath(), + $this->getStructAttributeTypeAsPhpType(new StructAttributeModel($this->generator, 'any', $name)) + ); } - /** - * @param string $soapHeaderName - * @return string - */ - protected function getSoapHeaderMethodName($soapHeaderName) + + protected function getSoapHeaderMethodName(string $soapHeaderName): string { return sprintf('%s%s', self::METHOD_SET_HEADER_PREFIX, ucfirst($soapHeaderName)); } - /** - * @return Service - */ - protected function addOperationsMethods() + + protected function addOperationsMethods(): self { foreach ($this->getModel()->getMethods() as $method) { $this->addMainMethod($method); } + return $this; } - /** - * @return Service - */ - protected function addGetResultMethod() + + protected function addGetResultMethod(): self { $method = new PhpMethod(self::METHOD_GET_RESULT); $method->addChild('return parent::getResult();'); $this->methods->add($method); + return $this; } - /** - * @param MethodModel $method - * @return Service - */ - protected function addMainMethod(MethodModel $method) + + protected function addMainMethod(MethodModel $method): self { $methodFile = new Operation($method, $this->getGenerator()); $mainMethod = $methodFile->getMainMethod(); $this->methods->add($mainMethod); $this->setModelFromMethod($mainMethod, $method); + return $this; } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getMethodAnnotationBlock() - */ - protected function getMethodAnnotationBlock(PhpMethod $method) + + protected function getMethodAnnotationBlock(PhpMethod $method): PhpAnnotationBlock { $annotationBlock = new PhpAnnotationBlock(); - if (mb_stripos($method->getName(), self::METHOD_SET_HEADER_PREFIX) === 0) { + if (0 === mb_stripos($method->getName(), self::METHOD_SET_HEADER_PREFIX)) { $this->addAnnotationBlockForSoapHeaderMethod($annotationBlock, $method); - } elseif ($method->getName() === self::METHOD_GET_RESULT) { + } elseif (self::METHOD_GET_RESULT === $method->getName()) { $this->addAnnotationBlockForgetResultMethod($annotationBlock); } else { $this->addAnnotationBlockForOperationMethod($annotationBlock, $method); } + return $annotationBlock; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @param PhpMethod $method - * @return Service - */ - protected function addAnnotationBlockForSoapHeaderMethod(PhpAnnotationBlock $annotationBlock, PhpMethod $method) + + protected function addAnnotationBlockForSoapHeaderMethod(PhpAnnotationBlock $annotationBlock, PhpMethod $method): self { $methodParameters = $method->getParameters(); $firstParameter = array_shift($methodParameters); @@ -232,121 +231,68 @@ protected function addAnnotationBlockForSoapHeaderMethod(PhpAnnotationBlock $ann $annotationBlock ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $firstParameter->getModel()->getPackagedName(true), StructEnum::METHOD_VALUE_IS_VALID))) ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $firstParameter->getModel()->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES))) - ->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, '\InvalidArgumentException')); + ->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, InvalidArgumentException::class)) + ; } } $annotationBlock - ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::setSoapHeader()', $this->getModel()->getExtends(true)))) + ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $this->getModel()->getExtends(true), self::METHOD_SET_HEADER_PREFIX))) ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', $firstParameterType, $firstParameter->getName()))) - ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('string $%s', self::PARAM_SET_HEADER_NAMESPACE))) - ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('bool $%s', self::PARAM_SET_HEADER_MUSTUNDERSTAND))) - ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('string $%s', self::PARAM_SET_HEADER_ACTOR))) - ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, 'bool')); + ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', self::TYPE_STRING, self::PARAM_SET_HEADER_NAMESPACE))) + ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', self::TYPE_BOOL, self::PARAM_SET_HEADER_MUSTUNDERSTAND))) + ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', self::TYPE_STRING, self::PARAM_SET_HEADER_ACTOR))) + ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getModel()->getPackagedName(true))) + ; } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @param PhpMethod $method - * @return Service - */ - protected function addAnnotationBlockForOperationMethod(PhpAnnotationBlock $annotationBlock, PhpMethod $method) + + protected function addAnnotationBlockForOperationMethod(PhpAnnotationBlock $annotationBlock, PhpMethod $method): self { if (($model = $this->getModelFromMethod($method)) instanceof MethodModel) { $operationAnnotationBlock = new OperationAnnotationBlock($model, $this->getGenerator()); $operationAnnotationBlock->addAnnotationBlockForOperationMethod($annotationBlock); } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return Service - */ - protected function addAnnotationBlockForgetResultMethod(PhpAnnotationBlock $annotationBlock) + + protected function addAnnotationBlockForgetResultMethod(PhpAnnotationBlock $annotationBlock): self { $annotationBlock ->addChild('Returns the result')->addChild(new PhpAnnotation(self::ANNOTATION_SEE, sprintf('%s::getResult()', $this->getModel()->getExtends(true)))) - ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getServiceReturnTypes())); + ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getServiceReturnTypes())) + ; + return $this; } - /** - * @return string - */ - protected function getServiceReturnTypes() + + protected function getServiceReturnTypes(): string { $returnTypes = []; foreach ($this->getModel()->getMethods() as $method) { $returnTypes[] = self::getOperationMethodReturnType($method, $this->getGenerator()); } natcasesort($returnTypes); + return implode('|', array_unique($returnTypes)); } - /** - * @param MethodModel $method - * @return string - */ - public static function getOperationMethodReturnType(MethodModel $method, Generator $generator) - { - $returnType = $method->getReturnType(); - - if (is_null($returnType)) { - return 'null'; - } - if ((($struct = $generator->getStructByName($returnType)) instanceof StructModel) && !$struct->isRestriction()) { - if ($struct->isStruct()) { - $returnType = $struct->getPackagedName(true); - } elseif ($struct->isArray()) { - if (($structInheritance = $struct->getInheritanceStruct()) instanceof StructModel) { - $returnType = sprintf('%s[]', $structInheritance->getPackagedName(true)); - } else { - $returnType = $struct->getInheritance(); - } - } - } - return $returnType; - } - /** - * @param PhpMethod $method - * @return MethodModel|null - */ - protected function getModelFromMethod(PhpMethod $method) + protected function getModelFromMethod(PhpMethod $method): ?MethodModel { $model = $this->getGenerator()->getServiceMethod($method->getName()); if (!$model instanceof MethodModel) { $model = array_key_exists($method->getName(), $this->methodNames) ? $this->methodNames[$method->getName()] : null; } + return $model; } - /** - * @param PhpMethod $phpMethod - * @param MethodModel $methodModel - * @return Service - */ - protected function setModelFromMethod(PhpMethod $phpMethod, MethodModel $methodModel) + + protected function setModelFromMethod(PhpMethod $phpMethod, MethodModel $methodModel): self { $this->methodNames[$phpMethod->getName()] = $methodModel; + return $this; } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getModel() - * @return ServiceModel - */ - public function getModel() - { - return parent::getModel(); - } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel() - * @throws \InvalidArgumentException - * @param AbstractModel $model - * @return Service - */ - public function setModel(AbstractModel $model) - { - if (!$model instanceof ServiceModel) { - throw new \InvalidArgumentException('Model must be an instance of a Service', __LINE__); - } - return parent::setModel($model); - } } diff --git a/src/File/Struct.php b/src/File/Struct.php index 026ccab4..f03c4186 100644 --- a/src/File/Struct.php +++ b/src/File/Struct.php @@ -1,55 +1,85 @@ getGenerator()->getOptionValidation()) { + $this->getFile()->addUse(InvalidArgumentException::class, null, false); + } + + return parent::defineUseStatements(); + } + + protected function fillClassConstants(ConstantContainer $constants): void { } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getConstantAnnotationBlock() - */ - protected function getConstantAnnotationBlock(PhpConstant $constant) + + protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock { } - /** - * @return StructAttributeContainer - */ - protected function getModelAttributes() + + protected function getModelAttributes(): StructAttributeContainer { return $this->getModel()->getProperAttributes(true); } - /** - * @param PropertyContainer $properties - */ - protected function getClassProperties(PropertyContainer $properties) + + protected function fillClassProperties(PropertyContainer $properties): void { + /** @var StructAttributeModel $attribute */ foreach ($this->getModelAttributes() as $attribute) { - $properties->add(new PhpProperty($attribute->getCleanName(), PhpProperty::NO_VALUE)); + switch (true) { + case $attribute->isXml(): + $type = null; + + break; + + default: + $type = ($attribute->isRequired() || $attribute->isArray() ? '' : '?').$this->getStructAttributeTypeAsPhpType($attribute); + + break; + } + + $properties->add( + new PhpProperty( + $attribute->getCleanName(), + $attribute->isArray() ? [] : ($attribute->isRequired() ? PhpProperty::NO_VALUE : null), + $this->getGenerator()->getOptionValidation() ? PhpProperty::ACCESS_PROTECTED : PhpProperty::ACCESS_PUBLIC, + $type + ) + ); } } - /** - * @return PhpAnnotationBlock $property - */ - protected function getPropertyAnnotationBlock(PhpProperty $property) + + protected function getPropertyAnnotationBlock(PhpProperty $property): ?PhpAnnotationBlock { $annotationBlock = new PhpAnnotationBlock(); $annotationBlock->addChild(sprintf('The %s', $property->getName())); @@ -59,126 +89,121 @@ protected function getPropertyAnnotationBlock(PhpProperty $property) } if ($attribute instanceof StructAttributeModel) { $this->defineModelAnnotationsFromWsdl($annotationBlock, $attribute); - $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_VAR, $this->getStructAttributeTypeSetAnnotation($attribute, true))); + $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_VAR, $this->getStructAttributeTypeGetAnnotation($attribute))); } + return $annotationBlock; } - protected function fillClassMethods() + + protected function fillClassMethods(): void { $this ->addStructMethodConstruct() - ->addStructMethodsSetAndGet(); + ->addStructMethodsSetAndGet() + ; } - /** - * @return Struct - */ - protected function addStructMethodConstruct() + + protected function addStructMethodConstruct(): self { if (0 < count($parameters = $this->getStructMethodParametersValues())) { $method = new PhpMethod(self::METHOD_CONSTRUCT, $parameters); $this->addStructMethodConstructBody($method); $this->methods->add($method); } + return $this; } - /** - * @param PhpMethod $method - * @return Struct - */ - protected function addStructMethodConstructBody(PhpMethod $method) + + protected function addStructMethodConstructBody(PhpMethod $method): self { $count = $this->getModelAttributes()->count(); foreach ($this->getModelAttributes() as $index => $attribute) { - if ($index === 0) { + if (0 === $index) { $method->addChild('$this'); } $this->addStructMethodConstructBodyForAttribute($method, $attribute, $count - 1 === $index); } + return $this; } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @param bool $isLast - * @return Struct - */ - protected function addStructMethodConstructBodyForAttribute(PhpMethod $method, StructAttributeModel $attribute, $isLast) + + protected function addStructMethodConstructBodyForAttribute(PhpMethod $method, StructAttributeModel $attribute, bool $isLast): self { $uniqueString = $attribute->getUniqueString($attribute->getCleanName(), 'method'); $method->addChild($method->getIndentedString(sprintf('->%s($%s)%s', $attribute->getSetterName(), lcfirst($uniqueString), $isLast ? ';' : ''), 1)); + return $this; } - /** - * @return PhpFunctionParameter[] - */ - protected function getStructMethodParametersValues() + + protected function getStructMethodParametersValues(): array { $parametersValues = []; foreach ($this->getModelAttributes() as $attribute) { $parametersValues[] = $this->getStructMethodParameter($attribute); } + return $parametersValues; } - /** - * @param StructAttributeModel $attribute - * @return PhpFunctionParameter - */ - protected function getStructMethodParameter(StructAttributeModel $attribute) + + protected function getStructMethodParameter(StructAttributeModel $attribute): PhpFunctionParameter { + switch (true) { + case $attribute->isXml(): + case $attribute->isList(): + $type = null; + + break; + + default: + $type = ($attribute->isRequired() || $attribute->isArray() ? '' : '?').$this->getStructAttributeTypeAsPhpType($attribute); + + break; + } + try { return new PhpFunctionParameter( lcfirst($attribute->getUniqueString($attribute->getCleanName(), 'method')), - $attribute->getDefaultValue(), - $this->getStructMethodParameterType($attribute), + $attribute->isRequired() ? PhpFunctionParameter::NO_VALUE : $attribute->getDefaultValue(), + $type, $attribute ); - } catch (\InvalidArgumentException $exception) { - throw new \InvalidArgumentException(sprintf('Unable to create function parameter for struct "%s" with type "%s" for attribute "%s"', $this->getModel()->getName(), var_export($this->getStructMethodParameterType($attribute), true), $attribute->getName()), __LINE__, $exception); + } catch (InvalidArgumentException $exception) { + throw new InvalidArgumentException(sprintf('Unable to create function parameter for struct "%s" with type "%s" for attribute "%s"', $this->getModel()->getName(), var_export($this->getStructAttributeTypeAsPhpType($attribute), true), $attribute->getName()), __LINE__, $exception); } } - /** - * @param StructAttributeModel $attribute - * @param bool $returnArrayType - * @return string|null - */ - protected function getStructMethodParameterType(StructAttributeModel $attribute, $returnArrayType = true) - { - return self::getValidType($this->getStructAttributeTypeHint($attribute, $returnArrayType), $this->getGenerator()->getOptionXsdTypesPath(), null); - } - /** - * @return Struct - */ - protected function addStructMethodsSetAndGet() + + protected function addStructMethodsSetAndGet(): self { foreach ($this->getModelAttributes() as $attribute) { $this ->addStructMethodGet($attribute) ->addStructMethodSet($attribute) - ->addStructMethodAddTo($attribute); + ->addStructMethodAddTo($attribute) + ; } + return $this; } - /** - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodAddTo(StructAttributeModel $attribute) + + protected function addStructMethodAddTo(StructAttributeModel $attribute): self { if ($attribute->isArray()) { $method = new PhpMethod(sprintf('addTo%s', ucfirst($attribute->getCleanName())), [ - new PhpFunctionParameter('item', PhpFunctionParameter::NO_VALUE, $this->getStructMethodParameterType($attribute, false), $attribute), - ]); + new PhpFunctionParameter( + 'item', + PhpFunctionParameter::NO_VALUE, + $this->getStructAttributeTypeAsPhpType($attribute, false), + $attribute + ), + ], self::TYPE_SELF); $this->addStructMethodAddToBody($method, $attribute); $this->methods->add($method); } + return $this; } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodAddToBody(PhpMethod $method, StructAttributeModel $attribute) + + protected function addStructMethodAddToBody(PhpMethod $method, StructAttributeModel $attribute): self { if ($this->getGenerator()->getOptionValidation()) { $this->applyRules($method, $attribute, 'item', true); @@ -189,30 +214,28 @@ protected function addStructMethodAddToBody(PhpMethod $method, StructAttributeMo } else { $assignment = sprintf('$this->%s[] = $this->{\'%s\'}[] = $item;', $attribute->getCleanName(), addslashes($attribute->getName()), $attribute->getCleanName()); } + $method ->addChild($assignment) - ->addChild('return $this;'); + ->addChild('') + ->addChild('return $this;') + ; + return $this; } - /** - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodSet(StructAttributeModel $attribute) + + protected function addStructMethodSet(StructAttributeModel $attribute): self { $method = new PhpMethod($attribute->getSetterName(), [ $this->getStructMethodParameter($attribute), - ]); + ], self::TYPE_SELF); $this->addStructMethodSetBody($method, $attribute); $this->methods->add($method); + return $this; } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodSetBody(PhpMethod $method, StructAttributeModel $attribute) + + protected function addStructMethodSetBody(PhpMethod $method, StructAttributeModel $attribute): self { $parameters = $method->getParameters(); $parameter = array_shift($parameters); @@ -220,17 +243,14 @@ protected function addStructMethodSetBody(PhpMethod $method, StructAttributeMode if ($this->getGenerator()->getOptionValidation()) { $this->applyRules($method, $attribute, $parameterName); } + return $this ->addStructMethodSetBodyAssignment($method, $attribute, $parameterName) - ->addStructMethodSetBodyReturn($method); + ->addStructMethodSetBodyReturn($method) + ; } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @param string $parameterName - * @return Struct - */ - protected function addStructMethodSetBodyAssignment(PhpMethod $method, StructAttributeModel $attribute, $parameterName) + + protected function addStructMethodSetBodyAssignment(PhpMethod $method, StructAttributeModel $attribute, string $parameterName): self { if ($attribute->getRemovableFromRequest() || $attribute->isAChoice()) { $method @@ -238,87 +258,94 @@ protected function addStructMethodSetBodyAssignment(PhpMethod $method, StructAtt ->addChild($method->getIndentedString(sprintf('unset($this->%1$s%2$s);', $attribute->getCleanName(), $attribute->nameIsClean() ? '' : sprintf(', $this->{\'%s\'}', addslashes($attribute->getName()))), 1)) ->addChild('} else {') ->addChild($method->getIndentedString($this->getStructMethodSetBodyAssignment($attribute, $parameterName), 1)) - ->addChild('}'); + ->addChild('}') + ; } else { $method->addChild($this->getStructMethodSetBodyAssignment($attribute, $parameterName)); } + return $this; } - /** - * @param PhpMethod $method - * @return Struct - */ - protected function addStructMethodSetBodyReturn(PhpMethod $method) + + protected function addStructMethodSetBodyReturn(PhpMethod $method): self { - $method->addChild('return $this;'); + $method + ->addChild('') + ->addChild('return $this;') + ; + return $this; } - /** - * @param StructAttributeModel $attribute - * @param string $parameterName - * @return string - */ - protected function getStructMethodSetBodyAssignment(StructAttributeModel $attribute, $parameterName) + + protected function getStructMethodSetBodyAssignment(StructAttributeModel $attribute, string $parameterName): string { $prefix = '$'; - if ($this->isAttributeAList($attribute)) { + if ($attribute->isList()) { $prefix = ''; - $parameterName = sprintf('is_array($%1$s) ? implode(\' \', $%1$s) : null', $parameterName); + $parameterName = sprintf('is_array($%1$s) ? implode(\' \', $%1$s) : $%1$s', $parameterName); } elseif ($attribute->isXml()) { $prefix = ''; - $parameterName = sprintf('($%1$s instanceof \DOMDocument) && $%1$s->hasChildNodes() ? $%1$s->saveXML($%1$s->childNodes->item(0)) : $%1$s', $parameterName); + $parameterName = sprintf('($%1$s instanceof \DOMDocument) ? $%1$s->saveXML($%1$s->hasChildNodes() ? $%1$s->childNodes->item(0) : null) : $%1$s', $parameterName); } + if ($attribute->nameIsClean()) { $assignment = sprintf('$this->%s = %s%s;', $attribute->getName(), $prefix, $parameterName); } else { $assignment = sprintf('$this->%s = $this->{\'%s\'} = %s%s;', $attribute->getCleanName(), addslashes($attribute->getName()), $prefix, $parameterName); } + return $assignment; } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @param string $thisAccess - * @return Struct - */ - protected function addStructMethodGetBody(PhpMethod $method, StructAttributeModel $attribute, $thisAccess) + + protected function addStructMethodGetBody(PhpMethod $method, StructAttributeModel $attribute, string $thisAccess): self { return $this->addStructMethodGetBodyReturn($method, $attribute, $thisAccess); } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @param string $thisAccess - * @return Struct - */ - protected function addStructMethodGetBodyReturn(PhpMethod $method, StructAttributeModel $attribute, $thisAccess) + + protected function addStructMethodGetBodyReturn(PhpMethod $method, StructAttributeModel $attribute, string $thisAccess): self { $return = sprintf('return $this->%s;', $thisAccess); if ($attribute->isXml()) { $method ->addChild('$domDocument = null;') - ->addChild(sprintf('if (!empty($this->%1$s) && !$asString) {', $thisAccess)) + ->addChild(sprintf('if (!empty($this->%1$s) && $asDomDocument) {', $thisAccess)) ->addChild($method->getIndentedString('$domDocument = new \DOMDocument(\'1.0\', \'UTF-8\');', 1)) ->addChild($method->getIndentedString(sprintf('$domDocument->loadXML($this->%s);', $thisAccess), 1)) - ->addChild('}'); + ->addChild('}') + ; if ($attribute->getRemovableFromRequest() || $attribute->isAChoice()) { - $return = sprintf('return $asString ? (isset($this->%1$s) ? $this->%1$s : null) : $domDocument;', $thisAccess); + $return = sprintf('return $asDomDocument ? $domDocument : (isset($this->%1$s) ? $this->%1$s : null);', $thisAccess); } else { - $return = sprintf('return $asString ? $this->%1$s : $domDocument;', $thisAccess); + $return = sprintf('return $asDomDocument ? $domDocument : $this->%1$s;', $thisAccess); } } elseif ($attribute->getRemovableFromRequest() || $attribute->isAChoice()) { $return = sprintf('return isset($this->%1$s) ? $this->%1$s : null;', $thisAccess); } $method->addChild($return); + return $this; } - /** - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodGet(StructAttributeModel $attribute) + + protected function addStructMethodGet(StructAttributeModel $attribute): self { - $method = new PhpMethod($attribute->getGetterName(), $this->getStructMethodGetParameters($attribute)); + switch (true) { + // it can either be a string, a DOMDocument or null... + case $attribute->isXml(): + $returnType = ''; + + break; + + default: + $returnType = (!$attribute->getRemovableFromRequest() && ($attribute->isRequired() || $attribute->isArray()) ? '' : '?').$this->getStructAttributeTypeAsPhpType($attribute); + + break; + } + + $method = new PhpMethod( + $attribute->getGetterName(), + $this->getStructMethodGetParameters($attribute), + $returnType + ); if ($attribute->nameIsClean()) { $thisAccess = sprintf('%s', $attribute->getName()); } else { @@ -326,96 +353,103 @@ protected function addStructMethodGet(StructAttributeModel $attribute) } $this->addStructMethodGetBody($method, $attribute, $thisAccess); $this->methods->add($method); + return $this; } - /** - * @param StructAttributeModel $attribute - * @return PhpFunctionParameter[] - */ - protected function getStructMethodGetParameters(StructAttributeModel $attribute) + + protected function getStructMethodGetParameters(StructAttributeModel $attribute): array { $parameters = []; if ($attribute->isXml()) { - $parameters[] = new PhpFunctionParameter('asString', true, null, $attribute); + $parameters[] = new PhpFunctionParameter('asDomDocument', false, self::TYPE_BOOL, $attribute); } + return $parameters; } - /** - * @return PhpAnnotationBlock|null - */ - protected function getMethodAnnotationBlock(PhpMethod $method) + + protected function getMethodAnnotationBlock(PhpMethod $method): ?PhpAnnotationBlock { return $this->getStructMethodAnnotationBlock($method); } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock|null - */ - protected function getStructMethodAnnotationBlock(PhpMethod $method) + + protected function getStructMethodAnnotationBlock(PhpMethod $method): ?PhpAnnotationBlock { $annotationBlock = null; + switch ($method->getName()) { case self::METHOD_CONSTRUCT: $annotationBlock = $this->getStructMethodConstructAnnotationBlock(); + break; + case 0 === mb_strpos($method->getName(), 'get'): case 0 === mb_strpos($method->getName(), 'set'): $annotationBlock = $this->getStructMethodsSetAndGetAnnotationBlock($method); + break; + case 0 === mb_strpos($method->getName(), 'addTo'): $annotationBlock = $this->getStructMethodsAddToAnnotationBlock($method); + break; + case false !== mb_strpos($method->getName(), 'ForUnionConstraintsFrom'): $annotationBlock = $this->getStructMethodsValidateUnionAnnotationBlock($method); + break; + case false !== mb_strpos($method->getName(), 'ForArrayConstraintsFrom'): $annotationBlock = $this->getStructMethodsValidateArrayAnnotationBlock($method); + break; + case false !== mb_strpos($method->getName(), 'ForChoiceConstraintsFrom'): $annotationBlock = $this->getStructMethodsValidateChoiceAnnotationBlock($method); + break; + case false !== mb_strpos($method->getName(), 'MaxLengthConstraintFrom'): $annotationBlock = $this->getStructMethodsValidateLengthAnnotationBlock($method, 'max'); + break; + case false !== mb_strpos($method->getName(), 'MinLengthConstraintFrom'): $annotationBlock = $this->getStructMethodsValidateLengthAnnotationBlock($method, 'min'); + break; + case false !== mb_strpos($method->getName(), 'LengthConstraintFrom'): $annotationBlock = $this->getStructMethodsValidateLengthAnnotationBlock($method); + break; } + return $annotationBlock; } - /** - * @return PhpAnnotationBlock - */ - protected function getStructMethodConstructAnnotationBlock() + + protected function getStructMethodConstructAnnotationBlock(): PhpAnnotationBlock { $annotationBlock = new PhpAnnotationBlock([ sprintf('Constructor method for %s', $this->getModel()->getName()), ]); $this->addStructPropertiesToAnnotationBlock($annotationBlock); + return $annotationBlock; } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock - */ - protected function getStructMethodsSetAndGetAnnotationBlock(PhpMethod $method) + + protected function getStructMethodsSetAndGetAnnotationBlock(PhpMethod $method): PhpAnnotationBlock { $parameters = $method->getParameters(); $setOrGet = mb_strtolower(mb_substr($method->getName(), 0, 3)); $parameter = array_shift($parameters); - /** - * Only set parameter must be based on a potential PhpFunctionParameter - */ - if ($parameter instanceof PhpFunctionParameter && $setOrGet === 'set') { + // Only set parameter must be based on a potential PhpFunctionParameter + if ($parameter instanceof PhpFunctionParameter && 'set' === $setOrGet) { $parameterName = ucfirst($parameter->getName()); } else { $parameterName = mb_substr($method->getName(), 3); } /** - * Since properties can be duplicated with different case, we assume that _\d+ is replaceable by an empty string as methods are "duplicated" with this suffix + * Since properties can be duplicated with different case, we assume that _\d+ is replaceable by an empty string as methods are "duplicated" with this suffix. */ $parameterName = preg_replace('/(_\d+)/', '', $parameterName); $attribute = $this->getModel()->getAttribute($parameterName); @@ -438,15 +472,11 @@ protected function getStructMethodsSetAndGetAnnotationBlock(PhpMethod $method) $annotationBlock->addChild(sprintf($setValueAnnotation, ucfirst($setOrGet), lcfirst($parameterName))); $this->addStructMethodsSetAndGetAnnotationBlockFromScalar($setOrGet, $annotationBlock, $parameterName); } + return $annotationBlock; } - /** - * @param string $setOrGet - * @param PhpAnnotationBlock $annotationBlock - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodsSetAndGetAnnotationBlockFromStructAttribute($setOrGet, PhpAnnotationBlock $annotationBlock, StructAttributeModel $attribute) + + protected function addStructMethodsSetAndGetAnnotationBlockFromStructAttribute(string $setOrGet, PhpAnnotationBlock $annotationBlock, StructAttributeModel $attribute): self { switch ($setOrGet) { case 'set': @@ -460,122 +490,115 @@ protected function addStructMethodsSetAndGetAnnotationBlockFromStructAttribute($ $annotationBlock ->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\DOMDocument::hasChildNodes()')) ->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\DOMDocument::saveXML()')) - ->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\DOMNode::item()')); + ->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\DOMNode::item()')) + ; } if ($this->getGenerator()->getOptionValidation()) { if ($attribute->isAChoice()) { - $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, '\InvalidArgumentException')); + $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, InvalidArgumentException::class)); } if (($model = $this->getRestrictionFromStructAttribute($attribute)) instanceof StructModel) { $annotationBlock ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_VALUE_IS_VALID))) ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES))) - ->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, '\InvalidArgumentException')); + ->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, InvalidArgumentException::class)) + ; } elseif ($attribute->isArray()) { - $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, '\InvalidArgumentException')); + $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, InvalidArgumentException::class)); } } - $this->addStructMethodsSetAnnotationBlock($annotationBlock, $this->getStructAttributeTypeSetAnnotation($attribute), lcfirst($attribute->getCleanName())); + $this->addStructMethodsSetAnnotationBlock($annotationBlock, $this->getStructAttributeTypeSetAnnotation($attribute, false), lcfirst($attribute->getCleanName())); + break; + case 'get': if ($attribute->getRemovableFromRequest()) { $annotationBlock->addChild('An additional test has been added (isset) before returning the property value as this property may have been unset before, due to the fact that this property is removable from the request (nillable=true+minOccurs=0)'); } $this ->addStructMethodsGetAnnotationBlockFromXmlAttribute($annotationBlock, $attribute) - ->addStructMethodsGetAnnotationBlock($annotationBlock, $this->getStructAttributeTypeGetAnnotation($attribute)); + ->addStructMethodsGetAnnotationBlock($annotationBlock, $this->getStructAttributeTypeGetAnnotation($attribute)) + ; + break; } + return $this; } - /** - * @param string $setOrGet - * @param PhpAnnotationBlock $annotationBlock - * @param string $attributeName - * @return Struct - */ - protected function addStructMethodsSetAndGetAnnotationBlockFromScalar($setOrGet, PhpAnnotationBlock $annotationBlock, $attributeName) + + protected function addStructMethodsSetAndGetAnnotationBlockFromScalar(string $setOrGet, PhpAnnotationBlock $annotationBlock, string $attributeName): self { switch ($setOrGet) { case 'set': $this->addStructMethodsSetAnnotationBlock($annotationBlock, lcfirst($attributeName), lcfirst($attributeName)); + break; + case 'get': $this->addStructMethodsGetAnnotationBlock($annotationBlock, lcfirst($attributeName)); + break; } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @param string $type - * @param string $name - * @return Struct - */ - protected function addStructMethodsSetAnnotationBlock(PhpAnnotationBlock $annotationBlock, $type, $name) + + protected function addStructMethodsSetAnnotationBlock(PhpAnnotationBlock $annotationBlock, string $type, string $name): self { - $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', $type, $name)))->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getModel()->getPackagedName(true))); + $annotationBlock + ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', $type, $name))) + ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getModel()->getPackagedName(true))) + ; + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @param string $attributeType - * @return Struct - */ - protected function addStructMethodsGetAnnotationBlock(PhpAnnotationBlock $annotationBlock, $attributeType) + + protected function addStructMethodsGetAnnotationBlock(PhpAnnotationBlock $annotationBlock, string $attributeType): self { $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $attributeType)); + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @param StructAttributeModel $attribute - * @return Struct - */ - protected function addStructMethodsGetAnnotationBlockFromXmlAttribute(PhpAnnotationBlock $annotationBlock, StructAttributeModel $attribute) + + protected function addStructMethodsGetAnnotationBlockFromXmlAttribute(PhpAnnotationBlock $annotationBlock, StructAttributeModel $attribute): self { if ($attribute->isXml()) { $annotationBlock ->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\DOMDocument::loadXML()')) - ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, 'bool $asString true: returns XML string, false: returns \DOMDocument')); + ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, 'bool $asString true: returns XML string, false: returns \DOMDocument')) + ; } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return Struct - */ - protected function addStructPropertiesToAnnotationBlock(PhpAnnotationBlock $annotationBlock) + + protected function addStructPropertiesToAnnotationBlock(PhpAnnotationBlock $annotationBlock): self { - return $this->addStructPropertiesToAnnotationBlockUses($annotationBlock)->addStructPropertiesToAnnotationBlockParams($annotationBlock); + return $this + ->addStructPropertiesToAnnotationBlockUses($annotationBlock) + ->addStructPropertiesToAnnotationBlockParams($annotationBlock) + ; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return Struct - */ - protected function addStructPropertiesToAnnotationBlockUses(PhpAnnotationBlock $annotationBlock) + + protected function addStructPropertiesToAnnotationBlockUses(PhpAnnotationBlock $annotationBlock): self { foreach ($this->getModelAttributes() as $attribute) { $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $this->getModel()->getPackagedName(), $attribute->getSetterName()))); } + return $this; } - /** - * @param PhpAnnotationBlock $annotationBlock - * @return Struct - */ - protected function addStructPropertiesToAnnotationBlockParams(PhpAnnotationBlock $annotationBlock) + + protected function addStructPropertiesToAnnotationBlockParams(PhpAnnotationBlock $annotationBlock): self { foreach ($this->getModelAttributes() as $attribute) { - $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', $this->getStructAttributeTypeSetAnnotation($attribute), lcfirst($attribute->getCleanName())))); + $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', $this->getStructAttributeTypeSetAnnotation($attribute, false), lcfirst($attribute->getCleanName())))); } + return $this; } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock - */ - protected function getStructMethodsAddToAnnotationBlock(PhpMethod $method) + + protected function getStructMethodsAddToAnnotationBlock(PhpMethod $method): PhpAnnotationBlock { $methodParameters = $method->getParameters(); $firstParameter = array_shift($methodParameters); @@ -587,22 +610,23 @@ protected function getStructMethodsAddToAnnotationBlock(PhpMethod $method) if ($model instanceof StructModel) { $annotationBlock ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_VALUE_IS_VALID))) - ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES))); + ->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES))) + ; } $annotationBlock - ->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, '\InvalidArgumentException')) - ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $item', $this->getStructAttributeTypeSetAnnotation($attribute, false)))) - ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getModel()->getPackagedName(true))); + ->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, InvalidArgumentException::class)) + ->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $item', $this->getStructAttributeTypeSetAnnotation($attribute, false, true)))) + ->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getModel()->getPackagedName(true))) + ; } + return $annotationBlock; } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock - */ - protected function getStructMethodsValidateArrayAnnotationBlock(PhpMethod $method) + + protected function getStructMethodsValidateArrayAnnotationBlock(PhpMethod $method): PhpAnnotationBlock { $methodName = lcfirst(mb_substr($method->getName(), mb_strpos($method->getName(), 'ForArrayConstraintsFrom') + mb_strlen('ForArrayConstraintsFrom'))); + return new PhpAnnotationBlock([ new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is responsible for validating the values passed to the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is willingly generated in order to preserve the one-line inline validation within the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), @@ -610,13 +634,11 @@ protected function getStructMethodsValidateArrayAnnotationBlock(PhpMethod $metho new PhpAnnotation(self::ANNOTATION_RETURN, 'string A non-empty message if the values does not match the validation rules'), ]); } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock - */ - protected function getStructMethodsValidateUnionAnnotationBlock(PhpMethod $method) + + protected function getStructMethodsValidateUnionAnnotationBlock(PhpMethod $method): PhpAnnotationBlock { $methodName = lcfirst(mb_substr($method->getName(), mb_strpos($method->getName(), 'ForUnionConstraintsFrom') + mb_strlen('ForUnionConstraintsFrom'))); + return new PhpAnnotationBlock([ new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is responsible for validating the value passed to the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is willingly generated in order to preserve the one-line inline validation within the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), @@ -625,13 +647,11 @@ protected function getStructMethodsValidateUnionAnnotationBlock(PhpMethod $metho new PhpAnnotation(self::ANNOTATION_RETURN, 'string A non-empty message if the values does not match the validation rules'), ]); } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock - */ - protected function getStructMethodsValidateChoiceAnnotationBlock(PhpMethod $method) + + protected function getStructMethodsValidateChoiceAnnotationBlock(PhpMethod $method): PhpAnnotationBlock { $methodName = lcfirst(mb_substr($method->getName(), mb_strpos($method->getName(), 'ForChoiceConstraintsFrom') + mb_strlen('ForChoiceConstraintsFrom'))); + return new PhpAnnotationBlock([ new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is responsible for validating the value passed to the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is willingly generated in order to preserve the one-line inline validation within the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), @@ -640,15 +660,12 @@ protected function getStructMethodsValidateChoiceAnnotationBlock(PhpMethod $meth new PhpAnnotation(self::ANNOTATION_RETURN, 'string A non-empty message if the values does not match the validation rules'), ]); } - /** - * @param PhpMethod $method - * @param string $type - * @return PhpAnnotationBlock - */ - protected function getStructMethodsValidateLengthAnnotationBlock(PhpMethod $method, $type = '') + + protected function getStructMethodsValidateLengthAnnotationBlock(PhpMethod $method, string $type = ''): PhpAnnotationBlock { $replace = sprintf('%sLengthConstraintFrom', ucfirst($type)); $methodName = lcfirst(mb_substr($method->getName(), mb_strpos($method->getName(), $replace) + mb_strlen($replace))); + return new PhpAnnotationBlock([ new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is responsible for validating the value passed to the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), new PhpAnnotation(PhpAnnotation::NO_NAME, sprintf('This method is willingly generated in order to preserve the one-line inline validation within the %s method', $methodName), self::ANNOTATION_LONG_LENGTH), @@ -657,34 +674,8 @@ protected function getStructMethodsValidateLengthAnnotationBlock(PhpMethod $meth new PhpAnnotation(self::ANNOTATION_RETURN, 'string A non-empty message if the values does not match the validation rules'), ]); } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::getModel() - * @return StructModel - */ - public function getModel() - { - return parent::getModel(); - } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel() - * @throws \InvalidArgumentException - * @param AbstractModel $model - * @return StructArray - */ - public function setModel(AbstractModel $model) - { - if (!$model instanceof StructModel) { - throw new \InvalidArgumentException('Model must be an instance of a Struct', __LINE__); - } - return parent::setModel($model); - } - /** - * @param PhpMethod $method - * @param StructAttributeModel $attribute - * @param $parameterName - * @param bool $itemType - */ - protected function applyRules(PhpMethod $method, StructAttributeModel $attribute, $parameterName, $itemType = false) + + protected function applyRules(PhpMethod $method, StructAttributeModel $attribute, string $parameterName, bool $itemType = false): void { if ($this->getGenerator()->getOptionValidation()) { $rules = new Rules($this, $method, $attribute, $this->methods); diff --git a/src/File/StructArray.php b/src/File/StructArray.php index 22581589..cf87686a 100644 --- a/src/File/StructArray.php +++ b/src/File/StructArray.php @@ -1,46 +1,30 @@ addArrayMethodLast() ->addArrayMethodOffsetGet() ->addArrayMethodAdd() - ->addArrayMethodGetAttributeName(); + ->addArrayMethodGetAttributeName() + ; + return $this; } - /** - * @return StructArray - */ - protected function addArrayMethodCurrent() + + public function setModel(AbstractModel $model): self { - return $this->addArrayMethodGenericMethod(self::METHOD_CURRENT, $this->getArrayMethodBody(self::METHOD_CURRENT)); + if ($model instanceof StructModel && !$model->isArray()) { + throw new InvalidArgumentException('The model is not a valid array struct (name must contain Array and the model must contain only one property', __LINE__); + } + + return parent::setModel($model); } + /** - * @return StructArray + * Disable this feature within StructArray class. */ - protected function addArrayMethodItem() + protected function addStructMethodAddTo(StructAttributeModel $attribute): Struct + { + return $this; + } + + protected function addArrayMethodCurrent(): self + { + return $this->addArrayMethodGenericMethod(self::METHOD_CURRENT, $this->getArrayMethodBody(self::METHOD_CURRENT), [], '?'.$this->getStructAttributeTypeAsPhpType($this->getStructAttribute(), false)); + } + + protected function addArrayMethodItem(): self { return $this->addArrayMethodGenericMethod(self::METHOD_ITEM, $this->getArrayMethodBody(self::METHOD_ITEM, '$index'), [ 'index', - ]); + ], '?'.$this->getStructAttributeTypeAsPhpType($this->getStructAttribute(), false)); } - /** - * @return StructArray - */ - protected function addArrayMethodFirst() + + protected function addArrayMethodFirst(): self { - return $this->addArrayMethodGenericMethod(self::METHOD_FIRST, $this->getArrayMethodBody(self::METHOD_FIRST)); + return $this->addArrayMethodGenericMethod(self::METHOD_FIRST, $this->getArrayMethodBody(self::METHOD_FIRST), [], '?'.$this->getStructAttributeTypeAsPhpType($this->getStructAttribute(), false)); } - /** - * @return StructArray - */ - protected function addArrayMethodLast() + + protected function addArrayMethodLast(): self { - return $this->addArrayMethodGenericMethod(self::METHOD_LAST, $this->getArrayMethodBody(self::METHOD_LAST)); + return $this->addArrayMethodGenericMethod(self::METHOD_LAST, $this->getArrayMethodBody(self::METHOD_LAST), [], '?'.$this->getStructAttributeTypeAsPhpType($this->getStructAttribute(), false)); } - /** - * @return StructArray - */ - protected function addArrayMethodOffsetGet() + + protected function addArrayMethodOffsetGet(): self { return $this->addArrayMethodGenericMethod(self::METHOD_OFFSET_GET, $this->getArrayMethodBody(self::METHOD_OFFSET_GET, '$offset'), [ 'offset', - ]); + ], '?'.$this->getStructAttributeTypeAsPhpType($this->getStructAttribute(), false)); } - /** - * @return StructArray - */ - protected function addArrayMethodGetAttributeName() - { - return $this->addArrayMethodGenericMethod(self::METHOD_GET_ATTRIBUTE_NAME, sprintf('return \'%s\';', $this->getModel() - ->getAttributes() - ->offsetGet(0) - ->getName())); + + protected function addArrayMethodGetAttributeName(): self + { + return $this->addArrayMethodGenericMethod( + self::METHOD_GET_ATTRIBUTE_NAME, + sprintf( + 'return \'%s\';', + $this + ->getModel() + ->getAttributes() + ->offsetGet(0) + ->getName() + ), + [], + self::TYPE_STRING + ); } - /** - * @return StructArray - */ - protected function addArrayMethodAdd() + + protected function addArrayMethodAdd(): self { - if ($this->getRestrictionFromStructAttribute() instanceof StructModel) { + if ($this->getModelFromStructAttribute() instanceof StructModel) { $method = new PhpMethod(self::METHOD_ADD, [ - 'item', - ]); + new PhpFunctionParameter( + 'item', + PhpFunctionParameter::NO_VALUE, + $this->getStructAttributeTypeAsPhpType($this->getStructAttribute(), false), + $this->getStructAttribute() + ), + ], self::TYPE_SELF); + if ($this->getGenerator()->getOptionValidation()) { $rules = new Rules($this, $method, $this->getStructAttribute(), $this->methods); $rules->getEnumerationRule()->applyRule('item', null); } + $method->addChild('return parent::add($item);'); $this->methods->add($method); } + return $this; } - /** - * @param string $name - * @param string $body - * @param string[] $methodParameters - * @return StructArray - */ - protected function addArrayMethodGenericMethod($name, $body, array $methodParameters = []) + + protected function addArrayMethodGenericMethod(string $name, string $body, array $methodParameters = [], ?string $returnType = null): self { - $method = new PhpMethod($name, $methodParameters); + $method = new PhpMethod($name, $methodParameters, $returnType); $method->addChild($body); $this->methods->add($method); + return $this; } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodGetAttributeNameAnnotationBlock() + + protected function getArrayMethodGetAttributeNameAnnotationBlock(): PhpAnnotationBlock { return new PhpAnnotationBlock([ 'Returns the attribute name', @@ -144,127 +144,107 @@ protected function getArrayMethodGetAttributeNameAnnotationBlock() new PhpAnnotation(self::ANNOTATION_RETURN, sprintf('string %s', $this->getModel()->getAttributes()->offsetGet(0)->getName())), ]); } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodCurrentAnnotationBlock() + + protected function getArrayMethodCurrentAnnotationBlock(): PhpAnnotationBlock { return $this->getArrayMethodGenericAnnotationBlock(self::METHOD_CURRENT, 'Returns the current element'); } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodFirstAnnotationBlock() + + protected function getArrayMethodFirstAnnotationBlock(): PhpAnnotationBlock { return $this->getArrayMethodGenericAnnotationBlock(self::METHOD_FIRST, 'Returns the first element'); } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodLastAnnotationBlock() + + protected function getArrayMethodLastAnnotationBlock(): PhpAnnotationBlock { return $this->getArrayMethodGenericAnnotationBlock(self::METHOD_LAST, 'Returns the last element'); } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodItemAnnotationBlock() + + protected function getArrayMethodItemAnnotationBlock(): PhpAnnotationBlock { return $this->getArrayMethodGenericAnnotationBlock(self::METHOD_ITEM, 'Returns the indexed element', 'int $index'); } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodOffsetGetAnnotationBlock() + + protected function getArrayMethodOffsetGetAnnotationBlock(): PhpAnnotationBlock { return $this->getArrayMethodGenericAnnotationBlock(self::METHOD_OFFSET_GET, 'Returns the element at the offset', 'int $offset'); } - /** - * @return PhpAnnotationBlock - */ - protected function getArrayMethodAddAnnotationBlock() + + protected function getArrayMethodAddAnnotationBlock(): PhpAnnotationBlock { return new PhpAnnotationBlock([ 'Add element to array', new PhpAnnotation(self::ANNOTATION_SEE, sprintf('%s::add()', $this->getModel()->getExtends(true))), - new PhpAnnotation(self::ANNOTATION_THROWS, '\InvalidArgumentException'), - new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::valueIsValid()', $this->getModelFromStructAttribute()->getPackagedName(true))), - new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $item', $this->getStructAttributeType())), + new PhpAnnotation(self::ANNOTATION_THROWS, InvalidArgumentException::class), + new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $item', $this->getStructAttributeType(null, true, false))), new PhpAnnotation(self::ANNOTATION_RETURN, sprintf('%s', $this->getModel()->getPackagedName(true))), ]); } - /** - * @param string $name - * @param string $description - * @param string $param - * @return PhpAnnotationBlock - */ - protected function getArrayMethodGenericAnnotationBlock($name, $description, $param = null) + + protected function getArrayMethodGenericAnnotationBlock(string $name, string $description, $param = null): PhpAnnotationBlock { $annotationBlock = new PhpAnnotationBlock([ $description, new PhpAnnotation(self::ANNOTATION_SEE, sprintf('%s::%s()', $this->getModel()->getExtends(true), $name)), ]); + if (!empty($param)) { $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, $param)); } - $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getStructAttributeTypeGetAnnotation(null, false))); + $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getStructAttributeTypeGetAnnotation($this->getStructAttribute(), false, true))); + return $annotationBlock; } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock|null - */ - protected function getStructMethodAnnotationBlock(PhpMethod $method) + + protected function getStructMethodAnnotationBlock(PhpMethod $method): ?PhpAnnotationBlock { switch ($method->getName()) { case self::METHOD_GET_ATTRIBUTE_NAME: $annotationBlock = $this->getArrayMethodGetAttributeNameAnnotationBlock(); + break; + case self::METHOD_CURRENT: $annotationBlock = $this->getArrayMethodCurrentAnnotationBlock(); + break; + case self::METHOD_FIRST: $annotationBlock = $this->getArrayMethodFirstAnnotationBlock(); + break; + case self::METHOD_ITEM: $annotationBlock = $this->getArrayMethodItemAnnotationBlock(); + break; + case self::METHOD_LAST: $annotationBlock = $this->getArrayMethodLastAnnotationBlock(); + break; + case self::METHOD_OFFSET_GET: $annotationBlock = $this->getArrayMethodOffsetGetAnnotationBlock(); + break; + case self::METHOD_ADD: $annotationBlock = $this->getArrayMethodAddAnnotationBlock(); + break; + default: $annotationBlock = parent::getStructMethodAnnotationBlock($method); + break; } + return $annotationBlock; } - /** - * @param string $method - * @param string $var - * @return string - */ - protected function getArrayMethodBody($method, $var = '') + + protected function getArrayMethodBody(string $method, $var = ''): string { return sprintf('return parent::%s(%s);', $method, $var); } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel() - * @throws \InvalidArgumentException - * @param AbstractModel $model - * @return StructArray - */ - public function setModel(AbstractModel $model) - { - if ($model instanceof StructModel && !$model->isArray()) { - throw new \InvalidArgumentException('The model is not a valid array struct (name must contain Array and the model must contain only one property', __LINE__); - } - return parent::setModel($model); - } } diff --git a/src/File/StructEnum.php b/src/File/StructEnum.php index e5671c5a..23b88d9a 100644 --- a/src/File/StructEnum.php +++ b/src/File/StructEnum.php @@ -1,40 +1,41 @@ isRestriction()) { + throw new InvalidArgumentException('Model must be a restriction containing values', __LINE__); + } + + return parent::setModel($model); + } + + protected function fillClassConstants(ConstantContainer $constants): void { foreach ($this->getModel()->getValues() as $value) { $constants->add(new PhpConstant($value->getCleanName(), $value->getValue())); } } - /** - * @param PhpConstant $constant - * @return PhpAnnotationBlock - */ - protected function getConstantAnnotationBlock(PhpConstant $constant) + + protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock { $block = new PhpAnnotationBlock([ sprintf('Constant for value \'%s\'', $constant->getValue()), @@ -43,55 +44,53 @@ protected function getConstantAnnotationBlock(PhpConstant $constant) $this->defineModelAnnotationsFromWsdl($block, $value); } $block->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, sprintf('string \'%s\'', $constant->getValue()))); + return $block; } - protected function fillClassMethods() + + protected function fillClassMethods(): void { $this->methods->add($this->getEnumMethodGetValidValues()); } - /** - * @param PhpMethod $method - * @return PhpAnnotationBlock|null - */ - protected function getMethodAnnotationBlock(PhpMethod $method) + + protected function getMethodAnnotationBlock(PhpMethod $method): ?PhpAnnotationBlock { $block = null; + switch ($method->getName()) { case self::METHOD_GET_VALID_VALUES: $block = $this->getEnumGetValidValuesAnnotationBlock(); + break; } + return $block; } - /** - * @return PhpMethod - */ - protected function getEnumMethodGetValidValues() + + protected function getEnumMethodGetValidValues(): PhpMethod { - $method = new PhpMethod(self::METHOD_GET_VALID_VALUES, [], PhpMethod::ACCESS_PUBLIC, false, true); + $method = new PhpMethod(self::METHOD_GET_VALID_VALUES, [], self::TYPE_ARRAY, PhpMethod::ACCESS_PUBLIC, false, true); $validValues = $this->getEnumMethodValues(); - $method->addChild('return array('); + $method->addChild('return ['); foreach ($validValues as $validValue) { $method->addChild(sprintf('%s,', $method->getIndentedString($validValue, 1))); } - $method->addChild(');'); + $method->addChild('];'); + return $method; } - /** - * @return string[] - */ - protected function getEnumMethodValues() + + protected function getEnumMethodValues(): array { $values = []; foreach ($this->getModel()->getValues() as $value) { $values[] = sprintf('self::%s', $value->getCleanName()); } + return $values; } - /** - * @return PhpAnnotationBlock - */ - protected function getEnumGetValidValuesAnnotationBlock() + + protected function getEnumGetValidValuesAnnotationBlock(): PhpAnnotationBlock { $annotationBlock = new PhpAnnotationBlock([ 'Return allowed values', @@ -100,19 +99,7 @@ protected function getEnumGetValidValuesAnnotationBlock() $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_USES, $value)); } $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, 'string[]')); + return $annotationBlock; } - /** - * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel() - * @throws \InvalidArgumentException - * @param AbstractModel $model - * @return StructArray - */ - public function setModel(AbstractModel $model) - { - if ($model instanceof StructModel && !$model->isRestriction()) { - throw new \InvalidArgumentException('Model must be a restriction containing values', __LINE__); - } - return parent::setModel($model); - } } diff --git a/src/File/Tutorial.php b/src/File/Tutorial.php index 97ddf2f9..b39b900f 100644 --- a/src/File/Tutorial.php +++ b/src/File/Tutorial.php @@ -1,208 +1,188 @@ addMainAnnotationBlock() + $this + ->addMainAnnotationBlock() ->addAutoload() ->addOptionsAnnotationBlock() ->addOptions() - ->addContent(); + ->addContent() + ; parent::writeFile(); } - /** - * @return Tutorial - */ - public function addMainAnnotationBlock() + + public function addMainAnnotationBlock(): self { $this->getFile()->addAnnotationBlockElement($this->getAnnotationBlock()); + return $this; } - /** - * @return PhpAnnotationBlock - */ - protected function getAnnotationBlock() - { - $block = new PhpAnnotationBlock(); - $this->addChild($block, 'This file aims to show you how to use this generated package.') - ->addChild($block, 'In addition, the goal is to show which methods are available and the first needed parameter(s)') - ->addChild($block, 'You have to use an associative array such as:') - ->addChild($block, '- the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class)') - ->addChild($block, '- the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option)') - ->addChild($block, '$options = array(') - ->addChild($block, sprintf('\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => \'%s\',', $this->getGenerator()->getWsdl()->getName())) - ->addChild($block, '\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true,') - ->addChild($block, '\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => \'you_secret_login\',') - ->addChild($block, '\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => \'you_secret_password\',') - ->addChild($block, ');') - ->addChild($block, 'etc...'); - if ($this->getGenerator()->getOptionStandalone() === false) { - $this->addChild($block, '################################################################################')->addChild($block, 'Don\'t forget to add wsdltophp/packagebase:dev-master to your main composer.json.')->addChild($block, '################################################################################'); - } - return $block; - } - /** - * @param PhpAnnotationBlock $block - * @param string $content - * @return Tutorial - */ - public function addChild(PhpAnnotationBlock $block, $content) + + public function addChild(PhpAnnotationBlock $block, string $content): self { $block->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, $content, AbstractModelFile::ANNOTATION_LONG_LENGTH)); + return $this; } - /** - * @return Tutorial - */ - public function addAutoload() + + public function addAutoload(): self { - if ($this->getGenerator()->getOptionStandalone() === true) { + if ($this->getGenerator()->getOptionStandalone()) { $this->getFile()->getMainElement()->addChild(sprintf('require_once __DIR__ . \'/vendor/autoload.php\';')); } + return $this; } - /** - * @return Tutorial - */ - public function addContent() + + public function addContent(): self { foreach ($this->getGenerator()->getServices(true) as $service) { $serviceVariableName = lcfirst($service->getName()); $this->addAnnotationBlockFromService($service)->addServiceDeclaration($serviceVariableName, $service)->addServiceSoapHeadersDefinitions($serviceVariableName, $service)->addContentFromService($serviceVariableName, $service); } + return $this; } - /** - * @return Tutorial - */ - protected function addOptionsAnnotationBlock() + + protected function getAnnotationBlock(): PhpAnnotationBlock + { + $block = new PhpAnnotationBlock(); + $this + ->addChild($block, 'This file aims to show you how to use this generated package.') + ->addChild($block, 'In addition, the goal is to show which methods are available and the first needed parameter(s)') + ->addChild($block, 'You have to use an associative array such as:') + ->addChild($block, '- the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class)') + ->addChild($block, '- the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option)') + ->addChild($block, '$options = [') + ->addChild($block, sprintf('%s::WSDL_URL => \'%s\',', AbstractSoapClientBase::class, $this->getGenerator()->getWsdl()->getName())) + ->addChild($block, sprintf('%s::WSDL_TRACE => true,', AbstractSoapClientBase::class)) + ->addChild($block, sprintf('%s::WSDL_LOGIN => \'you_secret_login\',', AbstractSoapClientBase::class)) + ->addChild($block, sprintf('%s::WSDL_PASSWORD => \'you_secret_password\',', AbstractSoapClientBase::class)) + ->addChild($block, '];') + ->addChild($block, 'etc...') + ; + + if (!$this->getGenerator()->getOptionStandalone()) { + $this + ->addChild($block, '################################################################################') + ->addChild($block, 'Don\'t forget to add wsdltophp/packagebase:~5.0 to your main composer.json.') + ->addChild($block, '################################################################################') + ; + } + + return $block; + } + + protected function addOptionsAnnotationBlock(): self { $this->addAnnotationBlock([ 'Minimal options', ]); + return $this; } - /** - * @return Tutorial - */ - protected function addOptions() + + protected function addOptions(): self { - $this->getFile() + $this + ->getFile() ->getMainElement() - ->addChild('$options = array(') - ->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => \'%s\',', $this->getGenerator()->getWsdl()->getName()), 1)) - ->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => %s::%s(),', $this->getGenerator()->getFiles()->getClassmapFile()->getModel()->getPackagedName(true), ClassMap::METHOD_NAME), 1)) - ->addChild(');'); + ->addChild('$options = [') + ->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => \'%s\',', $this->getGenerator()->getWsdl()->getName()), 1)) + ->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => %s::%s(),', $this->getGenerator()->getFiles()->getClassmapFile()->getModel()->getPackagedName(true), ClassMap::METHOD_NAME), 1)) + ->addChild('];') + ; + return $this; } - /** - * @param ServiceModel $service - * @return Tutorial - */ - protected function addAnnotationBlockFromService(ServiceModel $service) + + protected function addAnnotationBlockFromService(ServiceModel $service): self { return $this->addAnnotationBlock([ sprintf('Samples for %s ServiceType', $service->getName()), ]); } - /** - * @param string $serviceVariableName - * @param ServiceModel $service - * @return Tutorial - */ - protected function addContentFromService($serviceVariableName, ServiceModel $service) + + protected function addContentFromService(string $serviceVariableName, ServiceModel $service): self { foreach ($service->getMethods() as $method) { $this->addAnnotationBlockFromMethod($method)->addContentFromMethod($serviceVariableName, $method); } + return $this; } - /** - * @param string $serviceVariableName - * @param ServiceModel $service - * @return Tutorial - */ - protected function addServiceDeclaration($serviceVariableName, ServiceModel $service) + + protected function addServiceDeclaration(string $serviceVariableName, ServiceModel $service): self { $this->getFile()->getMainElement()->addChild(sprintf('$%s = new %s($options);', $serviceVariableName, $service->getPackagedName(true))); + return $this; } - /** - * @param string $serviceVariableName - * @param ServiceModel $service - * @return Tutorial - */ - protected function addServiceSoapHeadersDefinitions($serviceVariableName, ServiceModel $service) + + protected function addServiceSoapHeadersDefinitions(string $serviceVariableName, ServiceModel $service): self { $added = []; foreach ($service->getMethods() as $method) { $added = array_merge($added, $this->addServiceSoapHeadersDefinition($serviceVariableName, $method, $added)); } + return $this; } - /** - * @param string $serviceVariableName - * @param MethodModel $method - * @param array $added - * @return string[] - */ - protected function addServiceSoapHeadersDefinition($serviceVariableName, MethodModel $method, array $added) + + protected function addServiceSoapHeadersDefinition(string $serviceVariableName, MethodModel $method, array $added): array { $addedNames = []; $soapHeaderNames = $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMES, []); foreach ($soapHeaderNames as $soapHeaderName) { - if (!in_array($soapHeaderName, $added, true)) { - $addedNames[] = $soapHeaderName; - $this->getFile()->getMainElement()->addChild(sprintf('$%s->%s%s(%s);', $serviceVariableName, Service::METHOD_SET_HEADER_PREFIX, ucfirst($soapHeaderName), $this->getMethodParameter($soapHeaderName))); + if (in_array($soapHeaderName, $added, true)) { + continue; } + + $addedNames[] = $soapHeaderName; + $this->getFile()->getMainElement()->addChild(sprintf('$%s->%s%s(%s);', $serviceVariableName, Service::METHOD_SET_HEADER_PREFIX, ucfirst($soapHeaderName), $this->getMethodParameter($soapHeaderName))); } + return $addedNames; } - /** - * @param MethodModel $method - * @return Tutorial - */ - protected function addAnnotationBlockFromMethod(MethodModel $method) + + protected function addAnnotationBlockFromMethod(MethodModel $method): self { return $this->addAnnotationBlock([ sprintf('Sample call for %s operation/method', $method->getMethodName()), ]); } - /** - * @param string $serviceVariableName - * @param MethodModel $method - * @return Tutorial - */ - protected function addContentFromMethod($serviceVariableName, MethodModel $method) + + protected function addContentFromMethod(string $serviceVariableName, MethodModel $method): self { - $this->getFile() + $this + ->getFile() ->getMainElement() ->addChild(sprintf('if ($%s->%s(%s) !== false) {', $serviceVariableName, $method->getMethodName(), $this->getMethodParameters($method))) ->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('print_r($%s->getResult());', $serviceVariableName), 1)) ->addChild('} else {') ->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('print_r($%s->getLastError());', $serviceVariableName), 1)) - ->addChild('}'); + ->addChild('}') + ; + return $this; } - /** - * @param MethodModel $method - * @return string - */ - protected function getMethodParameters(MethodModel $method) + + protected function getMethodParameters(MethodModel $method): string { $parameters = []; if (is_array($method->getParameterType())) { @@ -212,29 +192,25 @@ protected function getMethodParameters(MethodModel $method) } else { $parameters[] = $this->getMethodParameter($method->getParameterType()); } + return implode(', ', $parameters); } - /** - * @param string $parameterType - * @param string $parameterName - * @return string - */ - protected function getMethodParameter($parameterType, $parameterName = null) + + protected function getMethodParameter(?string $parameterType, ?string $parameterName = null): string { $parameter = sprintf('%1$s%2$s', (empty($parameterType) && empty($parameterName)) ? '' : '$', empty($parameterName) ? $parameterType : $parameterName); - $model = $parameterType !== null ? $this->getGenerator()->getStructByName($parameterType) : null; + $model = null !== $parameterType ? $this->getGenerator()->getStructByName($parameterType) : null; if ($model instanceof StructModel && $model->isStruct() && !$model->isRestriction()) { $parameter = sprintf('new %s()', $model->getPackagedName(true)); } + return $parameter; } - /** - * @param string[]|PhpAnnotation[] $content - * @return Tutorial - */ - protected function addAnnotationBlock($content) + + protected function addAnnotationBlock($content): self { $this->getFile()->getMainElement()->addChild(new PhpAnnotationBlock($content)); + return $this; } } diff --git a/src/File/Utils.php b/src/File/Utils.php index 05b7370a..51d3e2a7 100644 --- a/src/File/Utils.php +++ b/src/File/Utils.php @@ -1,68 +1,61 @@ getChildren()) === 1) { + // First line is the "The {propertyName}" + if (1 === count($block->getChildren())) { $block->addChild('Meta information extracted from the WSDL'); } + foreach ($validMeta as $meta) { $block->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, $meta, AbstractModelFile::ANNOTATION_META_LENGTH)); } } } - /** - * @param AbstractModel $model - * @param array $ignoreMeta - * @return string[] - */ - public static function getValidMetaValues(AbstractModel $model, array $ignoreMeta = []) + + public static function getValidMetaValues(AbstractModel $model, array $ignoreMeta = []): array { $meta = $model->getMeta(); $validMeta = []; foreach ($meta as $metaName => $metaValue) { - if (!in_array($metaName, $ignoreMeta, true)) { - $finalMeta = self::getMetaValueAnnotation($metaName, $metaValue); - if (is_scalar($finalMeta)) { - $validMeta[] = $finalMeta; - } + if (in_array($metaName, $ignoreMeta, true)) { + continue; + } + + $finalMeta = self::getMetaValueAnnotation($metaName, $metaValue); + if (is_scalar($finalMeta)) { + $validMeta[] = $finalMeta; } } + return $validMeta; } - /** - * @param string $metaName - * @param mixed $metaValue - * @return string|null - */ - public static function getMetaValueAnnotation($metaName, $metaValue) + + public static function getMetaValueAnnotation(string $metaName, $metaValue): ?string { $meta = null; if (is_array($metaValue)) { $metaValue = implode(' | ', array_unique($metaValue)); } - $metaValue = GeneratorUtils::cleanComment($metaValue, ', ', mb_stripos($metaName, 'SOAPHeader') === false); + + $metaValue = GeneratorUtils::cleanComment($metaValue, ', ', false === mb_stripos($metaName, 'SOAPHeader')); if (is_scalar($metaValue)) { $meta = sprintf("\t- %s: %s", $metaName, $metaValue); } + return $meta; } } diff --git a/src/File/Validation/AbstractBoundRule.php b/src/File/Validation/AbstractBoundRule.php index 6bce9229..8a80e949 100644 --- a/src/File/Validation/AbstractBoundRule.php +++ b/src/File/Validation/AbstractBoundRule.php @@ -1,22 +1,15 @@ symbol()) { case self::SYMBOL_MAX_EXCLUSIVE: case self::SYMBOL_MAX_INCLUSIVE: $checkValueDomain = '==='; + break; + default: $checkValueDomain = '!=='; + break; } - $test = 'false %5$s mb_strpos($%1$s, \'-\') && ($time = (string) time()) && \DateTime::createFromFormat(\'U\', $time)->%4$s(new \DateInterval(preg_replace(\'/(.*)(\.[0-9]*S)/\', \'$1S\', str_replace(\'-\', \'\', $%1$s)))) %3$s \DateTime::createFromFormat(\'U\', $time)->%4$s(new \DateInterval(preg_replace(\'/(.*)(\.[0-9]*S)/\', \'$1S\', \'%2$s\')))'; + $test = 'false %5$s mb_strpos((string) $%1$s, \'-\') && ($time = (string) time()) && \DateTime::createFromFormat(\'U\', $time)->%4$s(new \DateInterval(preg_replace(\'/(.*)(\.[0-9]*S)/\', \'$1S\', str_replace(\'-\', \'\', $%1$s)))) %3$s \DateTime::createFromFormat(\'U\', $time)->%4$s(new \DateInterval(preg_replace(\'/(.*)(\.[0-9]*S)/\', \'$1S\', \'%2$s\')))'; } - return sprintf(($itemType ? '' : '!is_null($%1$s) && ') . $test, $parameterName, $value, $this->symbol(), $method, $checkValueDomain); + + return sprintf(($itemType ? '' : '!is_null($%1$s) && ').$test, $parameterName, $value, $this->symbol(), $method, $checkValueDomain); } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - final public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + final public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { return sprintf('sprintf(\'Invalid value %%s, the value must be %s %s %s\', var_export($%4$s, true))', is_numeric($value) ? 'numerically' : 'chronologically', $this->comparisonString(), is_array($value) ? implode(',', array_unique($value)) : $value, $parameterName); } diff --git a/src/File/Validation/AbstractLengthRule.php b/src/File/Validation/AbstractLengthRule.php index c6b5f272..b8c77304 100644 --- a/src/File/Validation/AbstractLengthRule.php +++ b/src/File/Validation/AbstractLengthRule.php @@ -1,60 +1,51 @@ getAttribute()->isArray()) { - $test = sprintf(($itemType ? '' : '!is_null($%1$s) && ') . 'mb_strlen($%1$s) %3$s %2$d', $parameterName, $value, $this->symbol()); + $test = sprintf(($itemType ? '' : '!is_null($%1$s) && ').'mb_strlen((string) $%1$s) %3$s %2$d', $parameterName, $value, $this->symbol()); } else { $this->addValidationMethod($parameterName, $value); $test = sprintf('\'\' !== (%s = self::%s($%s))', $this->getErrorMessageVariableName($parameterName), $this->getValidationMethodName($parameterName), $parameterName); } + return $test; } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - final public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + final public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { if ($itemType || !$this->getAttribute()->isArray()) { - $message = sprintf('sprintf(\'Invalid length of %%s, the number of characters/octets contained by the literal must be %s %s\', mb_strlen($%s))', $this->comparisonString(), is_array($value) ? implode(',', array_unique($value)) : $value, $parameterName); + $message = sprintf('sprintf(\'Invalid length of %%s, the number of characters/octets contained by the literal must be %s %s\', mb_strlen((string) $%s))', $this->comparisonString(), is_array($value) ? implode(',', array_unique($value)) : $value, $parameterName); } else { $message = $this->getErrorMessageVariableName($parameterName); } + return $message; } - /** - * @param string $parameterName - * @param mixed $value - */ - protected function addValidationMethod($parameterName, $value) + public function getErrorMessageVariableName(string $parameterName): string + { + return sprintf('$%s%sErrorMessage', $parameterName, ucfirst($this->name())); + } + + protected function addValidationMethod(string $parameterName, $value): void { $method = new PhpMethod($this->getValidationMethodName($parameterName), [ new PhpFunctionParameter('values', PhpFunctionParameter::NO_VALUE), - ], PhpMethod::ACCESS_PUBLIC, false, true); + ], AbstractModelFile::TYPE_STRING, PhpMethod::ACCESS_PUBLIC, false, true); $itemName = sprintf('%s%sItem', lcfirst($this->getFile()->getModel()->getCleanName(false)), ucfirst($this->getAttribute()->getCleanName())); $method @@ -70,25 +61,14 @@ protected function addValidationMethod($parameterName, $value) ->addChild($method->getIndentedString(sprintf('$message = sprintf(\'Invalid length for value(s) %%s, the number of characters/octets contained by the literal must be %s %s\', implode(\', \', $invalidValues));', $this->comparisonString(), $value), 1)) ->addChild('}') ->addChild('unset($invalidValues);') - ->addChild('return $message;'); + ->addChild('') + ->addChild('return $message;') + ; $this->getMethods()->add($method); } - /** - * @param string $parameterName - * @return string - */ - protected function getValidationMethodName($parameterName) - { - return sprintf('validate%sFor%sConstraintFrom%s', ucfirst($parameterName), ucfirst($this->name()), ucFirst($this->getMethod()->getName())); - } - - /** - * @param string $parameterName - * @return string - */ - public function getErrorMessageVariableName($parameterName) + protected function getValidationMethodName(string $parameterName): string { - return sprintf('$%s%sErrorMessage', $parameterName, ucfirst($this->name())); + return sprintf('validate%sFor%sConstraintFrom%s', ucfirst($parameterName), ucfirst($this->name()), ucfirst($this->getMethod()->getName())); } } diff --git a/src/File/Validation/AbstractMinMaxRule.php b/src/File/Validation/AbstractMinMaxRule.php index b80e372d..f8c88160 100644 --- a/src/File/Validation/AbstractMinMaxRule.php +++ b/src/File/Validation/AbstractMinMaxRule.php @@ -1,70 +1,56 @@ '; + public const SYMBOL_MAX_EXCLUSIVE = '>='; + public const SYMBOL_MIN_INCLUSIVE = '<'; + public const SYMBOL_MIN_EXCLUSIVE = '<='; + public const SYMBOL_STRICT = '!=='; /** - * Symbol to use for max rule - * @var string - */ - const SYMBOL_MAX_INCLUSIVE = '>'; - - /** - * Symbol to use for max exclusive rule - * @var string - */ - const SYMBOL_MAX_EXCLUSIVE = '>='; - - /** - * Symbol to use for min rule - * @var string - */ - const SYMBOL_MIN_INCLUSIVE = '<'; - - /** - * Symbol to use for min exclusive rule - * @var string - */ - const SYMBOL_MIN_EXCLUSIVE = '<='; - - /** - * Symbol to use for strict rule - * @var string - */ - const SYMBOL_STRICT = '!=='; - - /** - * Must return the comparison symbol - * @return string + * Must return the comparison symbol. */ - abstract public function symbol(); + abstract public function symbol(): string; - /** - * @return string - */ - final public function comparisonString() + final public function comparisonString(): string { switch ($this->symbol()) { case self::SYMBOL_MAX_INCLUSIVE: $comparison = 'less than or equal to'; + break; + case self::SYMBOL_MIN_INCLUSIVE: $comparison = 'greater than or equal to'; + break; + case self::SYMBOL_MIN_EXCLUSIVE: $comparison = 'greater than'; + break; + case self::SYMBOL_MAX_EXCLUSIVE: $comparison = 'less than'; + break; + case self::SYMBOL_STRICT: $comparison = 'equal to'; + break; + default: - throw new \InvalidArgumentException(sprintf('Invalid value %s returned by symbol() method, can\'t determine comparison string', $this->symbol())); + throw new InvalidArgumentException(sprintf('Invalid value %s returned by symbol() method, can\'t determine comparison string', $this->symbol())); } + return $comparison; } } diff --git a/src/File/Validation/AbstractRule.php b/src/File/Validation/AbstractRule.php index c0ab951c..943b6099 100644 --- a/src/File/Validation/AbstractRule.php +++ b/src/File/Validation/AbstractRule.php @@ -1,134 +1,81 @@ rules = $rules; } - /** - * This method has to add the validation rule to the method's body - * @param string $parameterName - * @param string|string[] $value - * @param bool $itemType - * @return AbstractRule - */ - final public function applyRule($parameterName, $value, $itemType = false) + final public function applyRule(string $parameterName, $value, bool $itemType = false): void { $test = $this->testConditions($parameterName, $value, $itemType); if (!empty($test)) { $message = $this->exceptionMessageOnTestFailure($parameterName, $value, $itemType); - $this->getMethod() + $this + ->getMethod() ->addChild($this->validationRuleComment($value)) ->addChild(sprintf('if (%s) {', $test)) - ->addChild($this->getMethod()->getIndentedString(sprintf('throw new \InvalidArgumentException(%s, __LINE__);', $message), 1)) - ->addChild('}'); + ->addChild($this->getMethod()->getIndentedString(sprintf('throw new InvalidArgumentException(%s, __LINE__);', $message), 1)) + ->addChild('}') + ; unset($message); Rules::ruleHasBeenAppliedToAttribute($this, $value, $this->getAttribute()); } unset($test); } - /** - * @param string|string[] $value - * @return string - */ - final public function validationRuleComment($value) + final public function validationRuleComment($value): string { return sprintf('// %s %s%s', self::VALIDATION_RULE_COMMENT_SENTENCE, $this->name(), is_array($value) ? sprintf('(%s)', implode(', ', array_unique($value))) : (empty($value) ? '' : sprintf('(%s)', $value))); } - /** - * Name of the validation rule - * @return string - */ - abstract public function name(); - - /** - * Inline tests of the validation rule - * @param string $parameterName - * @param string|string[] $value - * @param bool $itemType - * @return string - */ - abstract public function testConditions($parameterName, $value, $itemType = false); - - /** - * Message when test fails in order to throw the exception - * @param string $parameterName - * @param string|string[] $value - * @param bool $itemType - * @return string - */ - abstract public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false); - - /** - * @return Rules - */ - public function getRules() + abstract public function name(): string; + + abstract public function testConditions(string $parameterName, $value, bool $itemType = false): string; + + abstract public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string; + + public function getRules(): Rules { return $this->rules; } - /** - * @return PhpMethod - */ - public function getMethod() + public function getMethod(): PhpMethod { return $this->rules->getMethod(); } - /** - * @return MethodContainer - */ - public function getMethods() + public function getMethods(): MethodContainer { return $this->rules->getMethods(); } - /** - * @return AbstractModelFile - */ - public function getFile() + public function getFile(): AbstractModelFile { return $this->rules->getFile(); } - /** - * @return StructAttributeModel - */ - public function getAttribute() + public function getAttribute(): StructAttributeModel { return $this->rules->getAttribute(); } - /** - * @return Generator - */ - public function getGenerator() + public function getGenerator(): Generator { return $this->rules->getGenerator(); } diff --git a/src/File/Validation/AbstractSetOfValuesRule.php b/src/File/Validation/AbstractSetOfValuesRule.php index e758a81f..80c06c37 100644 --- a/src/File/Validation/AbstractSetOfValuesRule.php +++ b/src/File/Validation/AbstractSetOfValuesRule.php @@ -1,56 +1,52 @@ mustApplyRuleOnAttribute()) { $this->addValidationMethod($parameterName, $value); - $test = sprintf('\'\' !== (%s = self::%s($%s))', self::getErrorMessageVariableName($parameterName), $this->getValidationMethodName($parameterName), $parameterName); + $test = sprintf('\'\' !== (%s = self::%s(%s))', static::getErrorMessageVariableName($parameterName), $this->getValidationMethodName($parameterName), static::getParameterPassedValue($parameterName)); } + return $test; } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string + { + return static::getErrorMessageVariableName($parameterName); + } + + public static function getErrorMessageVariableName(string $parameterName): string { - return self::getErrorMessageVariableName($parameterName); + return sprintf('$%sArrayErrorMessage', $parameterName); + } + + public static function getParameterPassedValue(string $parameterName): string + { + return sprintf('$%s', $parameterName); } /** - * @param string $parameterName - * @param mixed $value + * Must check the attribute validity according to the current rule. */ - protected function addValidationMethod($parameterName, $value) + abstract protected function mustApplyRuleOnAttribute(): bool; + + protected function addValidationMethod(string $parameterName, $value) { $method = new PhpMethod($this->getValidationMethodName($parameterName), [ new PhpFunctionParameter('values', [], 'array'), - ], PhpMethod::ACCESS_PUBLIC, false, true); + ], AbstractModelFile::TYPE_STRING, PhpMethod::ACCESS_PUBLIC, false, true); $model = $this->getFile()->getRestrictionFromStructAttribute($this->getAttribute()); $itemName = sprintf('%s%sItem', lcfirst($this->getFile()->getModel()->getCleanName(false)), ucfirst($this->getAttribute()->getCleanName())); $rules = clone $this->getRules(); @@ -74,25 +70,14 @@ protected function addValidationMethod($parameterName, $value) ->addChild($method->getIndentedString(sprintf('$message = %s;', $rule->exceptionMessageOnTestFailure('invalidValues', null)), 1)) ->addChild('}') ->addChild('unset($invalidValues);') - ->addChild('return $message;'); + ->addChild('') + ->addChild('return $message;') + ; $this->getMethods()->add($method); } - /** - * @param string $parameterName - * @return string - */ - protected function getValidationMethodName($parameterName) + protected function getValidationMethodName(string $parameterName): string { - return sprintf('validate%sForArrayConstraintsFrom%s', ucfirst($parameterName), ucFirst($this->getMethod()->getName())); - } - - /** - * @param string $parameterName - * @return string - */ - public static function getErrorMessageVariableName($parameterName) - { - return sprintf('$%sArrayErrorMessage', $parameterName); + return sprintf('validate%sForArrayConstraintsFrom%s', ucfirst($parameterName), ucfirst($this->getMethod()->getName())); } } diff --git a/src/File/Validation/ArrayRule.php b/src/File/Validation/ArrayRule.php index 4aa82afb..21c20ef5 100644 --- a/src/File/Validation/ArrayRule.php +++ b/src/File/Validation/ArrayRule.php @@ -1,22 +1,17 @@ getAttribute()->isArray(); } diff --git a/src/File/Validation/BoolRule.php b/src/File/Validation/BoolRule.php index 6b526496..1659493c 100644 --- a/src/File/Validation/BoolRule.php +++ b/src/File/Validation/BoolRule.php @@ -1,7 +1,9 @@ addValidationMethod($parameterName, $value); $test = sprintf('\'\' !== (%s = self::%s($%s))', self::getErrorMessageVariableName($parameterName), $this->getValidationMethodName($parameterName), $parameterName); } + return $test; } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { return self::getErrorMessageVariableName($parameterName); } - /** - * @param string $parameterName - * @param string[] $choiceNames - */ - protected function addValidationMethod($parameterName, array $choiceNames) + public static function getErrorMessageVariableName(string $parameterName): string + { + return sprintf('$%sChoiceErrorMessage', $parameterName); + } + + protected function addValidationMethod(string $parameterName, array $choiceNames) { $attribute = $this->getAttribute(); $struct = $attribute->getOwner(); @@ -61,14 +50,15 @@ protected function addValidationMethod($parameterName, array $choiceNames) $method = new PhpMethod($this->getValidationMethodName($parameterName), [ new PhpFunctionParameter('value', PhpFunctionParameter::NO_VALUE), - ]); + ], AbstractModelFile::TYPE_STRING); $method ->addChild('$message = \'\';') ->addChild('if (is_null($value)) {') ->addChild($method->getIndentedString('return $message;', 1)) ->addChild('}') - ->addChild('$properties = ['); + ->addChild('$properties = [') + ; array_walk($choiceAttributes, function (StructAttribute $choiceAttribute) use ($method) { $method->addChild($method->getIndentedString(sprintf('%s,', var_export($choiceAttribute->getCleanName(), true)), 1)); @@ -79,32 +69,21 @@ protected function addValidationMethod($parameterName, array $choiceNames) ->addChild('try {') ->addChild($method->getIndentedString('foreach ($properties as $property) {', 1)) ->addChild($method->getIndentedString('if (isset($this->{$property})) {', 2)) - ->addChild($method->getIndentedString(sprintf('throw new \InvalidArgumentException(sprintf(\'The property %1$s can\\\'t be set as the property %%s is already set. Only one property must be set among these properties: %1$s, %%s.\', $property, implode(\', \', $properties)), __LINE__);', $attribute->getName()), 3)) + ->addChild($method->getIndentedString(sprintf('throw new InvalidArgumentException(sprintf(\'The property %1$s can\\\'t be set as the property %%s is already set. Only one property must be set among these properties: %1$s, %%s.\', $property, implode(\', \', $properties)), __LINE__);', $attribute->getName()), 3)) ->addChild($method->getIndentedString(sprintf('}'), 2)) ->addChild($method->getIndentedString('}', 1)) - ->addChild('} catch (\InvalidArgumentException $e) {') + ->addChild('} catch (InvalidArgumentException $e) {') ->addChild($method->getIndentedString('$message = $e->getMessage();', 1)) ->addChild('}') - ->addChild('return $message;'); + ->addChild('') + ->addChild('return $message;') + ; $this->getMethods()->add($method); } - /** - * @param string $parameterName - * @return string - */ - protected function getValidationMethodName($parameterName) + protected function getValidationMethodName(string $parameterName): string { - return sprintf('validate%sForChoiceConstraintsFrom%s', ucfirst($parameterName), ucFirst($this->getMethod()->getName())); - } - - /** - * @param string $parameterName - * @return string - */ - public static function getErrorMessageVariableName($parameterName) - { - return sprintf('$%sChoiceErrorMessage', $parameterName); + return sprintf('validate%sForChoiceConstraintsFrom%s', ucfirst($parameterName), ucfirst($this->getMethod()->getName())); } } diff --git a/src/File/Validation/EnumerationRule.php b/src/File/Validation/EnumerationRule.php index caea07f9..b1ad8d23 100644 --- a/src/File/Validation/EnumerationRule.php +++ b/src/File/Validation/EnumerationRule.php @@ -1,70 +1,52 @@ getRestrictionModel()) { $test = sprintf('!%s::%s($%s)', $this->getRestrictionModel()->getPackagedName(true), StructEnum::METHOD_VALUE_IS_VALID, $parameterName); } + return $test; } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { $exceptionMessage = ''; - if ($this->getRestrictionModel()) { - $exceptionMessage = sprintf('sprintf(\'Invalid value(s) %%s, please use one of: %%s from enumeration class %2$s\', is_array($%1$s) ? implode(\', \', $%1$s) : var_export($%1$s, true), implode(\', \', %2$s::%3$s()))', $parameterName, $this->getRestrictionModel()->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES); + if ($restrictionModel = $this->getRestrictionModel()) { + $exceptionMessage = sprintf('sprintf(\'Invalid value(s) %%s, please use one of: %%s from enumeration class %2$s\', is_array($%1$s) ? implode(\', \', $%1$s) : var_export($%1$s, true), implode(\', \', %2$s::%3$s()))', $parameterName, $restrictionModel->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES); } + return $exceptionMessage; } - /** - * @return Struct|null - */ - protected function getRestrictionModel() + protected function getRestrictionModel(): ?Struct { if (!$this->model) { $this->model = $this->getFile()->getRestrictionFromStructAttribute($this->getAttribute()); } + return $this->model; } } diff --git a/src/File/Validation/FloatRule.php b/src/File/Validation/FloatRule.php index 0a0e869c..44085a85 100644 --- a/src/File/Validation/FloatRule.php +++ b/src/File/Validation/FloatRule.php @@ -1,36 +1,22 @@ %2$d', $parameterName, $value); + return sprintf(($itemType ? '' : '!is_null($%1$s) && ').'mb_strlen(mb_substr((string) $%1$s, false !== mb_strpos((string) $%1$s, \'.\') ? mb_strpos((string) $%1$s, \'.\') + 1 : mb_strlen((string) $%1$s))) > %2$d', $parameterName, $value); } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { - return sprintf('sprintf(\'Invalid value %%s, the value must at most contain %1$d fraction digits, %%d given\', var_export($%2$s, true), mb_strlen(mb_substr($%2$s, mb_strpos($%2$s, \'.\') + 1)))', $value, $parameterName); + return sprintf('sprintf(\'Invalid value %%s, the value must at most contain %1$d fraction digits, %%d given\', var_export($%2$s, true), mb_strlen(mb_substr((string) $%2$s, mb_strpos((string) $%2$s, \'.\') + 1)))', $value, $parameterName); } } diff --git a/src/File/Validation/IntRule.php b/src/File/Validation/IntRule.php index ba746839..33296d73 100644 --- a/src/File/Validation/IntRule.php +++ b/src/File/Validation/IntRule.php @@ -1,36 +1,22 @@ getItemSanityCheck($parameterName)); } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { - return sprintf('sprintf(\'The %1$s property can only contain items of type %2$s, %%s given\', is_object($%3$s) ? get_class($%3$s) : (is_array($%3$s) ? implode(\', \', $%3$s) : gettype($%3$s)))', $this->getAttribute()->getCleanName(), $this->getFile()->getStructAttributeType($this->getAttribute(), true), $parameterName); + return sprintf('sprintf(\'The %1$s property can only contain items of type %2$s, %%s given\', is_object($%3$s) ? get_class($%3$s) : (is_array($%3$s) ? implode(\', \', $%3$s) : gettype($%3$s)))', $this->getAttribute()->getCleanName(), $this->getFile()->getStructAttributeTypeAsPhpType($this->getAttribute(), false), $parameterName); } /** * The second case which used PHP native functions is voluntarily limited by the native functions provided by PHP, - * and the possible types defined in xsd_types.yml - * @param string $itemName - * @return string + * and the possible types defined in xsd_types.yml. */ - protected function getItemSanityCheck($itemName) + protected function getItemSanityCheck(string $itemName): string { $model = $this->getFile()->getModelFromStructAttribute($this->getAttribute()); $sanityCheck = 'false'; if ($model instanceof Struct && !$model->isList() && ($model->isStruct() || ($model->isArray() && $model->getInheritanceStruct() instanceof Struct))) { - $sanityCheck = sprintf('!$%s instanceof %s', $itemName, $this->getFile()->getStructAttributeType($this->getAttribute(), true)); + $sanityCheck = sprintf('!$%s instanceof %s', $itemName, $this->getFile()->getStructAttributeTypeAsPhpType($this->getAttribute(), false)); + } elseif ($this->getAttribute()->isXml()) { + $sanityCheck = $this->getRules()->getXmlRule()->testConditions($itemName, null, true); } else { - $type = AbstractModelFile::getPhpType($this->getFile()->getStructAttributeType($this->getAttribute())); + $type = $this->getFile()->getStructAttributeTypeAsPhpType($this->getAttribute(), false); if ($rule = $this->getRules()->getRule($type)) { $sanityCheck = $rule->testConditions($itemName, null, true); } } + return $sanityCheck; } } diff --git a/src/File/Validation/LengthRule.php b/src/File/Validation/LengthRule.php index ea55912f..c8390fb3 100644 --- a/src/File/Validation/LengthRule.php +++ b/src/File/Validation/LengthRule.php @@ -1,10 +1,11 @@ getAttribute()->isList(); } diff --git a/src/File/Validation/MaxExclusiveRule.php b/src/File/Validation/MaxExclusiveRule.php index 473a9732..9a7f96f3 100644 --- a/src/File/Validation/MaxExclusiveRule.php +++ b/src/File/Validation/MaxExclusiveRule.php @@ -1,11 +1,12 @@ getAttribute()->isArray() && ((is_scalar($value) && 'unbounded' !== $value) || (is_array($value) && !in_array('unbounded', $value)))) { @@ -66,22 +58,18 @@ final public function testConditions($parameterName, $value, $itemType = false) } $test = sprintf($test, $this->getAttribute()->getCleanName(), $value, $symbol, $parameterName); } + return $test; } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - final public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + final public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { if ($itemType) { $message = 'sprintf(\'You can\\\'t add anymore element to this property that already contains %%s elements, the number of elements contained by the property must be %1$s %2$s\', count($this->%4$s))'; } else { $message = 'sprintf(\'Invalid count of %%s, the number of elements contained by the property must be %1$s %2$s\', count($%3$s))'; } + return sprintf($message, $this->comparisonString(), is_array($value) ? implode(',', array_unique($value)) : $value, $parameterName, $this->getAttribute()->getCleanName()); } } diff --git a/src/File/Validation/MinExclusiveRule.php b/src/File/Validation/MinExclusiveRule.php index 5382bb6b..48af5ea1 100644 --- a/src/File/Validation/MinExclusiveRule.php +++ b/src/File/Validation/MinExclusiveRule.php @@ -1,11 +1,12 @@ file = $file; @@ -49,14 +30,12 @@ public function __construct(AbstractModelFile $file, PhpMethod $method, StructAt $this->methods = $methods; } - /** - * @param string $parameterName - * @param bool $itemType - */ - public function applyRules($parameterName, $itemType = false) + public function applyRules(string $parameterName, bool $itemType = false): void { if ($this->attribute->isArray() && !$itemType) { $this->getArrayRule()->applyRule($parameterName, null, $itemType); + } elseif ($this->attribute->isXml() && !$itemType) { + $this->getXmlRule()->applyRule($parameterName, null, $itemType); } elseif ($this->attribute->isList() && !$itemType) { $this->getListRule()->applyRule($parameterName, null, $itemType); } elseif ($this->getFile()->getRestrictionFromStructAttribute($this->attribute)) { @@ -69,159 +48,104 @@ public function applyRules($parameterName, $itemType = false) $this->applyRulesFromAttribute($parameterName, $itemType); } - /** - * Generic method to apply rules from current model - * @param string $parameterName - * @param bool $itemType - */ - protected function applyRulesFromAttribute($parameterName, $itemType = false) + public function getRule(string $name): ?AbstractRule { - foreach ($this->attribute->getMeta() as $metaName => $metaValue) { - $rule = $this->getRule($metaName); - if ($rule instanceof AbstractRule) { - $rule->applyRule($parameterName, $metaValue, $itemType); - } - } + $className = sprintf('%s\%sRule', __NAMESPACE__, ucfirst($name)); + + return class_exists($className) ? new $className($this) : null; } - /** - * @param string $name - * @return AbstractRule|null - */ - public function getRule($name) + public function getArrayRule(): ArrayRule { - if (is_string($name)) { - $className = sprintf('%s\%sRule', __NAMESPACE__, ucfirst($name)); - if (class_exists($className)) { - return new $className($this); - } - } - return null; + return $this->getRule('array'); } - /** - * @return ArrayRule - */ - public function getArrayRule() + public function getXmlRule(): XmlRule { - return $this->getRule('array'); + return $this->getRule('xml'); } - /** - * @return EnumerationRule - */ - public function getEnumerationRule() + public function getEnumerationRule(): EnumerationRule { return $this->getRule('enumeration'); } - /** - * @return ItemTypeRule - */ - public function getItemTypeRule() + public function getItemTypeRule(): ItemTypeRule { return $this->getRule('itemType'); } - /** - * @return ListRule - */ - public function getListRule() + public function getListRule(): ListRule { return $this->getRule('list'); } - /** - * @return StructAttribute - */ - public function getAttribute() + + public function getAttribute(): StructAttribute { return $this->attribute; } - /** - * @param StructAttribute $attribute - * @return Rules - */ - public function setAttribute(StructAttribute $attribute) + public function setAttribute(StructAttribute $attribute): self { $this->attribute = $attribute; + return $this; } - /** - * @return AbstractModelFile - */ - public function getFile() + public function getFile(): AbstractModelFile { return $this->file; } - /** - * @return PhpMethod - */ - public function getMethod() + public function getMethod(): PhpMethod { return $this->method; } - /** - * @param PhpMethod $method - * @return Rules - */ - public function setMethod(PhpMethod $method) + public function setMethod(PhpMethod $method): self { $this->method = $method; + return $this; } - /** - * @return MethodContainer - */ - public function getMethods() + + public function getMethods(): MethodContainer { return $this->methods; } - /** - * @return Generator - */ - public function getGenerator() + + public function getGenerator(): Generator { return $this->file->getGenerator(); } - /** - * @param AbstractRule $rule - * @param string|string[] $value - * @param StructAttribute $attribute - * @return string - */ - private static function getAppliedRuleToAttributeKey(AbstractRule $rule, $value, StructAttribute $attribute) + public static function ruleHasBeenAppliedToAttribute(AbstractRule $rule, $value, StructAttribute $attribute): void { - return implode('_', [ - $rule->validationRuleComment($value), - $attribute->getOwner()->getName(), - $attribute->getName(), - ]); + self::$rulesAppliedToAttribute[self::getAppliedRuleToAttributeKey($rule, $value, $attribute)] = true; } - /** - * @param AbstractRule $rule - * @param string|string[] $value - * @param StructAttribute $attribute - * @retrun void - */ - public static function ruleHasBeenAppliedToAttribute(AbstractRule $rule, $value, StructAttribute $attribute) + public static function hasRuleBeenAppliedToAttribute(AbstractRule $rule, $value, StructAttribute $attribute): bool { - self::$rulesAppliedToAttribute[self::getAppliedRuleToAttributeKey($rule, $value, $attribute)] = true; + return array_key_exists(self::getAppliedRuleToAttributeKey($rule, $value, $attribute), self::$rulesAppliedToAttribute); } - /** - * @param AbstractRule $rule - * @param string|string[] $value - * @param StructAttribute $attribute - * @return bool - */ - public static function hasRuleBeenAppliedToAttribute(AbstractRule $rule, $value, StructAttribute $attribute) + private function applyRulesFromAttribute(string $parameterName, bool $itemType = false): void { - return array_key_exists(self::getAppliedRuleToAttributeKey($rule, $value, $attribute), self::$rulesAppliedToAttribute); + foreach ($this->attribute->getMeta() as $metaName => $metaValue) { + if (!($rule = $this->getRule($metaName)) instanceof AbstractRule) { + continue; + } + + $rule->applyRule($parameterName, $metaValue, $itemType); + } + } + + private static function getAppliedRuleToAttributeKey(AbstractRule $rule, $value, StructAttribute $attribute): string + { + return implode('_', [ + $rule->validationRuleComment($value), + $attribute->getOwner()->getName(), + $attribute->getName(), + ]); } } diff --git a/src/File/Validation/StringRule.php b/src/File/Validation/StringRule.php index e8a37af0..16d7e989 100644 --- a/src/File/Validation/StringRule.php +++ b/src/File/Validation/StringRule.php @@ -1,36 +1,22 @@ %2$d', $parameterName, $value); + return sprintf(($itemType ? '' : '!is_null($%1$s) && ').'mb_strlen(preg_replace(\'/(\D)/\', \'\', (string) $%1$s)) > %2$d', $parameterName, $value); } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { - return sprintf('sprintf(\'Invalid value %%s, the value must use at most %1$d digits, "%%d" given\', var_export($%2$s, true), mb_strlen(preg_replace(\'/(\D)/\', \'\', $%2$s)))', $value, $parameterName); + return sprintf('sprintf(\'Invalid value %%s, the value must use at most %1$d digits, "%%d" given\', var_export($%2$s, true), mb_strlen(preg_replace(\'/(\D)/\', \'\', (string) $%2$s)))', $value, $parameterName); } } diff --git a/src/File/Validation/UnionRule.php b/src/File/Validation/UnionRule.php index 74e2b02f..1096e8e0 100644 --- a/src/File/Validation/UnionRule.php +++ b/src/File/Validation/UnionRule.php @@ -1,58 +1,46 @@ addValidationMethod($parameterName, $value); $test = sprintf('\'\' !== (%s = self::%s($%s))', self::getErrorMessageVariableName($parameterName), $this->getValidationMethodName($parameterName), $parameterName); } + return $test; } - /** - * @param string $parameterName - * @param mixed $value - * @param bool $itemType - * @return string - */ - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { return self::getErrorMessageVariableName($parameterName); } - /** - * @param string $parameterName - * @param string[] $unionValues - */ - protected function addValidationMethod($parameterName, array $unionValues) + public static function getErrorMessageVariableName(string $parameterName): string + { + return sprintf('$%sUnionErrorMessage', $parameterName); + } + + protected function addValidationMethod(string $parameterName, array $unionValues): void { $method = new PhpMethod('temp'); $rules = clone $this->getRules(); @@ -64,7 +52,8 @@ protected function addValidationMethod($parameterName, array $unionValues) $attribute->setOwner($this->getAttribute()->getOwner()); $rules ->setAttribute($attribute) - ->applyRules('value'); + ->applyRules('value') + ; unset($attribute); } @@ -77,17 +66,16 @@ protected function addValidationMethod($parameterName, array $unionValues) $methodChildren = $method->getChildren(); $childrenCount = count($methodChildren); $existingValidationRules = []; - for ($i = 0;$i < $childrenCount;$i += 4) { + for ($i = 0; $i < $childrenCount; $i += 4) { $validationRules = array_slice($methodChildren, ((int) $i / 4) * 4, 4); if (!in_array($validationRules, $existingValidationRules)) { foreach ($validationRules as $validationRuleIndex => $validationRule) { - // avoid having a validation rule that has already been applied to the attribute within the method which is calling the validate method if (0 === $validationRuleIndex) { $ruleParts = []; preg_match(sprintf('/%s\s(\w*)(.*)?/', self::VALIDATION_RULE_COMMENT_SENTENCE), $validationRule, $ruleParts); if (3 === count($ruleParts) && !empty($ruleParts[1]) && $rules->getRule($ruleParts[1]) instanceof AbstractRule && Rules::hasRuleBeenAppliedToAttribute($rules->getRule($ruleParts[1]), $ruleParts[2], $this->getAttribute())) { - continue(2); + continue 2; } } @@ -107,36 +95,26 @@ protected function addValidationMethod($parameterName, array $unionValues) // populate final validation method $method = new PhpMethod($this->getValidationMethodName($parameterName), [ new PhpFunctionParameter('value', PhpFunctionParameter::NO_VALUE), - ], PhpMethod::ACCESS_PUBLIC, false, true); + ], AbstractModelFile::TYPE_STRING, PhpMethod::ACCESS_PUBLIC, false, true); $method->addChild('$message = \'\';'); array_walk($children, [ $method, 'addChild', ]); + $method ->addChild(sprintf('if (%s) {', implode(' && ', $exceptionsTests))) - ->addChild($method->getIndentedString(sprintf('$message = sprintf("The value %%s does not match any of the union rules: %s. See following errors:\n%%s", var_export($value, true), implode("\n", array_map(function(\InvalidArgumentException $e) { return sprintf(\' - %%s\', $e->getMessage()); }, [%s])));', implode(', ', $unionValues), implode(', ', $exceptionsArray)), 1)) + ->addChild($method->getIndentedString(sprintf('$message = sprintf("The value %%s does not match any of the union rules: %s. See following errors:\n%%s", var_export($value, true), implode("\n", array_map(function(InvalidArgumentException $e) { return sprintf(\' - %%s\', $e->getMessage()); }, [%s])));', implode(', ', $unionValues), implode(', ', $exceptionsArray)), 1)) ->addChild('}') ->addChild(sprintf('unset(%s);', implode(', ', $exceptionsArray))) - ->addChild('return $message;'); + ->addChild('') + ->addChild('return $message;') + ; $this->getMethods()->add($method); } - /** - * @param string $parameterName - * @return string - */ - protected function getValidationMethodName($parameterName) - { - return sprintf('validate%sForUnionConstraintsFrom%s', ucfirst($parameterName), ucFirst($this->getMethod()->getName())); - } - - /** - * @param string $parameterName - * @return string - */ - public static function getErrorMessageVariableName($parameterName) + protected function getValidationMethodName(string $parameterName): string { - return sprintf('$%sUnionErrorMessage', $parameterName); + return sprintf('validate%sForUnionConstraintsFrom%s', ucfirst($parameterName), ucfirst($this->getMethod()->getName())); } } diff --git a/src/File/Validation/XmlRule.php b/src/File/Validation/XmlRule.php new file mode 100644 index 00000000..6c7618d2 --- /dev/null +++ b/src/File/Validation/XmlRule.php @@ -0,0 +1,23 @@ +loadXML($%1$s)))))', $parameterName); + } + + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string + { + return sprintf('sprintf(\'Invalid value %%s, please provide a valid XML string\', var_export($%1$s, true))', $parameterName); + } +} diff --git a/src/Generator/AbstractGeneratorAware.php b/src/Generator/AbstractGeneratorAware.php index d2164879..d3615522 100644 --- a/src/Generator/AbstractGeneratorAware.php +++ b/src/Generator/AbstractGeneratorAware.php @@ -1,34 +1,27 @@ setGenerator($generator); } - /** - * @param Generator $generator - * @return AbstractGeneratorAware - */ - protected function setGenerator(Generator $generator) + + public function getGenerator(): ?Generator { - $this->generator = $generator; - return $this; + return $this->generator; } - /** - * @return Generator - */ - public function getGenerator() + + protected function setGenerator(Generator $generator): self { - return $this->generator; + $this->generator = $generator; + + return $this; } } diff --git a/src/Generator/Generator.php b/src/Generator/Generator.php index bd18a475..5479c623 100644 --- a/src/Generator/Generator.php +++ b/src/Generator/Generator.php @@ -1,244 +1,100 @@ setOptions($options)->initialize(); - } - /** - * @return Generator - */ - protected function initialize() - { - return $this->initContainers() - ->initParsers() - ->initFiles() - ->initSoapClient() - ->initWsdl(); - } - /** - * @throws \InvalidArgumentException - * @return Generator - */ - protected function initSoapClient() - { - if (!isset($this->soapClient)) { - $this->soapClient = new GeneratorSoapClient($this); - } - return $this; - } - /** - * @return Generator - */ - protected function initContainers() - { - if (!isset($this->containers)) { - $this->containers = new GeneratorContainers($this); - } - return $this; - } - /** - * @return Generator - */ - protected function initParsers() - { - if (!isset($this->parsers)) { - $this->parsers = new GeneratorParsers($this); - } - return $this; + $this + ->setOptions($options) + ->initialize() + ; } - /** - * @return GeneratorParsers - */ - public function getParsers() + + public function getParsers(): GeneratorParsers { return $this->parsers; } - /** - * @return Generator - */ - protected function initFiles() - { - if (!isset($this->files)) { - $this->files = new GeneratorFiles($this); - } - return $this; - } - /** - * @return GeneratorFiles - */ - public function getFiles() + + public function getFiles(): GeneratorFiles { return $this->files; } - /** - * @throws \InvalidArgumentException - * @return Generator - */ - protected function initDirectory() - { - Utils::createDirectory($this->getOptions()->getDestination()); - if (!is_writable($this->getOptionDestination())) { - throw new \InvalidArgumentException(sprintf('Unable to use dir "%s" as dir does not exists, its creation has been impossible or it\'s not writable', $this->getOptionDestination()), __LINE__); - } - return $this; - } - /** - * @return Generator - */ - protected function initWsdl() - { - $this->setWsdl(new Wsdl($this, $this->getOptionOrigin(), $this->getUrlContent($this->getOptionOrigin()))); - return $this; - } - /** - * @return Generator - */ - protected function doSanityChecks() - { - $destination = $this->getOptionDestination(); - if (empty($destination)) { - throw new \InvalidArgumentException('Package\'s destination must be defined', __LINE__); - } - $composerName = $this->getOptionComposerName(); - if ($this->getOptionStandalone() && empty($composerName)) { - throw new \InvalidArgumentException('Package\'s composer name must be defined', __LINE__); - } - return $this; - } - /** - * @return Generator - */ - protected function doParse() - { - $this->parsers->doParse(); - return $this; - } - /** - * @return Generator - */ - protected function doGenerate() - { - $this->files->doGenerate(); - return $this; - } - /** - * Generates all classes based on options - * @return Generator - */ - public function generatePackage() + + public function generatePackage(): self { return $this ->doSanityChecks() ->parse() ->initDirectory() - ->doGenerate(); + ->doGenerate() + ; } - /** - * Only parses what has to be parsed, called before actually generating the package - * @return Generator - */ - public function parse() + + public function parse(): self { return $this->doParse(); } + /** * Gets the struct by its name - * Starting from issue #157, we know call getVirtual secondly as structs are now betterly parsed and so is their inheritance/type is detected - * @uses Generator::getStructs() + * Starting from issue #157, we know call getVirtual secondly as structs are now betterly parsed and so is their inheritance/type is detected. + * * @param string $structName the original struct name - * @return Struct|null + * + * @uses Generator::getStructs() */ - public function getStructByName($structName) + public function getStructByName(string $structName): ?Struct { $struct = $this->getStructs()->getStructByName($structName); + return $struct ? $struct : $this->getStructs()->getVirtual($structName); } - /** - * Gets the struct by its name and type - * @uses Generator::getStructs() - * @param string $structName the original struct name - * @param string $type the original struct type - * @return Struct|null - */ - public function getStructByNameAndType($structName, $type) + + public function getStructByNameAndType(string $structName, string $type): ?Struct { return $this->getStructs()->getStructByNameAndType($structName, $type); } - /** - * Gets a service by its name - * @param string $serviceName the service name - * @return Service|null - */ - public function getService($serviceName) + + public function getService(string $serviceName): ?Service { return $this->getServices()->getServiceByName($serviceName); } - /** - * Returns the method - * @uses Generator::getServiceName() - * @uses Generator::getService() - * @uses Service::getMethod() - * @param string $methodName the original function name - * @return Method|null - */ - public function getServiceMethod($methodName) + + public function getServiceMethod(string $methodName): ?Method { return $this->getService($this->getServiceName($methodName)) instanceof Service ? $this->getService($this->getServiceName($methodName))->getMethod($methodName) : null; } - /** - * @param bool $usingGatherMethods allows to gather methods within a single service if gather_methods options is set to true - * @return ServiceContainer - */ - public function getServices($usingGatherMethods = false) + + public function getServices(bool $usingGatherMethods = false): ServiceContainer { $services = $this->containers->getServices(); if ($usingGatherMethods && GeneratorOptions::VALUE_NONE === $this->getOptionGatherMethods()) { @@ -252,451 +108,596 @@ public function getServices($usingGatherMethods = false) $serviceContainer->add($serviceModel); $services = $serviceContainer; } + return $services; } - /** - * @return StructContainer - */ - public function getStructs() + + public function getStructs(): StructContainer { return $this->containers->getStructs(); } + /** - * Sets the optionCategory value + * Sets the optionCategory value. + * * @return string */ public function getOptionCategory() { return $this->options->getCategory(); } + /** - * Sets the optionCategory value + * Sets the optionCategory value. + * * @param string $category + * * @return Generator */ public function setOptionCategory($category) { $this->options->setCategory($category); + return $this; } + /** - * Sets the optionGatherMethods value + * Sets the optionGatherMethods value. + * * @return string */ public function getOptionGatherMethods() { return $this->options->getGatherMethods(); } + /** - * Sets the optionGatherMethods value + * Sets the optionGatherMethods value. + * * @param string $gatherMethods + * * @return Generator */ public function setOptionGatherMethods($gatherMethods) { $this->options->setGatherMethods($gatherMethods); + return $this; } + /** - * Gets the optionGenericConstantsNames value + * Gets the optionGenericConstantsNames value. + * * @return bool */ public function getOptionGenericConstantsNames() { return $this->options->getGenericConstantsName(); } + /** - * Sets the optionGenericConstantsNames value + * Sets the optionGenericConstantsNames value. + * * @param bool $genericConstantsNames + * * @return Generator */ public function setOptionGenericConstantsNames($genericConstantsNames) { $this->options->setGenericConstantsName($genericConstantsNames); + return $this; } + /** - * Gets the optionGenerateTutorialFile value + * Gets the optionGenerateTutorialFile value. + * * @return bool */ public function getOptionGenerateTutorialFile() { return $this->options->getGenerateTutorialFile(); } + /** - * Sets the optionGenerateTutorialFile value + * Sets the optionGenerateTutorialFile value. + * * @param bool $generateTutorialFile + * * @return Generator */ public function setOptionGenerateTutorialFile($generateTutorialFile) { $this->options->setGenerateTutorialFile($generateTutorialFile); + return $this; } + /** - * Gets the optionNamespacePrefix value + * Gets the optionNamespacePrefix value. + * * @return string */ public function getOptionNamespacePrefix() { return $this->options->getNamespace(); } + /** - * Sets the optionGenerateTutorialFile value + * Sets the optionGenerateTutorialFile value. + * * @param string $namespace + * * @return Generator */ public function setOptionNamespacePrefix($namespace) { $this->options->setNamespace($namespace); + return $this; } + /** - * Gets the optionAddComments value + * Gets the optionAddComments value. + * * @return array */ public function getOptionAddComments() { return $this->options->getAddComments(); } + /** - * Sets the optionAddComments value + * Sets the optionAddComments value. + * * @param array $addComments + * * @return Generator */ public function setOptionAddComments($addComments) { $this->options->setAddComments($addComments); + return $this; } + /** - * Gets the optionStandalone value + * Gets the optionStandalone value. + * * @return bool */ public function getOptionStandalone() { return $this->options->getStandalone(); } + /** - * Sets the optionStandalone value + * Sets the optionStandalone value. + * * @param bool $standalone + * * @return Generator */ public function setOptionStandalone($standalone) { $this->options->setStandalone($standalone); + return $this; } + /** - * Gets the optionValidation value + * Gets the optionValidation value. + * * @return bool */ public function getOptionValidation() { return $this->options->getValidation(); } + /** - * Sets the optionValidation value + * Sets the optionValidation value. + * * @param bool $validation + * * @return Generator */ public function setOptionValidation($validation) { $this->options->setValidation($validation); + return $this; } + /** - * Gets the optionStructClass value + * Gets the optionStructClass value. + * * @return string */ public function getOptionStructClass() { return $this->options->getStructClass(); } + /** - * Sets the optionStructClass value + * Sets the optionStructClass value. + * * @param string $structClass + * * @return Generator */ public function setOptionStructClass($structClass) { $this->options->setStructClass($structClass); + return $this; } + /** - * Gets the optionStructArrayClass value + * Gets the optionStructArrayClass value. + * * @return string */ public function getOptionStructArrayClass() { return $this->options->getStructArrayClass(); } + /** - * Sets the optionStructArrayClass value + * Sets the optionStructArrayClass value. + * * @param string $structArrayClass + * * @return Generator */ public function setOptionStructArrayClass($structArrayClass) { $this->options->setStructArrayClass($structArrayClass); + return $this; } + /** - * Gets the optionStructEnumClass value + * Gets the optionStructEnumClass value. + * * @return string */ public function getOptionStructEnumClass() { return $this->options->getStructEnumClass(); } + /** - * Sets the optionStructEnumClass value + * Sets the optionStructEnumClass value. + * * @param string $structEnumClass + * * @return Generator */ public function setOptionStructEnumClass($structEnumClass) { $this->options->setStructEnumClass($structEnumClass); + return $this; } + /** - * Gets the optionSoapClientClass value + * Gets the optionSoapClientClass value. + * * @return string */ public function getOptionSoapClientClass() { return $this->options->getSoapClientClass(); } + /** - * Sets the optionSoapClientClass value + * Sets the optionSoapClientClass value. + * * @param string $soapClientClass + * * @return Generator */ public function setOptionSoapClientClass($soapClientClass) { $this->options->setSoapClientClass($soapClientClass); + return $this; } + /** - * Gets the package name prefix + * Gets the package name prefix. + * * @param bool $ucFirst ucfirst package name prefix or not + * * @return string */ public function getOptionPrefix($ucFirst = true) { return $ucFirst ? ucfirst($this->getOptions()->getPrefix()) : $this->getOptions()->getPrefix(); } + /** - * Sets the package name prefix + * Sets the package name prefix. + * * @param string $optionPrefix + * * @return Generator */ public function setOptionPrefix($optionPrefix) { $this->options->setPrefix($optionPrefix); + return $this; } + /** - * Gets the package name suffix + * Gets the package name suffix. + * * @param bool $ucFirst ucfirst package name suffix or not + * * @return string */ public function getOptionSuffix($ucFirst = true) { return $ucFirst ? ucfirst($this->getOptions()->getSuffix()) : $this->getOptions()->getSuffix(); } + /** - * Sets the package name suffix + * Sets the package name suffix. + * * @param string $optionSuffix + * * @return Generator */ public function setOptionSuffix($optionSuffix) { $this->options->setSuffix($optionSuffix); + return $this; } + /** - * Gets the optionBasicLogin value + * Gets the optionBasicLogin value. + * * @return string */ public function getOptionBasicLogin() { return $this->options->getBasicLogin(); } + /** - * Sets the optionBasicLogin value + * Sets the optionBasicLogin value. + * * @param string $optionBasicLogin + * * @return Generator */ public function setOptionBasicLogin($optionBasicLogin) { $this->options->setBasicLogin($optionBasicLogin); + return $this; } + /** - * Gets the optionBasicPassword value + * Gets the optionBasicPassword value. + * * @return string */ public function getOptionBasicPassword() { return $this->options->getBasicPassword(); } + /** - * Sets the optionBasicPassword value + * Sets the optionBasicPassword value. + * * @param string $optionBasicPassword + * * @return Generator */ public function setOptionBasicPassword($optionBasicPassword) { $this->options->setBasicPassword($optionBasicPassword); + return $this; } + /** - * Gets the optionProxyHost value + * Gets the optionProxyHost value. + * * @return string */ public function getOptionProxyHost() { return $this->options->getProxyHost(); } + /** - * Sets the optionProxyHost value + * Sets the optionProxyHost value. + * * @param string $optionProxyHost + * * @return Generator */ public function setOptionProxyHost($optionProxyHost) { $this->options->setProxyHost($optionProxyHost); + return $this; } + /** - * Gets the optionProxyPort value + * Gets the optionProxyPort value. + * * @return string */ public function getOptionProxyPort() { return $this->options->getProxyPort(); } + /** - * Sets the optionProxyPort value + * Sets the optionProxyPort value. + * * @param string $optionProxyPort + * * @return Generator */ public function setOptionProxyPort($optionProxyPort) { $this->options->setProxyPort($optionProxyPort); + return $this; } + /** - * Gets the optionProxyLogin value + * Gets the optionProxyLogin value. + * * @return string */ public function getOptionProxyLogin() { return $this->options->getProxyLogin(); } + /** - * Sets the optionProxyLogin value + * Sets the optionProxyLogin value. + * * @param string $optionProxyLogin + * * @return Generator */ public function setOptionProxyLogin($optionProxyLogin) { $this->options->setProxyLogin($optionProxyLogin); + return $this; } + /** - * Gets the optionProxyPassword value + * Gets the optionProxyPassword value. + * * @return string */ public function getOptionProxyPassword() { return $this->options->getProxyPassword(); } + /** - * Sets the optionProxyPassword value + * Sets the optionProxyPassword value. + * * @param string $optionProxyPassword + * * @return Generator */ public function setOptionProxyPassword($optionProxyPassword) { $this->options->setProxyPassword($optionProxyPassword); + return $this; } + /** - * Gets the optionOrigin value + * Gets the optionOrigin value. + * * @return string */ public function getOptionOrigin() { return $this->options->getOrigin(); } + /** - * Sets the optionOrigin value + * Sets the optionOrigin value. + * * @param string $optionOrigin + * * @return Generator */ public function setOptionOrigin($optionOrigin) { $this->options->setOrigin($optionOrigin); $this->initWsdl(); + return $this; } + /** - * Gets the optionDestination value + * Gets the optionDestination value. + * * @return string */ public function getOptionDestination() { $destination = $this->options->getDestination(); if (!empty($destination)) { - $destination = rtrim($destination, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $destination = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; } + return $destination; } + /** - * Sets the optionDestination value + * Sets the optionDestination value. + * * @param string $optionDestination + * * @return Generator */ public function setOptionDestination($optionDestination) { if (!empty($optionDestination)) { - $this->options->setDestination(rtrim($optionDestination, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); + $this->options->setDestination(rtrim($optionDestination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR); } else { - throw new \InvalidArgumentException('Package\'s destination can\'t be empty', __LINE__); + throw new InvalidArgumentException('Package\'s destination can\'t be empty', __LINE__); } + return $this; } + /** - * Gets the optionSrcDirname value + * Gets the optionSrcDirname value. + * * @return string */ public function getOptionSrcDirname() { return $this->options->getSrcDirname(); } + /** - * Sets the optionSrcDirname value + * Sets the optionSrcDirname value. + * * @param string $optionSrcDirname + * * @return Generator */ public function setOptionSrcDirname($optionSrcDirname) { $this->options->setSrcDirname($optionSrcDirname); + return $this; } + /** - * Gets the optionSoapOptions value + * Gets the optionSoapOptions value. + * * @return array */ public function getOptionSoapOptions() { return $this->options->getSoapOptions(); } + /** - * Sets the optionSoapOptions value + * Sets the optionSoapOptions value. + * * @param array $optionSoapOptions + * * @return Generator */ public function setOptionSoapOptions($optionSoapOptions) @@ -705,19 +706,25 @@ public function setOptionSoapOptions($optionSoapOptions) if ($this->soapClient) { $this->soapClient->initSoapClient(); } + return $this; } + /** - * Gets the optionComposerName value + * Gets the optionComposerName value. + * * @return string */ public function getOptionComposerName() { return $this->options->getComposerName(); } + /** - * Sets the optionComposerName value + * Sets the optionComposerName value. + * * @param string $optionComposerName + * * @return Generator */ public function setOptionComposerName($optionComposerName) @@ -725,269 +732,253 @@ public function setOptionComposerName($optionComposerName) if (!empty($optionComposerName)) { $this->options->setComposerName($optionComposerName); } else { - throw new \InvalidArgumentException('Package\'s composer name can\'t be empty', __LINE__); + throw new InvalidArgumentException('Package\'s composer name can\'t be empty', __LINE__); } + return $this; } + /** - * Gets the optionComposerSettings value + * Gets the optionComposerSettings value. + * * @return array */ public function getOptionComposerSettings() { return $this->options->getComposerSettings(); } + /** - * Sets the optionComposerSettings value - * @param array $optionComposerSettings + * Sets the optionComposerSettings value. + * * @return Generator */ public function setOptionComposerSettings(array $optionComposerSettings = []) { $this->options->setComposerSettings($optionComposerSettings); + return $this; } + /** - * Gets the optionStructsFolder value + * Gets the optionStructsFolder value. + * * @return string */ public function getOptionStructsFolder() { return $this->options->getStructsFolder(); } + /** - * Sets the optionStructsFolder value + * Sets the optionStructsFolder value. + * * @param string $optionStructsFolder + * * @return Generator */ public function setOptionStructsFolder($optionStructsFolder) { $this->options->setStructsFolder($optionStructsFolder); + return $this; } + /** - * Gets the optionArraysFolder value + * Gets the optionArraysFolder value. + * * @return string */ public function getOptionArraysFolder() { return $this->options->getArraysFolder(); } + /** - * Sets the optionArraysFolder value + * Sets the optionArraysFolder value. + * * @param string $optionArraysFolder + * * @return Generator */ public function setOptionArraysFolder($optionArraysFolder) { $this->options->setArraysFolder($optionArraysFolder); + return $this; } + /** - * Gets the optionEnumsFolder value + * Gets the optionEnumsFolder value. + * * @return string */ public function getOptionEnumsFolder() { return $this->options->getEnumsFolder(); } + /** - * Sets the optionEnumsFolder value + * Sets the optionEnumsFolder value. + * * @param string $optionEnumsFolder + * * @return Generator */ public function setOptionEnumsFolder($optionEnumsFolder) { $this->options->setEnumsFolder($optionEnumsFolder); + return $this; } + /** - * Gets the optionServicesFolder value + * Gets the optionServicesFolder value. + * * @return string */ public function getOptionServicesFolder() { return $this->options->getServicesFolder(); } + /** - * Sets the optionServicesFolder value + * Sets the optionServicesFolder value. + * * @param string $optionServicesFolder + * * @return Generator */ public function setOptionServicesFolder($optionServicesFolder) { $this->options->setServicesFolder($optionServicesFolder); + return $this; } + /** - * Gets the optionSchemasSave value + * Gets the optionSchemasSave value. + * * @return bool */ public function getOptionSchemasSave() { return $this->options->getSchemasSave(); } + /** - * Sets the optionSchemasSave value + * Sets the optionSchemasSave value. + * * @param bool $optionSchemasSave + * * @return Generator */ public function setOptionSchemasSave($optionSchemasSave) { $this->options->setSchemasSave($optionSchemasSave); + return $this; } + /** - * Gets the optionSchemasFolder value + * Gets the optionSchemasFolder value. + * * @return string */ public function getOptionSchemasFolder() { return $this->options->getSchemasFolder(); } + /** - * Sets the optionSchemasFolder value + * Sets the optionSchemasFolder value. + * * @param string $optionSchemasFolder + * * @return Generator */ public function setOptionSchemasFolder($optionSchemasFolder) { $this->options->setSchemasFolder($optionSchemasFolder); + return $this; } - /** - * Gets the optionXsdTypesPath value - * @return string - */ - public function getOptionXsdTypesPath() + + public function getOptionXsdTypesPath(): string { return $this->options->getXsdTypesPath(); } - /** - * Sets the optionXsdTypesPath value - * @param string $xsdTypesPath - * @return Generator - */ - public function setOptionXsdTypesPath($xsdTypesPath) + + public function setOptionXsdTypesPath(string $xsdTypesPath): self { $this->options->setXsdTypesPath($xsdTypesPath); + return $this; } - /** - * Gets the WSDL - * @return Wsdl|null - */ - public function getWsdl() + + public function getWsdl(): ?Wsdl { return $this->wsdl; } - /** - * Sets the WSDLs - * @param Wsdl $wsdl - * @return Generator - */ - protected function setWsdl(Wsdl $wsdl) - { - $this->wsdl = $wsdl; - return $this; - } - /** - * Adds Wsdl location - * @param Wsdl $wsdl - * @param string $schemaLocation - * @return Generator - */ - public function addSchemaToWsdl(Wsdl $wsdl, $schemaLocation) + + public function addSchemaToWsdl(Wsdl $wsdl, string $schemaLocation): self { - if (!empty($schemaLocation) && $wsdl->getContent() instanceof WsdlDocument && $wsdl->getContent()->getExternalSchema($schemaLocation) === null) { - $wsdl->getContent()->addExternalSchema(new Schema($wsdl->getGenerator(), $schemaLocation, $this->getUrlContent($schemaLocation))); + if (!empty($schemaLocation) && !$wsdl->hasSchema($schemaLocation)) { + $wsdl->addSchema(new Schema($wsdl->getGenerator(), $schemaLocation, $this->getUrlContent($schemaLocation))); } + return $this; } - /** - * Gets gather name class - * @param AbstractModel $model the model for which we generate the folder - * @return string - */ - protected function getGather(AbstractModel $model) - { - return Utils::getPart($this->getOptionGatherMethods(), $model->getCleanName()); - } - /** - * Returns the service name associated to the method/operation name in order to gather them in one service class - * @param string $methodName original operation/method name - * @return string - */ - public function getServiceName($methodName) + + public function getServiceName(string $methodName): string { return ucfirst($this->getGather(new EmptyModel($this, $methodName))); } - /** - * @param GeneratorOptions $options - * @return Generator - */ - protected function setOptions(GeneratorOptions $options = null) - { - $this->options = $options; - return $this; - } - /** - * @return GeneratorOptions - */ - public function getOptions() + + public function getOptions(): ?GeneratorOptions { return $this->options; } - /** - * @return GeneratorSoapClient - */ - public function getSoapClient() + + public function getSoapClient(): GeneratorSoapClient { return $this->soapClient; } - /** - * @param string $url - * @return string - */ - public function getUrlContent($url) + + public function getUrlContent(string $url): ?string { - if (mb_strpos($url, '://') !== false) { + if (false !== mb_strpos($url, '://')) { $content = Utils::getContentFromUrl($url, $this->getOptionBasicLogin(), $this->getOptionBasicPassword(), $this->getOptionProxyHost(), $this->getOptionProxyPort(), $this->getOptionProxyLogin(), $this->getOptionProxyPassword(), $this->getSoapClient()->getSoapClientStreamContextOptions()); - if ($this->getOptionSchemasSave() === true) { + if ($this->getOptionSchemasSave()) { Utils::saveSchemas($this->getOptionDestination(), $this->getOptionSchemasFolder(), $url, $content); } + return $content; - } elseif (is_file($url)) { + } + if (is_file($url)) { return file_get_contents($url); } + return null; } - /** - * @return GeneratorContainers - */ - public function getContainers() + + public function getContainers(): GeneratorContainers { return $this->containers; } - /** - * @return array - */ - public function jsonSerialize() + + public function jsonSerialize(): array { return [ 'containers' => $this->containers, 'options' => $this->options, ]; } - /** - * @param string $json - * @throws \InvalidArgumentException - * @return Generator - */ - public static function instanceFromSerializedJson($json) + + public static function instanceFromSerializedJson(string $json): Generator { $decodedJson = json_decode($json, true); - if (json_last_error() === JSON_ERROR_NONE) { + if (JSON_ERROR_NONE === json_last_error()) { // load options first $options = GeneratorOptions::instance(); foreach ($decodedJson['options'] as $name => $value) { @@ -1004,16 +995,125 @@ public static function instanceFromSerializedJson($json) $instance->getContainers()->getStructs()->add(self::getModelInstanceFromJsonArrayEntry($instance, $struct)); } } else { - throw new \InvalidArgumentException(sprintf('Json is invalid, please check error %s', json_last_error())); + throw new InvalidArgumentException(sprintf('Json is invalid, please check error %s', json_last_error())); } + return $instance; } - /** - * @param Generator $generator - * @param array $jsonArrayEntry - * @return AbstractModel - */ - protected static function getModelInstanceFromJsonArrayEntry(Generator $generator, array $jsonArrayEntry) + + protected function initialize(): self + { + return $this + ->initContainers() + ->initParsers() + ->initFiles() + ->initSoapClient() + ->initWsdl() + ; + } + + protected function initSoapClient(): self + { + if (!isset($this->soapClient)) { + $this->soapClient = new GeneratorSoapClient($this); + } + + return $this; + } + + protected function initContainers(): self + { + if (!isset($this->containers)) { + $this->containers = new GeneratorContainers($this); + } + + return $this; + } + + protected function initParsers(): self + { + if (!isset($this->parsers)) { + $this->parsers = new GeneratorParsers($this); + } + + return $this; + } + + protected function initFiles(): self + { + if (!isset($this->files)) { + $this->files = new GeneratorFiles($this); + } + + return $this; + } + + protected function initDirectory(): self + { + Utils::createDirectory($this->getOptions()->getDestination()); + if (!is_writable($this->getOptionDestination())) { + throw new InvalidArgumentException(sprintf('Unable to use dir "%s" as dir does not exists, its creation has been impossible or it\'s not writable', $this->getOptionDestination()), __LINE__); + } + + return $this; + } + + protected function initWsdl(): self + { + $this->setWsdl(new Wsdl($this, $this->getOptionOrigin(), $this->getUrlContent($this->getOptionOrigin()))); + + return $this; + } + + protected function doSanityChecks(): self + { + $destination = $this->getOptionDestination(); + if (empty($destination)) { + throw new InvalidArgumentException('Package\'s destination must be defined', __LINE__); + } + + $composerName = $this->getOptionComposerName(); + if ($this->getOptionStandalone() && empty($composerName)) { + throw new InvalidArgumentException('Package\'s composer name must be defined', __LINE__); + } + + return $this; + } + + protected function doParse(): self + { + $this->parsers->doParse(); + + return $this; + } + + protected function doGenerate(): self + { + $this->files->doGenerate(); + + return $this; + } + + protected function setWsdl(Wsdl $wsdl): self + { + $this->wsdl = $wsdl; + + return $this; + } + + protected function getGather(AbstractModel $model): string + { + return Utils::getPart($this->getOptionGatherMethods(), $model->getCleanName()); + } + + protected function setOptions(GeneratorOptions $options): self + { + $this->options = $options; + + return $this; + } + + protected static function getModelInstanceFromJsonArrayEntry(Generator $generator, array $jsonArrayEntry): AbstractModel { return AbstractModel::instanceFromSerializedJson($generator, $jsonArrayEntry); } diff --git a/src/Generator/GeneratorContainers.php b/src/Generator/GeneratorContainers.php index d85b3275..8a2c9b9d 100644 --- a/src/Generator/GeneratorContainers.php +++ b/src/Generator/GeneratorContainers.php @@ -1,74 +1,61 @@ initStructs()->initServices(); - } - /** - * @return GeneratorContainers - */ - protected function initStructs() - { - if (!isset($this->structs)) { - $this->structs = new StructContainer($this->generator); - } - return $this; + $this + ->initStructs() + ->initServices() + ; } - /** - * @return GeneratorContainers - */ - protected function initServices() - { - if (!isset($this->services)) { - $this->services = new ServiceContainer($this->generator); - } - return $this; - } - /** - * @return ServiceContainer - */ - public function getServices() + + public function getServices(): ServiceContainer { return $this->services; } - /** - * @return StructContainer - */ - public function getStructs() + + public function getStructs(): StructContainer { return $this->structs; } - /** - * {@inheritDoc} - * @see JsonSerializable::jsonSerialize() - * @return StructContainer[]|ServiceContainer[] - */ - public function jsonSerialize() + + public function jsonSerialize(): array { return [ 'services' => $this->services, 'structs' => $this->structs, ]; } + + protected function initStructs(): self + { + if (!isset($this->structs)) { + $this->structs = new StructContainer($this->generator); + } + + return $this; + } + + protected function initServices(): self + { + if (!isset($this->services)) { + $this->services = new ServiceContainer($this->generator); + } + + return $this; + } } diff --git a/src/Generator/GeneratorFiles.php b/src/Generator/GeneratorFiles.php index f5027fa9..ce576818 100644 --- a/src/Generator/GeneratorFiles.php +++ b/src/Generator/GeneratorFiles.php @@ -1,28 +1,25 @@ classmapFile)) { $classMapModel = new EmptyModel($this->generator, 'ClassMap'); @@ -30,38 +27,39 @@ public function getClassmapFile() $classMap->setModel($classMapModel); $this->classmapFile = $classMap; } + return $this->classmapFile; } - /** - * @return GeneratorFiles - */ - public function doGenerate() + + public function doGenerate(): GeneratorFiles { - return $this->generateStructsClasses() + return $this + ->generateStructsClasses() ->generateServicesClasses() ->generateClassMap() ->generateTutorialFile() - ->generateComposerFile(); + ->generateComposerFile() + ; } - /** - * Generates structs classes based on structs collected - * @return GeneratorFiles - */ - protected function generateStructsClasses() + + protected function generateStructsClasses(): GeneratorFiles { foreach ($this->getGenerator()->getStructs() as $struct) { if (!$struct->isStruct()) { continue; } - $this->getStructFile($struct)->setModel($struct)->write(); + + $this + ->getStructFile($struct) + ->setModel($struct) + ->write() + ; } + return $this; } - /** - * @param StructModel $struct - * @return StructEnumFile|StructArrayFile|StructFile - */ - protected function getStructFile(StructModel $struct) + + protected function getStructFile(StructModel $struct): AbstractModelFile { if ($struct->isRestriction()) { $file = new StructEnumFile($this->generator, $struct->getPackagedName()); @@ -70,51 +68,44 @@ protected function getStructFile(StructModel $struct) } else { $file = new StructFile($this->generator, $struct->getPackagedName()); } + return $file; } - /** - * Generates methods by class - * @return GeneratorFiles - */ - protected function generateServicesClasses() + + protected function generateServicesClasses(): self { foreach ($this->getGenerator()->getServices(true) as $service) { $file = new ServiceFile($this->generator, $service->getPackagedName()); $file->setModel($service)->write(); } + return $this; } - /** - * Generates classMap class - * @return GeneratorFiles - */ - protected function generateClassMap() + + protected function generateClassMap(): self { $this->getClassmapFile()->write(); + return $this; } - /** - * Generates tutorial file - * @return GeneratorFiles - */ - protected function generateTutorialFile() + + protected function generateTutorialFile(): self { - if ($this->generator->getOptionGenerateTutorialFile() === true && $this->getClassmapFile() instanceof ClassMapFile) { + if ($this->generator->getOptionGenerateTutorialFile() && $this->getClassmapFile() instanceof ClassMapFile) { $tutorialFile = new TutorialFile($this->generator, 'tutorial'); $tutorialFile->write(); } + return $this; } - /** - * @throws \InvalidArgumentException - * @return GeneratorFiles - */ - protected function generateComposerFile() + + protected function generateComposerFile(): self { - if ($this->generator->getOptionStandalone() === true) { + if ($this->generator->getOptionStandalone()) { $composerFile = new ComposerFile($this->generator, 'composer'); $composerFile->write(); } + return $this; } } diff --git a/src/Generator/GeneratorParsers.php b/src/Generator/GeneratorParsers.php index 7edb6f8a..bf884442 100644 --- a/src/Generator/GeneratorParsers.php +++ b/src/Generator/GeneratorParsers.php @@ -1,11 +1,14 @@ initParsers(); } - /** - * @return GeneratorParsers - */ - protected function initParsers() + + public function doParse(): self + { + foreach ($this->parsers as $parser) { + $parser->parse(); + } + + return $this; + } + + public function getParsers(): ParserContainer + { + return $this->parsers; + } + + protected function initParsers(): self { if (!isset($this->parsers)) { $this->parsers = new ParserContainer($this->generator); @@ -59,25 +68,10 @@ protected function initParsers() ->add(new TagUnionParser($this->generator)) ->add(new TagListParser($this->generator)) ->add(new TagChoiceParser($this->generator)) - ->add(new TagDocumentationParser($this->generator)); - } - return $this; - } - /** - * @return GeneratorParsers - */ - public function doParse() - { - foreach ($this->parsers as $parser) { - $parser->parse(); + ->add(new TagDocumentationParser($this->generator)) + ; } + return $this; } - /** - * @return ParserContainer - */ - public function getParsers() - { - return $this->parsers; - } } diff --git a/src/Generator/GeneratorSoapClient.php b/src/Generator/GeneratorSoapClient.php index 07f41ed5..e757b45e 100644 --- a/src/Generator/GeneratorSoapClient.php +++ b/src/Generator/GeneratorSoapClient.php @@ -1,45 +1,38 @@ initSoapClient(); } - /** - * @throws \InvalidArgumentException - * @return GeneratorSoapClient - */ - public function initSoapClient() + + public function initSoapClient(): self { try { $soapClient = new SoapClient($this->getSoapClientOptions(SOAP_1_1)); - } catch (\SoapFault $fault) { + } catch (SoapFault $fault) { try { $soapClient = new SoapClient($this->getSoapClientOptions(SOAP_1_2)); - } catch (\SoapFault $fault) { - throw new \InvalidArgumentException(sprintf('Unable to load WSDL at "%s"!', $this->getGenerator()->getOptionOrigin()), __LINE__, $fault); + } catch (SoapFault $fault) { + throw new InvalidArgumentException(sprintf('Unable to load WSDL at "%s"!', $this->getGenerator()->getOptionOrigin()), __LINE__, $fault); } } + return $this->setSoapClient($soapClient); } - /** - * @param int $soapVersion - * @return string[] - */ - public function getSoapClientOptions($soapVersion) + + public function getSoapClientOptions(int $soapVersion): array { return array_merge([ SoapClient::WSDL_SOAP_VERSION => $soapVersion, @@ -52,32 +45,28 @@ public function getSoapClientOptions($soapVersion) SoapClient::WSDL_PROXY_PASSWORD => $this->getGenerator()->getOptionProxyPassword(), ], $this->getGenerator()->getOptionSoapOptions()); } - /** - * @param SoapClient $soapClient - * @return GeneratorSoapClient - */ - public function setSoapClient(SoapClient $soapClient) + + public function setSoapClient(SoapClient $soapClient): self { $this->soapClient = $soapClient; + return $this; } - /** - * @return SoapClient - */ - public function getSoapClient() + + public function getSoapClient(): SoapClient { return $this->soapClient; } - /** - * @return array - */ - public function getSoapClientStreamContextOptions() + + public function getSoapClientStreamContextOptions(): array { $options = []; $soapClient = $this->getSoapClient(); + if ($soapClient instanceof SoapClient) { $options = $soapClient->getStreamContextOptions(); } + return $options; } } diff --git a/src/Generator/SoapClient.php b/src/Generator/SoapClient.php index 60bdc3a3..f06e4724 100644 --- a/src/Generator/SoapClient.php +++ b/src/Generator/SoapClient.php @@ -1,5 +1,7 @@ = 0; $i--) { - $part = trim($parts[$i]); - if (!empty($part)) { - break; - } + + if (empty($string)) { + return ''; + } + + $elementType = ''; + + switch ($optionValue) { + case GeneratorOptions::VALUE_END: + $parts = preg_split('/[A-Z]/', ucfirst($string)); + $partsCount = count($parts); + if (!empty($parts[$partsCount - 1])) { + $elementType = mb_substr($string, mb_strrpos($string, implode('', array_slice($parts, -1))) - 1); + } else { + for ($i = $partsCount - 1; $i >= 0; --$i) { + $part = trim($parts[$i]); + if (!empty($part)) { + break; } - $elementType = mb_substr($string, ((count($parts) - 2 - $i) + 1) * -1); } - break; - case GeneratorOptions::VALUE_START: - $parts = preg_split('/[A-Z]/', ucfirst($string)); - $partsCount = count($parts); - if (empty($parts[0]) && !empty($parts[1])) { - $elementType = mb_substr($string, 0, mb_strlen($parts[1]) + 1); - } else { - for ($i = 0; $i < $partsCount; $i++) { - $part = trim($parts[$i]); - if (!empty($part)) { - break; - } + $elementType = mb_substr($string, ((count($parts) - 2 - $i) + 1) * -1); + } + + break; + + case GeneratorOptions::VALUE_START: + $parts = preg_split('/[A-Z]/', ucfirst($string)); + $partsCount = count($parts); + if (empty($parts[0]) && !empty($parts[1])) { + $elementType = mb_substr($string, 0, mb_strlen($parts[1]) + 1); + } else { + for ($i = 0; $i < $partsCount; ++$i) { + $part = trim($parts[$i]); + if (!empty($part)) { + break; } - $elementType = mb_substr($string, 0, $i); } - break; - case GeneratorOptions::VALUE_NONE: - $elementType = $string; - break; - default: - break; - } + $elementType = mb_substr($string, 0, $i); + } + + break; + + case GeneratorOptions::VALUE_NONE: + $elementType = $string; + + break; } + return $elementType; } - /** - * Get content from url using a proxy or not - * @param string $url - * @param string $basicAuthLogin - * @param string $basicAuthPassword - * @param string $proxyHost - * @param string $proxyPort - * @param string $proxyLogin - * @param string $proxyPassword - * @param array $contextOptions - * @return string - */ - public static function getContentFromUrl($url, $basicAuthLogin = null, $basicAuthPassword = null, $proxyHost = null, $proxyPort = null, $proxyLogin = null, $proxyPassword = null, array $contextOptions = []) + + public static function getContentFromUrl(string $url, ?string $basicAuthLogin = null, ?string $basicAuthPassword = null, ?string $proxyHost = null, $proxyPort = null, ?string $proxyLogin = null, ?string $proxyPassword = null, array $contextOptions = []): string { $context = null; $options = self::getStreamContextOptions($basicAuthLogin, $basicAuthPassword, $proxyHost, $proxyPort, $proxyLogin, $proxyPassword, $contextOptions); if (!empty($options)) { $context = stream_context_create($options); } + return file_get_contents($url, false, $context); } - /** - * @param string $basicAuthLogin - * @param string $basicAuthPassword - * @param string $proxyHost - * @param string $proxyPort - * @param string $proxyLogin - * @param string $proxyPassword - * @param array $contextOptions - * @return string[] - */ - public static function getStreamContextOptions($basicAuthLogin = null, $basicAuthPassword = null, $proxyHost = null, $proxyPort = null, $proxyLogin = null, $proxyPassword = null, array $contextOptions = []) + + public static function getStreamContextOptions(?string $basicAuthLogin = null, ?string $basicAuthPassword = null, ?string $proxyHost = null, $proxyPort = null, ?string $proxyLogin = null, ?string $proxyPassword = null, array $contextOptions = []): array { $proxyOptions = $basicAuthOptions = []; if (!empty($basicAuthLogin) && !empty($basicAuthPassword)) { @@ -101,6 +89,7 @@ public static function getStreamContextOptions($basicAuthLogin = null, $basicAut ], ]; } + if (!empty($proxyHost)) { $proxyOptions = [ 'http' => [ @@ -111,15 +100,11 @@ public static function getStreamContextOptions($basicAuthLogin = null, $basicAut ], ]; } + return array_merge_recursive($contextOptions, $proxyOptions, $basicAuthOptions); } - /** - * Returns the value with good type - * @param mixed $value the value - * @param string $knownType the value - * @return mixed - */ - public static function getValueWithinItsType($value, $knownType = null) + + public static function getValueWithinItsType($value, ?string $knownType = null) { if (is_int($value) || (!is_null($value) && in_array($knownType, [ 'time', @@ -132,145 +117,133 @@ public static function getValueWithinItsType($value, $knownType = null) 'integer', ], true))) { return intval($value); - } elseif (is_float($value) || (!is_null($value) && in_array($knownType, [ + } + if (is_float($value) || (!is_null($value) && in_array($knownType, [ 'float', 'double', 'decimal', ], true))) { return floatval($value); - } elseif (is_bool($value) || (!is_null($value) && in_array($knownType, [ + } + if (is_bool($value) || (!is_null($value) && in_array($knownType, [ 'bool', 'boolean', ], true))) { - return ($value === 'true' || $value === true || $value === 1 || $value === '1'); + return 'true' === $value || true === $value || 1 === $value || '1' === $value; } + return $value; } - /** - * @param string $origin - * @param string $destination - * @return string - */ - public static function resolveCompletePath($origin, $destination) + + public static function resolveCompletePath(string $origin, string $destination): string { $resolvedPath = $destination; - if (!empty($destination) && mb_strpos($destination, 'http://') === false && mb_strpos($destination, 'https://') === false && !empty($origin)) { - if (mb_substr($destination, 0, 2) === './') { + if (!empty($destination) && false === mb_strpos($destination, 'http://') && false === mb_strpos($destination, 'https://') && !empty($origin)) { + if ('./' === mb_substr($destination, 0, 2)) { $destination = mb_substr($destination, 2); } $destinationParts = explode('/', $destination); $fileParts = pathinfo($origin); $fileBasename = (is_array($fileParts) && array_key_exists('basename', $fileParts)) ? $fileParts['basename'] : ''; - $parts = parse_url(str_replace('/' . $fileBasename, '', $origin)); + $parts = parse_url(str_replace('/'.$fileBasename, '', $origin)); $scheme = (is_array($parts) && array_key_exists('scheme', $parts)) ? $parts['scheme'] : ''; $host = (is_array($parts) && array_key_exists('host', $parts)) ? $parts['host'] : ''; $path = (is_array($parts) && array_key_exists('path', $parts)) ? $parts['path'] : ''; - $path = str_replace('/' . $fileBasename, '', $path); + $path = str_replace('/'.$fileBasename, '', $path); $pathParts = explode('/', $path); $finalPath = implode('/', $pathParts); foreach ($destinationParts as $locationPart) { - if ($locationPart == '..') { + if ('..' === $locationPart) { $finalPath = mb_substr($finalPath, 0, mb_strrpos($finalPath, '/', 0)); } else { - $finalPath .= '/' . $locationPart; + $finalPath .= '/'.$locationPart; } } $port = (is_array($parts) && array_key_exists('port', $parts)) ? $parts['port'] : ''; - /** - * Remote file - */ + // Remote file if (!empty($scheme) && !empty($host)) { - $resolvedPath = str_replace('urn', 'http', $scheme) . '://' . $host . (!empty($port) ? ':' . $port : '') . str_replace('//', '/', $finalPath); + $resolvedPath = str_replace('urn', 'http', $scheme).'://'.$host.(!empty($port) ? ':'.$port : '').str_replace('//', '/', $finalPath); } elseif (empty($scheme) && empty($host) && count($pathParts)) { - /** - * Local file - */ + // Local file if (is_file($finalPath)) { $resolvedPath = $finalPath; } } } + return $resolvedPath; } - /** - * Clean comment - * @param string $comment the comment to clean - * @param string $glueSeparator ths string to use when gathering values - * @param bool $uniqueValues indicates if comment values must be unique or not - * @return string - */ - public static function cleanComment($comment, $glueSeparator = ',', $uniqueValues = true) + + public static function cleanComment($comment, string $glueSeparator = ',', bool $uniqueValues = true): string { if (!is_scalar($comment) && !is_array($comment)) { return ''; } - return trim(str_replace('*/', '*[:slash:]', is_scalar($comment) ? $comment : implode($glueSeparator, $uniqueValues ? array_unique($comment) : $comment))); + + return trim(str_replace('*/', '*[:slash:]', is_scalar($comment) ? (string) $comment : implode($glueSeparator, $uniqueValues ? array_unique($comment) : $comment))); } + /** * Clean a string to make it valid as PHP variable * See more about the used regular expression at {@link http://www.regular-expressions.info/unicode.html}: * - \p{L} for any valid letter * - \p{N} for any valid number - * - /u for supporting unicode - * @param string $string the string to clean - * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores - * @return string + * - /u for supporting unicode. + * + * @param string $string the string to clean + * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores */ - public static function cleanString($string, $keepMultipleUnderscores = true) + public static function cleanString(string $string, bool $keepMultipleUnderscores = true): string { $cleanedString = preg_replace('/[^\p{L}\p{N}_]/u', '_', $string); if (!$keepMultipleUnderscores) { $cleanedString = preg_replace('/[_]+/', '_', $cleanedString); } + return $cleanedString; } - /** - * @param string $namespacedClassName - * @return string - */ - public static function removeNamespace($namespacedClassName) + + public static function removeNamespace(string $namespacedClassName): string { $elements = explode('\\', $namespacedClassName); + return (string) array_pop($elements); } - /** - * @param string $directory - * @param int $permissions - * @return bool - */ - public static function createDirectory($directory, $permissions = 0775) + + public static function createDirectory(string $directory, $permissions = 0775): bool { if (!is_dir($directory)) { mkdir($directory, $permissions, true); } + return true; } + /** * Save schemas to schemasFolder - * Filename will be extracted from schemasUrl or default schema.wsdl will be used - * @param string $destinationFolder - * @param string $schemasFolder - * @param string $schemasUrl - * @param string $content - * @return string + * Filename will be extracted from schemasUrl or default schema.wsdl will be used. */ - public static function saveSchemas($destinationFolder, $schemasFolder, $schemasUrl, $content) + public static function saveSchemas(string $destinationFolder, string $schemasFolder, string $schemasUrl, string $content): string { - if (($schemasFolder === null) || empty($schemasFolder)) { + if ((is_null($schemasFolder)) || empty($schemasFolder)) { // if null or empty schemas folder was provided // default schemas folder will be wsdl $schemasFolder = 'wsdl'; } - $schemasPath = rtrim($destinationFolder, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . rtrim($schemasFolder, DIRECTORY_SEPARATOR); + $schemasPath = rtrim($destinationFolder, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.rtrim($schemasFolder, DIRECTORY_SEPARATOR); + // Here we must cover all possible variants - if ((mb_strpos(mb_strtolower($schemasUrl), '.wsdl') !== false) || (mb_strpos(mb_strtolower($schemasUrl), '.xsd') !== false) || (mb_strpos(mb_strtolower($schemasUrl), '.xml') !== false)) { + if ((false !== mb_strpos(mb_strtolower($schemasUrl), '.wsdl')) || (false !== mb_strpos(mb_strtolower($schemasUrl), '.xsd')) || (false !== mb_strpos(mb_strtolower($schemasUrl), '.xml'))) { $filename = basename($schemasUrl); } else { // if $url is like http://example.com/index.php?WSDL default filename will be schema.wsdl $filename = 'schema.wsdl'; } + self::createDirectory($schemasPath); - file_put_contents($schemasPath . DIRECTORY_SEPARATOR . $filename, $content); - return $schemasPath . DIRECTORY_SEPARATOR . $filename; + + file_put_contents($schemasPath.DIRECTORY_SEPARATOR.$filename, $content); + + return $schemasPath.DIRECTORY_SEPARATOR.$filename; } } diff --git a/src/Model/AbstractDocument.php b/src/Model/AbstractDocument.php index 0309d3bd..6594b238 100644 --- a/src/Model/AbstractDocument.php +++ b/src/Model/AbstractDocument.php @@ -1,60 +1,48 @@ setContent($content); + $this->initContentFromContentString($content); } - /** - * @return string - */ - abstract protected function contentClass(); - /** - * @param string $content wsdl/schema content - * @return AbstractDocument - */ - protected function setContent($content) + + public function getContent(): AbstractDocumentHandler + { + return $this->content; + } + + abstract protected function contentClass(): string; + + protected function initContentFromContentString(string $content): AbstractDocument { $contentClass = $this->contentClass(); - $domDocument = new \DOMDocument('1.0', 'utf-8'); + $domDocument = new DOMDocument('1.0', 'utf-8'); + try { $domDocument->loadXML($content, LIBXML_NOERROR); $this->content = new $contentClass($domDocument, $this->generator); - } catch (\Exception $exception) { - throw new \InvalidArgumentException(sprintf('Unable to load document at "%s"', $this->getName()), __LINE__, $exception); + } catch (Exception $exception) { + throw new InvalidArgumentException(sprintf('Unable to load document at "%s"', $this->getName()), __LINE__, $exception); } + return $this; } - /** - * - * @return \WsdlToPhp\PackageGenerator\WsdlHandler\AbstractDocument - */ - public function getContent() - { - return $this->content; - } - /** - * {@inheritDoc} - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() - */ - protected function toJsonSerialize() + + protected function toJsonSerialize(): array { return []; } diff --git a/src/Model/AbstractModel.php b/src/Model/AbstractModel.php index d5ca09a9..a4516af7 100644 --- a/src/Model/AbstractModel.php +++ b/src/Model/AbstractModel.php @@ -1,85 +1,78 @@ setName($name); } - /** - * @uses AbstractModel::getInheritedModel() - * @uses AbstractModel::getPackagedName() - * @uses AbstractModel::getExtends() - * @uses Struct::isStruct() - * @return string - */ - public function getExtendsClassName() + + public function getExtendsClassName(): string { $extends = ''; if (($model = $this->getInheritedModel()) instanceof Struct && $model->isStruct()) { @@ -88,66 +81,43 @@ public function getExtendsClassName() if (empty($extends)) { $extends = $this->getExtends(true); } + return $extends; } - /** - * Returns the name of the class the current class inherits from - * @return string - */ - public function getInheritance() + + public function getInheritance(): string { return $this->inheritance; } - /** - * Sets the name of the class the current class inherits from - * @param string $inheritance - * @return AbstractModel - */ - public function setInheritance($inheritance = '') + + public function setInheritance(string $inheritance = ''): self { $this->inheritance = $inheritance; + return $this; } - /** - * @uses AbstractGeneratorAware::getGenerator() - * @uses Generator::getStructByName() - * @uses AbstractModel::getInheritance() - * @return Struct - */ - public function getInheritedModel() + + public function getInheritedModel(): ?Struct { return $this->getGenerator()->getStructByName($this->getInheritance()); } - /** - * Returns the meta - * @return string[] - */ - public function getMeta() + + public function getMeta(): array { return $this->meta; } - /** - * Sets the meta - * @param string[] $meta - * @return AbstractModel - */ - public function setMeta(array $meta = []) + + public function setMeta(array $meta = []): self { $this->meta = $meta; + return $this; } - /** - * Add meta information to the operation - * @uses AbstractModel::getMeta() - * @throws \InvalidArgumentException - * @param string $metaName - * @param mixed $metaValue - * @return AbstractModel - */ - public function addMeta($metaName, $metaValue) + + public function addMeta(string $metaName, $metaValue): self { if (!is_scalar($metaName) || (!is_scalar($metaValue) && !is_array($metaValue))) { - throw new \InvalidArgumentException(sprintf('Invalid meta name "%s" or value "%s". Please provide scalar meta name and scalar or array meta value.', gettype($metaName), gettype($metaValue)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid meta name "%s" or value "%s". Please provide scalar meta name and scalar or array meta value.', gettype($metaName), gettype($metaValue)), __LINE__); } $metaValue = is_scalar($metaValue) ? ((is_numeric($metaValue) || is_bool($metaValue) ? $metaValue : trim($metaValue))) : $metaValue; if (is_scalar($metaValue) || is_array($metaValue)) { @@ -167,89 +137,24 @@ public function addMeta($metaName, $metaValue) } ksort($this->meta); } + return $this; } - /** - * Allows to merge meta from different sources and ensure consistency of their order - * Must be passed as less important (at first position) to most important (last position) - * @param array $meta - * @param array $meta - * @param array $meta - * @param array ... - * @return array - */ - protected function mergeMeta() - { - $meta = func_get_args(); - $mergedMeta = []; - $metaDocumentation = []; - // gather meta - foreach ($meta as $metaItem) { - foreach ($metaItem as $metaName => $metaValue) { - if (self::META_DOCUMENTATION === $metaName) { - $metaDocumentation = array_merge($metaDocumentation, $metaValue); - } elseif (!array_key_exists($metaName, $mergedMeta)) { - $mergedMeta[$metaName] = $metaValue; - } elseif (is_array($mergedMeta[$metaName]) && is_array($metaValue)) { - $mergedMeta[$metaName] = array_merge($mergedMeta[$metaName], $metaValue); - } elseif (is_array($mergedMeta[$metaName])) { - $mergedMeta[$metaName][] = $metaValue; - } else { - $mergedMeta[$metaName] = $metaValue; - } - } - } - - // sort by key - ksort($mergedMeta); - - // add documentation if any at first position - if (!empty($metaDocumentation)) { - $definitiveMeta = [ - self::META_DOCUMENTATION => array_unique(array_reverse($metaDocumentation)), - ]; - foreach ($mergedMeta as $metaName => $metaValue) { - $definitiveMeta[$metaName] = $metaValue; - } - $mergedMeta = $definitiveMeta; - unset($definitiveMeta); - } - unset($meta, $metaDocumentation); - return $mergedMeta; - } - /** - * Sets the documentation meta value. - * Documentation is set as an array so if multiple documentation nodes are set for an unique element, it will gather them. - * @uses AbstractModel::META_DOCUMENTATION - * @uses AbstractModel::addMeta() - * @param string $documentation the documentation from the WSDL - * @return AbstractModel - */ - public function setDocumentation($documentation) + public function setDocumentation(string $documentation): self { return $this->addMeta(self::META_DOCUMENTATION, is_array($documentation) ? $documentation : [ $documentation, ]); } - /** - * Returns a meta value according to its name - * @uses AbstractModel::getMeta() - * @param string $metaName the meta information name - * @param mixed $fallback the fallback value if unset - * @return mixed the meta information value - */ - public function getMetaValue($metaName, $fallback = null) + + public function getMetaValue(string $metaName, $fallback = null) { $meta = $this->getMeta(); + return array_key_exists($metaName, $meta) ? $meta[$metaName] : $fallback; } - /** - * Returns the value of the first meta value assigned to the name - * @param string[] $names the meta names to check - * @param mixed $fallback the fallback value if anyone is set - * @return mixed the meta information value - */ + public function getMetaValueFirstSet(array $names, $fallback = null) { $meta = $this->getMeta(); @@ -258,299 +163,199 @@ public function getMetaValueFirstSet(array $names, $fallback = null) return $meta[$name]; } } + return $fallback; } - /** - * Returns the original name extracted from the WSDL - * @return string - */ + public function getName() { return $this->name; } - /** - * Sets the original name extracted from the WSDL - * @param string $name - * @return AbstractModel - */ - public function setName($name) + + public function setName($name): self { $this->name = $name; + return $this; } - /** - * Returns a valid clean name for PHP - * @uses AbstractModel::getName() - * @uses AbstractModel::cleanString() - * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores - * @return string - */ - public function getCleanName($keepMultipleUnderscores = true) + + public function getCleanName(bool $keepMultipleUnderscores = true): string { return self::cleanString($this->getName(), $keepMultipleUnderscores); } - /** - * Returns the owner model object - * @return AbstractModel - */ - public function getOwner() + + public function getOwner(): ?AbstractModel { return $this->owner; } - /** - * Sets the owner model object - * @param AbstractModel $owner object the owner of the current model - * @return AbstractModel - */ - public function setOwner(AbstractModel $owner = null) + + public function setOwner(?AbstractModel $owner = null): self { $this->owner = $owner; + return $this; } - /** - * @return bool - */ - public function isAbstract() + + public function isAbstract(): bool { return $this->isAbstract; } - /** - * @param bool $isAbstract - * @return AbstractModel - */ - public function setAbstract($isAbstract) + + public function setAbstract(bool $isAbstract): self { $this->isAbstract = $isAbstract; + return $this; } - /** - * Returns true if the original name is safe to use as a PHP property, variable name or class name - * @uses AbstractModel::getName() - * @uses AbstractModel::getCleanName() - * @return bool - */ - public function nameIsClean() + + public function nameIsClean(): bool { - return ($this->getName() !== '' && $this->getName() === $this->getCleanName()); + return '' !== $this->getName() && $this->getName() === $this->getCleanName(); } - /** - * Returns the packaged name - * @uses AbstractModel::getNamespace() - * @uses AbstractModel::getCleanName() - * @uses AbstractModel::getContextualPart() - * @uses AbstractModel::uniqueName() - * @uses AbstractModel::replacePhpReservedKeyword() - * @uses AbstractGeneratorAware::getGenerator() - * @uses Generator::getOptionPrefix() - * @uses Generator::getOptionSuffix() - * @uses AbstractModel::uniqueName() to ensure unique naming of struct case sensitively - * @param bool $namespaced - * @return string - */ - public function getPackagedName($namespaced = false) + + public function getPackagedName(bool $namespaced = false): string { $nameParts = []; - if ($namespaced && $this->getNamespace() !== '') { + if ($namespaced && !empty($this->getNamespace())) { $nameParts[] = sprintf('\%s\\', $this->getNamespace()); } + $cleanName = $this->getCleanName(); - if ($this->getGenerator()->getOptionPrefix() !== '') { + if (!empty($this->getGenerator()->getOptionPrefix())) { $nameParts[] = $this->getGenerator()->getOptionPrefix(); } else { $cleanName = self::replacePhpReservedKeyword($cleanName); } + $nameParts[] = ucfirst(self::uniqueName($cleanName, $this->getContextualPart())); - if ($this->getGenerator()->getOptionSuffix() !== '') { + if (!empty($this->getGenerator()->getOptionSuffix())) { $nameParts[] = $this->getGenerator()->getOptionSuffix(); } + return implode('', $nameParts); } + /** - * Allows to define the contextual part of the class name for the package - * @return string + * Allows to define the contextual part of the class name for the package. */ - public function getContextualPart() + public function getContextualPart(): string { return ''; } - /** - * Allows to define from which class the current model extends - * @param bool $short - * @return string|null - */ - public function getExtends($short = false) + + public function getExtends(bool $short = false): ?string { return ''; } - /** - * @uses AbstractGeneratorAware::getGenerator() - * @uses Generator::getOptionNamespacePrefix() - * @uses Generator::getOptionPrefix() - * @uses Generator::getOptionSuffix() - * @uses AbstractModel::getSubDirectory() - * @return string - */ - public function getNamespace() + + public function getNamespace(): string { $namespaces = []; $namespace = $this->getGenerator()->getOptionNamespacePrefix(); + if (empty($namespace)) { - if ($this->getGenerator()->getOptionPrefix() !== '') { + if (!empty($this->getGenerator()->getOptionPrefix())) { $namespaces[] = $this->getGenerator()->getOptionPrefix(); - } elseif ($this->getGenerator()->getOptionSuffix() !== '') { + } elseif (!empty($this->getGenerator()->getOptionSuffix())) { $namespaces[] = $this->getGenerator()->getOptionSuffix(); } } else { $namespaces[] = $namespace; } - if ($this->getSubDirectory() !== '') { + + if (!empty($this->getSubDirectory())) { $namespaces[] = $this->getSubDirectory(); } + return implode('\\', $namespaces); } - /** - * Returns directory where to store class and create it if needed - * @uses AbstractGeneratorAware::getGenerator() - * @uses AbstractModel::getOptionCategory() - * @uses AbstractGeneratorAware::getContextualPart() - * @uses GeneratorOptions::VALUE_CAT - * @return string - */ - public function getSubDirectory() + + public function getSubDirectory(): string { $subDirectory = ''; - if ($this->getGenerator()->getOptionCategory() === GeneratorOptions::VALUE_CAT) { + if (GeneratorOptions::VALUE_CAT === $this->getGenerator()->getOptionCategory()) { $subDirectory = $this->getContextualPart(); } + return $subDirectory; } + /** * Returns the sub package name which the model belongs to - * Must be overridden by sub classes - * @return array + * Must be overridden by sub classes. */ - public function getDocSubPackages() + public function getDocSubPackages(): array { return []; } - /** - * Clean a string to make it valid as PHP variable - * @uses GeneratorUtils::cleanString() - * @param string $string the string to clean - * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores - * @return string - */ - public static function cleanString($string, $keepMultipleUnderscores = true) + + public static function cleanString(string $string, bool $keepMultipleUnderscores = true): string { return GeneratorUtils::cleanString($string, $keepMultipleUnderscores); } - /** - * Returns a usable keyword for a original keyword - * @uses PhpReservedKeyword::instance() - * @uses PhpReservedKeyword::is() - * @param string $keyword the keyword - * @param string $context the context - * @return string - */ - public static function replacePhpReservedKeyword($keyword, $context = null) + + public static function replacePhpReservedKeyword(string $keyword, ?string $context = null): string { if (PhpReservedKeyword::instance()->is($keyword)) { - if ($context !== null) { - $keywordKey = $keyword . '_' . $context; + if (!is_null($context)) { + $keywordKey = $keyword.'_'.$context; if (!array_key_exists($keywordKey, self::$replacedPhpReservedKeywords)) { self::$replacedPhpReservedKeywords[$keywordKey] = 0; } else { - self::$replacedPhpReservedKeywords[$keywordKey]++; + ++self::$replacedPhpReservedKeywords[$keywordKey]; } - return '_' . $keyword . (self::$replacedPhpReservedKeywords[$keywordKey] ? '_' . self::$replacedPhpReservedKeywords[$keywordKey] : ''); - } else { - return '_' . $keyword; + + return '_'.$keyword.(self::$replacedPhpReservedKeywords[$keywordKey] ? '_'.self::$replacedPhpReservedKeywords[$keywordKey] : ''); } - } else { - return $keyword; + + return '_'.$keyword; } + + return $keyword; } - /** - * @throws \InvalidArgumentException - * @param $filename - * @return AbstractReservedWord - */ - public function getReservedMethodsInstance($filename = null) + + public function getReservedMethodsInstance(): AbstractReservedWord { - throw new \InvalidArgumentException(sprintf('The method %s should be defined in the class %s', __FUNCTION__, get_called_class(), __LINE__)); + throw new InvalidArgumentException(sprintf('The method %s should be defined in the class %s', __FUNCTION__, get_called_class(), __LINE__)); } - /** - * Returns a usable method for a original method - * @uses PhpReservedKeywords::instance() - * @uses PhpReservedKeywords::is() - * @param string $methodName the method name - * @param string $context the context - * @return string - */ - public function replaceReservedMethod($methodName, $context = null) + + public function replaceReservedMethod(string $methodName, ?string $context = null): string { if ($this->getReservedMethodsInstance()->is($methodName)) { - if ($context !== null) { - $methodKey = $methodName . '_' . $context; + if (!is_null($context)) { + $methodKey = $methodName.'_'.$context; if (!array_key_exists($methodKey, $this->replacedReservedMethods)) { $this->replacedReservedMethods[$methodKey] = 0; } else { - $this->replacedReservedMethods[$methodKey]++; + ++$this->replacedReservedMethods[$methodKey]; } - return '_' . $methodName . ($this->replacedReservedMethods[$methodKey] ? '_' . $this->replacedReservedMethods[$methodKey] : ''); - } else { - return '_' . $methodName; + + return '_'.$methodName.($this->replacedReservedMethods[$methodKey] ? '_'.$this->replacedReservedMethods[$methodKey] : ''); } - } else { - return $methodName; - } - } - /** - * Static method which returns a unique name case sensitively - * Useful to name methods case sensitively distinct, see http://the-echoplex.net/log/php-case-sensitivity - * @param string $name the original name - * @param string $context the context where the name is needed unique - * @return string - */ - protected static function uniqueName($name, $context) - { - $insensitiveKey = mb_strtolower($name . '_' . $context); - $sensitiveKey = $name . '_' . $context; - if (array_key_exists($sensitiveKey, self::$uniqueNames)) { - return self::$uniqueNames[$sensitiveKey]; - } elseif (!array_key_exists($insensitiveKey, self::$uniqueNames)) { - self::$uniqueNames[$insensitiveKey] = 0; - } else { - self::$uniqueNames[$insensitiveKey]++; + + return '_'.$methodName; } - $uniqueName = $name . (self::$uniqueNames[$insensitiveKey] ? '_' . self::$uniqueNames[$insensitiveKey] : ''); - self::$uniqueNames[$sensitiveKey] = $uniqueName; - return $uniqueName; + + return $methodName; } + /** - * Gives the availability for test purpose and multiple package generation to purge unique names + * Gives the availability for test purpose and multiple package generation to purge unique names. */ public static function purgeUniqueNames() { self::$uniqueNames = []; } + /** - * Gives the availability for test purpose and multiple package generation to purge reserved keywords usage + * Gives the availability for test purpose and multiple package generation to purge reserved keywords usage. */ public static function purgePhpReservedKeywords() { self::$replacedPhpReservedKeywords = []; } - /** - * Should return the properties of the inherited class - * @return array - */ - abstract protected function toJsonSerialize(); - /** - * {@inheritDoc} - * @see JsonSerializable::jsonSerialize() - */ - public function jsonSerialize() + + public function jsonSerialize(): array { return array_merge($this->toJsonSerialize(), [ 'inheritance' => $this->inheritance, @@ -560,12 +365,8 @@ public function jsonSerialize() '__CLASS__' => get_called_class(), ]); } - /** - * @param Generator $generator - * @param array $args - * @return AbstractModel - */ - public static function instanceFromSerializedJson(Generator $generator, array $args) + + public static function instanceFromSerializedJson(Generator $generator, array $args): self { self::checkSerializedJson($args); $class = $args['__CLASS__']; @@ -575,27 +376,104 @@ public static function instanceFromSerializedJson(Generator $generator, array $a $setFromSerializedJson = sprintf('set%sFromSerializedJson', ucfirst($arg)); $set = sprintf('set%s', ucfirst($arg)); if (method_exists($instance, $setFromSerializedJson)) { - $instance->$setFromSerializedJson($value); + $instance->{$setFromSerializedJson}($value); } elseif (method_exists($instance, $set)) { - $instance->$set($value); + $instance->{$set}($value); } } + return $instance; } + + /** + * Allows to merge meta from different sources and ensure consistency of their order + * Must be passed as less important (at first position) to most important (last position). + */ + protected function mergeMeta(): array + { + $meta = func_get_args(); + $mergedMeta = []; + $metaDocumentation = []; + // gather meta + foreach ($meta as $metaItem) { + foreach ($metaItem as $metaName => $metaValue) { + if (self::META_DOCUMENTATION === $metaName) { + $metaDocumentation = array_merge($metaDocumentation, $metaValue); + } elseif (!array_key_exists($metaName, $mergedMeta)) { + $mergedMeta[$metaName] = $metaValue; + } elseif (is_array($mergedMeta[$metaName]) && is_array($metaValue)) { + $mergedMeta[$metaName] = array_merge($mergedMeta[$metaName], $metaValue); + } elseif (is_array($mergedMeta[$metaName])) { + $mergedMeta[$metaName][] = $metaValue; + } else { + $mergedMeta[$metaName] = $metaValue; + } + } + } + + // sort by key + ksort($mergedMeta); + + // add documentation if any at first position + if (!empty($metaDocumentation)) { + $definitiveMeta = [ + self::META_DOCUMENTATION => array_unique(array_reverse($metaDocumentation)), + ]; + foreach ($mergedMeta as $metaName => $metaValue) { + $definitiveMeta[$metaName] = $metaValue; + } + $mergedMeta = $definitiveMeta; + unset($definitiveMeta); + } + unset($meta, $metaDocumentation); + + return $mergedMeta; + } + /** - * @param array $args - * @throws \InvalidArgumentException + * Static method which returns a unique name case sensitively + * Useful to name methods case sensitively distinct, see http://the-echoplex.net/log/php-case-sensitivity. + * + * @param string $name the original name + * @param string $context the context where the name is needed unique */ - protected static function checkSerializedJson(array $args) + protected static function uniqueName(string $name, string $context): string + { + $insensitiveKey = mb_strtolower($name.'_'.$context); + $sensitiveKey = $name.'_'.$context; + if (array_key_exists($sensitiveKey, self::$uniqueNames)) { + return self::$uniqueNames[$sensitiveKey]; + } + + if (!array_key_exists($insensitiveKey, self::$uniqueNames)) { + self::$uniqueNames[$insensitiveKey] = 0; + } else { + ++self::$uniqueNames[$insensitiveKey]; + } + + $uniqueName = $name.(self::$uniqueNames[$insensitiveKey] ? '_'.self::$uniqueNames[$insensitiveKey] : ''); + self::$uniqueNames[$sensitiveKey] = $uniqueName; + + return $uniqueName; + } + + /** + * Must return the properties of the inherited class. + */ + abstract protected function toJsonSerialize(): array; + + protected static function checkSerializedJson(array $args): void { if (!array_key_exists('__CLASS__', $args)) { - throw new \InvalidArgumentException(sprintf('__CLASS__ key is missing from "%s"', var_export($args, true))); + throw new InvalidArgumentException(sprintf('__CLASS__ key is missing from "%s"', var_export($args, true))); } + if (!class_exists($args['__CLASS__'])) { - throw new \InvalidArgumentException(sprintf('Class %s is unknown', $args['__CLASS__'])); + throw new InvalidArgumentException(sprintf('Class "%s" is unknown', $args['__CLASS__'])); } + if (!array_key_exists('name', $args)) { - throw new \InvalidArgumentException(sprintf('name key is missing from %s', var_export($args, true))); + throw new InvalidArgumentException(sprintf('name key is missing from "%s"', var_export($args, true))); } } } diff --git a/src/Model/EmptyModel.php b/src/Model/EmptyModel.php index d6aa91e9..a40c2171 100644 --- a/src/Model/EmptyModel.php +++ b/src/Model/EmptyModel.php @@ -1,14 +1,12 @@ setParameterType($parameterType)->setReturnType($returnType)->setUnique($isUnique)->setOwner($service); + $this + ->setParameterType($parameterType) + ->setReturnType($returnType) + ->setUnique($isUnique) + ->setOwner($service) + ; } + /** - * Method name can't starts with numbers - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getCleanName() - * @param bool $keepMultipleUnderscores - * @return string + * Method name can't starts with numbers. */ - public function getCleanName($keepMultipleUnderscores = true) + public function getCleanName(bool $keepMultipleUnderscores = true): string { return preg_replace('/^(\d+)([a-zA-Z0-9]*)$/', '_$2', parent::getCleanName($keepMultipleUnderscores)); } + /** * Returns the name of the method that is used to call the operation * It takes care of the fact that the method might not be the only one named as it is. - * @uses Method::getCleanName() - * @uses AbstractModel::replacePhpReservedKeyword() - * @uses AbstractModel::getOwner() - * @uses AbstractModel::getPackagedName() - * @uses AbstractModel::uniqueName() - * @uses Method::getOwner() - * @uses Method::getParameterType() - * @uses Method::isUnique() - * @return string */ - public function getMethodName() + public function getMethodName(): string { if (empty($this->methodName)) { $methodName = $this->getCleanName(); @@ -79,7 +51,7 @@ public function getMethodName() if (is_string($this->getParameterType())) { $methodName .= ucfirst($this->getParameterType()); } else { - $methodName .= '_' . md5(var_export($this->getParameterType(), true)); + $methodName .= '_'.md5(var_export($this->getParameterType(), true)); } } $context = $this->getOwner()->getPackagedName(); @@ -87,85 +59,57 @@ public function getMethodName() $methodName = self::replacePhpReservedKeyword($methodName, $context); $this->methodName = self::uniqueName($methodName, $this->getOwner()->getPackagedName()); } + return $this->methodName; } - /** - * Returns the parameter type - * @return string|string[] - */ + public function getParameterType() { return $this->parameterType; } - /** - * Set the parameter type - * @param string|string[] - * @return Method - */ - public function setParameterType($parameterType) + + public function setParameterType($parameterType): self { $this->parameterType = $parameterType; + return $this; } - /** - * Returns the return type - * @return string - */ + public function getReturnType() { return $this->returnType; } - /** - * Set the return type - * @param string|string[] - * @return Method - */ - public function setReturnType($returnType) + + public function setReturnType($returnType): self { $this->returnType = $returnType; + return $this; } - /** - * Returns the isUnique property - * @return bool - */ - public function isUnique() + + public function isUnique(): bool { return $this->isUnique; } - /** - * Set the isUnique property - * @param bool - * @return Method - */ - public function setUnique($isUnique) + + public function setUnique(bool $isUnique = true): self { $this->isUnique = $isUnique; + return $this; } - /** - * Returns the owner model object, meaning a Service object - * @see AbstractModel::getOwner() - * @uses AbstractModel::getOwner() - * @return Service - */ - public function getOwner() + + public function getOwner(): Service { return parent::getOwner(); } - /** - * @param $filename - * @return ServiceReservedMethod - */ - public function getReservedMethodsInstance($filename = null) + + public function getReservedMethodsInstance(?string $filename = null): ServiceReservedMethod { return ServiceReservedMethod::instance($filename); } - /** - * {@inheritDoc} - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() - */ - protected function toJsonSerialize() + + protected function toJsonSerialize(): array { return [ 'unique' => $this->isUnique, diff --git a/src/Model/Schema.php b/src/Model/Schema.php index 83ab1f78..164b8c3a 100644 --- a/src/Model/Schema.php +++ b/src/Model/Schema.php @@ -1,21 +1,15 @@ setMethods(new MethodContainer($generator)); } - /** - * Returns the contextual part of the class name for the package - * @see AbstractModel::getContextualPart() - * @return string - */ - public function getContextualPart() + + public function getContextualPart(): string { return $this->getGenerator()->getOptionServicesFolder(); } - /** - * Returns the sub package name which the model belongs to - * Must be overridden by sub classes - * @see AbstractModel::getDocSubPackages() - * @return array - */ - public function getDocSubPackages() + + public function getDocSubPackages(): array { return [ 'Services', ]; } - /** - * Returns the methods of the service - * @return MethodContainer - */ - public function getMethods() + + public function getMethods(): MethodContainer { return $this->methods; } - /** - * Sets the methods container - * @param MethodContainer $methodContainer - * @return Service - */ - protected function setMethods(MethodContainer $methodContainer) - { - $this->methods = $methodContainer; - return $this; - } - /** - * Adds a method to the service - * @uses Method::setUnique() - * @param string $methodName original method name - * @param string|array $methodParameterType original parameter type/name - * @param string|array $methodReturnType original return type/name - * @param bool $methodIsUnique original isUnique value - * @return Method - */ - public function addMethod($methodName, $methodParameterType, $methodReturnType, $methodIsUnique = true) + + public function addMethod(string $methodName, $methodParameterType, $methodReturnType, $methodIsUnique = true): Method { $method = new Method($this->getGenerator(), $methodName, $methodParameterType, $methodReturnType, $this, $methodIsUnique); $this->methods->add($method); + return $method; } - /** - * Returns the method by its original name - * @uses Service::getMethods() - * @uses AbstractModel::getName() - * @param string $methodName the original method name - * @return Method|null - */ - public function getMethod($methodName) + + public function getMethod(string $methodName): ?Method { return $this->methods->getMethodByName($methodName); } - /** - * Allows to define from which class the current model extends - * @param bool $short - * @return string - */ - public function getExtends($short = false) + + public function getExtends(bool $short = false): string { $extends = $this->getGenerator()->getOptionSoapClientClass(); + return $short ? Utils::removeNamespace($extends) : $extends; } - /** - * @param $filename - * @return ServiceReservedMethod - */ - public function getReservedMethodsInstance($filename = null) + + public function getReservedMethodsInstance(?string $filename = null): ServiceReservedMethod { return ServiceReservedMethod::instance($filename); } - /** - * {@inheritDoc} - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() - */ - protected function toJsonSerialize() - { - return [ - 'methods' => $this->methods, - ]; - } - /** - * @param array $methods - */ - public function setMethodsFromSerializedJson(array $methods) + + public function setMethodsFromSerializedJson(array $methods): void { foreach ($methods as $method) { $this->methods->add(self::instanceFromSerializedJson($this->generator, $method)->setOwner($this)); } } + + protected function setMethods(MethodContainer $methodContainer): self + { + $this->methods = $methodContainer; + + return $this; + } + + protected function toJsonSerialize(): array + { + return [ + 'methods' => $this->methods, + ]; + } } diff --git a/src/Model/Struct.php b/src/Model/Struct.php index cf17dd00..1c9f87b6 100644 --- a/src/Model/Struct.php +++ b/src/Model/Struct.php @@ -1,75 +1,61 @@ setRestriction($isRestriction) ->setAttributes(new StructAttributeContainer($generator)) ->setValues(new StructValueContainer($generator)) - ->setTypes([]); + ; } - /** - * Returns the contextual part of the class name for the package - * @see AbstractModel::getContextualPart() - * @uses Struct::isRestriction() - * @return string - */ - public function getContextualPart() + + public function getContextualPart(): string { $part = $this->getGenerator()->getOptionStructsFolder(); if ($this->isRestriction()) { @@ -94,16 +75,11 @@ public function getContextualPart() } elseif ($this->isArray()) { $part = $this->getGenerator()->getOptionArraysFolder(); } + return $part; } - /** - * Returns the sub package name which the model belongs to - * Must be overridden by sub classes - * @see AbstractModel::getDocSubPackages() - * @uses Struct::isRestriction() - * @return array - */ - public function getDocSubPackages() + + public function getDocSubPackages(): array { $package = self::DOC_SUB_PACKAGE_STRUCTS; if ($this->isRestriction()) { @@ -111,61 +87,49 @@ public function getDocSubPackages() } elseif ($this->isArray()) { $package = self::DOC_SUB_PACKAGE_ARRAYS; } + return [ $package, ]; } - /** - * Returns true if the current struct is a collection of values (like an array or a list of values) - * @uses AbstractModel::getName() - * @uses Struct::countOwnAttributes() - * @return bool - */ - public function isArray() + + public function isArray(): bool { return - ( ( ( - ($this->isStruct() && $this->countAllAttributes() === 1) || - (!$this->isStruct() && $this->countOwnAttributes() <= 1) - ) && - mb_stripos($this->getName(), 'array') !== false - ) || - (!$this->isStruct() && $this->getMetaValueFirstSet(['arraytype', 'arrayType'], false) !== false) - ); + ($this->isStruct() && 1 === $this->countAllAttributes()) + || (!$this->isStruct() && 1 >= $this->countOwnAttributes()) + ) + && false !== mb_stripos($this->getName(), 'array') + ) + || (!$this->isStruct() && false !== $this->getMetaValueFirstSet(['arraytype', 'arrayType'], false)) + ; } - /** - * Returns the attributes of the struct and potentially from the parent class - * @uses AbstractModel::getInheritance() - * @uses Struct::isStruct() - * @uses Struct::getAttributes() - * @param bool $includeInheritanceAttributes include the attributes of parent class, default parent attributes are not included. If true, then the array is an associative array containing and index "attribute" for the StructAttribute object and an index "model" for the Struct object. - * @param bool $requiredFirst places the required attributes first, then the not required in order to have the _construct method with the required attribute at first - * @return StructAttributeContainer - */ - public function getAttributes($includeInheritanceAttributes = false, $requiredFirst = false) + + public function getAttributes(bool $includeInheritanceAttributes = false, bool $requiredFirst = false): StructAttributeContainer { if (!$includeInheritanceAttributes && !$requiredFirst) { $attributes = $this->attributes; } else { $attributes = $this->getAllAttributes($includeInheritanceAttributes, $requiredFirst); } + return $attributes; } /** * Returns the attributes of the struct and not the ones that are declared by the parent struct if this struct inherits from a Struct - * This means it removes from the attributes this Struct has the attributes declared by its parent class(es) + * This means it removes from the attributes this Struct has the attributes declared by its parent class(es). + * * @param bool $requiredFirst places the required attributes first, then the not required in order to have the _construct method with the required attribute at first - * @return StructAttributeContainer */ - public function getProperAttributes($requiredFirst = false) + public function getProperAttributes(bool $requiredFirst = false): StructAttributeContainer { $properAttributes = new StructAttributeContainer($this->getGenerator()); $parentAttributes = new StructAttributeContainer($this->getGenerator()); - if ($this->getInheritance() != '' && ($model = $this->getInheritanceStruct()) instanceof Struct) { + if (!empty($this->getInheritance()) && ($model = $this->getInheritanceStruct()) instanceof Struct) { while ($model instanceof Struct && $model->isStruct()) { foreach ($model->getAttributes() as $attribute) { $parentAttributes->add($attribute); @@ -184,223 +148,96 @@ public function getProperAttributes($requiredFirst = false) return $requiredFirst ? $this->putRequiredAttributesFirst($properAttributes) : $properAttributes; } - /** - * @param bool $includeInheritanceAttributes - * @param bool $requiredFirst - * @return StructAttributeContainer - */ - protected function getAllAttributes($includeInheritanceAttributes, $requiredFirst) - { - $allAttributes = new StructAttributeContainer($this->getGenerator()); - if ($includeInheritanceAttributes) { - $this->addInheritanceAttributes($allAttributes); - } - foreach ($this->attributes as $attribute) { - $allAttributes->add($attribute); - } - if ($requiredFirst) { - $attributes = $this->putRequiredAttributesFirst($allAttributes); - } else { - $attributes = $allAttributes; - } - return $attributes; - } - /** - * @param StructAttributeContainer $attributes - */ - protected function addInheritanceAttributes(StructAttributeContainer $attributes) - { - if ($this->getInheritance() != '' && ($model = $this->getInheritanceStruct()) instanceof Struct) { - while ($model instanceof Struct && $model->isStruct()) { - foreach ($model->getAttributes() as $attribute) { - $attributes->add($attribute); - } - $model = $model->getInheritanceStruct(); - } - } - } - /** - * @param StructAttributeContainer $allAttributes - * @return StructAttributeContainer - */ - protected function putRequiredAttributesFirst(StructAttributeContainer $allAttributes) - { - $attributes = new StructAttributeContainer($this->getGenerator()); - $requiredAttributes = new StructAttributeContainer($this->getGenerator()); - $notRequiredAttributes = new StructAttributeContainer($this->getGenerator()); - foreach ($allAttributes as $attribute) { - if ($attribute->isRequired()) { - $requiredAttributes->add($attribute); - } else { - $notRequiredAttributes->add($attribute); - } - } - foreach ($requiredAttributes as $attribute) { - $attributes->add($attribute); - } - foreach ($notRequiredAttributes as $attribute) { - $attributes->add($attribute); - } - unset($requiredAttributes, $notRequiredAttributes); - return $attributes; - } - /** - * Returns the number of own attributes - * @uses Struct::getAttributes() - * @return int - */ - public function countOwnAttributes() + + public function countOwnAttributes(): int { return $this->getAttributes()->count(); } - /** - * Returns the number of all attributes - * @uses Struct::getAttributes() - * @return int - */ - public function countAllAttributes() + + public function countAllAttributes(): int { return $this->getAttributes(true)->count(); } - /** - * Sets the attributes of the struct - * @param StructAttributeContainer $structAttributeContainer - * @return Struct - */ - public function setAttributes(StructAttributeContainer $structAttributeContainer) + + public function setAttributes(StructAttributeContainer $structAttributeContainer): self { $this->attributes = $structAttributeContainer; + return $this; } - /** - * Adds attribute based on its original name - * @throws \InvalidArgumentException - * @param string $attributeName the attribute name - * @param string $attributeType the attribute type - * @return Struct - */ - public function addAttribute($attributeName, $attributeType) + + public function addAttribute(string $attributeName, string $attributeType): self { if (empty($attributeName) || empty($attributeType)) { - throw new \InvalidArgumentException(sprintf('Attribute name "%s" and/or attribute type "%s" is invalid for Struct "%s"', $attributeName, $attributeType, $this->getName()), __LINE__); + throw new InvalidArgumentException(sprintf('Attribute name "%s" and/or attribute type "%s" is invalid for Struct "%s"', $attributeName, $attributeType, $this->getName()), __LINE__); } - if ($this->attributes->getStructAttributeByName($attributeName) === null) { + if (is_null($this->attributes->getStructAttributeByName($attributeName))) { $structAttribute = new StructAttribute($this->getGenerator(), $attributeName, $attributeType, $this); $this->attributes->add($structAttribute); } + return $this; } - /** - * Returns the attribute by its name, otherwise null - * @uses Struct::getAttributes() - * @param string $attributeName the original attribute name - * @return StructAttribute|null - */ - public function getAttribute($attributeName) + + public function getAttribute(string $attributeName): ?StructAttribute { return $this->attributes->getStructAttributeByName($attributeName); } - /** - * Returns the attribute by its cleaned name, otherwise null - * @uses Struct::getAttributes() - * @param string $attributeCleanName the cleaned attribute name - * @return StructAttribute|null - */ - public function getAttributeByCleanName($attributeCleanName) + + public function getAttributeByCleanName(string $attributeCleanName): ?StructAttribute { return $this->attributes->getStructAttributeByCleanName($attributeCleanName); } - /** - * Returns the isRestriction value - * @return bool - */ - public function isRestriction() + + public function isRestriction(): bool { return $this->isRestriction; } - /** - * Sets the isRestriction value - * @param bool $isRestriction - * @return Struct - */ - public function setRestriction($isRestriction = true) + + public function setRestriction($isRestriction = true): self { $this->isRestriction = $isRestriction; + return $this; } - /** - * Returns the isStruct value - * @return bool - */ - public function isStruct() + + public function isStruct(): bool { return $this->isStruct; } - /** - * Sets the isStruct value - * @param bool $isStruct - * @return Struct - */ - public function setStruct($isStruct = true) + + public function setStruct(bool $isStruct = true): self { $this->isStruct = $isStruct; + return $this; } - /** - * Returns the list value - * @return string - */ - public function getList() + + public function getList(): string { return $this->list; } - /** - * Returns if the current struct is a list - * List are a set of basic-type values - * @return bool - */ - public function isList() + + public function isList(): bool { return !empty($this->list); } - /** - * Sets the list value - * @param string $list - * @return Struct - */ - public function setList($list = '') + + public function setList(string $list = ''): self { $this->list = $list; + return $this; } - /** - * Returns the values for an enumeration - * @return StructValueContainer - */ - public function getValues() + + public function getValues(): StructValueContainer { return $this->values; } - /** - * Sets the values for an enumeration - * @param StructValueContainer $structValueContainer - * @return Struct - */ - protected function setValues(StructValueContainer $structValueContainer) - { - $this->values = $structValueContainer; - return $this; - } - /** - * Adds value to values array - * @uses Struct::getValue() - * @uses Struct::getValues() - * @param mixed $value the original value - * @return Struct - */ - public function addValue($value) + + public function addValue($value): self { - if ($this->getValue($value) === null) { + if (is_null($this->getValue($value))) { // issue #177, rare case: a struct and an enum has the same name and the enum is not detected by the SoapClient, // then we need to create the enumeration struct in order to deduplicate the two structs // this is why enumerations has to be parsed before any other elements by the WSDL parsers @@ -410,35 +247,25 @@ public function addValue($value) ->setInheritance(self::DEFAULT_ENUM_TYPE) ->getValues()->add(new StructValue($enum->getGenerator(), $value, $enum->getValues()->count(), $enum)); $this->getGenerator()->getStructs()->add($enum); + return $enum; - } else { - $this - ->setStruct(true) - ->setRestriction(true) - ->getValues()->add(new StructValue($this->getGenerator(), $value, $this->getValues()->count(), $this)); } + $this + ->setStruct(true) + ->setRestriction(true) + ->getValues()->add(new StructValue($this->getGenerator(), $value, $this->getValues()->count(), $this)); } + return $this; } - /** - * Gets the value object for the given value - * @uses Struct::getValues() - * @uses AbstractModel::getName() - * @param string $value Value name - * @return StructValue|null - */ - public function getValue($value) + + public function getValue($value): ?StructValue { return $this->values->getStructValueByName($value); } - /** - * Allows to define from which class the current model extends - * @param bool $short - * @return string - */ - public function getExtends($short = false) + + public function getExtends(bool $short = false): string { - $extends = ''; if ($this->isArray()) { $extends = $this->getGenerator()->getOptionStructArrayClass(); } elseif ($this->isRestriction()) { @@ -446,19 +273,16 @@ public function getExtends($short = false) } else { $extends = $this->getGenerator()->getOptionStructClass(); } + return $short ? Utils::removeNamespace($extends) : $extends; } - /** - * @return Struct|null - */ - public function getInheritanceStruct() + + public function getInheritanceStruct(): ?Struct { return $this->getName() === $this->getInheritance() ? null : $this->getGenerator()->getStructByName(str_replace('[]', '', $this->getInheritance())); } - /** - * @return string - */ - public function getTopInheritance() + + public function getTopInheritance(): string { $inheritance = $this->getInheritance(); if (!empty($inheritance)) { @@ -471,12 +295,11 @@ public function getTopInheritance() $struct = $struct->getInheritanceStruct(); } } + return $inheritance; } - /** - * @return Struct|null - */ - public function getTopInheritanceStruct() + + public function getTopInheritanceStruct(): ?Struct { $struct = $this->getInheritanceStruct(); $latestValidStruct = $struct; @@ -486,83 +309,129 @@ public function getTopInheritanceStruct() $latestValidStruct = $struct; } } + return $latestValidStruct; } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta() - * @return string[] - */ - public function getMeta() + + public function getMeta(): array { $inheritanceStruct = $this->getInheritanceStruct(); + return $this->mergeMeta(($inheritanceStruct && !$inheritanceStruct->isStruct()) ? $inheritanceStruct->getMeta() : [], parent::getMeta()); } - /** - * @param $filename - * @return StructReservedMethod|StructArrayReservedMethod - */ - public function getReservedMethodsInstance($filename = null) + + public function getReservedMethodsInstance(?string $filename = null): AbstractReservedWord { $instance = StructReservedMethod::instance($filename); if ($this->isArray()) { $instance = StructArrayReservedMethod::instance($filename); } + return $instance; } - /** - * @return string[] - */ - public function getTypes() + + public function getTypes(): array { return $this->types; } - /** - * @return boolean - */ - public function isUnion() + + public function isUnion(): bool { - return count($this->types) > 0; + return 0 < count($this->types); } - /** - * @param string[] $types - * @return Struct - */ - public function setTypes(array $types) + + public function setTypes(array $types): self { $this->types = $types; + return $this; } - /** - * {@inheritDoc} - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() - */ - protected function toJsonSerialize() - { - return [ - 'attributes' => $this->attributes, - 'restriction' => $this->isRestriction, - 'struct' => $this->isStruct, - 'types' => $this->types, - 'values' => $this->values, - 'list' => $this->list, - ]; - } - /** - * @param array $attributes - */ - public function setAttributesFromSerializedJson(array $attributes) + + public function setAttributesFromSerializedJson(array $attributes): void { foreach ($attributes as $attribute) { $this->attributes->add(self::instanceFromSerializedJson($this->generator, $attribute)->setOwner($this)); } } - /** - * @param array $values - */ - public function setValuesFromSerializedJson(array $values) + + public function setValuesFromSerializedJson(array $values): void { foreach ($values as $value) { $this->values->add(self::instanceFromSerializedJson($this->generator, $value)->setOwner($this)); } } + + protected function getAllAttributes(bool $includeInheritanceAttributes, bool $requiredFirst): StructAttributeContainer + { + $allAttributes = new StructAttributeContainer($this->getGenerator()); + if ($includeInheritanceAttributes) { + $this->addInheritanceAttributes($allAttributes); + } + + foreach ($this->attributes as $attribute) { + $allAttributes->add($attribute); + } + + if ($requiredFirst) { + $attributes = $this->putRequiredAttributesFirst($allAttributes); + } else { + $attributes = $allAttributes; + } + + return $attributes; + } + + protected function addInheritanceAttributes(StructAttributeContainer $attributes): void + { + if (!empty($this->getInheritance()) && ($model = $this->getInheritanceStruct()) instanceof Struct) { + while ($model instanceof Struct && $model->isStruct()) { + foreach ($model->getAttributes() as $attribute) { + $attributes->add($attribute); + } + $model = $model->getInheritanceStruct(); + } + } + } + + protected function putRequiredAttributesFirst(StructAttributeContainer $allAttributes): StructAttributeContainer + { + $attributes = new StructAttributeContainer($this->getGenerator()); + $requiredAttributes = new StructAttributeContainer($this->getGenerator()); + $notRequiredAttributes = new StructAttributeContainer($this->getGenerator()); + foreach ($allAttributes as $attribute) { + if ($attribute->isRequired()) { + $requiredAttributes->add($attribute); + } else { + $notRequiredAttributes->add($attribute); + } + } + foreach ($requiredAttributes as $attribute) { + $attributes->add($attribute); + } + foreach ($notRequiredAttributes as $attribute) { + $attributes->add($attribute); + } + unset($requiredAttributes, $notRequiredAttributes); + + return $attributes; + } + + protected function setValues(StructValueContainer $structValueContainer): self + { + $this->values = $structValueContainer; + + return $this; + } + + protected function toJsonSerialize(): array + { + return [ + 'attributes' => $this->attributes, + 'restriction' => $this->isRestriction, + 'struct' => $this->isStruct, + 'types' => $this->types, + 'values' => $this->values, + 'list' => $this->list, + ]; + } } diff --git a/src/Model/StructAttribute.php b/src/Model/StructAttribute.php index cea7667a..fea81ebe 100644 --- a/src/Model/StructAttribute.php +++ b/src/Model/StructAttribute.php @@ -1,190 +1,142 @@ setType($type)->setOwner($struct); + $this + ->setType($type) + ->setOwner($struct) + ; } - /** - * Returns the unique name in the current struct (for setters/getters and struct constructor array) - * @uses AbstractModel::getCleanName() - * @uses AbstractModel::getName() - * @uses AbstractModel::uniqueName() - * @uses StructAttribute::getOwner() - * @param string $string - * @param string $additionalContext - * @return string - */ - public function getUniqueString($string, $additionalContext = '') + + public function getUniqueString(string $string, string $additionalContext = ''): string { - return self::uniqueName($string, spl_object_hash($this->getOwner()) . $this->getOwner()->getName() . $additionalContext); + return self::uniqueName($string, spl_object_hash($this->getOwner()).$this->getOwner()->getName().$additionalContext); } - /** - * Returns the unique name in the current struct (for setters/getters and struct constructor array) - * @uses AbstractModel::getCleanName() - * @uses AbstractModel::getName() - * @uses AbstractModel::uniqueName() - * @uses StructAttribute::getOwner() - * @param string $additionalContext - * @return string - */ - public function getUniqueName($additionalContext = '') + + public function getUniqueName(string $additionalContext = ''): string { return $this->getUniqueString($this->getCleanName(), $additionalContext); } - /** - * Returns the getter name for this attribute - * @uses StructAttribute::getUniqueName() - * @return string - */ - public function getGetterName() + + public function getGetterName(): string { return $this->replaceReservedMethod(sprintf('get%s', ucfirst($this->getUniqueName('get'))), $this->getOwner()->getPackagedName()); } - /** - * Returns the getter name for this attribute - * @uses StructAttribute::getUniqueName() - * @return string - */ - public function getSetterName() + + public function getSetterName(): string { return $this->replaceReservedMethod(sprintf('set%s', ucfirst($this->getUniqueName('set'))), $this->getOwner()->getPackagedName()); } - /** - * Returns the type value - * @return string - */ - public function getType($useTypeStruct = false) + + public function getType(bool $useTypeStruct = false): string { if ($useTypeStruct) { $typeStruct = $this->getTypeStruct(); if ($typeStruct instanceof Struct) { $type = $typeStruct->getTopInheritance(); + return $type ? $type : $this->type; } } + return $this->type; } - /** - * Sets the type value - * @param string $type - * @return StructAttribute - */ - public function setType($type) + + public function setType(string $type): StructAttribute { $this->type = $type; + return $this; } - /** - * Returns the type value - * @return bool - */ - public function getContainsElements() + + public function getContainsElements(): bool { return $this->containsElements; } + /** - * Sets the type value - * If already able to contain several occurrences, it must stay as it is, the wider behaviour wins - * @param bool $containsElements - * @return StructAttribute + * If already able to contain several occurrences, it must stay as it is, the wider behaviour wins. */ - public function setContainsElements($containsElements) + public function setContainsElements(bool $containsElements = true): StructAttribute { $this->containsElements = $this->containsElements || $containsElements; + return $this; } - /** - * @return bool - */ - public function getRemovableFromRequest() + + public function getRemovableFromRequest(): bool { return $this->removableFromRequest; } - /** - * @return bool - */ - public function isAChoice() + + public function isAChoice(): bool { return is_array($this->getMetaValue('choice')); } + /** - * If already able to be removed from request, it must stay as it is, the wider behaviour wins - * @param bool $removableFromRequest - * @return StructAttribute + * If already able to be removed from request, it must stay as it is, the wider behaviour wins. */ - public function setRemovableFromRequest($removableFromRequest) + public function setRemovableFromRequest(bool $removableFromRequest = true): StructAttribute { $this->removableFromRequest = $this->removableFromRequest || $removableFromRequest; + return $this; } + /** * If this attribute contains elements then it's an array * only if its parent, the Struct, is not itself an array, - * if the parent is an array, then it is certainly not an array too - * @return bool + * if the parent is an array, then it is certainly not an array too. */ - public function isArray() + public function isArray(): bool { return $this->containsElements || $this->isTypeStructArray(); } + /** * If this attribute is based on a struct that is a list, - * then it is list of basic scalar values that are sent space-separated - * @return bool + * then it is a list of basic scalar values that are sent space-separated. */ - public function isList() + public function isList(): bool { $typeStruct = $this->getTypeStruct(); + return $typeStruct && $typeStruct->isList(); } + /** - * Returns potential default value - * @uses AbstractModel::getMetaValueFirstSet() - * @uses Utils::getValueWithinItsType() - * @uses StructAttribute::getType() - * @uses StructAttribute::getContainsElements() - * @return mixed + * @return array|bool|float|int|string */ public function getDefaultValue() { @@ -204,99 +156,71 @@ public function getDefaultValue() 'defaultvalue', ]), $this->getType(true)); } - /** - * Returns true or false depending on minOccurs information associated to the attribute - * @uses AbstractModel::getMetaValueFirstSet() - * @uses AbstractModel::getMetaValue() - * @return bool true|false - */ - public function isRequired() + + public function isRequired(): bool { - return ($this->getMetaValue('use', '') === 'required' || $this->getMetaValueFirstSet([ + return 'required' === $this->getMetaValue('use', '') || 0 < $this->getMetaValueFirstSet([ 'minOccurs', 'minoccurs', 'MinOccurs', 'Minoccurs', - ], false)); + ], 0); } - /** - * Returns the owner model object, meaning a Struct object - * @see AbstractModel::getOwner() - * @uses AbstractModel::getOwner() - * @return Struct - */ - public function getOwner() + + public function getOwner(): Struct { return parent::getOwner(); } - /** - * @uses StructAttribute::getType() - * @return bool - */ - public function isXml() + + public function isXml(): bool { - return mb_stripos($this->getType(), '\DOM') === 0; + return DOMDocument::class === $this->getType(); } - /** - * @return Struct|null - */ - public function getTypeStruct() + + public function getTypeStruct(): ?Struct { $struct = $this->getGenerator()->getStructByNameAndType($this->getType(), $this->getInheritance()); + return $struct ? $struct : $this->getGenerator()->getStructByName($this->getType()); } - /** - * @return string[] - */ - public function getTypeStructMeta() + + public function getTypeStructMeta(): array { $typeStruct = $this->getTypeStruct(); + return ($typeStruct && !$typeStruct->isStruct()) ? $typeStruct->getMeta() : []; } - /** - * @return bool - */ - public function isTypeStructArray() + + public function isTypeStructArray(): bool { $typeStruct = $this->getTypeStruct(); + return $typeStruct && $typeStruct->isArray() && !$typeStruct->isStruct(); } - /** - * @return Struct|null - */ - public function getInheritanceStruct() + + public function getInheritanceStruct(): ?Struct { return $this->getGenerator()->getStructByName($this->getInheritance()); } - /** - * @return string[] - */ - public function getInheritanceStructMeta() + + public function getInheritanceStructMeta(): array { $inheritanceStruct = $this->getInheritanceStruct(); + return ($inheritanceStruct && !$inheritanceStruct->isStruct()) ? $inheritanceStruct->getMeta() : []; } - /** - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta() - * @return string[] - */ - public function getMeta() + + public function getMeta(): array { return $this->mergeMeta($this->getInheritanceStructMeta(), $this->getTypeStructMeta(), parent::getMeta()); } - /** - * @param $filename - * @return StructReservedMethod|StructArrayReservedMethod - */ - public function getReservedMethodsInstance($filename = null) + + public function getReservedMethodsInstance(?string $filename = null): AbstractReservedWord { return $this->getOwner()->getReservedMethodsInstance($filename); } - /** - * {@inheritDoc} - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() - */ - protected function toJsonSerialize() + + protected function toJsonSerialize(): array { return [ 'containsElements' => $this->containsElements, diff --git a/src/Model/StructValue.php b/src/Model/StructValue.php index d32557c4..34f196f1 100644 --- a/src/Model/StructValue.php +++ b/src/Model/StructValue.php @@ -1,150 +1,96 @@ setIndex($index) - ->setOwner($struct); + ->setOwner($struct) + ; } - /** - * Returns the name of the value as constant - * @see AbstractModel::getCleanName() - * @uses AbstractModel::getCleanName() - * @uses AbstractModel::getName() - * @uses AbstractModel::getOwner() - * @uses StructValue::constantSuffix() - * @uses StructValue::getIndex() - * @uses StructValue::getOwner() - * @uses Generator::getOptionGenericConstantsNames() - * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores - * @return string - */ - public function getCleanName($keepMultipleUnderscores = false) + + public function getCleanName(bool $keepMultipleUnderscores = false): string { if ($this->getGenerator()->getOptionGenericConstantsNames()) { - return 'ENUM_VALUE_' . $this->getIndex(); - } else { - $nameWithSeparatedWords = $this->getNameWithSeparatedWords($keepMultipleUnderscores); - $key = self::constantSuffix($this->getOwner()->getName(), $nameWithSeparatedWords, $this->getIndex()); - return 'VALUE_' . mb_strtoupper($nameWithSeparatedWords . ($key ? '_' . $key : '')); + return self::GENERIC_NAME_PREFIX.$this->getIndex(); } + + $nameWithSeparatedWords = $this->getNameWithSeparatedWords($keepMultipleUnderscores); + $key = self::constantSuffix($this->getOwner()->getName(), $nameWithSeparatedWords, $this->getIndex()); + + return self::VALUE_NAME_PREFIX.mb_strtoupper($nameWithSeparatedWords.($key ? '_'.$key : '')); } - /** - * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores - * @return string - */ - public function getNameWithSeparatedWords($keepMultipleUnderscores = false) + + public function getNameWithSeparatedWords(bool $keepMultipleUnderscores = false): string { - return trim(self::cleanString(preg_replace(self::MATCH_PATTERN, self::REPLACEMENT_PATTERN, $this->getName()), $keepMultipleUnderscores), '_'); + return trim(self::cleanString(preg_replace(self::MATCH_PATTERN, self::REPLACEMENT_PATTERN, (string) $this->getName()), $keepMultipleUnderscores), '_'); } - /** - * Returns the value with good type - * @uses AbstractModel::getName() - * @uses Utils::getValueWithinItsType() - * @return mixed - */ + public function getValue() { return Utils::getValueWithinItsType($this->getName()); } - /** - * Gets the index attribute value - * @return int - */ - public function getIndex() + + public function getIndex(): int { return $this->index; } - /** - * Sets the index attribute value - * @throws \InvalidArgumentException - * @param int $index - * @return StructValue - */ - public function setIndex($index) + + public function setIndex(int $index): StructValue { - if (!is_int($index) || $index < 0) { - throw new \InvalidArgumentException(sprintf('The value\'s index must be a positive integer, "%s" given', var_export($index, true))); + if (0 > $index) { + throw new InvalidArgumentException(sprintf('The value\'s index must be a positive integer, "%s" given', var_export($index, true))); } $this->index = $index; + return $this; } - /** - * Returns the index which has to be added at the end of natural constant name defined with the value cleaned - * Allows to avoid multiple constant name to be identical - * @param string $structName the struct name - * @param string $value the value - * @param int $index the position of the value - * @return int - */ - protected static function constantSuffix($structName, $value, $index) + + public function getOwner(): Struct + { + return parent::getOwner(); + } + + protected static function constantSuffix(string $structName, string $value, int $index): int { - $key = mb_strtoupper($structName . '_' . $value); - $indexedKey = $key . '_' . $index; + $key = mb_strtoupper($structName.'_'.$value); + $indexedKey = $key.'_'.$index; if (array_key_exists($indexedKey, self::$uniqueConstants)) { return self::$uniqueConstants[$indexedKey]; - } elseif (!array_key_exists($key, self::$uniqueConstants)) { + } + if (!array_key_exists($key, self::$uniqueConstants)) { self::$uniqueConstants[$key] = 0; } else { - self::$uniqueConstants[$key]++; + ++self::$uniqueConstants[$key]; } self::$uniqueConstants[$indexedKey] = self::$uniqueConstants[$key]; + return self::$uniqueConstants[$key]; } - /** - * Returns the owner model object, meaning a Struct object - * @see AbstractModel::getOwner() - * @uses AbstractModel::getOwner() - * @return Struct - */ - public function getOwner() - { - return parent::getOwner(); - } - /** - * {@inheritDoc} - * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() - */ - protected function toJsonSerialize() + + protected function toJsonSerialize(): array { return [ 'index' => $this->index, diff --git a/src/Model/Wsdl.php b/src/Model/Wsdl.php index 37a096f8..f8ab1188 100644 --- a/src/Model/Wsdl.php +++ b/src/Model/Wsdl.php @@ -1,21 +1,49 @@ schemas = new SchemaContainer($generator); } - /** - * @return \WsdlToPhp\PackageGenerator\WsdlHandler\Wsdl - */ - public function getContent() + + public function getContent(): WsdlDocument { return parent::getContent(); } + + public function addSchema(Schema $schema): self + { + $this->getContent()->addExternalSchema($schema->getContent()); + + $this->schemas->add($schema); + + return $this; + } + + public function hasSchema(string $schemaLocation): bool + { + return $this->schemas->getSchemaByName($schemaLocation) instanceof Schema; + } + + public function getSchemas(): SchemaContainer + { + return $this->schemas; + } + + protected function contentClass(): string + { + return WsdlDocument::class; + } } diff --git a/src/Parser/AbstractParser.php b/src/Parser/AbstractParser.php index 5e3f1d9c..bd57b1e9 100644 --- a/src/Parser/AbstractParser.php +++ b/src/Parser/AbstractParser.php @@ -1,15 +1,14 @@ getGenerator() + $methods = $this + ->getGenerator() ->getSoapClient() ->getSoapClient() ->getSoapClient() - ->__getFunctions(); + ->__getFunctions() + ; + $services = $this->getGenerator()->getServices(); - if (is_array($methods) && count($methods)) { - foreach ($methods as $method) { - $infos = explode(' ', $method); + + if (!is_array($methods) || 0 === count($methods)) { + return; + } + + foreach ($methods as $method) { + $infos = explode(' ', $method); + // "Regular" SOAP Style + if (count($infos) < 3) { + $returnType = $infos[0]; + if (count($infos) < 3 && false !== mb_strpos($infos[1], '()') && array_key_exists(1, $infos)) { + $methodName = trim(str_replace('()', '', $infos[1])); + $parameterType = null; + } else { + [$methodName, $parameterType] = explode('(', $infos[1]); + } + if (!empty($returnType) && !empty($methodName)) { + $services->addService($this->getGenerator()->getServiceName($methodName), $methodName, $parameterType, $returnType); + } + } elseif (count($infos) >= 3) { + /* + * RPC SOAP Style + * Some RPC WS defines the return type as a list of values + * So we define the return type as an array and reset the information to use to extract method name and parameters + */ + if (0 === mb_stripos($infos[0], 'list(')) { + $infos = explode(' ', preg_replace('/(list\(.*\)\s)/i', '', $method)); + array_unshift($infos, 'array'); + } /** - * "Regular" SOAP Style + * Returns type is not defined in some case. */ - if (count($infos) < 3) { - $returnType = $infos[0]; - if (count($infos) < 3 && mb_strpos($infos[1], '()') !== false && array_key_exists(1, $infos)) { - $methodName = trim(str_replace('()', '', $infos[1])); - $parameterType = null; - } else { - list($methodName, $parameterType) = explode('(', $infos[1]); - } - if (!empty($returnType) && !empty($methodName)) { - $services->addService($this->getGenerator()->getServiceName($methodName), $methodName, $parameterType, $returnType); - } - } elseif (count($infos) >= 3) { - /** - * RPC SOAP Style - * Some RPC WS defines the return type as a list of values - * So we define the return type as an array and reset the information to use to extract method name and parameters - */ - if (mb_stripos($infos[0], 'list(') === 0) { - $infos = explode(' ', preg_replace('/(list\(.*\)\s)/i', '', $method)); - array_unshift($infos, 'array'); - } - /** - * Returns type is not defined in some case - */ - $start = 0; - $returnType = mb_strpos($infos[0], '(') === false ? $infos[0] : ''; - $firstParameterType = ''; - if (empty($returnType) && mb_strpos($infos[0], '(') !== false) { - $start = 1; - list($methodName, $firstParameterType) = explode('(', $infos[0]); - } elseif (mb_strpos($infos[1], '(') !== false) { - $start = 2; - list($methodName, $firstParameterType) = explode('(', $infos[1]); - } - if (!empty($methodName)) { - $methodParameters = []; - $infosCount = count($infos); - for ($i = $start; $i < $infosCount; $i += 2) { - $info = str_replace([ - ', ', - ',', - '(', - ')', - '$', - ], '', trim($infos[$i])); - if (!empty($info)) { - $methodParameters = array_merge($methodParameters, [ - $info => $i == $start ? $firstParameterType : $infos[$i - 1], - ]); - } + $start = 0; + $returnType = false === mb_strpos($infos[0], '(') ? $infos[0] : ''; + $firstParameterType = ''; + if (empty($returnType) && false !== mb_strpos($infos[0], '(')) { + $start = 1; + [$methodName, $firstParameterType] = explode('(', $infos[0]); + } elseif (false !== mb_strpos($infos[1], '(')) { + $start = 2; + [$methodName, $firstParameterType] = explode('(', $infos[1]); + } + if (!empty($methodName)) { + $methodParameters = []; + $infosCount = count($infos); + for ($i = $start; $i < $infosCount; $i += 2) { + $info = str_replace([ + ', ', + ',', + '(', + ')', + '$', + ], '', trim($infos[$i])); + if (!empty($info)) { + $methodParameters = array_merge($methodParameters, [ + $info => $start === $i ? $firstParameterType : $infos[$i - 1], + ]); } - $services->addService($this->getGenerator()->getServiceName($methodName), $methodName, $methodParameters, empty($returnType) ? 'unknown' : $returnType); } + $services->addService($this->getGenerator()->getServiceName($methodName), $methodName, $methodParameters, empty($returnType) ? 'unknown' : $returnType); } } } diff --git a/src/Parser/SoapClient/Structs.php b/src/Parser/SoapClient/Structs.php index f2253243..b5589976 100644 --- a/src/Parser/SoapClient/Structs.php +++ b/src/Parser/SoapClient/Structs.php @@ -1,72 +1,62 @@ '; - /** - * @var string - */ - const ANY_XML_TYPE = '\DOMDocument'; - /** - * @var string[] - */ - protected $definedStructs = []; - /** - * Parses the SoapClient types - * @see \WsdlToPhp\PackageGenerator\Parser\ParserInterface::parse() - */ - public function parse() + public const STRUCT_DECLARATION = 'struct'; + public const UNION_DECLARATION = 'union'; + public const ANY_XML_DECLARATION = ''; + public const ANY_XML_TYPE = DOMDocument::class; + + protected array $definedStructs = []; + + public function parse(): void { - $types = $this->getGenerator() + $types = $this + ->getGenerator() ->getSoapClient() ->getSoapClient() ->getSoapClient() - ->__getTypes(); + ->__getTypes() + ; + foreach ($types as $type) { $this->parseType($type); } } - /** - * @param string $type - */ - protected function parseType($type) + + protected function parseType(string $type): void { - if (!$this->isStructDefined($type)) { - $cleanType = self::cleanType($type); - $typeDef = explode(' ', $cleanType); - if (array_key_exists(1, $typeDef) && !empty($typeDef)) { - $structName = $typeDef[1]; - if ($typeDef[0] === self::UNION_DECLARATION) { - $this->parseUnionStruct($typeDef); - } elseif ($typeDef[0] === self::STRUCT_DECLARATION) { - $this->parseComplexStruct($typeDef); - } else { - $this->getGenerator()->getStructs()->addVirtualStruct($structName, $typeDef[0]); - } + if ($this->isStructDefined($type)) { + return; + } + + $cleanType = self::cleanType($type); + $typeDef = explode(' ', $cleanType); + + if (array_key_exists(1, $typeDef) && !empty($typeDef)) { + $structName = $typeDef[1]; + if (self::UNION_DECLARATION === $typeDef[0]) { + $this->parseUnionStruct($typeDef); + } elseif (self::STRUCT_DECLARATION === $typeDef[0]) { + $this->parseComplexStruct($typeDef); + } else { + $this->getGenerator()->getStructs()->addVirtualStruct($structName, $typeDef[0]); } - $this->structHasBeenDefined($type); } + + $this->structHasBeenDefined($type); } - /** - * @param array $typeDef - */ - protected function parseComplexStruct($typeDef) + + protected function parseComplexStruct(array $typeDef): void { $typeDefCount = count($typeDef); - if ($typeDefCount > 3) { + if (3 < $typeDefCount) { for ($i = 2; $i < $typeDefCount; $i += 2) { $structParamType = str_replace(self::ANY_XML_DECLARATION, self::ANY_XML_TYPE, $typeDef[$i]); $structParamName = $typeDef[$i + 1]; @@ -76,14 +66,14 @@ protected function parseComplexStruct($typeDef) $this->getGenerator()->getStructs()->addStruct($typeDef[1]); } } + /** - * union types are passed such as ",dateTime,time" or ",PMS_ResStatusType,TransactionActionType,UpperCaseAlphaLength1to2" - * @param array $typeDef + * union types are passed such as ",dateTime,time" or ",PMS_ResStatusType,TransactionActionType,UpperCaseAlphaLength1to2". */ - protected function parseUnionStruct($typeDef) + protected function parseUnionStruct(array $typeDef): void { $typeDefCount = count($typeDef); - if ($typeDefCount === 3) { + if (3 === $typeDefCount) { $unionName = $typeDef[1]; $unionTypes = array_filter(explode(',', $typeDef[2]), function ($type) { return !empty($type); @@ -92,16 +82,15 @@ protected function parseUnionStruct($typeDef) $this->getGenerator()->getStructs()->addUnionStruct($unionName, $unionTypes); } } + /** * Remove useless break line, tabs * Remove curly braces * Remove brackets * Adds space before semicolon to parse it - * Remove duplicated spaces - * @param string $type - * @return string + * Remove duplicated spaces. */ - protected static function cleanType($type) + protected static function cleanType(string $type): string { $type = str_replace([ "\r", @@ -114,30 +103,23 @@ protected static function cleanType($type) ';', ], '', $type); $type = preg_replace('/[\s]+/', ' ', $type); + return trim($type); } - /** - * @param string $type - * @return boolean - */ - protected function isStructDefined($type) + + protected function isStructDefined(string $type): bool { return in_array(self::typeSignature($type), $this->definedStructs); } - /** - * @param string $type - * @return Structs - */ - protected function structHasBeenDefined($type) + + protected function structHasBeenDefined(string $type): Structs { $this->definedStructs[] = self::typeSignature($type); + return $this; } - /** - * @param string $type - * @return string - */ - protected static function typeSignature($type) + + protected static function typeSignature(string $type): string { return md5($type); } diff --git a/src/Parser/Wsdl/AbstractAttributesParser.php b/src/Parser/Wsdl/AbstractAttributesParser.php index db13061f..f9c47bce 100644 --- a/src/Parser/Wsdl/AbstractAttributesParser.php +++ b/src/Parser/Wsdl/AbstractAttributesParser.php @@ -1,43 +1,46 @@ getTags() as $tag) { - if ($tag instanceof Tag) { - $this->parseTag($tag); - } - } - } - /** - * @param Tag $tag - */ - public function parseTag(Tag $tag) + public function parseTag(Tag $tag): void { $parent = $tag->getSuitableParent(); + if ($parent instanceof Tag) { $model = $this->getModel($parent); if ($model instanceof Struct) { if ($tag->hasAttributeName() && ($modelAttribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) { - return $this->parseTagAttributes($tag, $model, $modelAttribute); - } elseif ($tag->hasAttributeRef() && ($modelAttribute = $model->getAttribute($tag->getAttributeRef())) instanceof StructAttribute) { - return $this->parseTagAttributes($tag, $model, $modelAttribute); + $this->parseTagAttributes($tag, $model, $modelAttribute); + + return; } + + if ($tag->hasAttributeRef() && ($modelAttribute = $model->getAttribute($tag->getAttributeRef())) instanceof StructAttribute) { + $this->parseTagAttributes($tag, $model, $modelAttribute); + + return; + } + $this->parseTagAttributes($tag, $model); } } + $this->parseTagAttributes($tag); } + + protected function parseWsdl(Wsdl $wsdl): void + { + foreach ($this->getTags() as $tag) { + $this->parseTag($tag); + } + } } diff --git a/src/Parser/Wsdl/AbstractParser.php b/src/Parser/Wsdl/AbstractParser.php index 2c1a1e9f..f98ec35c 100644 --- a/src/Parser/Wsdl/AbstractParser.php +++ b/src/Parser/Wsdl/AbstractParser.php @@ -1,144 +1,109 @@ parsedWsdls = []; - $this->parsedSchemas = []; - } + protected array $parsedSchemas = []; + /** - * The method takes care of looping among WSDLS as much time as it is needed - * @see \WsdlToPhp\PackageGenerator\Generator\ParserInterface::parse() + * The method takes care of looping among WSDLS as much time as it is needed. */ - final public function parse() + final public function parse(): void { $wsdl = $this->generator->getWsdl(); - if ($wsdl instanceof Wsdl) { - $content = $wsdl->getContent(); - if ($content instanceof WsdlDocument) { - if ($this->isWsdlParsed($wsdl) === false) { - $this->setWsdlAsParsed($wsdl)->setTags($content->getElementsByName($this->parsingTag()))->parseWsdl($wsdl); - } - foreach ($content->getExternalSchemas() as $schema) { - if ($this->isSchemaParsed($wsdl, $schema) === false) { - $this->setSchemaAsParsed($wsdl, $schema); - $schemaContent = $schema->getContent(); - if ($schemaContent instanceof SchemaDocument) { - $this->setTags($schemaContent->getElementsByName($this->parsingTag()))->parseSchema($wsdl, $schema); - } - } - } + + if (!$this->isWsdlParsed($wsdl)) { + $this + ->setWsdlAsParsed($wsdl) + ->setTags($wsdl->getContent()->getElementsByName($this->parsingTag())) + ->parseWsdl($wsdl) + ; + } + + /** @var Schema $schema */ + foreach ($wsdl->getSchemas() as $schema) { + if ($this->isSchemaParsed($wsdl, $schema)) { + continue; } + + $this->setSchemaAsParsed($wsdl, $schema); + + $this + ->setTags($schema->getContent()->getElementsByName($this->parsingTag())) + ->parseSchema($wsdl, $schema) + ; } } - /** - * Actual parsing of the Wsdl - * @param Wsdl $wsdl - */ - abstract protected function parseWsdl(Wsdl $wsdl); - /** - * Actual parsing of the Schema - * @param Wsdl $wsdl - * @param Schema $schema - */ - abstract protected function parseSchema(Wsdl $wsdl, Schema $schema); - /** - * Must return the tag that will be parsed - * @return string - */ - abstract protected function parsingTag(); - /** - * @param AbstractTag[] $tags - * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser - */ - protected function setTags(array $tags) + + public function getTags(): array { - $this->tags = $tags; - return $this; + return $this->tags; } - /** - * @return AbstractTag[] - */ - public function getTags() + + public function isWsdlParsed(Wsdl $wsdl): bool { - return $this->tags; + return array_key_exists($wsdl->getName(), $this->parsedWsdls) && is_array($this->parsedWsdls[$wsdl->getName()]) && in_array($this->parsingTag(), $this->parsedWsdls[$wsdl->getName()]); } - /** - * @param Wsdl $wsdl - * @return AbstractParser - */ - protected function setWsdlAsParsed(Wsdl $wsdl) + + public function isSchemaParsed(Wsdl $wsdl, Schema $schema): bool + { + $key = $wsdl->getName().$schema->getName(); + + return array_key_exists($key, $this->parsedSchemas) && is_array($this->parsedSchemas[$key]) && in_array($this->parsingTag(), $this->parsedSchemas[$key]); + } + + abstract protected function parseWsdl(Wsdl $wsdl): void; + + abstract protected function parseSchema(Wsdl $wsdl, Schema $schema): void; + + abstract protected function parsingTag(): string; + + protected function setTags(array $tags): self + { + $this->tags = $tags; + + return $this; + } + + protected function setWsdlAsParsed(Wsdl $wsdl): self { if (!array_key_exists($wsdl->getName(), $this->parsedWsdls)) { $this->parsedWsdls[$wsdl->getName()] = []; } $this->parsedWsdls[$wsdl->getName()][] = $this->parsingTag(); + return $this; } - /** - * @param Wsdl $wsdl - * @return boolean - */ - public function isWsdlParsed(Wsdl $wsdl) - { - return array_key_exists($wsdl->getName(), $this->parsedWsdls) && is_array($this->parsedWsdls[$wsdl->getName()]) && in_array($this->parsingTag(), $this->parsedWsdls[$wsdl->getName()]); - } - /** - * @param Wsdl $wsdl - * @param Schema $schema - * @return AbstractParser - */ - protected function setSchemaAsParsed(Wsdl $wsdl, Schema $schema) + + protected function setSchemaAsParsed(Wsdl $wsdl, Schema $schema): self { - $key = $wsdl->getName() . $schema->getName(); + $key = $wsdl->getName().$schema->getName(); if (!array_key_exists($key, $this->parsedSchemas)) { $this->parsedSchemas[$key] = []; } $this->parsedSchemas[$key][] = $this->parsingTag(); + return $this; } - /** - * @param Wsdl $wsdl - * @param Schema $schema - * @return boolean - */ - public function isSchemaParsed(Wsdl $wsdl, Schema $schema) - { - $key = $wsdl->getName() . $schema->getName(); - return array_key_exists($key, $this->parsedSchemas) && is_array($this->parsedSchemas[$key]) && in_array($this->parsingTag(), $this->parsedSchemas[$key]); - } } diff --git a/src/Parser/Wsdl/AbstractTagImportParser.php b/src/Parser/Wsdl/AbstractTagImportParser.php index 8a1cb33c..3ea40fa5 100644 --- a/src/Parser/Wsdl/AbstractTagImportParser.php +++ b/src/Parser/Wsdl/AbstractTagImportParser.php @@ -1,71 +1,62 @@ getTags() as $tag) { - if ($tag instanceof AbstractTagImport && $tag->getLocationAttribute() != '') { - $finalLocation = Utils::resolveCompletePath($this->getLocation($wsdl, $schema), $tag->getLocationAttribute()); - $this->generator->addSchemaToWsdl($wsdl, $finalLocation); + if (empty($location = $tag->getLocationAttributeValue())) { + continue; } + + $finalLocation = Utils::resolveCompletePath($this->getLocation($wsdl, $schema), $location); + $this->generator->addSchemaToWsdl($wsdl, $finalLocation); } } - /** - * @param Wsdl $wsdl - * @param Schema $schema - * @return string - */ - protected function getLocation(Wsdl $wsdl, Schema $schema = null) + + protected function getLocation(Wsdl $wsdl, Schema $schema = null): string { - $model = $wsdl; - if ($schema instanceof Schema) { - $model = $schema; - } - return $model->getName(); + return ($schema ?? $wsdl)->getName(); } + /** * The goal of this method is to ensure that each schema is parsed by both TagInclude and TagImport in case of one of the two does not find tags that matches its tag name. * As the GeneratorParsers loads the include/import tags parses in a certain order, it can occur that import tags might be found after the import tag parser has been launched and vice versa. - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parseSchema() - * @param Wsdl $wsdl - * @param Schema $schema */ - protected function parseSchema(Wsdl $wsdl, Schema $schema) + protected function parseSchema(Wsdl $wsdl, Schema $schema): void { - if (count($this->getTags())) { + if (0 < count($this->getTags())) { $this->parseWsdl($wsdl, $schema); } else { $this->getTagParser()->parse(); } } - /** - * @return AbstractTagImportParser - */ - protected function getTagParser() + + protected function getTagParser(): ?AbstractTagImportParser { $tagName = null; + switch ($this->parsingTag()) { case WsdlDocument::TAG_IMPORT: $tagName = WsdlDocument::TAG_INCLUDE; + break; + case WsdlDocument::TAG_INCLUDE: $tagName = WsdlDocument::TAG_IMPORT; + break; } + return $this->getGenerator()->getParsers()->getParsers()->getParserByName($tagName); } } diff --git a/src/Parser/Wsdl/AbstractTagInputOutputParser.php b/src/Parser/Wsdl/AbstractTagInputOutputParser.php index c00ccb20..c8c3810a 100644 --- a/src/Parser/Wsdl/AbstractTagInputOutputParser.php +++ b/src/Parser/Wsdl/AbstractTagInputOutputParser.php @@ -1,96 +1,85 @@ getTags() as $tag) { - if ($tag instanceof AbstractTagOperationElement) { - $this->parseInputOutput($tag); - } - } - } - /** - * @param AbstractTagOperationElement $tag - */ - public function parseInputOutput(AbstractTagOperationElement $tag) + public const UNKNOWN = 'unknown'; + + public function parseInputOutput(AbstractTagOperationElement $tag): void { if (!$tag->hasAttributeMessage()) { return; } + $operation = $tag->getParentOperation(); if (!$operation instanceof TagOperation) { return; } + $method = $this->getModel($operation); if (!$method instanceof Method) { return; } - if ($this->isKnownTypeUnknown($method)) { - $parts = $tag->getParts(); - $multipleParts = count($parts); - if (is_array($parts) && $multipleParts > 1) { - $types = []; - foreach ($parts as $part) { - if (($type = $this->getTypeFromPart($part)) !== '') { - $types[$part->getAttributeName()] = $type; - } - } - $this->setKnownType($method, $types); - } elseif (is_array($parts) && $multipleParts > 0) { - $part = array_shift($parts); - if ($part instanceof TagPart && ($type = $this->getTypeFromPart($part)) !== '') { - $this->setKnownType($method, $type); + + if (!$this->isKnownTypeUnknown($method)) { + return; + } + + $parts = $tag->getParts(); + $multipleParts = count($parts); + if (is_array($parts) && $multipleParts > 1) { + $types = []; + foreach ($parts as $part) { + if (!empty($type = $this->getTypeFromPart($part))) { + $types[$part->getAttributeName()] = $type; } } + $this->setKnownType($method, $types); + } elseif (is_array($parts) && $multipleParts > 0) { + $part = array_shift($parts); + if ($part instanceof TagPart && !empty($type = $this->getTypeFromPart($part))) { + $this->setKnownType($method, $type); + } + } + } + + abstract protected function getKnownType(Method $method); + + abstract protected function setKnownType(Method $method, $knownType); + + protected function parseWsdl(Wsdl $wsdl): void + { + foreach ($this->getTags() as $tag) { + $this->parseInputOutput($tag); } } - /** - * @param TagPart $part - * @return string - */ - protected function getTypeFromPart(TagPart $part) + + protected function getTypeFromPart(TagPart $part): string { return $part->getFinalType(); } - /** - * @param Method $method - * @return boolean - */ - protected function isKnownTypeUnknown(Method $method) + + protected function isKnownTypeUnknown(Method $method): bool { $isKnown = true; $knownType = $this->getKnownType($method); if (is_string($knownType)) { - $isKnown = !empty($knownType) && mb_strtolower($knownType) !== self::UNKNOWN; + $isKnown = !empty($knownType) && self::UNKNOWN !== mb_strtolower($knownType); } elseif (is_array($knownType)) { foreach ($knownType as $knownValue) { - $isKnown &= !empty($knownType) && mb_strtolower($knownValue) !== self::UNKNOWN; + $isKnown &= !empty($knownType) && self::UNKNOWN !== mb_strtolower($knownValue); } } + return (bool) !$isKnown; } } diff --git a/src/Parser/Wsdl/AbstractTagParser.php b/src/Parser/Wsdl/AbstractTagParser.php index 9dd4813b..69220671 100644 --- a/src/Parser/Wsdl/AbstractTagParser.php +++ b/src/Parser/Wsdl/AbstractTagParser.php @@ -1,116 +1,95 @@ generator; + return $this->parsingTag(); } - /** - * Return the model on which the method will be called - * @param Tag $tag - * @param string $type can be passed to specify the Struct type (inheritance) - * @return Struct|Method|null - */ - protected function getModel(Tag $tag, $type = '') + + protected function getModel(Tag $tag, string $type = ''): ?AbstractModel { switch ($tag->getName()) { case WsdlDocument::TAG_OPERATION: $model = $this->getMethodByName($tag->getAttributeName()); + break; + default: if (empty($type)) { $model = $this->getStructByName($tag->getAttributeName()); } else { $model = $this->getStructByNameAndType($tag->getAttributeName(), $type); } + break; } + return $model; } - /** - * @param string $name - * @return null|\WsdlToPhp\PackageGenerator\Model\Struct - */ - protected function getStructByName($name) + + protected function getStructByName(string $name): ?Struct { return $this->generator->getStructByName($name); } - /** - * @param string $name - * @param string $type - * @return null|\WsdlToPhp\PackageGenerator\Model\Struct - */ - protected function getStructByNameAndType($name, $type) + + protected function getStructByNameAndType(string $name, string $type): ?Struct { return $this->generator->getStructByNameAndType($name, $type); } - /** - * @param string $name - * @return null|\WsdlToPhp\PackageGenerator\Model\Method - */ - protected function getMethodByName($name) + + protected function getMethodByName(string $name): ?Method { return $this->generator->getServiceMethod($name); } + /** * Most of he time, this method is not used, even if it used, * for now, knowing that we are in a schema is not a useful information, - * so we can simply parse the tag with only the wsdl as parameter - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parseSchema() - * @param Wsdl $wsdl - * @param Schema $schema + * so we can simply parse the tag with only the wsdl as parameter. */ - protected function parseSchema(Wsdl $wsdl, Schema $schema) + protected function parseSchema(Wsdl $wsdl, Schema $schema): void { $this->parseWsdl($wsdl); } - /** - * @param Tag $tag - * @param AbstractModel $model - * @param StructAttribute $structAttribute - */ - protected function parseTagAttributes(Tag $tag, AbstractModel $model = null, StructAttribute $structAttribute = null) + + protected function parseTagAttributes(Tag $tag, AbstractModel $model = null, StructAttribute $structAttribute = null): void { $model = $model instanceof AbstractModel ? $model : $this->getModel($tag); - if ($model) { - foreach ($tag->getAttributes() as $attribute) { - $methodToCall = $this->getParseTagAttributeMethod($attribute->getName()); - if (is_array($methodToCall)) { - call_user_func_array($methodToCall, [ - $attribute, - $model, - $structAttribute, - ]); - } else { - $currentModel = $structAttribute instanceof StructAttribute ? $structAttribute : $model; - $currentModel->addMeta($attribute->getName(), $attribute->getValue(true)); - } + if (!$model) { + return; + } + + foreach ($tag->getAttributes() as $attribute) { + $methodToCall = $this->getParseTagAttributeMethod($attribute->getName()); + if (is_array($methodToCall)) { + call_user_func_array($methodToCall, [ + $attribute, + $model, + $structAttribute, + ]); + } else { + ($structAttribute ?? $model)->addMeta($attribute->getName(), $attribute->getValue(true)); } } } - /** - * @param string $tagName - * @return array|null - */ - protected function getParseTagAttributeMethod($tagName) + + protected function getParseTagAttributeMethod(string $tagName): ?array { $methodName = sprintf('parseTagAttribute%s', ucfirst($tagName)); if (method_exists($this, $methodName)) { @@ -119,63 +98,54 @@ protected function getParseTagAttributeMethod($tagName) $methodName, ]; } + return null; } - /** - * @param AttributeHandler $tagAttribute - * @param AbstractModel $model - * @param StructAttribute $structAttribute - */ - protected function parseTagAttributeType(AttributeHandler $tagAttribute, AbstractModel $model, StructAttribute $structAttribute = null) + + protected function parseTagAttributeType(AttributeHandler $tagAttribute, AbstractModel $model, StructAttribute $structAttribute = null): void { if ($structAttribute instanceof StructAttribute) { $type = $tagAttribute->getValue(); - if ($type !== null) { - $typeModel = $this->generator->getStructByName($type); - $modelAttributeType = $structAttribute->getType(); - if ($typeModel instanceof Struct && (empty($modelAttributeType) || mb_strtolower($modelAttributeType) === 'unknown')) { - if ($typeModel->isRestriction()) { - $structAttribute->setType($typeModel->getName()); - } elseif (!$typeModel->isStruct() && $typeModel->getInheritance()) { - $structAttribute->setType($typeModel->getInheritance()); - } + if (is_null($type)) { + return; + } + + $typeModel = $this->generator->getStructByName($type); + $modelAttributeType = $structAttribute->getType(); + + if ($typeModel instanceof Struct && (empty($modelAttributeType) || 'unknown' === mb_strtolower($modelAttributeType))) { + if ($typeModel->isRestriction()) { + $structAttribute->setType($typeModel->getName()); + } elseif (!$typeModel->isStruct() && $typeModel->getInheritance()) { + $structAttribute->setType($typeModel->getInheritance()); } } } else { $model->addMeta($tagAttribute->getName(), $tagAttribute->getValue(true)); } } + /** - * Avoid this attribute to be added as meta + * Avoid the "name" attribute to be added as meta. */ - protected function parseTagAttributeName() + protected function parseTagAttributeName(): void { } - /** - * @param AttributeHandler $tagAttribute - * @param AbstractModel $model - */ - protected function parseTagAttributeAbstract(AttributeHandler $tagAttribute, AbstractModel $model) + + protected function parseTagAttributeAbstract(AttributeHandler $tagAttribute, AbstractModel $model): void { $model->setAbstract($tagAttribute->getValue(false, true, 'bool')); } + /** - * Enumeration does not need its own value as meta information, it's like the name for struct attribute - * @param AttributeHandler $tagAttribute - * @param AbstractModel $model + * Enumeration does not need its own value as meta information, it's like the name for struct attribute. */ - protected function parseTagAttributeValue(AttributeHandler $tagAttribute, AbstractModel $model) + protected function parseTagAttributeValue(AttributeHandler $tagAttribute, AbstractModel $model): void { - if (!$model instanceof StructValue) { - $model->addMeta($tagAttribute->getName(), $tagAttribute->getValue(true)); + if ($model instanceof StructValue) { + return; } - } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\AbstractParser::getName() - * @return string - */ - public function getName() - { - return $this->parsingTag(); + + $model->addMeta($tagAttribute->getName(), $tagAttribute->getValue(true)); } } diff --git a/src/Parser/Wsdl/TagAttribute.php b/src/Parser/Wsdl/TagAttribute.php index 03f9b32b..29656eb2 100644 --- a/src/Parser/Wsdl/TagAttribute.php +++ b/src/Parser/Wsdl/TagAttribute.php @@ -1,40 +1,37 @@ getSuitableParent(); - /** - * Is it part of an attributeGroup - */ - if ($tag->hasAttribute('type') && $parent instanceof TagAttributeGroup) { - foreach ($parent->getReferencingElements() as $element) { - if (($model = $this->getModel($element)) instanceof Struct && ($attribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) { - $this->parseTagAttributes($tag, $attribute); - } + + // Is it part of an attributeGroup? + if (!$tag->hasAttribute('type') || !$parent instanceof TagAttributeGroup) { + return; + } + + foreach ($parent->getReferencingElements() as $element) { + if (($model = $this->getModel($element)) instanceof Struct && ($attribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) { + $this->parseTagAttributes($tag, $attribute); } } } + + protected function parsingTag(): string + { + return WsdlDocument::TAG_ATTRIBUTE; + } } diff --git a/src/Parser/Wsdl/TagChoice.php b/src/Parser/Wsdl/TagChoice.php index efa1ef2a..51e0a9b8 100644 --- a/src/Parser/Wsdl/TagChoice.php +++ b/src/Parser/Wsdl/TagChoice.php @@ -1,43 +1,23 @@ getTags() as $tag) { - if ($tag instanceof Choice) { - $this->parseChoice($tag); - } - } - } - - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() - { - return WsdlDocument::TAG_CHOICE; - } - /** * @see https://www.w3schools.com/xml/el_choice.asp * @see https://www.w3.org/TR/xmlschema11-1/#element-choice - * @param Choice $choice */ - public function parseChoice(Choice $choice) + public function parseChoice(Choice $choice): void { $parent = $choice->getSuitableParent(); $children = $choice->getChildrenElements(); @@ -53,23 +33,31 @@ public function parseChoice(Choice $choice) } } - /** - * @param Choice $choice - * @param string[] $choiceNames - * @param AbstractTag $child - * @param Struct $struct - */ - protected function parseChoiceChild(Choice $choice, array $choiceNames, AbstractTag $child, Struct $struct) + protected function parseWsdl(Wsdl $wsdl): void + { + foreach ($this->getTags() as $tag) { + $this->parseChoice($tag); + } + } + + protected function parsingTag(): string + { + return WsdlDocument::TAG_CHOICE; + } + + protected function parseChoiceChild(Choice $choice, array $choiceNames, AbstractTag $child, Struct $struct): void { $attributeName = $child->getAttributeName(); if (empty($attributeName) && ($attributeRef = $child->getAttributeRef())) { $attributeName = $attributeRef; } + if (($structAttribute = $struct->getAttribute($attributeName)) instanceof StructAttribute) { $structAttribute ->addMeta('choice', $choiceNames) ->addMeta('choiceMaxOccurs', $choice->getMaxOccurs()) - ->addMeta('choiceMinOccurs', $choice->getMinOccurs()); + ->addMeta('choiceMinOccurs', $choice->getMinOccurs()) + ; } } } diff --git a/src/Parser/Wsdl/TagComplexType.php b/src/Parser/Wsdl/TagComplexType.php index 16c7e661..61b038a9 100644 --- a/src/Parser/Wsdl/TagComplexType.php +++ b/src/Parser/Wsdl/TagComplexType.php @@ -1,37 +1,29 @@ parseTagAttributes($complexType); + } + + protected function parseWsdl(Wsdl $wsdl): void { foreach ($this->getTags() as $tag) { - if ($tag instanceof ComplexType) { - $this->parseComplexType($tag); - } + $this->parseComplexType($tag); } } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() + + protected function parsingTag(): string { return WsdlDocument::TAG_COMPLEX_TYPE; } - /** - * @param ComplexType $complexType - */ - public function parseComplexType(ComplexType $complexType) - { - $this->parseTagAttributes($complexType); - } } diff --git a/src/Parser/Wsdl/TagDocumentation.php b/src/Parser/Wsdl/TagDocumentation.php index 80364080..351ec5ff 100644 --- a/src/Parser/Wsdl/TagDocumentation.php +++ b/src/Parser/Wsdl/TagDocumentation.php @@ -1,93 +1,86 @@ getTags() as $tag) { - if ($tag instanceof Documentation) { - $this->parseDocumentation($tag); - } - } - } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() - { - return WsdlDocument::TAG_DOCUMENTATION; - } - /** - * @param Documentation $documentation - */ - public function parseDocumentation(Documentation $documentation) + public function parseDocumentation(Documentation $documentation): void { $content = $documentation->getContent(); $parent = $documentation->getSuitableParent(); $parentParent = $parent instanceof Tag ? $parent->getSuitableParent() : null; - if (!empty($content) && $parent instanceof Tag) { - /** - * Is it an element ? part of an attributeGroup - * Finds parent node of this documentation node - */ - if ($parent->hasAttribute('type') && $parentParent instanceof TagAttributeGroup) { - foreach ($parentParent->getReferencingElements() as $element) { - if (($model = $this->getModel($element)) instanceof Struct && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { - $attribute->setDocumentation($content); - } - } - } - /** - * Is it an element ? part of a struct - * Finds parent node of this documentation node - */ - elseif ($parent->hasAttribute('type') && $parentParent instanceof Tag) { - if (($model = $this->getModel($parentParent)) instanceof Struct && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { + + if (empty($content) || !$parent instanceof Tag) { + return; + } + + /* + * Is it an element ? part of an attributeGroup + * Finds parent node of this documentation node + */ + if ($parent->hasAttribute('type') && $parentParent instanceof TagAttributeGroup) { + foreach ($parentParent->getReferencingElements() as $element) { + if (($model = $this->getModel($element)) instanceof Struct && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { $attribute->setDocumentation($content); } } - /** - * Is it a value of an enumeration ? - * Finds parent node of this documentation node - */ - elseif ($parent instanceof Enumeration && $parentParent instanceof Tag) { - if (($model = $this->getModel($parentParent)) instanceof Struct && ($structValue = $model->getValue($parent->getValue())) instanceof StructValue) { - $structValue->setDocumentation($content); - } + } + /* + * Is it an element ? part of a struct + * Finds parent node of this documentation node + */ + elseif ($parent->hasAttribute('type') && $parentParent instanceof Tag) { + if (($model = $this->getModel($parentParent)) instanceof Struct && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { + $attribute->setDocumentation($content); } - /** - * Is it a restriction with enumeration (a real struct) that needs to find the model based on its type ? - */ - elseif ($parent->hasRestrictionChild() && $parent->getFirstRestrictionChild()->isEnumeration() && $parent->getFirstRestrictionChild()->isTheParent($parent)) { - $model = $this->getModel($parent, $parent->getFirstRestrictionChild()->getAttributeBase()); - $model = $model ? $model : $this->getModel($parent); - if ($model instanceof Struct) { - $model->setDocumentation($content); - } + } + /* + * Is it a value of an enumeration ? + * Finds parent node of this documentation node + */ + elseif ($parent instanceof Enumeration && $parentParent instanceof Tag) { + if (($model = $this->getModel($parentParent)) instanceof Struct && ($structValue = $model->getValue($parent->getValue())) instanceof StructValue) { + $structValue->setDocumentation($content); } - /** - * Is it an element ? - * Finds parent node of this documentation node - */ - elseif ($model = $this->getModel($parent)) { + } + // Is it a restriction with enumeration (a real struct) that needs to find the model based on its type ? + elseif ($parent->hasRestrictionChild() && $parent->getFirstRestrictionChild()->isEnumeration() && $parent->getFirstRestrictionChild()->isTheParent($parent)) { + $model = $this->getModel($parent, $parent->getFirstRestrictionChild()->getAttributeBase()); + $model = $model ? $model : $this->getModel($parent); + if ($model instanceof Struct) { $model->setDocumentation($content); } } + /* + * Is it an element ? + * Finds parent node of this documentation node + */ + elseif ($model = $this->getModel($parent)) { + $model->setDocumentation($content); + } + } + + protected function parseWsdl(Wsdl $wsdl): void + { + foreach ($this->getTags() as $tag) { + $this->parseDocumentation($tag); + } + } + + protected function parsingTag(): string + { + return WsdlDocument::TAG_DOCUMENTATION; } } diff --git a/src/Parser/Wsdl/TagElement.php b/src/Parser/Wsdl/TagElement.php index 85db805e..fffee0a4 100644 --- a/src/Parser/Wsdl/TagElement.php +++ b/src/Parser/Wsdl/TagElement.php @@ -1,35 +1,30 @@ setContainsElements($tag->canOccurSeveralTimes())->setRemovableFromRequest($tag->isRemovable()); + $structAttribute + ->setContainsElements($tag->canOccurSeveralTimes()) + ->setRemovableFromRequest($tag->isRemovable()) + ; } } } diff --git a/src/Parser/Wsdl/TagEnumeration.php b/src/Parser/Wsdl/TagEnumeration.php index 27c07032..b6cb5503 100644 --- a/src/Parser/Wsdl/TagEnumeration.php +++ b/src/Parser/Wsdl/TagEnumeration.php @@ -1,61 +1,55 @@ getModel($tag, $enumeration->getRestrictionParentType()); + $struct = $struct ? $struct : $this->getModel($tag); + if (!$struct instanceof Struct) { + return; + } + + // issue #177: the aim of redefining the $struct variable is to keep the reference to the right struct + $struct = $struct->addValue($enumeration->getValue()); + if (($value = $struct->getValue($enumeration->getValue())) instanceof StructValue) { + $this->parseTagAttributes($enumeration, $value); + } + } + + protected function parseWsdl(Wsdl $wsdl): void { foreach ($this->getTags() as $tag) { - if ($tag instanceof Enumeration) { - $this->parseEnumeration($tag); - } + $this->parseEnumeration($tag); } } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() + + protected function parsingTag(): string { return WsdlDocument::TAG_ENUMERATION; } - /** - * @param Enumeration $enumeration - */ - protected function parseEnumeration(Enumeration $enumeration) + + protected function parseEnumeration(Enumeration $enumeration): void { $parent = $enumeration->getSuitableParent(); - if ($parent instanceof Tag) { - $this->addStructValue($parent, $enumeration); - } - } - /** - * @param Tag $tag - * @param Enumeration $enumeration - */ - public function addStructValue(Tag $tag, Enumeration $enumeration) - { - // issue #177: first time, the enumeration struct is unknown, - // it'll be created when addValue is called on the existing struct which is not an enum - $struct = $this->getModel($tag, $enumeration->getRestrictionParentType()); - $struct = $struct ? $struct : $this->getModel($tag); - if ($struct instanceof Struct) { - // issue #177: the aim of redefining the $struct variable is to keep the reference to the right struct - $struct = $struct->addValue($enumeration->getValue()); - if (($value = $struct->getValue($enumeration->getValue())) instanceof StructValue) { - $this->parseTagAttributes($enumeration, $value); - } + + if (!$parent instanceof Tag) { + return; } + + $this->addStructValue($parent, $enumeration); } } diff --git a/src/Parser/Wsdl/TagExtension.php b/src/Parser/Wsdl/TagExtension.php index 53f71b24..4dbf313f 100644 --- a/src/Parser/Wsdl/TagExtension.php +++ b/src/Parser/Wsdl/TagExtension.php @@ -1,38 +1,18 @@ getTags() as $tag) { - if ($tag instanceof Extension) { - $this->parseExtension($tag); - } - } - } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() - { - return WsdlDocument::TAG_EXTENSION; - } - /** - * @param Extension $extension - */ - public function parseExtension(Extension $extension) + public function parseExtension(Extension $extension): void { $base = $extension->getAttribute('base')->getValue(); $parent = $extension->getSuitableParent(); @@ -40,4 +20,16 @@ public function parseExtension(Extension $extension) $this->getModel($parent)->setInheritance($base); } } + + protected function parseWsdl(Wsdl $wsdl): void + { + foreach ($this->getTags() as $tag) { + $this->parseExtension($tag); + } + } + + protected function parsingTag(): string + { + return WsdlDocument::TAG_EXTENSION; + } } diff --git a/src/Parser/Wsdl/TagHeader.php b/src/Parser/Wsdl/TagHeader.php index 508ccc4c..5e0079ad 100644 --- a/src/Parser/Wsdl/TagHeader.php +++ b/src/Parser/Wsdl/TagHeader.php @@ -1,84 +1,68 @@ getTags() as $tag) { - if ($tag instanceof Header) { - $this->parseHeader($tag); - } + $operation = $header->getParentOperation(); + $input = $header->getParentInput(); + if (!$operation instanceof Operation || !$input instanceof Input) { + return; + } + + $serviceMethod = $this->getModel($operation); + if (!$serviceMethod instanceof Method || $this->isSoapHeaderAlreadyDefined($serviceMethod, $header->getHeaderName())) { + return; } + + $serviceMethod + ->addMeta(self::META_SOAP_HEADERS, [ + $header->getHeaderRequired(), + ]) + ->addMeta(self::META_SOAP_HEADER_NAMES, [ + $header->getHeaderName(), + ]) + ->addMeta(self::META_SOAP_HEADER_TYPES, [ + $header->getHeaderType(), + ]) + ->addMeta(self::META_SOAP_HEADER_NAMESPACES, [ + $header->getHeaderNamespace(), + ]) + ; } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() + + protected function parseWsdl(Wsdl $wsdl): void { - return WsdlDocument::TAG_HEADER; + foreach ($this->getTags() as $tag) { + $this->parseHeader($tag); + } } - /** - * @param Header $header - */ - public function parseHeader(Header $header) + + protected function parsingTag(): string { - $operation = $header->getParentOperation(); - $input = $header->getParentInput(); - if ($operation instanceof Operation && $input instanceof Input) { - $serviceMethod = $this->getModel($operation); - if ($serviceMethod instanceof Method && !$this->isSoapHeaderAlreadyDefined($serviceMethod, $header->getHeaderName())) { - $serviceMethod->addMeta(self::META_SOAP_HEADERS, [ - $header->getHeaderRequired(), - ]) - ->addMeta(self::META_SOAP_HEADER_NAMES, [ - $header->getHeaderName(), - ]) - ->addMeta(self::META_SOAP_HEADER_TYPES, [ - $header->getHeaderType(), - ]) - ->addMeta(self::META_SOAP_HEADER_NAMESPACES, [ - $header->getHeaderNamespace(), - ]); - } - } + return WsdlDocument::TAG_HEADER; } - /** - * @param Method $method - * @param string $soapHeaderName - * @return bool - */ - protected function isSoapHeaderAlreadyDefined(Method $method, $soapHeaderName) + + protected function isSoapHeaderAlreadyDefined(Method $method, string $soapHeaderName): bool { $methodSoapHeaders = $method->getMetaValue(self::META_SOAP_HEADER_NAMES, []); + return in_array($soapHeaderName, $methodSoapHeaders, true); } } diff --git a/src/Parser/Wsdl/TagImport.php b/src/Parser/Wsdl/TagImport.php index b958a6b5..18581c34 100644 --- a/src/Parser/Wsdl/TagImport.php +++ b/src/Parser/Wsdl/TagImport.php @@ -1,16 +1,14 @@ getParameterType(); } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractTagInputOutputParser::setKnownType() - * @param Method $method - * @param string|string[] $knownType - * @return TagInput - */ - protected function setKnownType(Method $method, $knownType) + + protected function setKnownType(Method $method, $knownType): self { $method->setParameterType($knownType); + return $this; } } diff --git a/src/Parser/Wsdl/TagList.php b/src/Parser/Wsdl/TagList.php index 55102754..af724b0c 100644 --- a/src/Parser/Wsdl/TagList.php +++ b/src/Parser/Wsdl/TagList.php @@ -1,62 +1,62 @@ getTags() as $tag) { - if ($tag instanceof ListTag) { - $this->parseList($tag); - } + $parent = $tag->getSuitableParent(); + if (!$parent instanceof AbstractTag) { + return; + } + + $parentParent = $parent->getSuitableParent(); + $model = $this->getModel($parent); + if (is_null($model) && $parentParent instanceof AbstractTag) { + $model = $this->getModel($parentParent); + } + + if (!$model instanceof Struct) { + return; + } + + $itemType = $tag->getItemType(); + $struct = $this->getStructByName($itemType); + + $type = $struct instanceof Struct ? $struct->getName() : $itemType; + if ($parentParent instanceof AbstractTag && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { + $attribute + ->setContainsElements(true) + ->setType($type) + ->setInheritance($type) + ; + } else { + $model + ->setList($type) + ->setInheritance(sprintf('%s[]', $type)) + ; } } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() + + protected function parseWsdl(Wsdl $wsdl): void { - return WsdlDocument::TAG_LIST; + foreach ($this->getTags() as $tag) { + $this->parseList($tag); + } } - /** - * @param ListTag $tag - */ - public function parseList(ListTag $tag) + + protected function parsingTag(): string { - $parent = $tag->getSuitableParent(); - if ($parent instanceof AbstractTag) { - $parentParent = $parent->getSuitableParent(); - $model = $this->getModel($parent); - if ($model === null && $parentParent instanceof AbstractTag) { - $model = $this->getModel($parentParent); - } - $itemType = $tag->getItemType(); - $struct = $this->getStructByName($itemType); - if ($model instanceof Struct) { - $type = $struct instanceof Struct ? $struct->getName() : $itemType; - if ($parentParent instanceof AbstractTag && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { - $attribute - ->setContainsElements(true) - ->setType($type) - ->setInheritance($type); - } else { - $model - ->setList($type) - ->setInheritance(sprintf('%s[]', $type)); - } - } - } + return WsdlDocument::TAG_LIST; } } diff --git a/src/Parser/Wsdl/TagOutput.php b/src/Parser/Wsdl/TagOutput.php index 97c3f90c..64f8f0f1 100644 --- a/src/Parser/Wsdl/TagOutput.php +++ b/src/Parser/Wsdl/TagOutput.php @@ -1,38 +1,28 @@ getReturnType(); } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractTagOutputOutputParser::setKnownType() - * @param Method $method - * @param string|string[] $knownType - * @return TagOutput - */ - protected function setKnownType(Method $method, $knownType) + + protected function setKnownType(Method $method, $knownType): self { $method->setReturnType($knownType); + return $this; } } diff --git a/src/Parser/Wsdl/TagRestriction.php b/src/Parser/Wsdl/TagRestriction.php index 54f97af1..45068d5f 100644 --- a/src/Parser/Wsdl/TagRestriction.php +++ b/src/Parser/Wsdl/TagRestriction.php @@ -1,77 +1,77 @@ getTags() as $tag) { - if ($tag instanceof Restriction && $tag->isEnumeration() === false) { - $this->parseRestriction($tag); + $parent = $restriction->getSuitableParent(); + if (!$parent) { + return; + } + + $parentParent = $parent->getSuitableParent(); + if ($parentParent) { + $parentModel = $this->getModel($parentParent); + if (!$parentModel instanceof Struct) { + return; + } + + $parentAttribute = $parentModel->getAttribute($parent->getAttributeName()); + if (!$parentAttribute instanceof StructAttribute) { + return; + } + + $this + ->parseRestrictionAttributes($parentAttribute, $restriction) + ->parseRestrictionChildren($parentAttribute, $restriction) + ; + } else { + // if restriction is contained by an union tag, don't create the virtual struct as "union"s + // are wrongly parsed by SoapClient::__getTypes and this creates a duplicated element then + $model = $this->getModel($parent, $restriction->getAttributeBase()); + if (!$restriction->hasUnionParent() && !$model) { + $this->getGenerator()->getStructs()->addVirtualStruct($parent->getAttributeName(), $restriction->getAttributeBase()); + $model = $this->getModel($parent, $restriction->getAttributeBase()); + } + if ($model instanceof Struct) { + $this + ->parseRestrictionAttributes($model, $restriction) + ->parseRestrictionChildren($model, $restriction) + ; } } } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() - { - return WsdlDocument::TAG_RESTRICTION; - } - /** - * @param Restriction $restriction - */ - public function parseRestriction(Restriction $restriction) + + protected function parseWsdl(Wsdl $wsdl): void { - $parent = $restriction->getSuitableParent(); - if ($parent) { - $parentParent = $parent->getSuitableParent(); - if ($parentParent) { - $parentModel = $this->getModel($parentParent); - if ($parentModel instanceof Struct) { - $parentAttribute = $parentModel->getAttribute($parent->getAttributeName()); - if ($parentAttribute instanceof StructAttribute) { - $this - ->parseRestrictionAttributes($parentAttribute, $restriction) - ->parseRestrictionChildren($parentAttribute, $restriction); - } - } - } else { - // if restriction is contained by an union tag, don't create the virtual struct as "union"s - // are wrongly parsed by SoapClient::__getTypes and this creates a duplicated element then - $model = $this->getModel($parent, $restriction->getAttributeBase()); - if (!$restriction->hasUnionParent() && !$model) { - $this->getGenerator()->getStructs()->addVirtualStruct($parent->getAttributeName(), $restriction->getAttributeBase()); - $model = $this->getModel($parent, $restriction->getAttributeBase()); - } - if ($model instanceof Struct) { - $this - ->parseRestrictionAttributes($model, $restriction) - ->parseRestrictionChildren($model, $restriction); - } + foreach ($this->getTags() as $tag) { + if ($tag->isEnumeration()) { + continue; } + + $this->parseRestriction($tag); } } - /** - * @param AbstractModel $model - * @param Restriction $restriction - * @return TagRestriction - */ - protected function parseRestrictionAttributes(AbstractModel $model, Restriction $restriction) + + protected function parsingTag(): string + { + return WsdlDocument::TAG_RESTRICTION; + } + + protected function parseRestrictionAttributes(AbstractModel $model, Restriction $restriction): self { if ($restriction->hasAttributes()) { // ensure inheritance of model is well defined, SoapClient parser is based on SoapClient::__getTypes which can be false in some case @@ -80,28 +80,24 @@ protected function parseRestrictionAttributes(AbstractModel $model, Restriction $model->addMeta($attribute->getName(), $attribute->getValue(true)); } } + return $this; } - /** - * @param AbstractModel $model - * @param Restriction $restriction - * @return TagRestriction - */ - protected function parseRestrictionChildren(AbstractModel $model, Restriction $restriction) + + protected function parseRestrictionChildren(AbstractModel $model, Restriction $restriction): self { foreach ($restriction->getElementChildren() as $child) { - if ($child instanceof Tag) { - $this->parseRestrictionChild($model, $child); + if (!$child instanceof Tag) { + continue; } + + $this->parseRestrictionChild($model, $child); } + return $this; } - /** - * @param AbstractModel $model - * @param Tag $child - * @return TagRestriction - */ - protected function parseRestrictionChild(AbstractModel $model, Tag $child) + + protected function parseRestrictionChild(AbstractModel $model, Tag $child): self { if ($child->hasAttributeValue()) { $model->addMeta($child->getName(), $child->getValueAttributeValue(true)); @@ -110,19 +106,17 @@ protected function parseRestrictionChild(AbstractModel $model, Tag $child) $this->parseRestrictionChildAttribute($model, $attribute); } } + return $this; } - /** - * @param AbstractModel $model - * @param AttributeHandler $attribute - * @return TagRestriction - */ - protected function parseRestrictionChildAttribute(AbstractModel $model, AttributeHandler $attribute) + + protected function parseRestrictionChildAttribute(AbstractModel $model, AttributeHandler $attribute): self { - if (mb_strtolower($attribute->getName()) === 'arraytype') { + if ('arraytype' === mb_strtolower($attribute->getName())) { $model->setInheritance($attribute->getValue()); } $model->addMeta($attribute->getName(), $attribute->getValue(true)); + return $this; } } diff --git a/src/Parser/Wsdl/TagUnion.php b/src/Parser/Wsdl/TagUnion.php index 7b431dc4..6a1177c5 100644 --- a/src/Parser/Wsdl/TagUnion.php +++ b/src/Parser/Wsdl/TagUnion.php @@ -1,81 +1,78 @@ getTags() as $tag) { - if ($tag instanceof Union) { - $this->parseUnion($tag); - } + $parent = $union->getSuitableParent(); + if (!$parent) { + return; + } + + $model = $this->getModel($parent); + if (!$model) { + return; } + + $memberTypes = $union->getAttributeMemberTypes(); + if ($union->hasMemberTypesAsChildren()) { + $memberTypes = array_unique(array_merge($memberTypes, $this->getUnionMemberTypesFromChildren($union))); + } + + $memberTypes = array_filter($memberTypes, function ($memberType) use ($model) { + return $model->getName() !== $memberType; + }); + + if (empty($memberTypes)) { + return; + } + + $model->addMeta('union', $memberTypes); + $model->setInheritance($this->findSuitableInheritance($memberTypes)); } - /** - * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parsingTag() - */ - protected function parsingTag() + + protected function parseWsdl(Wsdl $wsdl): void { - return WsdlDocument::TAG_UNION; + foreach ($this->getTags() as $tag) { + $this->parseUnion($tag); + } } - /** - * @param Union $union - */ - public function parseUnion(Union $union) + + protected function parsingTag(): string { - $parent = $union->getSuitableParent(); - if ($parent) { - $model = $this->getModel($parent); - if ($model) { - $memberTypes = $union->getAttributeMemberTypes(); - if ($union->hasMemberTypesAsChildren()) { - $memberTypes = array_unique(array_merge($memberTypes, $this->getUnionMemberTypesFromChildren($union))); - } - $memberTypes = array_filter($memberTypes, function ($memberType) use ($model) { - return $model->getName() !== $memberType; - }); - if (!empty($memberTypes)) { - $model->addMeta('union', $memberTypes); - $model->setInheritance($this->findSuitableInheritance($memberTypes)); - } - } - } + return WsdlDocument::TAG_UNION; } - /** - * @param string[] $values - * @return string - */ - protected function findSuitableInheritance(array $values) + + protected function findSuitableInheritance(array $values): string { $validInheritance = ''; foreach ($values as $value) { $model = $this->getStructByName($value); - while ($model instanceof AbstractModel && $model->getInheritance() !== '') { + while ($model instanceof AbstractModel && !empty($model->getInheritance())) { $model = $this->getStructByName($validInheritance = $model->getInheritance()); } + if ($model instanceof AbstractModel) { $validInheritance = $model->getName(); + break; } } + return $validInheritance; } - /** - * @param Union $union - * @return string[] - */ - protected function getUnionMemberTypesFromChildren(Union $union) + + protected function getUnionMemberTypesFromChildren(Union $union): array { $memberTypes = []; foreach ($union->getMemberTypesChildren() as $child) { @@ -83,6 +80,7 @@ protected function getUnionMemberTypesFromChildren(Union $union) $memberTypes[] = $child->getFirstRestrictionChild()->getAttributeBase(); } } + return array_unique($memberTypes); } } diff --git a/src/WsdlHandler/AbstractDocument.php b/src/WsdlHandler/AbstractDocument.php deleted file mode 100644 index 5e67af54..00000000 --- a/src/WsdlHandler/AbstractDocument.php +++ /dev/null @@ -1,88 +0,0 @@ -nodeName), -1, 1)))); - $tagClass = sprintf('%s\Tag\Tag', __NAMESPACE__); - if (class_exists($elementNameClass)) { - $handlerName = $elementNameClass; - } elseif (class_exists($tagClass)) { - $handlerName = $tagClass; - } - return new $handlerName($element, $domDocument, $index); - } - /** - * @param string $namespace - * @return string - */ - public function getNamespaceUri($namespace) - { - $rootElement = $this->getRootElement(); - $uri = ''; - if ($rootElement instanceof ElementHandler && $rootElement->hasAttribute(sprintf('xmlns:%s', $namespace))) { - $uri = $rootElement->getAttribute(sprintf('xmlns:%s', $namespace))->getValue(); - } - return $uri; - } -} diff --git a/src/WsdlHandler/Schema.php b/src/WsdlHandler/Schema.php deleted file mode 100644 index 4c4af7c4..00000000 --- a/src/WsdlHandler/Schema.php +++ /dev/null @@ -1,7 +0,0 @@ -getParent() instanceof AbstractNodeHandler) { - $parentTags = $strict ? $additionalTags : $this->getSuitableParentTags($additionalTags); - $parentNode = $this->getParent()->getNode(); - while ($maxDeep-- > 0 && ($parentNode instanceof \DOMElement) && !empty($parentNode->nodeName) && (!preg_match('/' . implode('|', $parentTags) . '/i', $parentNode->nodeName) || ($checkName && preg_match('/' . implode('|', $parentTags) . '/i', $parentNode->nodeName) && (!$parentNode->hasAttribute('name') || $parentNode->getAttribute('name') === '')))) { - $parentNode = $parentNode->parentNode; - } - if ($parentNode instanceof \DOMElement) { - $parentNode = $this->getDomDocumentHandler()->getHandler($parentNode); - } else { - $parentNode = null; - } - } - return $parentNode; - } - /** - * Suitable tags as parent - * @param array $additionalTags - * @return string[] - */ - protected function getSuitableParentTags(array $additionalTags = []) - { - return array_merge([ - WsdlDocument::TAG_ELEMENT, - WsdlDocument::TAG_ATTRIBUTE, - WsdlDocument::TAG_SIMPLE_TYPE, - WsdlDocument::TAG_COMPLEX_TYPE, - ], $additionalTags); - } - /** - * @param string $name - * @param bool $checkName - * @return AbstractTag|null - */ - protected function getStrictParent($name, $checkName = false) - { - $parent = $this->getSuitableParent($checkName, [ - $name, - ], self::MAX_DEEP, true); - if ($parent instanceof AbstractNodeHandler && $parent->getName() === $name) { - return $parent; - } - return null; - } - /** - * @return bool - */ - public function hasAttributeName() - { - return $this->hasAttribute(Attribute::ATTRIBUTE_NAME); - } - /** - * @return bool - */ - public function hasAttributeRef() - { - return $this->hasAttribute(Attribute::ATTRIBUTE_REF); - } - /** - * @return string - */ - public function getAttributeName() - { - return $this->getAttribute(Attribute::ATTRIBUTE_NAME) instanceof Attribute ? $this->getAttribute(Attribute::ATTRIBUTE_NAME)->getValue() : ''; - } - /** - * @return string - */ - public function getAttributeRef() - { - return $this->getAttribute(Attribute::ATTRIBUTE_REF) instanceof Attribute ? $this->getAttribute(Attribute::ATTRIBUTE_REF)->getValue() : ''; - } - /** - * @return boolean - */ - public function hasAttributeValue() - { - return $this->hasAttribute(Attribute::ATTRIBUTE_VALUE); - } - /** - * @param bool $withNamespace - * @param bool $withinItsType - * @param string $asType - * @return mixed - */ - public function getValueAttributeValue($withNamespace = false, $withinItsType = true, $asType = null) - { - return $this->getAttribute(Attribute::ATTRIBUTE_VALUE) instanceof Attribute ? $this->getAttribute(Attribute::ATTRIBUTE_VALUE)->getValue($withNamespace, $withinItsType, $asType) : ''; - } - /** - * @return WsdlDocument|SchemaDocument - */ - public function getDomDocumentHandler() - { - return $this->domDocumentHandler; - } - /** - * @see \WsdlToPhp\DomHandler\AbstractElementHandler::getChildrenByName() - * @param string $name - * @return AbstractTag[] - */ - public function getChildrenByName($name) - { - return parent::getChildrenByName($name); - } -} diff --git a/src/WsdlHandler/Tag/AbstractTagImport.php b/src/WsdlHandler/Tag/AbstractTagImport.php deleted file mode 100644 index 4669359a..00000000 --- a/src/WsdlHandler/Tag/AbstractTagImport.php +++ /dev/null @@ -1,38 +0,0 @@ -hasAttribute(self::ATTRIBUTE_LOCATION)) { - $location = $this->getAttribute(self::ATTRIBUTE_LOCATION)->getValue(true); - } elseif ($this->hasAttribute(self::ATTRIBUTE_SCHEMA_LOCATION)) { - $location = $this->getAttribute(self::ATTRIBUTE_SCHEMA_LOCATION)->getValue(true); - } elseif ($this->hasAttribute(self::ATTRIBUTE_SCHEMA_LOCATION_)) { - $location = $this->getAttribute(self::ATTRIBUTE_SCHEMA_LOCATION_)->getValue(true); - } - if (!empty($location) && mb_substr($location, 0, 2) === './') { - $location = mb_substr($location, 2); - } - return $location; - } -} diff --git a/src/WsdlHandler/Tag/AbstractTagOperationElement.php b/src/WsdlHandler/Tag/AbstractTagOperationElement.php deleted file mode 100644 index b12ce004..00000000 --- a/src/WsdlHandler/Tag/AbstractTagOperationElement.php +++ /dev/null @@ -1,77 +0,0 @@ -getStrictParent(WsdlDocument::TAG_OPERATION); - } - /** - * @return bool - */ - public function hasAttributeMessage() - { - return $this->hasAttribute(self::ATTRIBUTE_MESSAGE); - } - /** - * @return string - */ - public function getAttributeMessage() - { - return $this->hasAttributeMessage() ? $this->getAttribute(self::ATTRIBUTE_MESSAGE)->getValue() : ''; - } - /** - * @return string - */ - public function getAttributeMessageNamespace() - { - return $this->hasAttribute(self::ATTRIBUTE_MESSAGE) ? $this->getAttribute(self::ATTRIBUTE_MESSAGE)->getValueNamespace() : ''; - } - /** - * @return TagMessage|null - */ - public function getMessage() - { - $message = null; - $messageName = $this->getAttributeMessage(); - if (!empty($messageName)) { - $message = $this->getDomDocumentHandler()->getElementByNameAndAttributes('message', [ - 'name' => $messageName, - ], true); - } - return $message; - } - /** - * @return TagPart[]|null - */ - public function getParts() - { - $parts = null; - $message = $this->getMessage(); - if ($message instanceof TagMessage) { - $parts = $message->getChildrenByName(WsdlDocument::TAG_PART); - } - return $parts; - } - /** - * @param string $partName - * @return TagPart|null - */ - public function getPart($partName) - { - $part = null; - $message = $this->getMessage(); - if ($message instanceof TagMessage && !empty($partName)) { - $part = $message->getPart($partName); - } - return $part; - } -} diff --git a/src/WsdlHandler/Tag/AbstractTagType.php b/src/WsdlHandler/Tag/AbstractTagType.php deleted file mode 100644 index 76c3be7b..00000000 --- a/src/WsdlHandler/Tag/AbstractTagType.php +++ /dev/null @@ -1,7 +0,0 @@ -getFirstRestrictionChild() instanceof Restriction; - } - - /** - * @return Restriction|null - */ - public function getFirstRestrictionChild() - { - return $this->getChildByNameAndAttributes(AbstractDocument::TAG_RESTRICTION, []); - } - - /** - * Checks if the given tag is the same direct parent of this current tag - * @param AbstractTag $tag - * @return bool - */ - public function isTheParent(AbstractTag $tag) - { - /** @var AbstractTag|null $parent */ - $parent = $this->getSuitableParent(); - return $parent ? $parent->getNode()->isSameNode($tag->getNode()) : false; - } -} diff --git a/src/WsdlHandler/Tag/TagAddress.php b/src/WsdlHandler/Tag/TagAddress.php deleted file mode 100644 index 2fd75d60..00000000 --- a/src/WsdlHandler/Tag/TagAddress.php +++ /dev/null @@ -1,7 +0,0 @@ -getDomDocumentHandler()->getElementsByNameAndAttributes('attributeGroup', [ - 'ref' => sprintf('*:%s', $this->getAttributeName()), - ]); - /** - * In case of a referencing element that use this attributeGroup that is not namespaced, - * use the non namespaced value - */ - if (empty($attributeGroups)) { - $attributeGroups = $this->getDomDocumentHandler()->getElementsByNameAndAttributes('attributeGroup', [ - 'ref' => sprintf('*%s', $this->getAttributeName()), - ]); - } - foreach ($attributeGroups as $attributeGroup) { - $parent = $attributeGroup->getSuitableParent(); - /** - * In this case, this means the attribute is included in another attribute group, - * this means we must climb to its parent recursively until we find the elements referencing the top attributeGroup tag - */ - if ($parent instanceof TagAttributeGroup) { - $elements = array_merge($elements, $parent->getReferencingElements()); - } elseif ($parent instanceof AbstractTag) { - $elements[] = $parent; - } - } - return $elements; - } -} diff --git a/src/WsdlHandler/Tag/TagBinding.php b/src/WsdlHandler/Tag/TagBinding.php deleted file mode 100644 index b7306750..00000000 --- a/src/WsdlHandler/Tag/TagBinding.php +++ /dev/null @@ -1,7 +0,0 @@ -getFilteredChildrenByName($tagName)); - } - return $children; - } - - /** - * @param $tagName - * @return AbstractTag[] - */ - protected function getFilteredChildrenByName($tagName) - { - return array_filter($this->getChildrenByName($tagName), [ - $this, - 'filterFoundChildren', - ]); - } - - /** - * This must ensure the current element, based on its tagName is not contained by another element than the choice. - * If it is contained by another element, then it is child/property of its parent element and does not belong to the choice elements - * @param AbstractTag $child - * @return bool - */ - protected function filterFoundChildren(AbstractTag $child) - { - $forbiddenParentTags = self::getForbiddenParentTags(); - $valid = true; - while ($child && $child->getParent() && !$this->getNode()->isSameNode($child->getParent()->getNode())) { - $valid &= !in_array($child->getParent()->getName(), $forbiddenParentTags); - $child = $child->getParent(); - } - return (bool) $valid; - } - - /** - * @see https://www.w3.org/TR/xmlschema11-1/#element-choice - * @return string[] - */ - public static function getChildrenElementsTags() - { - return [ - AbstractDocument::TAG_ELEMENT, - AbstractDocument::TAG_GROUP, - AbstractDocument::TAG_CHOICE, - AbstractDocument::TAG_ANY, - ]; - } - - /** - * @return string[] - */ - public static function getForbiddenParentTags() - { - return [ - AbstractDocument::TAG_COMPLEX_TYPE, - ]; - } -} diff --git a/src/WsdlHandler/Tag/TagComplexContent.php b/src/WsdlHandler/Tag/TagComplexContent.php deleted file mode 100644 index 10f761f0..00000000 --- a/src/WsdlHandler/Tag/TagComplexContent.php +++ /dev/null @@ -1,7 +0,0 @@ -getNodeValue(); - } - /** - * Finds parent node of this documentation node without taking care of the name attribute for enumeration. - * This case is managed first because enumerations are contained by elements and - * the method could climb to its parent without stopping on the enumeration tag. - * Indeed, depending on the node, it may contain or not the attribute named "name" so we have to split each case. - * @see \WsdlToPhp\PackageGenerator\WsdlHandler\Tag\AbstractTag::getSuitableParent() - */ - public function getSuitableParent($checkName = true, array $additionalTags = [], $maxDeep = self::MAX_DEEP, $strict = false) - { - if ($strict === false) { - $enumerationTag = $this->getStrictParent(WsdlDocument::TAG_ENUMERATION); - if ($enumerationTag instanceof TagEnumeration) { - return $enumerationTag; - } - } - return parent::getSuitableParent($checkName, $additionalTags, $maxDeep, $strict); - } - /** - * @see \WsdlToPhp\PackageGenerator\WsdlHandler\Tag\AbstractTag::getSuitableParentTags() - */ - public function getSuitableParentTags(array $additionalTags = []) - { - return parent::getSuitableParentTags(array_merge($additionalTags, [ - WsdlDocument::TAG_OPERATION, - WsdlDocument::TAG_ATTRIBUTE_GROUP, - ])); - } -} diff --git a/src/WsdlHandler/Tag/TagElement.php b/src/WsdlHandler/Tag/TagElement.php deleted file mode 100644 index 7f869c84..00000000 --- a/src/WsdlHandler/Tag/TagElement.php +++ /dev/null @@ -1,7 +0,0 @@ -getValueAttributeValue(true); - } - - /** - * @return TagRestriction|null - */ - public function getRestrictionParent() - { - return $this->getStrictParent(WsdlDocument::TAG_RESTRICTION); - } - - /** - * @return string - */ - public function getRestrictionParentType() - { - /** @var TagRestriction|null $restrictionParent */ - $restrictionParent = $this->getRestrictionParent(); - return $restrictionParent ? $restrictionParent->getAttributeBase() : ''; - } -} diff --git a/src/WsdlHandler/Tag/TagExtension.php b/src/WsdlHandler/Tag/TagExtension.php deleted file mode 100644 index 233cc744..00000000 --- a/src/WsdlHandler/Tag/TagExtension.php +++ /dev/null @@ -1,7 +0,0 @@ -getStrictParent(WsdlDocument::TAG_INPUT); - } - /** - * @return string|bool - */ - public function getAttributeRequired() - { - return $this->hasAttribute(self::ATTRIBUTE_REQUIRED) ? $this->getAttribute(self::ATTRIBUTE_REQUIRED)->getValue(true, true, 'bool') : true; - } - /** - * @return string - */ - public function getAttributeNamespace() - { - return $this->hasAttribute(Attribute::ATTRIBUTE_NAMESPACE) ? $this->getAttribute(Attribute::ATTRIBUTE_NAMESPACE)->getValue() : ''; - } - /** - * @return string - */ - public function getAttributePart() - { - return $this->hasAttribute(self::ATTRIBUTE_PART) ? $this->getAttribute(self::ATTRIBUTE_PART)->getValue() : ''; - } - /** - * @return TagPart|null - */ - public function getPartTag() - { - return $this->getPart($this->getAttributePart()); - } - /** - * @return string - */ - public function getHeaderType() - { - $part = $this->getPartTag(); - return $part instanceof TagPart ? $part->getFinalType() : ''; - } - /** - * @return string - */ - public function getHeaderName() - { - $part = $this->getPartTag(); - return $part instanceof TagPart ? $part->getFinalName() : ''; - } - /** - * @see \WsdlToPhp\DomHandler\AbstractNodeHandler::getNamespace() - * @return string - */ - public function getHeaderNamespace() - { - $namespace = $this->getHeaderNamespaceFromPart(); - if (empty($namespace)) { - $namespace = $this->getHeaderNamespaceFromMessage(); - } - return $namespace; - } - /** - * @return string - */ - protected function getHeaderNamespaceFromPart() - { - $part = $this->getPartTag(); - $namespace = ''; - if ($part instanceof TagPart) { - $finalNamespace = $part->getFinalNamespace(); - if (!empty($finalNamespace)) { - $namespace = $this->getDomDocumentHandler()->getNamespaceUri($finalNamespace); - } - } - return $namespace; - } - /** - * @return string - */ - protected function getHeaderNamespaceFromMessage() - { - $namespace = ''; - $messageNamespace = $this->getAttributeMessageNamespace(); - if (!empty($messageNamespace)) { - $namespace = $this->getDomDocumentHandler()->getNamespaceUri($messageNamespace); - } - return $namespace; - } - /** - * @return string - */ - public function getHeaderRequired() - { - return $this->getAttributeRequired() === true ? self::REQUIRED_HEADER : self::OPTIONAL_HEADER; - } -} diff --git a/src/WsdlHandler/Tag/TagImport.php b/src/WsdlHandler/Tag/TagImport.php deleted file mode 100644 index 324b3a86..00000000 --- a/src/WsdlHandler/Tag/TagImport.php +++ /dev/null @@ -1,7 +0,0 @@ -hasAttribute(self::ATTRIBUTE_ITEM_TYPE) ? $this->getAttribute(self::ATTRIBUTE_ITEM_TYPE)->getValue() : ''; - } - - /** - * @return string - */ - public function getItemType() - { - $itemType = $this->getAttributeItemType(); - // this means this is its simpleType's restriction child element that defines its type - if (empty($itemType)) { - $child = $this->getChildByNameAndAttributes(AbstractDocument::TAG_RESTRICTION, []); - if ($child instanceof TagRestriction && $child->hasAttributeBase()) { - $itemType = $child->getAttributeBase(); - } - } - return $itemType; - } -} diff --git a/src/WsdlHandler/Tag/TagMemberTypes.php b/src/WsdlHandler/Tag/TagMemberTypes.php deleted file mode 100644 index a254183c..00000000 --- a/src/WsdlHandler/Tag/TagMemberTypes.php +++ /dev/null @@ -1,7 +0,0 @@ -getChildByNameAndAttributes('part', [ - 'name' => $name, - ]); - } -} diff --git a/src/WsdlHandler/Tag/TagNotation.php b/src/WsdlHandler/Tag/TagNotation.php deleted file mode 100644 index c3102d61..00000000 --- a/src/WsdlHandler/Tag/TagNotation.php +++ /dev/null @@ -1,7 +0,0 @@ -getAttributeMixedValue(self::ATTRIBUTE_ELEMENT, $returnValue); - } - /** - * @param bool $returnValue - * @return AttributeHandler|string|int|null - */ - public function getAttributeType($returnValue = true) - { - return $this->getAttributeMixedValue(self::ATTRIBUTE_TYPE, $returnValue); - } - /** - * @param string $attributeName - * @param bool $returnValue - * @return AttributeHandler|string|int|null - */ - protected function getAttributeMixedValue($attributeName, $returnValue = true) - { - $value = $this->getAttribute($attributeName); - if ($returnValue === true) { - $value = $value instanceof AttributeHandler ? $value->getValue() : null; - } - return $value; - } - /** - * @return string - */ - public function getFinalType() - { - $type = $this->getAttributeType(); - if (empty($type)) { - $elementName = $this->getAttributeElement(); - if (!empty($elementName)) { - $element = $this->getDomDocumentHandler()->getElementByNameAndAttributes(WsdlDocument::TAG_ELEMENT, [ - 'name' => $elementName, - ], true); - if ($element instanceof TagElement && $element->hasAttribute(self::ATTRIBUTE_TYPE)) { - $type = $element->getAttribute(self::ATTRIBUTE_TYPE)->getValue(); - } else { - $type = $elementName; - } - } - } - return $type; - } - /** - * @return string - */ - public function getFinalName() - { - $name = $this->getAttributeType(); - if (empty($name)) { - $name = $this->getAttributeElement(); - } - return $name; - } - /** - * @return null|string - */ - public function getFinalNamespace() - { - $attribute = $this->getAttributeType(false); - if (empty($attribute)) { - $attribute = $this->getAttributeElement(false); - if (empty($attribute)) { - return null; - } - } - return $attribute->getValueNamespace(); - } -} diff --git a/src/WsdlHandler/Tag/TagPort.php b/src/WsdlHandler/Tag/TagPort.php deleted file mode 100644 index 3bf4ff96..00000000 --- a/src/WsdlHandler/Tag/TagPort.php +++ /dev/null @@ -1,7 +0,0 @@ -getEnumerations()) > 0; - } - - /** - * @return TagEnumeration[] - */ - public function getEnumerations() - { - return $this->getChildrenByName(WsdlDocument::TAG_ENUMERATION); - } - - /** - * @return string - */ - public function getAttributeBase() - { - return $this->hasAttributeBase() ? $this->getAttribute(self::ATTRIBUTE_BASE)->getValue() : ''; - } - - /** - * @return bool - */ - public function hasAttributeBase() - { - return $this->hasAttribute(self::ATTRIBUTE_BASE); - } - - /** - * Checks whether this element is contained by an union parent or not - * @return bool - */ - public function hasUnionParent() - { - return $this->getSuitableParent(false, [ - AbstractDocument::TAG_UNION, - ], self::MAX_DEEP, true) instanceof TagUnion; - } -} diff --git a/src/WsdlHandler/Tag/TagSchema.php b/src/WsdlHandler/Tag/TagSchema.php deleted file mode 100644 index d59b2962..00000000 --- a/src/WsdlHandler/Tag/TagSchema.php +++ /dev/null @@ -1,7 +0,0 @@ -parseMemberTypes(); - } - /** - * @return bool - */ - public function hasMemberTypesAsChildren() - { - return 0 < count($this->getMemberTypesChildren()); - } - /** - * @return AbstractTag[] - */ - public function getMemberTypesChildren() - { - return $this->getChildrenByName(AbstractDocument::TAG_SIMPLE_TYPE); - } - /** - * @return string[] - */ - protected function parseMemberTypes() - { - $memberTypes = []; - $value = $this->hasAttribute(self::ATTRIBUTE_MEMBER_TYPES) ? $this->getAttribute(self::ATTRIBUTE_MEMBER_TYPES)->getValue(true) : ''; - if (!empty($value)) { - $values = explode(' ', $value); - foreach ($values as $val) { - $memberTypes[] = implode('', array_slice(explode(':', $val), -1, 1)); - } - } - return $memberTypes; - } -} diff --git a/src/WsdlHandler/Tag/TagUnique.php b/src/WsdlHandler/Tag/TagUnique.php deleted file mode 100644 index d24d7f4a..00000000 --- a/src/WsdlHandler/Tag/TagUnique.php +++ /dev/null @@ -1,7 +0,0 @@ -externalSchemas = new ModelContainer($generator); - } - /** - * @param Model $schema - * @return \WsdlToPhp\PackageGenerator\WsdlHandler\Wsdl - */ - public function addExternalSchema(Model $schema) - { - $this->externalSchemas->add($schema); - return $this; - } - /** - * @param string $name - * @return \WsdlToPhp\PackageGenerator\Model\Schema|null - */ - public function getExternalSchema($name) - { - return $this->externalSchemas->getSchemaByName($name); - } - /** - * @return \WsdlToPhp\PackageGenerator\Container\Model\Schema - */ - public function getExternalSchemas() - { - return $this->externalSchemas; - } - /** - * @see \WsdlToPhp\PackageGenerator\WsdlHandler\AbstractDocument::getElementByName() - * @return AbstractTag|null - */ - public function getElementByName($name, $includeExternals = false) - { - return $this->useParentMethodAndExternals(__FUNCTION__, [ - $name, - ], $includeExternals, true); - } - /** - * @see \WsdlToPhp\DomHandler\AbstractDomDocumentHandler::getElementByNameAndAttributes() - * @return AbstractTag|null - */ - public function getElementByNameAndAttributes($name, array $attributes, $includeExternals = false) - { - return $this->useParentMethodAndExternals(__FUNCTION__, [ - $name, - $attributes, - ], $includeExternals, true); - } - /** - * @see \WsdlToPhp\PackageGenerator\WsdlHandler\AbstractDocument::getElementsByName() - * @return AbstractTag[] - */ - public function getElementsByName($name, $includeExternals = false) - { - return $this->useParentMethodAndExternals(__FUNCTION__, [ - $name, - ], $includeExternals); - } - /** - * @param string $name - * @param array $attributes - * @param \DOMNode|null $node - * @param bool $includeExternals - * @see \WsdlToPhp\DomHandler\AbstractDomDocumentHandler::getElementsByNameAndAttributes() - * @return AbstractTag[] - */ - public function getElementsByNameAndAttributes($name, array $attributes, \DOMNode $node = null, $includeExternals = false) - { - return $this->useParentMethodAndExternals(__FUNCTION__, [ - $name, - $attributes, - $node, - ], $includeExternals); - } - /** - * Handler any method that exist within the parent class, - * in addition it handles the case when we want to use the external schemas to search in - * @param string $method - * @param array $parameters - * @param bool $includeExternals - * @param bool $returnOne - * @return mixed - */ - protected function useParentMethodAndExternals($method, $parameters, $includeExternals = false, $returnOne = false) - { - $result = call_user_func_array([ - $this, - sprintf('parent::%s', $method), - ], $parameters); - if ($includeExternals === true && (($returnOne === true && $result === null) || $returnOne === false)) { - $result = $this->useExternalSchemas($method, $parameters, $result, $returnOne); - } - return $result; - } - /** - * @param string $method - * @param array $parameters - * @param bool $returnOne - * @return mixed - */ - protected function useExternalSchemas($method, $parameters, $parentResult, $returnOne = false) - { - $result = $parentResult; - if ($this->getExternalSchemas()->count() > 0) { - foreach ($this->getExternalSchemas() as $externalSchema) { - if ($externalSchema->getContent() instanceof AbstractDocument) { - $externalResult = call_user_func_array([ - $externalSchema->getContent(), - $method, - ], $parameters); - if ($returnOne === true && $externalResult !== null) { - $result = $externalResult; - break; - } elseif (is_array($externalResult) && !empty($externalResult)) { - $result = array_merge($result, $externalResult); - } - } - } - } - return $result; - } -} diff --git a/src/resources/config/generator_options.yml b/src/resources/config/generator_options.yml index 456a8786..46823219 100644 --- a/src/resources/config/generator_options.yml +++ b/src/resources/config/generator_options.yml @@ -27,16 +27,16 @@ validation: default: true values: [ true, false ] struct_class: - default: '\WsdlToPhp\PackageBase\AbstractStructBase' + default: 'WsdlToPhp\PackageBase\AbstractStructBase' values: '' struct_array_class: - default: '\WsdlToPhp\PackageBase\AbstractStructArrayBase' + default: 'WsdlToPhp\PackageBase\AbstractStructArrayBase' values: '' struct_enum_class: - default: '\WsdlToPhp\PackageBase\AbstractStructEnumBase' + default: 'WsdlToPhp\PackageBase\AbstractStructEnumBase' values: '' soap_client_class: - default: '\WsdlToPhp\PackageBase\AbstractSoapClientBase' + default: 'WsdlToPhp\PackageBase\AbstractSoapClientBase' values: '' origin: default: '' diff --git a/src/resources/config/php_reserved_keywords.yml b/src/resources/config/php_reserved_keywords.yml index a5a64e48..6dab32c4 100644 --- a/src/resources/config/php_reserved_keywords.yml +++ b/src/resources/config/php_reserved_keywords.yml @@ -109,6 +109,7 @@ reserved_keywords: - "interface" - "isset" - "list" + - "match" - "namespace" - "new" - "or" diff --git a/src/resources/config/service_reserved_keywords.yml b/src/resources/config/service_reserved_keywords.yml index 4de6edf6..5bb6d415 100644 --- a/src/resources/config/service_reserved_keywords.yml +++ b/src/resources/config/service_reserved_keywords.yml @@ -20,7 +20,7 @@ reserved_keywords: - "getLastRequestHeaders" - "getLastResponseHeaders" - "getLastHeaders" - - "getFormatedXml" + - "getFormattedXml" - "convertStringHeadersToArray" - "setSoapHeader" - "setHttpHeader" diff --git a/src/resources/config/struct_array_reserved_keywords.yml b/src/resources/config/struct_array_reserved_keywords.yml index 956a130e..e2eb1088 100644 --- a/src/resources/config/struct_array_reserved_keywords.yml +++ b/src/resources/config/struct_array_reserved_keywords.yml @@ -7,6 +7,8 @@ reserved_keywords: - case_insensitive: # methods from AbstractStructArrayBase + - "getPropertyValue" + - "setPropertyValue" - "getAttributeName" - "length" - "count" diff --git a/src/resources/config/struct_reserved_keywords.yml b/src/resources/config/struct_reserved_keywords.yml index 8154c53b..488d9166 100644 --- a/src/resources/config/struct_reserved_keywords.yml +++ b/src/resources/config/struct_reserved_keywords.yml @@ -7,5 +7,5 @@ reserved_keywords: - case_insensitive: # methods from AbstractStructBase - - "_set" - - "_get" + - "setPropertValue" + - "getPropertyValue" diff --git a/src/resources/config/xsd_types.yml b/src/resources/config/xsd_types.yml index 77f2d48a..befe93b0 100644 --- a/src/resources/config/xsd_types.yml +++ b/src/resources/config/xsd_types.yml @@ -12,8 +12,8 @@ xsd_types: dateTime: "string" decimal: "float" double: "float" + DOMDocument: "string" duration: "string" - DayOfWeekType: "string" float: "float" gMonth: "string" gMonthDay: "int" diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php new file mode 100644 index 00000000..9612e3cc --- /dev/null +++ b/tests/AbstractTestCase.php @@ -0,0 +1,401 @@ +setOrigin($wsdlPath) + ->setDestination(self::getTestDirectory()) + ; + + return new Generator($options); + } +} diff --git a/tests/Command/GeneratePackageCommandTest.php b/tests/Command/GeneratePackageCommandTest.php index 321a4c73..8d3a2443 100644 --- a/tests/Command/GeneratePackageCommandTest.php +++ b/tests/Command/GeneratePackageCommandTest.php @@ -1,22 +1,28 @@ expectException(InvalidArgumentException::class); + AbstractYamlReader::resetInstances(); $command = new GeneratePackageCommand('WsdlToPhp'); @@ -28,11 +34,11 @@ public function testExceptionOnDestination() $command->run($input, $output); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnComposerName() { + $this->expectException(InvalidArgumentException::class); + AbstractYamlReader::resetInstances(); $command = new GeneratePackageCommand('WsdlToPhp'); @@ -45,11 +51,11 @@ public function testExceptionOnComposerName() $command->run($input, $output); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnOrigin() { + $this->expectException(InvalidArgumentException::class); + AbstractYamlReader::resetInstances(); $command = new GeneratePackageCommand('WsdlToPhp'); @@ -62,9 +68,7 @@ public function testExceptionOnOrigin() $command->run($input, $output); } - /** - * - */ + public function testDebugMode() { AbstractYamlReader::resetInstances(); @@ -72,20 +76,18 @@ public function testDebugMode() $input = new ArrayInput([ '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/debug/', + '--destination' => self::getTestDirectory().'/debug/', '--composer-name' => 'wsdltophp/package', - '--gentutorial' => 'true', - '--genericconstants' => 'false', + '--gentutorial' => true, + '--genericconstants' => false, ]); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); $command->run($input, $output); - $this->assertFalse(is_dir(self::getTestDirectory() . '/debug/')); + $this->assertFalse(is_dir(self::getTestDirectory().'/debug/')); } - /** - * - */ + public function testSetSrcDirname() { AbstractYamlReader::resetInstances(); @@ -93,12 +95,12 @@ public function testSetSrcDirname() $input = new ArrayInput([ '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/src/', + '--destination' => self::getTestDirectory().'/src/', '--composer-name' => 'wsdltophp/package', '--src-dirname' => '', - '--gentutorial' => 'true', - '--genericconstants' => 'false', - '--force' => 'true', + '--gentutorial' => true, + '--genericconstants' => false, + '--force' => true, ]); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); @@ -106,98 +108,88 @@ public function testSetSrcDirname() $this->assertSame('', $command->getGenerator()->getOptionSrcDirname()); } - /** - * - */ + public function testGetOptionValue() { $command = new GeneratePackageCommand('WsdlToPhp'); $input = new ArrayInput([ - '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/debug/', - '--composer-name' => 'wsdltophp/package', - '--gentutorial' => 'true', - '--genericconstants' => 'false', - sprintf('--%s', GeneratePackageCommand::GENERATOR_OPTIONS_CONFIG_OPTION) => __DIR__ . '/../resources/generator_options.yml', + '--urlorpath' => self::wsdlBingPath(), + '--destination' => self::getTestDirectory().'/debug/', + '--composer-name' => 'wsdltophp/package', + '--gentutorial' => true, + '--genericconstants' => false, + sprintf('--%s', GeneratePackageCommand::GENERATOR_OPTIONS_CONFIG_OPTION) => __DIR__.'/../resources/generator_options.yml', ]); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); $command->run($input, $output); - $this->assertSame(__DIR__ . '/../resources/generator_options.yml', $command->getGeneratorOptionsConfigOption()); + $this->assertSame(__DIR__.'/../resources/generator_options.yml', $command->getGeneratorOptionsConfigOption()); } - /** - * - */ + public function testResolveGeneratorOptionsConfigPathUsingOption() { $command = new GeneratePackageCommand('WsdlToPhp'); $input = new ArrayInput([ - '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/debug/', - '--composer-name' => 'wsdltophp/package', - '--gentutorial' => 'true', - '--genericconstants' => 'false', - sprintf('--%s', GeneratePackageCommand::GENERATOR_OPTIONS_CONFIG_OPTION) => __DIR__ . '/../resources/generator_options.yml', + '--urlorpath' => self::wsdlBingPath(), + '--destination' => self::getTestDirectory().'/debug/', + '--composer-name' => 'wsdltophp/package', + '--gentutorial' => true, + '--genericconstants' => false, + sprintf('--%s', GeneratePackageCommand::GENERATOR_OPTIONS_CONFIG_OPTION) => __DIR__.'/../resources/generator_options.yml', ]); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); $command->run($input, $output); - $this->assertSame(__DIR__ . '/../resources/generator_options.yml', $command->resolveGeneratorOptionsConfigPath()); + $this->assertSame(__DIR__.'/../resources/generator_options.yml', $command->resolveGeneratorOptionsConfigPath()); } - /** - * - */ + public function testResolveGeneratorOptionsConfigPathUsingExistingProperUserConfig() { $command = new GeneratePackageCommand('WsdlToPhp'); $input = new ArrayInput([ - '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/debug/', - '--composer-name' => 'wsdltophp/package', - '--gentutorial' => 'true', - '--genericconstants' => 'false', + '--urlorpath' => self::wsdlBingPath(), + '--destination' => self::getTestDirectory().'/debug/', + '--composer-name' => 'wsdltophp/package', + '--gentutorial' => true, + '--genericconstants' => false, ]); - chdir(self::getTestDirectory() . '../existing_config'); + chdir(self::getTestDirectory().'../existing_config'); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); $command->run($input, $output); - $this->assertSame(realpath(self::getTestDirectory() . '../existing_config/' . GeneratePackageCommand::PROPER_USER_CONFIGURATION), $command->resolveGeneratorOptionsConfigPath()); + $this->assertSame(realpath(self::getTestDirectory().'../existing_config/'.GeneratePackageCommand::PROPER_USER_CONFIGURATION), $command->resolveGeneratorOptionsConfigPath()); } - /** - * - */ + public function testResolveGeneratorOptionsConfigPathUsingExistingDistributedConfig() { $command = new GeneratePackageCommand('WsdlToPhp'); $input = new ArrayInput([ - '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/debug/', - '--composer-name' => 'wsdltophp/package', - '--gentutorial' => 'true', - '--genericconstants' => 'false', + '--urlorpath' => self::wsdlBingPath(), + '--destination' => self::getTestDirectory().'/debug/', + '--composer-name' => 'wsdltophp/package', + '--gentutorial' => true, + '--genericconstants' => false, ]); - chdir(self::getTestDirectory() . '../../../'); + chdir(self::getTestDirectory().'../../../'); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); $command->run($input, $output); - $this->assertSame(realpath(self::getTestDirectory() . '../../../' . GeneratePackageCommand::DEFAULT_CONFIGURATION_FILE), $command->resolveGeneratorOptionsConfigPath()); + $this->assertSame(realpath(self::getTestDirectory().'../../../'.GeneratePackageCommand::DEFAULT_CONFIGURATION_FILE), $command->resolveGeneratorOptionsConfigPath()); } - /** - * - */ + public function testResolveGeneratorOptionsConfigPathUsingDefaultConfig() { $command = new GeneratePackageCommand('WsdlToPhp'); $input = new ArrayInput([ - '--urlorpath' => self::wsdlBingPath(), - '--destination' => self::getTestDirectory() . '/debug/', - '--composer-name' => 'wsdltophp/package', - '--gentutorial' => 'true', - '--genericconstants' => 'false', + '--urlorpath' => self::wsdlBingPath(), + '--destination' => self::getTestDirectory().'/debug/', + '--composer-name' => 'wsdltophp/package', + '--gentutorial' => true, + '--genericconstants' => false, ]); chdir(self::getTestDirectory()); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); diff --git a/tests/ConfigurationReader/GeneratorOptionsTest.php b/tests/ConfigurationReader/GeneratorOptionsTest.php index 7e5c8fc0..aecb5dea 100755 --- a/tests/ConfigurationReader/GeneratorOptionsTest.php +++ b/tests/ConfigurationReader/GeneratorOptionsTest.php @@ -1,37 +1,40 @@ expectException(InvalidArgumentException::class); + + GeneratorOptions::instance(__DIR__.'/../resources/bad_generator_options.yml'); } - /** - * - */ + public function testGetPrefix() { $this->assertEmpty(self::optionsInstance()->getPrefix()); } - /** - * - */ + public function testSetPrefix() { $instance = self::optionsInstance(); @@ -39,16 +42,12 @@ public function testSetPrefix() $this->assertSame('MyPrefix', $instance->getPrefix()); } - /** - * - */ + public function testGetSuffix() { $this->assertEmpty(self::optionsInstance()->getSuffix()); } - /** - * - */ + public function testSetSuffix() { $instance = self::optionsInstance(); @@ -56,16 +55,12 @@ public function testSetSuffix() $this->assertSame('MySuffix', $instance->getSuffix()); } - /** - * - */ + public function testGetDestination() { $this->assertEmpty(self::optionsInstance()->getDestination()); } - /** - * - */ + public function testSetDestination() { $instance = self::optionsInstance(); @@ -73,16 +68,12 @@ public function testSetDestination() $this->assertSame('/my/destination/', $instance->getDestination()); } - /** - * - */ + public function testGetSrcDirname() { $this->assertSame('src', self::optionsInstance()->getSrcDirname()); } - /** - * - */ + public function testSetSrcDirname() { $instance = self::optionsInstance(); @@ -90,16 +81,12 @@ public function testSetSrcDirname() $this->assertSame('', $instance->getSrcDirname()); } - /** - * - */ + public function testGetOrigin() { $this->assertEmpty(self::optionsInstance()->getOrigin()); } - /** - * - */ + public function testSetOrigin() { $instance = self::optionsInstance(); @@ -107,16 +94,12 @@ public function testSetOrigin() $this->assertSame('/my/path/to/the/wsdl/file.wsdl', $instance->getOrigin()); } - /** - * - */ + public function testGetBasicLogin() { $this->assertNull(self::optionsInstance()->getBasicLogin()); } - /** - * - */ + public function testSetBasicLogin() { $instance = self::optionsInstance(); @@ -124,16 +107,12 @@ public function testSetBasicLogin() $this->assertSame('MyLogin', $instance->getBasicLogin()); } - /** - * - */ + public function testGetBasicPassword() { $this->assertNull(self::optionsInstance()->getBasicPassword()); } - /** - * - */ + public function testSetBasicPassword() { $instance = self::optionsInstance(); @@ -141,16 +120,12 @@ public function testSetBasicPassword() $this->assertSame('MyPassword', $instance->getBasicPassword()); } - /** - * - */ + public function testGetProxyHost() { $this->assertNull(self::optionsInstance()->getProxyHost()); } - /** - * - */ + public function testSetProxyHost() { $instance = self::optionsInstance(); @@ -158,16 +133,12 @@ public function testSetProxyHost() $this->assertSame('MyProxyHost', $instance->getProxyHost()); } - /** - * - */ + public function testGetProxyPort() { $this->assertNull(self::optionsInstance()->getProxyPort()); } - /** - * - */ + public function testSetProxyPort() { $instance = self::optionsInstance(); @@ -175,16 +146,12 @@ public function testSetProxyPort() $this->assertSame(3225, $instance->getProxyPort()); } - /** - * - */ + public function testGetProxyLogin() { $this->assertNull(self::optionsInstance()->getProxyLogin()); } - /** - * - */ + public function testSetProxyLogin() { $instance = self::optionsInstance(); @@ -192,16 +159,12 @@ public function testSetProxyLogin() $this->assertSame('MyProxyLogin', $instance->getProxyLogin()); } - /** - * - */ + public function testGetProxyPassword() { $this->assertNull(self::optionsInstance()->getProxyPassword()); } - /** - * - */ + public function testSetProxyPassword() { $instance = self::optionsInstance(); @@ -209,16 +172,12 @@ public function testSetProxyPassword() $this->assertSame('MyProxyPassword', $instance->getProxyPassword()); } - /** - * - */ + public function testGetSoapOptions() { $this->assertEmpty(self::optionsInstance()->getSoapOptions()); } - /** - * - */ + public function testSetSoapOptions() { $soapOptions = [ @@ -230,16 +189,12 @@ public function testSetSoapOptions() $this->assertSame($soapOptions, $instance->getSoapOptions()); } - /** - * - */ + public function testGetCategory() { $this->assertSame(GeneratorOptions::VALUE_CAT, self::optionsInstance()->getCategory()); } - /** - * - */ + public function testSetCategory() { $instance = self::optionsInstance(); @@ -247,16 +202,12 @@ public function testSetCategory() $this->assertSame(GeneratorOptions::VALUE_NONE, $instance->getCategory()); } - /** - * - */ + public function testGetGatherMethods() { $this->assertSame(GeneratorOptions::VALUE_START, self::optionsInstance()->getGatherMethods()); } - /** - * - */ + public function testSetGatherMethods() { $instance = self::optionsInstance(); @@ -264,9 +215,7 @@ public function testSetGatherMethods() $this->assertSame(GeneratorOptions::VALUE_END, $instance->getGatherMethods()); } - /** - * - */ + public function testSetGatherMethodsNone() { $instance = self::optionsInstance(); @@ -274,16 +223,12 @@ public function testSetGatherMethodsNone() $this->assertSame(GeneratorOptions::VALUE_NONE, $instance->getGatherMethods()); } - /** - * - */ + public function testGetGenericConstantsName() { $this->assertFalse(self::optionsInstance()->getGenericConstantsName()); } - /** - * - */ + public function testSetGenericConstantsName() { $instance = self::optionsInstance(); @@ -291,16 +236,12 @@ public function testSetGenericConstantsName() $this->assertTrue($instance->getGenericConstantsName()); } - /** - * - */ + public function testGetGenerateTutorialFile() { $this->assertTrue(self::optionsInstance()->getGenerateTutorialFile()); } - /** - * - */ + public function testSetGenerateTutorialFile() { $instance = self::optionsInstance(); @@ -308,9 +249,7 @@ public function testSetGenerateTutorialFile() $this->assertFalse($instance->getGenerateTutorialFile()); } - /** - * - */ + public function testGetAddComments() { $comments = [ @@ -323,9 +262,7 @@ public function testGetAddComments() $this->assertSame($comments, $instance->getAddComments()); } - /** - * - */ + public function testSetAddCommentsSimple() { $comments = [ @@ -341,9 +278,7 @@ public function testSetAddCommentsSimple() $this->assertSame($comments, $instance->getAddComments()); } - /** - * - */ + public function testSetAddComments() { $comments = [ @@ -356,16 +291,12 @@ public function testSetAddComments() $this->assertSame($comments, $instance->getAddComments()); } - /** - * - */ + public function testGetNamespace() { $this->assertSame('', self::optionsInstance()->getNamespace()); } - /** - * - */ + public function testSetNamespace() { $instance = self::optionsInstance(); @@ -373,16 +304,12 @@ public function testSetNamespace() $this->assertSame('\My\Project', $instance->getNamespace()); } - /** - * - */ + public function testGetStandalone() { $this->assertTrue(self::optionsInstance()->getStandalone()); } - /** - * - */ + public function testSetStandalone() { $instance = self::optionsInstance(); @@ -390,16 +317,12 @@ public function testSetStandalone() $this->assertFalse($instance->getStandalone()); } - /** - * - */ + public function testGetValidation() { $this->assertTrue(self::optionsInstance()->getValidation()); } - /** - * - */ + public function testSetValidation() { $instance = self::optionsInstance(); @@ -407,16 +330,12 @@ public function testSetValidation() $this->assertFalse($instance->getValidation()); } - /** - * - */ + public function testGetStructClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractStructBase', self::optionsInstance()->getStructClass()); + $this->assertSame(AbstractStructBase::class, self::optionsInstance()->getStructClass()); } - /** - * - */ + public function testSetStructClass() { $instance = self::optionsInstance(); @@ -424,16 +343,12 @@ public function testSetStructClass() $this->assertSame('\My\Project\StructClass', $instance->getStructClass()); } - /** - * - */ + public function testGetStructArrayClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractStructArrayBase', self::optionsInstance()->getStructArrayClass()); + $this->assertSame(AbstractStructArrayBase::class, self::optionsInstance()->getStructArrayClass()); } - /** - * - */ + public function testSetStructArrayClass() { $instance = self::optionsInstance(); @@ -441,16 +356,12 @@ public function testSetStructArrayClass() $this->assertSame('\My\Project\StructArrayClass', $instance->getStructArrayClass()); } - /** - * - */ + public function testGetStructEnumClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractStructEnumBase', self::optionsInstance()->getStructEnumClass()); + $this->assertSame(AbstractStructEnumBase::class, self::optionsInstance()->getStructEnumClass()); } - /** - * - */ + public function testSetStructEnumClass() { $instance = self::optionsInstance(); @@ -458,16 +369,12 @@ public function testSetStructEnumClass() $this->assertSame('\My\Project\StructEnumClass', $instance->getStructEnumClass()); } - /** - * - */ + public function testGetSoapClientClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractSoapClientBase', self::optionsInstance()->getSoapClientClass()); + $this->assertSame(AbstractSoapClientBase::class, self::optionsInstance()->getSoapClientClass()); } - /** - * - */ + public function testSetSoapClientClass() { $instance = self::optionsInstance(); @@ -475,16 +382,12 @@ public function testSetSoapClientClass() $this->assertSame('\My\Project\SoapClientClass', $instance->getSoapClientClass()); } - /** - * - */ + public function testGetComposerName() { $this->assertSame('', self::optionsInstance()->getComposerName()); } - /** - * - */ + public function testSetComposerName() { $instance = self::optionsInstance(); @@ -492,16 +395,12 @@ public function testSetComposerName() $this->assertSame('foo/bar', $instance->getComposerName()); } - /** - * - */ + public function testGetComposerSettings() { $this->assertSame([], self::optionsInstance()->getComposerSettings()); } - /** - * - */ + public function testSetComposerSettings() { $instance = self::optionsInstance(); @@ -531,16 +430,12 @@ public function testSetComposerSettings() ], ], $instance->getComposerSettings()); } - /** - * - */ + public function testGetStructsFolder() { $this->assertSame('StructType', self::optionsInstance()->getStructsFolder()); } - /** - * - */ + public function testSetStructsFolder() { $instance = self::optionsInstance(); @@ -548,16 +443,12 @@ public function testSetStructsFolder() $this->assertSame('Structs', $instance->getStructsFolder()); } - /** - * - */ + public function testGetEnumsFolder() { $this->assertSame('EnumType', self::optionsInstance()->getEnumsFolder()); } - /** - * - */ + public function testSetEnumsFolder() { $instance = self::optionsInstance(); @@ -565,16 +456,12 @@ public function testSetEnumsFolder() $this->assertSame('Enums', $instance->getEnumsFolder()); } - /** - * - */ + public function testGetArraysFolder() { $this->assertSame('ArrayType', self::optionsInstance()->getArraysFolder()); } - /** - * - */ + public function testSetArraysFolder() { $instance = self::optionsInstance(); @@ -582,16 +469,12 @@ public function testSetArraysFolder() $this->assertSame('Arrays', $instance->getArraysFolder()); } - /** - * - */ + public function testGetServicesFolder() { $this->assertSame('ServiceType', self::optionsInstance()->getServicesFolder()); } - /** - * - */ + public function testSetServicesFolder() { $instance = self::optionsInstance(); @@ -599,9 +482,7 @@ public function testSetServicesFolder() $this->assertSame('Services', $instance->getServicesFolder()); } - /** - * - */ + public function testSetSchemasSave() { $instance = self::optionsInstance(); @@ -609,9 +490,7 @@ public function testSetSchemasSave() $this->assertSame(false, $instance->getSchemasSave()); } - /** - * - */ + public function testSetSchemasFolder() { $instance = self::optionsInstance(); @@ -619,9 +498,7 @@ public function testSetSchemasFolder() $this->assertSame('wsdl', $instance->getSchemasFolder()); } - /** - * - */ + public function testSetExistingOptionValue() { $instance = self::optionsInstance(); @@ -630,17 +507,15 @@ public function testSetExistingOptionValue() $instance->setCategory('none'); $this->assertEquals('none', $instance->getOptionValue('category')); } - /** - * @expectedException InvalidArgumentException - */ + public function testSetExistingOptionValueWithInvalidValue() { + $this->expectException(InvalidArgumentException::class); + self::optionsInstance()->setOptionValue('category', 'null'); self::optionsInstance()->setCategory(null); } - /** - * - */ + public function testSetUnexistingOptionValue() { $newOptionKey = 'new_option'; @@ -650,23 +525,21 @@ public function testSetUnexistingOptionValue() $this->assertEquals(1, $instance->getOptionValue($newOptionKey)); } - /** - * @expectedException \InvalidArgumentException - */ + public function testSetUnexistingOptionValueWithInvalidValue() { + $this->expectException(InvalidArgumentException::class); + self::optionsInstance()->setGenerateTutorialFile('null'); } - /** - * @expectedException \InvalidArgumentException - */ + public function testGetUnexistingOptionValue() { + $this->expectException(InvalidArgumentException::class); + self::optionsInstance()->getOptionValue('myOption'); } - /** - * - */ + public function testToArray() { $this->assertSame([ @@ -678,10 +551,10 @@ public function testToArray() 'namespace_prefix' => '', 'standalone' => true, 'validation' => true, - 'struct_class' => '\WsdlToPhp\PackageBase\AbstractStructBase', - 'struct_array_class' => '\WsdlToPhp\PackageBase\AbstractStructArrayBase', - 'struct_enum_class' => '\WsdlToPhp\PackageBase\AbstractStructEnumBase', - 'soap_client_class' => '\WsdlToPhp\PackageBase\AbstractSoapClientBase', + 'struct_class' => AbstractStructBase::class, + 'struct_array_class' => AbstractStructArrayBase::class, + 'struct_enum_class' => AbstractStructEnumBase::class, + 'soap_client_class' => AbstractSoapClientBase::class, 'origin' => '', 'destination' => '', 'src_dirname' => 'src', @@ -705,9 +578,7 @@ public function testToArray() 'xsd_types_path' => '', ], self::optionsInstance()->toArray()); } - /** - * - */ + public function testJsonSerialize() { $this->assertSame([ @@ -719,10 +590,10 @@ public function testJsonSerialize() 'namespace_prefix' => '', 'standalone' => true, 'validation' => true, - 'struct_class' => '\WsdlToPhp\PackageBase\AbstractStructBase', - 'struct_array_class' => '\WsdlToPhp\PackageBase\AbstractStructArrayBase', - 'struct_enum_class' => '\WsdlToPhp\PackageBase\AbstractStructEnumBase', - 'soap_client_class' => '\WsdlToPhp\PackageBase\AbstractSoapClientBase', + 'struct_class' => AbstractStructBase::class, + 'struct_array_class' => AbstractStructArrayBase::class, + 'struct_enum_class' => AbstractStructEnumBase::class, + 'soap_client_class' => AbstractSoapClientBase::class, 'origin' => '', 'destination' => '', 'src_dirname' => 'src', diff --git a/tests/ConfigurationReader/PhpReservedKeywordTest.php b/tests/ConfigurationReader/PhpReservedKeywordTest.php index a5f6cff0..e77bb40e 100644 --- a/tests/ConfigurationReader/PhpReservedKeywordTest.php +++ b/tests/ConfigurationReader/PhpReservedKeywordTest.php @@ -1,295 +1,358 @@ assertTrue(self::instance()->is('__CLASS__')); } - /** - * - */ - public function testIs___class___() + + public function testIsClassLower() { $this->assertFalse(self::instance()->is('__class__')); } - public function testIs__construct() + + public function testIsConstruct() { $this->assertTrue(self::instance()->is('__construct')); } + public function testIsgetSoapClient() { $this->assertFalse(self::instance()->is('getSoapClient')); } + public function testIssetSoapClient() { $this->assertFalse(self::instance()->is('setSoapClient')); } + public function testIsinitSoapClient() { $this->assertFalse(self::instance()->is('initSoapClient')); } + public function testIsgetSoapClientClassName() { $this->assertFalse(self::instance()->is('getSoapClientClassName')); } + public function testIsgetDefaultWsdlOptions() { $this->assertFalse(self::instance()->is('getDefaultWsdlOptions')); } + public function testIssetLocation() { $this->assertFalse(self::instance()->is('setLocation')); } + public function testIsgetLastRequest() { $this->assertFalse(self::instance()->is('getLastRequest')); } + public function testIsgetLastResponse() { $this->assertFalse(self::instance()->is('getLastResponse')); } + public function testIsgetLastXml() { $this->assertFalse(self::instance()->is('getLastXml')); } + public function testIsgetLastRequestHeaders() { $this->assertFalse(self::instance()->is('getLastRequestHeaders')); } + public function testIsgetLastResponseHeaders() { $this->assertFalse(self::instance()->is('getLastResponseHeaders')); } + public function testIsgetLastHeaders() { $this->assertFalse(self::instance()->is('getLastHeaders')); } - public function testIsgetFormatedXml() + + public function testIsgetFormattedXml() { - $this->assertFalse(self::instance()->is('getFormatedXml')); + $this->assertFalse(self::instance()->is('getFormattedXml')); } + public function testIsconvertStringHeadersToArray() { $this->assertFalse(self::instance()->is('convertStringHeadersToArray')); } + public function testIssetSoapHeader() { $this->assertFalse(self::instance()->is('setSoapHeader')); } + public function testIssetHttpHeader() { $this->assertFalse(self::instance()->is('setHttpHeader')); } + public function testIsgetLastError() { $this->assertFalse(self::instance()->is('getLastError')); } + public function testIssetLastError() { $this->assertFalse(self::instance()->is('setLastError')); } + public function testIssaveLastError() { $this->assertFalse(self::instance()->is('saveLastError')); } + public function testIsgetLastErrorForMethod() { $this->assertFalse(self::instance()->is('getLastErrorForMethod')); } + public function testIsgetResult() { $this->assertFalse(self::instance()->is('getResult')); } + public function testIssetResult() { $this->assertFalse(self::instance()->is('setResult')); } - public function testIs_set() + + public function testIsSet() { $this->assertFalse(self::instance()->is('_set')); } - public function testIs_get() + + public function testIsGet() { $this->assertFalse(self::instance()->is('_get')); } + public function testIsgetAttributeName() { $this->assertFalse(self::instance()->is('getAttributeName')); } + public function testIslength() { $this->assertFalse(self::instance()->is('length')); } + public function testIscount() { $this->assertFalse(self::instance()->is('count')); } + public function testIscurrent() { $this->assertFalse(self::instance()->is('current')); } + public function testIsnext() { $this->assertFalse(self::instance()->is('next')); } + public function testIsrewind() { $this->assertFalse(self::instance()->is('rewind')); } + public function testIsvalid() { $this->assertFalse(self::instance()->is('valid')); } + public function testIskey() { $this->assertFalse(self::instance()->is('key')); } + public function testIsitem() { $this->assertFalse(self::instance()->is('item')); } + public function testIsadd() { $this->assertFalse(self::instance()->is('add')); } + public function testIsfirst() { $this->assertFalse(self::instance()->is('first')); } + public function testIslast() { $this->assertFalse(self::instance()->is('last')); } + public function testIsoffsetExists() { $this->assertFalse(self::instance()->is('offsetExists')); } + public function testIsoffsetGet() { $this->assertFalse(self::instance()->is('offsetGet')); } + public function testIsoffsetSet() { $this->assertFalse(self::instance()->is('offsetSet')); } + public function testIsoffsetUnset() { $this->assertFalse(self::instance()->is('offsetUnset')); } + public function testIsgetInternArray() { $this->assertFalse(self::instance()->is('getInternArray')); } + public function testIssetInternArray() { $this->assertFalse(self::instance()->is('setInternArray')); } + public function testIsgetInternArrayOffset() { $this->assertFalse(self::instance()->is('getInternArrayOffset')); } + public function testIsinitInternArray() { $this->assertFalse(self::instance()->is('initInternArray')); } + public function testIssetInternArrayOffset() { $this->assertFalse(self::instance()->is('setInternArrayOffset')); } + public function testIsgetInternArrayIsArray() { $this->assertFalse(self::instance()->is('getInternArrayIsArray')); } + public function testIssetInternArrayIsArray() { $this->assertFalse(self::instance()->is('setInternArrayIsArray')); } + public function testUppercasePHPReservedKeyword() { $this->assertTrue(self::instance()->is('Do')); } + public function testUppercaseIsoffsetGet() { $this->assertFalse(self::instance()->is('OffsetGet')); } - /** - * @expectedException InvalidArgumentException - */ + public function testException() { - PhpReservedKeyword::instance(__DIR__ . '/../resources/bad_php_reserved_keywords.yml'); + $this->expectException(InvalidArgumentException::class); + + PhpReservedKeyword::instance(__DIR__.'/../resources/bad_php_reserved_keywords.yml'); } - /** - * @expectedException InvalidArgumentException - */ + public function testExceptionForUnexistingFile() { - PhpReservedKeyword::instance(__DIR__ . '/../resources/bad_php_reserved_keywords'); + $this->expectException(InvalidArgumentException::class); + + PhpReservedKeyword::instance(__DIR__.'/../resources/bad_php_reserved_keywords'); } + public function testIntMustBeReserved() { $this->assertTrue(self::instance()->is('int')); } + public function testFloatMustBeReserved() { $this->assertTrue(self::instance()->is('float')); } + public function testBoolMustBeReserved() { $this->assertTrue(self::instance()->is('bool')); } + public function testStringMustBeReserved() { $this->assertTrue(self::instance()->is('string')); } + public function testTrueMustBeReserved() { $this->assertTrue(self::instance()->is('true')); } + public function testFalseMustBeReserved() { $this->assertTrue(self::instance()->is('false')); } + public function testNullMustBeReserved() { $this->assertTrue(self::instance()->is('null')); } + public function testVoidMustBeReserved() { $this->assertTrue(self::instance()->is('void')); } + public function testIterableMustBeReserved() { $this->assertTrue(self::instance()->is('iterable')); } + public function testObjectMustBeReserved() { $this->assertTrue(self::instance()->is('object')); } + public function testResourceMustBeReserved() { $this->assertTrue(self::instance()->is('resource')); } + public function testMixedMustBeReserved() { $this->assertTrue(self::instance()->is('mixed')); } + public function testNumericMustBeReserved() { $this->assertTrue(self::instance()->is('numeric')); diff --git a/tests/ConfigurationReader/ServiceReservedMethodTest.php b/tests/ConfigurationReader/ServiceReservedMethodTest.php index e983baf8..94bf7a90 100644 --- a/tests/ConfigurationReader/ServiceReservedMethodTest.php +++ b/tests/ConfigurationReader/ServiceReservedMethodTest.php @@ -1,229 +1,278 @@ assertFalse(self::instance()->is('__CLASS__')); } - /** - * - */ - public function testIs___class___() + + public function testIsClassLower() { $this->assertFalse(self::instance()->is('__class__')); } - public function testIs__construct() + + public function testIsConstruct() { $this->assertTrue(self::instance()->is('__construct')); } + public function testIsgetSoapClient() { $this->assertTrue(self::instance()->is('getSoapClient')); } + public function testIssetSoapClient() { $this->assertTrue(self::instance()->is('setSoapClient')); } + public function testIsinitSoapClient() { $this->assertTrue(self::instance()->is('initSoapClient')); } + public function testIsgetSoapClientClassName() { $this->assertTrue(self::instance()->is('getSoapClientClassName')); } + public function testIsgetDefaultWsdlOptions() { $this->assertTrue(self::instance()->is('getDefaultWsdlOptions')); } + public function testIssetLocation() { $this->assertTrue(self::instance()->is('setLocation')); } + public function testIsgetLastRequest() { $this->assertTrue(self::instance()->is('getLastRequest')); } + public function testIsgetLastResponse() { $this->assertTrue(self::instance()->is('getLastResponse')); } + public function testIsgetLastXml() { $this->assertTrue(self::instance()->is('getLastXml')); } + public function testIsgetLastRequestHeaders() { $this->assertTrue(self::instance()->is('getLastRequestHeaders')); } + public function testIsgetLastResponseHeaders() { $this->assertTrue(self::instance()->is('getLastResponseHeaders')); } + public function testIsgetLastHeaders() { $this->assertTrue(self::instance()->is('getLastHeaders')); } - public function testIsgetFormatedXml() + + public function testIsgetFormattedXml() { - $this->assertTrue(self::instance()->is('getFormatedXml')); + $this->assertTrue(self::instance()->is('getFormattedXml')); } + public function testIsconvertStringHeadersToArray() { $this->assertTrue(self::instance()->is('convertStringHeadersToArray')); } + public function testIssetSoapHeader() { $this->assertTrue(self::instance()->is('setSoapHeader')); } + public function testIssetHttpHeader() { $this->assertTrue(self::instance()->is('setHttpHeader')); } + public function testIsgetLastError() { $this->assertTrue(self::instance()->is('getLastError')); } + public function testIssetLastError() { $this->assertTrue(self::instance()->is('setLastError')); } + public function testIssaveLastError() { $this->assertTrue(self::instance()->is('saveLastError')); } + public function testIsgetLastErrorForMethod() { $this->assertTrue(self::instance()->is('getLastErrorForMethod')); } + public function testIsgetResult() { $this->assertTrue(self::instance()->is('getResult')); } + public function testIssetResult() { $this->assertTrue(self::instance()->is('setResult')); } - public function testIs_set() + + public function testIsSet() { $this->assertFalse(self::instance()->is('_set')); } - public function testIs_get() + + public function testIsGet() { $this->assertFalse(self::instance()->is('_get')); } + public function testIsgetAttributeName() { $this->assertFalse(self::instance()->is('getAttributeName')); } + public function testIslength() { $this->assertFalse(self::instance()->is('length')); } + public function testIscount() { $this->assertFalse(self::instance()->is('count')); } + public function testIscurrent() { $this->assertFalse(self::instance()->is('current')); } + public function testIsnext() { $this->assertFalse(self::instance()->is('next')); } + public function testIsrewind() { $this->assertFalse(self::instance()->is('rewind')); } + public function testIsvalid() { $this->assertFalse(self::instance()->is('valid')); } + public function testIskey() { $this->assertFalse(self::instance()->is('key')); } + public function testIsitem() { $this->assertFalse(self::instance()->is('item')); } + public function testIsadd() { $this->assertFalse(self::instance()->is('add')); } + public function testIsfirst() { $this->assertFalse(self::instance()->is('first')); } + public function testIslast() { $this->assertFalse(self::instance()->is('last')); } + public function testIsoffsetExists() { $this->assertFalse(self::instance()->is('offsetExists')); } + public function testIsoffsetGet() { $this->assertFalse(self::instance()->is('offsetGet')); } + public function testIsoffsetSet() { $this->assertFalse(self::instance()->is('offsetSet')); } + public function testIsoffsetUnset() { $this->assertFalse(self::instance()->is('offsetUnset')); } + public function testIsgetInternArray() { $this->assertFalse(self::instance()->is('getInternArray')); } + public function testIssetInternArray() { $this->assertFalse(self::instance()->is('setInternArray')); } + public function testIsgetInternArrayOffset() { $this->assertFalse(self::instance()->is('getInternArrayOffset')); } + public function testIsinitInternArray() { $this->assertFalse(self::instance()->is('initInternArray')); } + public function testIssetInternArrayOffset() { $this->assertFalse(self::instance()->is('setInternArrayOffset')); } + public function testIsgetInternArrayIsArray() { $this->assertFalse(self::instance()->is('getInternArrayIsArray')); } + public function testIssetInternArrayIsArray() { $this->assertFalse(self::instance()->is('setInternArrayIsArray')); } + public function testUppercasePHPReservedKeyword() { $this->assertFalse(self::instance()->is('Do')); } + public function testUppercaseIsoffsetGet() { $this->assertFalse(self::instance()->is('OffsetGet')); diff --git a/tests/ConfigurationReader/StructArrayReservedMethodTest.php b/tests/ConfigurationReader/StructArrayReservedMethodTest.php index 19ab2fe1..b6d961ab 100644 --- a/tests/ConfigurationReader/StructArrayReservedMethodTest.php +++ b/tests/ConfigurationReader/StructArrayReservedMethodTest.php @@ -1,229 +1,278 @@ assertFalse(self::instance()->is('__CLASS__')); } - /** - * - */ - public function testIs___class___() + + public function testIsClassLower() { $this->assertFalse(self::instance()->is('__class__')); } - public function testIs__construct() + + public function testIsConstruct() { $this->assertFalse(self::instance()->is('__construct')); } + public function testIsgetSoapClient() { $this->assertFalse(self::instance()->is('getSoapClient')); } + public function testIssetSoapClient() { $this->assertFalse(self::instance()->is('setSoapClient')); } + public function testIsinitSoapClient() { $this->assertFalse(self::instance()->is('initSoapClient')); } + public function testIsgetSoapClientClassName() { $this->assertFalse(self::instance()->is('getSoapClientClassName')); } + public function testIsgetDefaultWsdlOptions() { $this->assertFalse(self::instance()->is('getDefaultWsdlOptions')); } + public function testIssetLocation() { $this->assertFalse(self::instance()->is('setLocation')); } + public function testIsgetLastRequest() { $this->assertFalse(self::instance()->is('getLastRequest')); } + public function testIsgetLastResponse() { $this->assertFalse(self::instance()->is('getLastResponse')); } + public function testIsgetLastXml() { $this->assertFalse(self::instance()->is('getLastXml')); } + public function testIsgetLastRequestHeaders() { $this->assertFalse(self::instance()->is('getLastRequestHeaders')); } + public function testIsgetLastResponseHeaders() { $this->assertFalse(self::instance()->is('getLastResponseHeaders')); } + public function testIsgetLastHeaders() { $this->assertFalse(self::instance()->is('getLastHeaders')); } - public function testIsgetFormatedXml() + + public function testIsgetFormattedXml() { - $this->assertFalse(self::instance()->is('getFormatedXml')); + $this->assertFalse(self::instance()->is('getFormattedXml')); } + public function testIsconvertStringHeadersToArray() { $this->assertFalse(self::instance()->is('convertStringHeadersToArray')); } + public function testIssetSoapHeader() { $this->assertFalse(self::instance()->is('setSoapHeader')); } + public function testIssetHttpHeader() { $this->assertFalse(self::instance()->is('setHttpHeader')); } + public function testIsgetLastError() { $this->assertFalse(self::instance()->is('getLastError')); } + public function testIssetLastError() { $this->assertFalse(self::instance()->is('setLastError')); } + public function testIssaveLastError() { $this->assertFalse(self::instance()->is('saveLastError')); } + public function testIsgetLastErrorForMethod() { $this->assertFalse(self::instance()->is('getLastErrorForMethod')); } + public function testIsgetResult() { $this->assertFalse(self::instance()->is('getResult')); } + public function testIssetResult() { $this->assertFalse(self::instance()->is('setResult')); } - public function testIs_set() + + public function testIsSet() { $this->assertTrue(self::instance()->is('_set')); } - public function testIs_get() + + public function testIsGet() { $this->assertTrue(self::instance()->is('_get')); } + public function testIsgetAttributeName() { $this->assertTrue(self::instance()->is('getAttributeName')); } + public function testIslength() { $this->assertTrue(self::instance()->is('length')); } + public function testIscount() { $this->assertTrue(self::instance()->is('count')); } + public function testIscurrent() { $this->assertTrue(self::instance()->is('current')); } + public function testIsnext() { $this->assertTrue(self::instance()->is('next')); } + public function testIsrewind() { $this->assertTrue(self::instance()->is('rewind')); } + public function testIsvalid() { $this->assertTrue(self::instance()->is('valid')); } + public function testIskey() { $this->assertTrue(self::instance()->is('key')); } + public function testIsitem() { $this->assertTrue(self::instance()->is('item')); } + public function testIsadd() { $this->assertTrue(self::instance()->is('add')); } + public function testIsfirst() { $this->assertTrue(self::instance()->is('first')); } + public function testIslast() { $this->assertTrue(self::instance()->is('last')); } + public function testIsoffsetExists() { $this->assertTrue(self::instance()->is('offsetExists')); } + public function testIsoffsetGet() { $this->assertTrue(self::instance()->is('offsetGet')); } + public function testIsoffsetSet() { $this->assertTrue(self::instance()->is('offsetSet')); } + public function testIsoffsetUnset() { $this->assertTrue(self::instance()->is('offsetUnset')); } + public function testIsgetInternArray() { $this->assertTrue(self::instance()->is('getInternArray')); } + public function testIssetInternArray() { $this->assertTrue(self::instance()->is('setInternArray')); } + public function testIsgetInternArrayOffset() { $this->assertTrue(self::instance()->is('getInternArrayOffset')); } + public function testIsinitInternArray() { $this->assertTrue(self::instance()->is('initInternArray')); } + public function testIssetInternArrayOffset() { $this->assertTrue(self::instance()->is('setInternArrayOffset')); } + public function testIsgetInternArrayIsArray() { $this->assertTrue(self::instance()->is('getInternArrayIsArray')); } + public function testIssetInternArrayIsArray() { $this->assertTrue(self::instance()->is('setInternArrayIsArray')); } + public function testUppercasePHPReservedKeyword() { $this->assertFalse(self::instance()->is('Do')); } + public function testUppercaseIsoffsetGet() { $this->assertTrue(self::instance()->is('OffsetGet')); diff --git a/tests/ConfigurationReader/StructReservedMethodTest.php b/tests/ConfigurationReader/StructReservedMethodTest.php index 8f0a5e62..3b62789b 100644 --- a/tests/ConfigurationReader/StructReservedMethodTest.php +++ b/tests/ConfigurationReader/StructReservedMethodTest.php @@ -1,229 +1,278 @@ assertFalse(self::instance()->is('__CLASS__')); } - /** - * - */ - public function testIs___class___() + + public function testIsClassLower() { $this->assertFalse(self::instance()->is('__class__')); } - public function testIs__construct() + + public function testIsConstruct() { $this->assertFalse(self::instance()->is('__construct')); } + public function testIsgetSoapClient() { $this->assertFalse(self::instance()->is('getSoapClient')); } + public function testIssetSoapClient() { $this->assertFalse(self::instance()->is('setSoapClient')); } + public function testIsinitSoapClient() { $this->assertFalse(self::instance()->is('initSoapClient')); } + public function testIsgetSoapClientClassName() { $this->assertFalse(self::instance()->is('getSoapClientClassName')); } + public function testIsgetDefaultWsdlOptions() { $this->assertFalse(self::instance()->is('getDefaultWsdlOptions')); } + public function testIssetLocation() { $this->assertFalse(self::instance()->is('setLocation')); } + public function testIsgetLastRequest() { $this->assertFalse(self::instance()->is('getLastRequest')); } + public function testIsgetLastResponse() { $this->assertFalse(self::instance()->is('getLastResponse')); } + public function testIsgetLastXml() { $this->assertFalse(self::instance()->is('getLastXml')); } + public function testIsgetLastRequestHeaders() { $this->assertFalse(self::instance()->is('getLastRequestHeaders')); } + public function testIsgetLastResponseHeaders() { $this->assertFalse(self::instance()->is('getLastResponseHeaders')); } + public function testIsgetLastHeaders() { $this->assertFalse(self::instance()->is('getLastHeaders')); } - public function testIsgetFormatedXml() + + public function testIsgetFormattedXml() { - $this->assertFalse(self::instance()->is('getFormatedXml')); + $this->assertFalse(self::instance()->is('getFormattedXml')); } + public function testIsconvertStringHeadersToArray() { $this->assertFalse(self::instance()->is('convertStringHeadersToArray')); } + public function testIssetSoapHeader() { $this->assertFalse(self::instance()->is('setSoapHeader')); } + public function testIssetHttpHeader() { $this->assertFalse(self::instance()->is('setHttpHeader')); } + public function testIsgetLastError() { $this->assertFalse(self::instance()->is('getLastError')); } + public function testIssetLastError() { $this->assertFalse(self::instance()->is('setLastError')); } + public function testIssaveLastError() { $this->assertFalse(self::instance()->is('saveLastError')); } + public function testIsgetLastErrorForMethod() { $this->assertFalse(self::instance()->is('getLastErrorForMethod')); } + public function testIsgetResult() { $this->assertFalse(self::instance()->is('getResult')); } + public function testIssetResult() { $this->assertFalse(self::instance()->is('setResult')); } - public function testIs_set() + + public function testIsSet() { $this->assertTrue(self::instance()->is('_set')); } - public function testIs_get() + + public function testIsGet() { $this->assertTrue(self::instance()->is('_get')); } + public function testIsgetAttributeName() { $this->assertFalse(self::instance()->is('getAttributeName')); } + public function testIslength() { $this->assertFalse(self::instance()->is('length')); } + public function testIscount() { $this->assertFalse(self::instance()->is('count')); } + public function testIscurrent() { $this->assertFalse(self::instance()->is('current')); } + public function testIsnext() { $this->assertFalse(self::instance()->is('next')); } + public function testIsrewind() { $this->assertFalse(self::instance()->is('rewind')); } + public function testIsvalid() { $this->assertFalse(self::instance()->is('valid')); } + public function testIskey() { $this->assertFalse(self::instance()->is('key')); } + public function testIsitem() { $this->assertFalse(self::instance()->is('item')); } + public function testIsadd() { $this->assertFalse(self::instance()->is('add')); } + public function testIsfirst() { $this->assertFalse(self::instance()->is('first')); } + public function testIslast() { $this->assertFalse(self::instance()->is('last')); } + public function testIsoffsetExists() { $this->assertFalse(self::instance()->is('offsetExists')); } + public function testIsoffsetGet() { $this->assertFalse(self::instance()->is('offsetGet')); } + public function testIsoffsetSet() { $this->assertFalse(self::instance()->is('offsetSet')); } + public function testIsoffsetUnset() { $this->assertFalse(self::instance()->is('offsetUnset')); } + public function testIsgetInternArray() { $this->assertFalse(self::instance()->is('getInternArray')); } + public function testIssetInternArray() { $this->assertFalse(self::instance()->is('setInternArray')); } + public function testIsgetInternArrayOffset() { $this->assertFalse(self::instance()->is('getInternArrayOffset')); } + public function testIsinitInternArray() { $this->assertFalse(self::instance()->is('initInternArray')); } + public function testIssetInternArrayOffset() { $this->assertFalse(self::instance()->is('setInternArrayOffset')); } + public function testIsgetInternArrayIsArray() { $this->assertFalse(self::instance()->is('getInternArrayIsArray')); } + public function testIssetInternArrayIsArray() { $this->assertFalse(self::instance()->is('setInternArrayIsArray')); } + public function testUppercasePHPReservedKeyword() { $this->assertFalse(self::instance()->is('Do')); } + public function testUppercaseIsoffsetGet() { $this->assertFalse(self::instance()->is('OffsetGet')); diff --git a/tests/ConfigurationReader/XsdTypesTest.php b/tests/ConfigurationReader/XsdTypesTest.php index 3c075507..8af37b81 100755 --- a/tests/ConfigurationReader/XsdTypesTest.php +++ b/tests/ConfigurationReader/XsdTypesTest.php @@ -1,84 +1,73 @@ expectException(InvalidArgumentException::class); + + XsdTypes::instance(__DIR__.'/../resources/bad_xsd_types.yml'); } - /** - * @expectedException InvalidArgumentException - */ + public function testExceptionForUnexistingFile() { - XsdTypes::instance(__DIR__ . '/../resources/bad_xsd_types'); + $this->expectException(InvalidArgumentException::class); + + XsdTypes::instance(__DIR__.'/../resources/bad_xsd_types'); } - /** - * - */ + public function testIsXsdTrue() { $this->assertTrue(self::instance()->isXsd('duration')); } - /** - * - */ + public function testIsXsdFalse() { $this->assertFalse(self::instance()->isXsd('Duration')); } - /** - * - */ + public function testPhpXsd() { $this->assertSame('string', self::instance()->phpType('duration')); } - /** - * - */ + public function testPhpNonXsd() { $this->assertSame('', self::instance()->phpType('Duration')); } - /** - * - */ + public function testIsAnonymous() { $this->assertTrue(self::instance()->isAnonymous('anonymous159')); } - /** - * - */ + public function testAnonymousPhpType() { $this->assertSame('string', self::instance()->phpType('anonymous159')); } - /** - * - */ + public function testBase64BinaryXsd() { $this->assertTrue(self::instance()->isXsd('base64Binary')); } - /** - * - */ + public function testBase64BinaryPhpType() { $this->assertSame('string', self::instance()->phpType('base64Binary')); diff --git a/tests/Container/ContainerTest.php b/tests/Container/ContainerTest.php index d18239b9..06ff2614 100755 --- a/tests/Container/ContainerTest.php +++ b/tests/Container/ContainerTest.php @@ -1,38 +1,42 @@ expectException(InvalidArgumentException::class); + $container = new ObjectContainerTest(self::getBingGeneratorInstance()); $container->add(new FalseObjectTest()); } - /** - * @expectedException \InvalidArgumentException - */ + public function testOffsetSetWithException() { + $this->expectException(InvalidArgumentException::class); + $container = new ObjectContainerTest(self::getBingGeneratorInstance()); $container->offsetSet(1, new FalseObjectTest()); } - /** - * @expectedException \InvalidArgumentException - */ + public function testInvalidPropertyName() { + $this->expectException(InvalidArgumentException::class); + $container = new FalseObjectContainerTest(self::getBingGeneratorInstance()); $container->add(new FalseObjectTest()); } - /** - * - */ + public function testJsonSerialize() { $object = new ObjectTest(); diff --git a/tests/Container/FalseObjectContainerTest.php b/tests/Container/FalseObjectContainerTest.php index 8c9d3b3a..f4909184 100755 --- a/tests/Container/FalseObjectContainerTest.php +++ b/tests/Container/FalseObjectContainerTest.php @@ -1,17 +1,24 @@ add(new Method(self::getBingGeneratorInstance(), 'Foo', 'string', 'int', $service)); - $methodContainer->add(new Method(self::getBingGeneratorInstance(), 'Bar', 'string', 'int', $service)); - $methodContainer->add(new Method(self::getBingGeneratorInstance(), 'FooBar', [ + $methodContainer->add(new MethodModel(self::getBingGeneratorInstance(), 'Foo', 'string', 'int', $service)); + $methodContainer->add(new MethodModel(self::getBingGeneratorInstance(), 'Bar', 'string', 'int', $service)); + $methodContainer->add(new MethodModel(self::getBingGeneratorInstance(), 'FooBar', [ 'string', 'int', 'int', ], 'int', $service)); + return $methodContainer; } - /** - * - */ + public function testGetMethodByName() { $methodContainer = self::instance(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Method', $methodContainer->getMethodByName('Foo')); + $this->assertInstanceOf(MethodModel::class, $methodContainer->getMethodByName('Foo')); $this->assertNull($methodContainer->getMethodByName('boo')); } } diff --git a/tests/Container/Model/ModelContainerTest.php b/tests/Container/Model/ModelContainerTest.php index c4a06bd5..645bed7a 100755 --- a/tests/Container/Model/ModelContainerTest.php +++ b/tests/Container/Model/ModelContainerTest.php @@ -1,71 +1,70 @@ add(new EmptyModel(self::getBingGeneratorInstance(), 'Foo')); - $this->assertInstanceOf('WsdlToPhp\PackageGenerator\Model\EmptyModel', $modelContainer->get('Foo')); + $this->assertInstanceOf(EmptyModel::class, $modelContainer->get('Foo')); } - /** - * @expectedException InvalidArgumentException - */ + public function testExceptionOnObject() { + $this->expectException(TypeError::class); + $modelContainer = self::instance(); $modelContainer->add([]); } - /** - * @expectedException InvalidArgumentException - */ + public function testGetExceptionOnValue() { + $this->expectException(InvalidArgumentException::class); + $modelContainer = self::instance(); $modelContainer->add(new EmptyModel(self::getBingGeneratorInstance(), 'Foo')); $modelContainer->get([]); $modelContainer->get(null); } - /** - * @expectedException InvalidArgumentException - */ + public function testExceptionOnModelClass() { + $this->expectException(InvalidArgumentException::class); + $modelContainer = self::instance(); $modelContainer->add(new Struct(self::getBingGeneratorInstance(), 'Foo')); } - /** - * - */ + public function testGet() { $modelContainer = self::instance(); $modelContainer->add(new EmptyModel(self::getBingGeneratorInstance(), 'Foo')); $modelContainer->add(new EmptyModel(self::getBingGeneratorInstance(), 'Bar')); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\EmptyModel', $modelContainer->get('Foo')); + $this->assertInstanceOf(EmptyModel::class, $modelContainer->get('Foo')); } - /** - * - */ + public function testForeach() { $models = self::instance(); @@ -78,22 +77,20 @@ public function testForeach() foreach ($models as $model) { $this->assertSame($index, $models->key()); - if ($models->key() === 0) { + if (0 === $models->key()) { $this->assertSame('Foo', $model->getName()); - } elseif ($models->key() === 1) { + } elseif (1 === $models->key()) { $this->assertSame('Bar', $model->getName()); - } elseif ($models->key() === 2) { + } elseif (2 === $models->key()) { $this->assertSame('FooBar', $model->getName()); - } elseif ($models->key() === 3) { + } elseif (3 === $models->key()) { $this->assertSame('BarFoo', $model->getName()); } - $index++; + ++$index; } } - /** - * - */ + public function testCount() { $models = self::instance(); diff --git a/tests/Container/Model/SchemaContainerTest.php b/tests/Container/Model/SchemaContainerTest.php index 88262ce8..5a5a2133 100755 --- a/tests/Container/Model/SchemaContainerTest.php +++ b/tests/Container/Model/SchemaContainerTest.php @@ -1,35 +1,37 @@ add(new Schema(self::getBingGeneratorInstance(), self::SCHEMA_BING, file_get_contents(self::wsdlBingPath()))); - $schemaContainer->add(new Schema(self::getBingGeneratorInstance(), self::SCHEMA_EBAY, file_get_contents(self::wsdlEbayPath()))); + $schemaContainer->add(new SchemaModel(self::getBingGeneratorInstance(), self::SCHEMA_BING, file_get_contents(self::wsdlBingPath()))); + $schemaContainer->add(new SchemaModel(self::getBingGeneratorInstance(), self::SCHEMA_EBAY, file_get_contents(self::wsdlEbayPath()))); + return $schemaContainer; } - /** - * - */ + public function testGetSchemaByName() { $schemaContainer = self::instance(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Schema', $schemaContainer->getSchemaByName(self::SCHEMA_BING)); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Schema', $schemaContainer->getSchemaByName(self::SCHEMA_EBAY)); + $this->assertInstanceOf(SchemaModel::class, $schemaContainer->getSchemaByName(self::SCHEMA_BING)); + $this->assertInstanceOf(SchemaModel::class, $schemaContainer->getSchemaByName(self::SCHEMA_EBAY)); $this->assertNull($schemaContainer->getSchemaByName('Bar')); } } diff --git a/tests/Container/Model/ServiceContainerTest.php b/tests/Container/Model/ServiceContainerTest.php index 67121153..d78f29a2 100755 --- a/tests/Container/Model/ServiceContainerTest.php +++ b/tests/Container/Model/ServiceContainerTest.php @@ -1,35 +1,35 @@ add(new Service(self::getBingGeneratorInstance(), 'Foo')); + $serviceContainer->add(new ServiceModel(self::getBingGeneratorInstance(), 'Foo')); + return $serviceContainer; } - /** - * - */ + public function testGetServiceByName() { $serviceContainer = self::instance(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Service', $serviceContainer->getServiceByName('Foo')); + $this->assertInstanceOf(ServiceModel::class, $serviceContainer->getServiceByName('Foo')); $this->assertNull($serviceContainer->getServiceByName('Bar')); } - /** - * - */ + public function testAddServiceNonUnique() { $serviceContainer = self::instance(); @@ -44,7 +44,7 @@ public function testAddServiceNonUnique() $count = 0; foreach ($fooService->getMethods() as $method) { $this->assertFalse($method->isUnique()); - $count++; + ++$count; } $this->assertSame(2, $count); } diff --git a/tests/Container/Model/StructAttributeContainerTest.php b/tests/Container/Model/StructAttributeContainerTest.php index 7c3372fe..645535dd 100755 --- a/tests/Container/Model/StructAttributeContainerTest.php +++ b/tests/Container/Model/StructAttributeContainerTest.php @@ -1,18 +1,21 @@ add(new StructAttribute(self::getBingGeneratorInstance(), 'bar', 'int', $struct)); $structAttributeContainer->add(new StructAttribute(self::getBingGeneratorInstance(), 'Bar', 'float', $struct)); $structAttributeContainer->add(new StructAttribute(self::getBingGeneratorInstance(), 'fooBar', 'bool', $struct)); + return $structAttributeContainer; } - /** - * - */ + public function testGetStructAttributeByName() { $structAttributeContainer = self::instance(); diff --git a/tests/Container/Model/StructContainerTest.php b/tests/Container/Model/StructContainerTest.php index ea2a4326..3c78a984 100755 --- a/tests/Container/Model/StructContainerTest.php +++ b/tests/Container/Model/StructContainerTest.php @@ -1,37 +1,38 @@ add(StructTest::instance('Foo', true)); $structContainer->add(StructTest::instance('Bar', false)); + return $structContainer; } - /** - * - */ + public function testGetStructByName() { $structContainer = self::instance(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Struct', $structContainer->getStructByName('Foo')); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Struct', $structContainer->getStructByName('Bar')); + $this->assertInstanceOf(StructModel::class, $structContainer->getStructByName('Foo')); + $this->assertInstanceOf(StructModel::class, $structContainer->getStructByName('Bar')); $this->assertNull($structContainer->getStructByName('bar')); } - /** - * - */ + public function testAddStructWithSameAttributeName() { $structContainer = self::instance(); @@ -41,9 +42,7 @@ public function testAddStructWithSameAttributeName() $this->assertCount(1, $structContainer->getStructByName('Foo')->getAttributes()); } - /** - * - */ + public function testOffsetUnset() { $instance = self::instance(); @@ -55,18 +54,14 @@ public function testOffsetUnset() $this->assertNull($instance->offsetGet(1)); } - /** - * - */ + public function testGetStructByNameAndTypeMustFailAsTypeIsUnknown() { $structContainer = self::instance(); $this->assertNull($structContainer->getStructByNameAndType('bar', 'string')); } - /** - * - */ + public function testGetStructByNameAndTypeMustReturnTheStruct() { $structContainer = self::instance(); @@ -83,34 +78,4 @@ public function testGetStructByNameAndTypeMustReturnTheStruct() $this->assertSame($fooStringFirstMeta, $structContainer->getStructByNameAndType('FooString', 'string')->getMeta()); $this->assertSame($fooStringSecondMeta, $structContainer->getStructByNameAndType('FooString', 'int')->getMeta()); } - /** - * @requires PHP < 7.3 - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value "stdClass" can't be used to get an object from "WsdlToPhp\PackageGenerator\Container\Model\Struct" - */ - public function testGetByTypeMustThrowAnExceptionForInvalidValue() - { - $structContainer = self::instance(); - $structContainer->getByType(new \stdClass(), '_'); - } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Type "array ( - * )" can't be used to get an object - */ - public function testGetByTypeMustThrowAnExceptionForInvalidType() - { - $structContainer = self::instance(); - $structContainer->getByType(1, []); - } - /** - * @requires PHP < 7.3 - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value "stdClass" can't be used to get an object from "WsdlToPhp\PackageGenerator\Container\Model\Struct" - */ - public function testGetVirtualMustThrowAnExceptionForInvalidValue() - { - $structContainer = self::instance(); - $structContainer->getVirtual(new \stdClass()); - } } diff --git a/tests/Container/Model/StructValueContainerTest.php b/tests/Container/Model/StructValueContainerTest.php index 55b0cb48..edfc6d5d 100755 --- a/tests/Container/Model/StructValueContainerTest.php +++ b/tests/Container/Model/StructValueContainerTest.php @@ -1,37 +1,41 @@ add(new StructValue(self::getBingGeneratorInstance(), 1, 0, $struct)); $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 2, 1, $struct)); $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 'any', 2, $struct)); $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 'bar', 3, $struct)); + return $structValueContainer; } - /** - * - */ + public function testGetStructValueByName() { - $structvalueContainer = self::instance(); + $structValueContainer = self::instance(); - $this->assertInstanceOf('\WSdlToPhp\PackageGenerator\Model\StructValue', $structvalueContainer->getStructValueByName(1)); - $this->assertInstanceOf('\WSdlToPhp\PackageGenerator\Model\StructValue', $structvalueContainer->getStructValueByName(2)); - $this->assertInstanceOf('\WSdlToPhp\PackageGenerator\Model\StructValue', $structvalueContainer->getStructValueByName('any')); - $this->assertNull($structvalueContainer->getStructValueByName('Bar')); + $this->assertInstanceOf(StructValueModel::class, $structValueContainer->getStructValueByName(1)); + $this->assertInstanceOf(StructValueModel::class, $structValueContainer->getStructValueByName(2)); + $this->assertInstanceOf(StructValueModel::class, $structValueContainer->getStructValueByName('any')); + $this->assertNull($structValueContainer->getStructValueByName('Bar')); } } diff --git a/tests/Container/ObjectContainerTest.php b/tests/Container/ObjectContainerTest.php index 690f898f..b33bd0ac 100755 --- a/tests/Container/ObjectContainerTest.php +++ b/tests/Container/ObjectContainerTest.php @@ -1,17 +1,24 @@ expectException(InvalidArgumentException::class); + $container = new Parser(self::getBingGeneratorInstance()); $container->add($container); } diff --git a/tests/Container/PhpElement/ConstantTest.php b/tests/Container/PhpElement/ConstantTest.php index 64a8b76b..97bc9e84 100755 --- a/tests/Container/PhpElement/ConstantTest.php +++ b/tests/Container/PhpElement/ConstantTest.php @@ -1,17 +1,21 @@ add(new PhpConstant('foo', 1)); $this->assertCount(1, $constant); - - $this->assertInstanceOf('\WsdlToPhp\PhpGenerator\Element\PhpConstant', $constant->get('foo')); + $this->assertInstanceOf(PhpConstant::class, $constant->get('foo')); } - /** - * @expectedException \InvalidArgumentException - */ + public function testAddWithException() { + $this->expectException(InvalidArgumentException::class); + $constant = new Constant(self::getBingGeneratorInstance()); $constant->add(new PhpMethod('Bar')); diff --git a/tests/Container/PhpElement/MethodTest.php b/tests/Container/PhpElement/MethodTest.php index 4aa8bc30..f31f67e7 100755 --- a/tests/Container/PhpElement/MethodTest.php +++ b/tests/Container/PhpElement/MethodTest.php @@ -1,17 +1,21 @@ add(new PhpMethod('foo')); $this->assertCount(1, $method); - - $this->assertInstanceOf('\WsdlToPhp\PhpGenerator\Element\PhpMethod', $method->get('foo')); + $this->assertInstanceOf(PhpMethod::class, $method->get('foo')); } - /** - * @expectedException \InvalidArgumentException - */ + public function testAddWithException() { + $this->expectException(InvalidArgumentException::class); + $method = new Method(self::getBingGeneratorInstance()); $method->add(new PhpConstant('Bar')); diff --git a/tests/Container/PhpElement/PropertyTest.php b/tests/Container/PhpElement/PropertyTest.php index 3787ce87..a4d8252e 100755 --- a/tests/Container/PhpElement/PropertyTest.php +++ b/tests/Container/PhpElement/PropertyTest.php @@ -1,17 +1,21 @@ add(new PhpProperty('foo')); $this->assertCount(1, $property); - - $this->assertInstanceOf('\WsdlToPhp\PhpGenerator\Element\PhpProperty', $property->get('foo')); + $this->assertInstanceOf(PhpProperty::class, $property->get('foo')); } - /** - * @expectedException \InvalidArgumentException - */ + public function testAddWithException() { + $this->expectException(InvalidArgumentException::class); + $property = new Property(self::getBingGeneratorInstance()); $property->add(new PhpConstant('Bar')); diff --git a/tests/File/AbstractFile.php b/tests/File/AbstractFile.php index bce72955..3910f10c 100755 --- a/tests/File/AbstractFile.php +++ b/tests/File/AbstractFile.php @@ -1,14 +1,18 @@ setOptionPrefix('Api') ->setOptionAddComments([ 'release' => '1.1.0', ]) ->setOptionCategory(GeneratorOptions::VALUE_CAT) - ->setOptionGatherMethods($gatherMethods); - self::applyParsers($g, $wsdl); + ->setOptionGatherMethods($gatherMethods) + ; + self::applyParsers($g); + return $g; } - /** - * @param Generator $generator - */ - private static function applyParsers(Generator $generator) + + protected function assertSameFileContent(string $valid, File $file, string $fileExtension = 'php'): void + { + if (!is_file($file->getFileName())) { + $this->fail(sprintf('Generated file "%s" could not be found', $file->getFileName())); + } + + // uncomment next line to easily regenerate all valid files :) + // file_put_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension), str_replace($file->getGenerator()->getWsdl()->getName(), '__WSDL_URL__', file_get_contents($file->getFileName()))); + + $validContent = file_get_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension)); + $validContent = str_replace('__WSDL_URL__', $file->getGenerator()->getWsdl()->getName(), $validContent); + $toBeValidatedContent = file_get_contents($file->getFileName()); + $this->assertSame($validContent, $toBeValidatedContent); + + unlink($file->getFileName()); + } + + private static function applyParsers(Generator $generator): Generator { $parsers = [ new FunctionsParser($generator), @@ -73,21 +88,4 @@ private static function applyParsers(Generator $generator) $parser->parse(); } } - /** - * @param string $valid - * @param File $file - */ - protected function assertSameFileContent($valid, File $file, $fileExtension = 'php') - { - if (!is_file($file->getFileName())) { - return $this->fail(sprintf('Generated file "%s" could not be found', $file->getFileName())); - } - // uncomment next line to easily regenerate all valid files :) - // file_put_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension), str_replace($file->getGenerator()->getWsdl()->getName(), '__WSDL_URL__', file_get_contents($file->getFileName()))); - $validContent = file_get_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension)); - $validContent = str_replace('__WSDL_URL__', $file->getGenerator()->getWsdl()->getName(), $validContent); - $toBeValidatedContent = file_get_contents($file->getFileName()); - $this->assertSame($validContent, $toBeValidatedContent); - unlink($file->getFileName()); - } } diff --git a/tests/File/ClassMapTest.php b/tests/File/ClassMapTest.php index 1d5d1605..530a0371 100755 --- a/tests/File/ClassMapTest.php +++ b/tests/File/ClassMapTest.php @@ -1,16 +1,19 @@ getPackagedName()); $classMap ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBingClassMap', $classMap); } - /** - * - */ + public function testReforma() { $instance = self::reformaGeneratorInstance(); @@ -34,13 +36,12 @@ public function testReforma() $classMap = new ClassMapFile($instance, $model->getPackagedName()); $classMap ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidReformaClassMap', $classMap); } - /** - * - */ + public function testActon() { $instance = self::actonGeneratorInstance(); @@ -49,50 +50,49 @@ public function testActon() $classMap = new ClassMapFile($instance, $model->getPackagedName()); $classMap ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidActonClassMap', $classMap); } - /** - * - */ + public function testActonWihthoutPrefix() { $instance = self::actonGeneratorInstance(); $instance ->setOptionNamespacePrefix('') - ->setOptionPrefix(''); + ->setOptionPrefix('') + ; $model = new EmptyModel($instance, 'ClassMap'); $classMap = new ClassMapFile($instance, $model->getPackagedName()); $classMap ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidActonClassMapWihoutNamespace', $classMap); } - /** - * - */ + public function testActonWihthoutPrefixAndCategory() { $instance = self::actonGeneratorInstance(); $instance ->setOptionNamespacePrefix('') ->setOptionPrefix('') - ->setOptionCategory(GeneratorOptions::VALUE_NONE); + ->setOptionCategory(GeneratorOptions::VALUE_NONE) + ; $model = new EmptyModel($instance, 'ClassMap'); $classMap = new ClassMapFile($instance, $model->getPackagedName()); $classMap ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidActonClassMapWihoutNamespaceAndCategory', $classMap); } - /** - * - */ + public function testDestination() { $instance = self::bingGeneratorInstance(); @@ -101,6 +101,6 @@ public function testDestination() $classMap = new ClassMapFile($instance, $model->getPackagedName()); $classMap->setModel($model); - $this->assertSame(sprintf('%s%s', self::getTestDirectory(), $instance->getOptionSrcDirname() . DIRECTORY_SEPARATOR), $classMap->getFileDestination()); + $this->assertSame(sprintf('%s%s', self::getTestDirectory(), $instance->getOptionSrcDirname().DIRECTORY_SEPARATOR), $classMap->getFileDestination()); } } diff --git a/tests/File/ComposerTest.php b/tests/File/ComposerTest.php index e5165d82..874ab5bd 100755 --- a/tests/File/ComposerTest.php +++ b/tests/File/ComposerTest.php @@ -1,30 +1,33 @@ setOptionPrefix('Api') - ->setOptionComposerName('wsdltophp/bing'); + ->setOptionComposerName('wsdltophp/bing') + ; $composerFile = new Composer($instance, 'composer'); $composerFile ->setRunComposerUpdate(false) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBingComposer', $composerFile, 'json'); } - /** - * - */ + public function testBingWithSettings() { $instance = self::getBingGeneratorInstance(true); @@ -34,70 +37,69 @@ public function testBingWithSettings() ->setOptionComposerSettings([ 'config.disable-tls:true', 'require.wsdltophp/wssecurity:dev-master', - ]); + ]) + ; $composerFile = new Composer($instance, 'composer'); $composerFile ->setRunComposerUpdate(false) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBingComposerSettings', $composerFile, 'json'); } - /** - * - */ + public function testBingWithEmptySrcDirname() { $instance = self::getBingGeneratorInstance(true); $instance ->setOptionPrefix('Api') ->setOptionComposerName('wsdltophp/bing') - ->setOptionSrcDirname(''); + ->setOptionSrcDirname('') + ; $composerFile = new Composer($instance, 'composer'); $composerFile ->setRunComposerUpdate(false) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBingComposerEmptySrcDirname', $composerFile, 'json'); } - /** - * - */ + public function testBingWithSlashSrcDirname() { $instance = self::getBingGeneratorInstance(true); $instance ->setOptionPrefix('Api') ->setOptionComposerName('wsdltophp/bing') - ->setOptionSrcDirname('/'); + ->setOptionSrcDirname('/') + ; $composerFile = new Composer($instance, 'composer'); $composerFile ->setRunComposerUpdate(false) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBingComposerSlashSrcDirname', $composerFile, 'json'); } - /** - * - */ + public function testSetRunComposerUdpate() { $instance = self::getBingGeneratorInstance(true); $instance - ->setOptionPrefix('Api'); + ->setOptionPrefix('Api') + ; $composerFile = new Composer($instance, 'composer'); $composerFile->setRunComposerUpdate(false); $this->assertFalse($composerFile->getRunComposerUpdate()); } - /** - * - */ + public function testGetFileName() { $instance = self::getBingGeneratorInstance(true); $instance->setOptionPrefix('Api'); $composerFile = new Composer($instance, 'composer'); - $this->assertSame(self::getTestDirectory() . 'composer.json', $composerFile->getFileName()); + $this->assertSame(self::getTestDirectory().'composer.json', $composerFile->getFileName()); } } diff --git a/tests/File/ServiceTest.php b/tests/File/ServiceTest.php index a48eb189..076ef520 100755 --- a/tests/File/ServiceTest.php +++ b/tests/File/ServiceTest.php @@ -1,27 +1,31 @@ expectException(InvalidArgumentException::class); + $instance = self::bingGeneratorInstance(); $service = new ServiceFile($instance, 'Foo'); $service->setModel(new EmptyModel($instance, 'Foo')); } - /** - * - */ + public function testWriteActonServiceDeleteService() { $generator = self::actonGeneratorInstance(); @@ -29,15 +33,14 @@ public function testWriteActonServiceDeleteService() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiDelete', $service); } else { $this->fail('Unable to find Delete service for file generation'); } } - /** - * - */ + public function testWriteBingSearchSearchService() { $generator = self::bingGeneratorInstance(); @@ -45,15 +48,14 @@ public function testWriteBingSearchSearchService() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiSearch', $service); } else { $this->fail('Unable to find Search service for file generation'); } } - /** - * - */ + public function testWriteBingSearchSearchServiceMyProjectApiProject() { $generator = self::bingGeneratorInstance(); @@ -61,38 +63,38 @@ public function testWriteBingSearchSearchServiceMyProjectApiProject() $generator ->setOptionPrefix('Api') ->setOptionSuffix('Project') - ->setOptionNamespacePrefix('My\Project'); + ->setOptionNamespacePrefix('My\Project') + ; $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidMyProjectApiSearchProject', $service); } else { $this->fail('Unable to find Search service for file generation'); } } - /** - * - */ + public function testWriteBingSearchSearchServiceBingApi() { $generator = self::bingGeneratorInstance(); if (($model = $generator->getService('Search')) instanceof ServiceModel) { $generator ->setOptionPrefix('') - ->setOptionSuffix('BingApi'); + ->setOptionSuffix('BingApi') + ; $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiSearchBingApi', $service); } else { $this->fail('Unable to find Search service for file generation'); } } - /** - * - */ + public function testWritePortalServiceAuthenticate() { $generator = self::portalGeneratorInstance(); @@ -100,15 +102,14 @@ public function testWritePortalServiceAuthenticate() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiAuthenticate', $service); } else { $this->fail('Unable to find Authenticate service for file generation'); } } - /** - * - */ + public function testWriteReformServiceLogin() { $generator = self::reformaGeneratorInstance(); @@ -116,15 +117,14 @@ public function testWriteReformServiceLogin() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiLogin', $service); } else { $this->fail('Unable to find Login service for file generation'); } } - /** - * - */ + public function testWriteQueueServiceCreate() { $generator = self::queueGeneratorInstance(); @@ -132,15 +132,14 @@ public function testWriteQueueServiceCreate() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiCreate', $service); } else { $this->fail('Unable to find Create service for file generation'); } } - /** - * - */ + public function testWriteOmnitureServiceSaint() { $generator = self::omnitureGeneratorInstance(); @@ -148,15 +147,14 @@ public function testWriteOmnitureServiceSaint() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiSaint', $service); } else { $this->fail('Unable to find Saint service for file generation'); } } - /** - * - */ + public function testWritePayPalServiceDo() { $generator = self::payPalGeneratorInstance(false, GeneratorOptions::VALUE_START); @@ -164,15 +162,14 @@ public function testWritePayPalServiceDo() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiDo', $service); } else { $this->fail('Unable to find Do service for file generation'); } } - /** - * - */ + public function testWritePayPalServiceDoWithoutPrefix() { $generator = self::payPalGeneratorInstance(); @@ -181,15 +178,14 @@ public function testWritePayPalServiceDoWithoutPrefix() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidDoWithoutPrefix', $service); } else { $this->fail('Unable to find Do service for file generation'); } } - /** - * - */ + public function testWriteDocDataPaymentsServiceListWithoutPrefix() { $generator = self::docDataPaymentsGeneratorInstance(); @@ -198,15 +194,14 @@ public function testWriteDocDataPaymentsServiceListWithoutPrefix() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidListWithoutPrefix', $service); } else { $this->fail('Unable to find List service for file generation'); } } - /** - * - */ + public function testWriteBingService() { $generator = self::bingGeneratorInstance(false, GeneratorOptions::VALUE_NONE); @@ -215,15 +210,14 @@ public function testWriteBingService() $service = new ServiceFile($generator, ServiceModel::DEFAULT_SERVICE_CLASS_NAME); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBingApiService', $service); } else { $this->fail('Unable to find Service model for file generation'); } } - /** - * - */ + public function testWriteOmnitureService() { $generator = self::omnitureGeneratorInstance(false, GeneratorOptions::VALUE_NONE); @@ -236,12 +230,11 @@ public function testWriteOmnitureService() } $serviceFile ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidOmnitureApiService', $serviceFile); } - /** - * - */ + public function testWritePayPalService() { $generator = self::payPalGeneratorInstance(false, GeneratorOptions::VALUE_NONE); @@ -254,12 +247,11 @@ public function testWritePayPalService() } $serviceFile ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidPayPalApiService', $serviceFile); } - /** - * - */ + public function testWriteActonService() { $generator = self::actonGeneratorInstance(false, GeneratorOptions::VALUE_NONE); @@ -272,12 +264,11 @@ public function testWriteActonService() } $serviceFile ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidActonApiService', $serviceFile); } - /** - * - */ + public function testWriteYandexDirectApiLiveGetService() { $generator = self::yandexDirectApiLiveGeneratorInstance(); @@ -286,15 +277,14 @@ public function testWriteYandexDirectApiLiveGetService() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidYandexDirectApiLiveGet', $service); } else { $this->fail('Unable to find Get service for file generation'); } } - /** - * - */ + public function testDestination() { $generator = self::bingGeneratorInstance(); @@ -302,14 +292,12 @@ public function testDestination() $service = new ServiceFile($generator, $model->getName()); $service->setModel($model); - $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname() . DIRECTORY_SEPARATOR, $model->getContextualPart()), $service->getFileDestination()); + $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname().DIRECTORY_SEPARATOR, $model->getContextualPart()), $service->getFileDestination()); } else { $this->fail('Unable to find Search service for file generation'); } } - /** - * - */ + public function testWriteEwsFindService() { $generator = self::ewsInstance(); @@ -317,15 +305,14 @@ public function testWriteEwsFindService() $service = new ServiceFile($generator, $model->getName()); $service ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiFind', $service); } else { $this->fail('Unable to find Find service for file generation'); } } - /** - * - */ + public function testGetOperationMethodReturnTypeWithNullReturnTypeMustReturnNull() { $generatorInstance = self::bingGeneratorInstance(); diff --git a/tests/File/StructArrayTest.php b/tests/File/StructArrayTest.php index 5052aab7..d4f61c4f 100755 --- a/tests/File/StructArrayTest.php +++ b/tests/File/StructArrayTest.php @@ -1,37 +1,42 @@ expectException(InvalidArgumentException::class); + $struct = new StructModel(self::bingGeneratorInstance(), 'FooArray'); $struct ->addAttribute('bar', 'string') - ->addAttribute('foo', 'int'); + ->addAttribute('foo', 'int') + ; $array = new ArrayFile(self::bingGeneratorInstance(), 'Foo'); $array->setModel($struct); } - /** - * @expectedException \InvalidArgumentException - */ + public function testSetModelBasNameOneAttributeWithException() { + $this->expectException(InvalidArgumentException::class); + $struct = new StructModel(self::bingGeneratorInstance(), 'Foo'); $struct->addAttribute('bar', 'string'); $array = new ArrayFile(self::bingGeneratorInstance(), 'Foo'); $array->setModel($struct); } - /** - * - */ + public function testWriteBingSearchArrayOfNewsRelatedSearch() { $generator = self::bingGeneratorInstance(); @@ -39,15 +44,14 @@ public function testWriteBingSearchArrayOfNewsRelatedSearch() $struct = new ArrayFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiArrayOfNewsRelatedSearch', $struct); } else { $this->fail('Unable to find ArrayOfNewsRelatedSearch struct for file generation'); } } - /** - * - */ + public function testWriteBingSearchArrayOfWebSearchOption() { $generator = self::bingGeneratorInstance(); @@ -55,15 +59,14 @@ public function testWriteBingSearchArrayOfWebSearchOption() $struct = new ArrayFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiArrayOfWebSearchOption', $struct); } else { $this->fail('Unable to find ArrayOfWebSearchOption struct for file generation'); } } - /** - * - */ + public function testWriteBingSearchArrayOfString() { $generator = self::bingGeneratorInstance(); @@ -71,15 +74,14 @@ public function testWriteBingSearchArrayOfString() $struct = new ArrayFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiArrayOfString', $struct); } else { $this->fail('Unable to find ArrayOfString struct for file generation'); } } - /** - * - */ + public function testWriteBingSearchArrayOfError() { $generator = self::bingGeneratorInstance(); @@ -87,45 +89,45 @@ public function testWriteBingSearchArrayOfError() $struct = new ArrayFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiArrayOfError', $struct); } else { $this->fail('Unable to find ArrayOfError struct for file generation'); } } - /** - * - */ + public function testWriteBingSearchApiArrayOfErrorProject() { $generator = self::bingGeneratorInstance(); if (($model = $generator->getStructByName('ArrayOfError')) instanceof StructModel) { $generator ->setOptionPrefix('Api') - ->setOptionSuffix('Project'); + ->setOptionSuffix('Project') + ; $struct = new ArrayFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiArrayOfErrorProject', $struct); } else { $this->fail('Unable to find ArrayOfError struct for file generation'); } } - /** - * - */ + public function testDestination() { $generator = self::bingGeneratorInstance(); if (($model = $generator->getStructByName('ArrayOfError')) instanceof StructModel) { $generator ->setOptionPrefix('Api') - ->setOptionSuffix('Project'); + ->setOptionSuffix('Project') + ; $struct = new ArrayFile($generator, $model->getName()); $struct->setModel($model); - $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname() . DIRECTORY_SEPARATOR, $model->getContextualPart()), $struct->getFileDestination()); + $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname().DIRECTORY_SEPARATOR, $model->getContextualPart()), $struct->getFileDestination()); } else { $this->fail('Unable to find ArrayOfError struct for file generation'); } diff --git a/tests/File/StructEnumTest.php b/tests/File/StructEnumTest.php index 47b09d08..f4e77612 100755 --- a/tests/File/StructEnumTest.php +++ b/tests/File/StructEnumTest.php @@ -1,24 +1,28 @@ expectException(InvalidArgumentException::class); + $instance = self::bingGeneratorInstance(); $enum = new EnumFile($instance, 'Foo'); $enum->setModel(new StructModel($instance, 'FooEnum')); } - /** - * - */ + public function testWriteBingSearchEnumAdultOption() { $generator = self::bingGeneratorInstance(); @@ -26,15 +30,14 @@ public function testWriteBingSearchEnumAdultOption() $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiAdultOption', $struct); } else { $this->fail('Unable to find AdultOption enumeration for file generation'); } } - /** - * - */ + public function testWriteBingSearchEnumSourceType() { $generator = self::bingGeneratorInstance(); @@ -42,15 +45,14 @@ public function testWriteBingSearchEnumSourceType() $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiSourceType', $struct); } else { $this->fail('Unable to find SourceType enumeration for file generation'); } } - /** - * - */ + public function testWriteReformaHouseStageEnum() { $generator = self::reformaGeneratorInstance(); @@ -58,15 +60,14 @@ public function testWriteReformaHouseStageEnum() $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiHouseStageEnum', $struct); } else { $this->fail('Unable to find HouseStageEnum enumeration for file generation'); } } - /** - * - */ + public function testWriteOmnitureDsWeblogFormats() { $generator = self::omnitureGeneratorInstance(); @@ -74,15 +75,14 @@ public function testWriteOmnitureDsWeblogFormats() $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiDs_weblog_formats', $struct); } else { $this->fail('Unable to find ds_weblog_formats enumeration for file generation'); } } - /** - * - */ + public function testWriteBingSearchEnumWebSearchOption() { $generator = self::bingGeneratorInstance(true); @@ -91,70 +91,68 @@ public function testWriteBingSearchEnumWebSearchOption() $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiWebSearchOption', $struct); } else { $this->fail('Unable to find WebSearchOption enumeration for file generation'); } } - /** - * - */ + public function testWriteBingSearchEnumPhonebookSortOption() { $generator = self::bingGeneratorInstance(true); if (($model = $generator->getStructByName('PhonebookSortOption')) instanceof StructModel) { $generator - ->setOptionNamespacePrefix('Std\Opt'); + ->setOptionNamespacePrefix('Std\Opt') + ; $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiPhonebookSortOption', $struct); } else { $this->fail('Unable to find PhonebookSortOption enumeration for file generation'); } } - /** - * - */ + public function testWriteBingSearchEnumPhonebookSortOptionSuffixed() { $generator = self::bingGeneratorInstance(true); if (($model = $generator->getStructByName('PhonebookSortOption')) instanceof StructModel) { $generator ->setOptionPrefix('') - ->setOptionSuffix('Api'); + ->setOptionSuffix('Api') + ; $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiPhonebookSortOptionApi', $struct); } else { $this->fail('Unable to find PhonebookSortOption enumeration for file generation'); } } - /** - * - */ + public function testDestination() { $generator = self::bingGeneratorInstance(true); if (($model = $generator->getStructByName('PhonebookSortOption')) instanceof StructModel) { $generator ->setOptionPrefix('') - ->setOptionSuffix('Api'); + ->setOptionSuffix('Api') + ; $struct = new EnumFile($generator, $model->getName()); $struct->setModel($model); - $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname() . DIRECTORY_SEPARATOR, $model->getContextualPart()), $struct->getFileDestination()); + $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname().DIRECTORY_SEPARATOR, $model->getContextualPart()), $struct->getFileDestination()); } else { $this->fail('Unable to find PhonebookSortOption enumeration for file generation'); } } - /** - * - */ + public function testWriteWhlEnumTransactionActionType() { $generator = self::whlInstance(); @@ -162,7 +160,8 @@ public function testWriteWhlEnumTransactionActionType() $struct = new EnumFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiTransactionActionType', $struct); } else { $this->fail('Unable to find TransactionActionType enumeration for file generation'); diff --git a/tests/File/StructTest.php b/tests/File/StructTest.php index e372dba5..bb7c100c 100755 --- a/tests/File/StructTest.php +++ b/tests/File/StructTest.php @@ -1,45 +1,47 @@ expectException(InvalidArgumentException::class); + $instance = self::bingGeneratorInstance(); $struct = new StructFile($instance, 'Foo'); $struct->setModel(new EmptyModel($instance, 'Foo')); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnWrite() { + $this->expectException(InvalidArgumentException::class); + $file = new StructFile(self::bingGeneratorInstance(), 'foo'); $file->write(); } - /** - * - */ + public function testGetFileName() { $model = new StructModel(self::bingGeneratorInstance(), 'Foo'); $file = new StructFile(self::bingGeneratorInstance(), 'foo'); $file->setModel($model); - $this->assertSame(sprintf('%s%s%s/%s.php', self::getTestDirectory(), $model->getGenerator()->getOptionSrcDirname() . DIRECTORY_SEPARATOR, $model->getContextualPart(), $model->getPackagedName(false)), $file->getFileName()); + $this->assertSame(sprintf('%s%s%s/%s.php', self::getTestDirectory(), $model->getGenerator()->getOptionSrcDirname().DIRECTORY_SEPARATOR, $model->getContextualPart(), $model->getPackagedName(false)), $file->getFileName()); } - /** - * - */ + public function testWriteBingSearchStructQuery() { $generator = self::bingGeneratorInstance(); @@ -47,15 +49,14 @@ public function testWriteBingSearchStructQuery() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiQuery', $struct); } else { $this->fail('Unable to find Query struct for file generation'); } } - /** - * - */ + public function testWriteBingSearchStructVideoRequest() { $generator = self::bingGeneratorInstance(); @@ -63,15 +64,14 @@ public function testWriteBingSearchStructVideoRequest() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiVideoRequest', $struct); } else { $this->fail('Unable to find VideoRequest struct for file generation'); } } - /** - * - */ + public function testWriteBingSearchStructSearchRequest() { $generator = self::bingGeneratorInstance(); @@ -79,15 +79,14 @@ public function testWriteBingSearchStructSearchRequest() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiSearchRequest', $struct); } else { $this->fail('Unable to find SearchRequest struct for file generation'); } } - /** - * - */ + public function testWriteActonStructItem() { $generator = self::actonGeneratorInstance(); @@ -95,15 +94,14 @@ public function testWriteActonStructItem() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiItem', $struct); } else { $this->fail('Unable to find Item struct for file generation'); } } - /** - * - */ + public function testWriteOdigeoStructFareItinerary() { $generator = self::odigeoGeneratorInstance(); @@ -111,15 +109,14 @@ public function testWriteOdigeoStructFareItinerary() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiFareItinerary', $struct); } else { $this->fail('Unable to find fareItinerary struct for file generation'); } } - /** - * - */ + public function testWriteBingStructNewsArticle() { $generator = self::bingGeneratorInstance(); @@ -128,15 +125,14 @@ public function testWriteBingStructNewsArticle() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiNewsArticle', $struct); } else { $this->fail('Unable to find NewsArticle struct for file generation'); } } - /** - * - */ + public function testWriteWcfStructOffer() { $generator = self::wcfGeneratorInstance(); @@ -144,15 +140,14 @@ public function testWriteWcfStructOffer() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiOffer', $struct); } else { $this->fail('Unable to find offer struct for file generation'); } } - /** - * - */ + public function testWriteYandexDirectApiStructAddRequest() { $generator = self::yandexDirectApiAdGroupsGeneratorInstance(); @@ -160,22 +155,22 @@ public function testWriteYandexDirectApiStructAddRequest() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidAddRequest', $struct); } else { $this->fail('Unable to find AddRequest struct for file generation'); } } - /** - * - */ + public function testWriteYandexDirectApiStructAddRequestWithRepeatedMetaValueMaxOccurs() { $generator = self::yandexDirectApiAdGroupsGeneratorInstance(); if (($model = $generator->getStructByName('AddRequest')) instanceof StructModel) { $model->getAttribute('AdGroups') ->addMeta('maxOccurs', 1) - ->addMeta('maxOccurs', 'unbounded'); + ->addMeta('maxOccurs', 'unbounded') + ; $this->assertSame([ 'unbounded', @@ -186,15 +181,14 @@ public function testWriteYandexDirectApiStructAddRequestWithRepeatedMetaValueMax $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidAddRequestRepeatedMaxOccurs', $struct); } else { $this->fail('Unable to find AddRequest struct for file generation'); } } - /** - * - */ + public function testWriteYandexDirectApiStructAdGroupsSelectionCriteria() { $generator = self::yandexDirectApiAdGroupsGeneratorInstance(); @@ -202,15 +196,14 @@ public function testWriteYandexDirectApiStructAdGroupsSelectionCriteria() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidAdGroupsSelectionCriteria', $struct); } else { $this->fail('Unable to find AdGroupsSelectionCriteria struct for file generation'); } } - /** - * - */ + public function testWriteDocDataPaymentsStructShopper() { $generator = self::docDataPaymentsGeneratorInstance(true); @@ -218,15 +211,14 @@ public function testWriteDocDataPaymentsStructShopper() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidShopper', $struct); } else { $this->fail('Unable to find shopper struct for file generation'); } } - /** - * - */ + public function testWriteDocDataPaymentsStructExpiryDate() { $generator = self::docDataPaymentsGeneratorInstance(true); @@ -234,15 +226,14 @@ public function testWriteDocDataPaymentsStructExpiryDate() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidExpiryDate', $struct); } else { $this->fail('Unable to find expiryDate struct for file generation'); } } - /** - * - */ + public function testWriteDeliveryServiceStructExpiryDate() { $generator = self::deliveryServiceInstance(); @@ -250,15 +241,14 @@ public function testWriteDeliveryServiceStructExpiryDate() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidAddress', $struct); } else { $this->fail('Unable to find АдресРФ struct for file generation'); } } - /** - * - */ + public function testWriteReformaStructHouseProfileData() { $generator = self::reformaGeneratorInstance(true); @@ -266,31 +256,29 @@ public function testWriteReformaStructHouseProfileData() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidHouseProfileData', $struct); } else { $this->fail('Unable to find HouseProfileData struct for file generation'); } } - /** - * - */ - public function testOrderContractStructAddressDelivery_Type() + + public function testOrderContractStructAddressDeliveryType() { $generator = self::orderContractInstance(true); if (($model = $generator->getStructByName('AddressDelivery_Type')) instanceof StructModel) { $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidAddressDelivery_Type', $struct); } else { $this->fail('Unable to find AddressDelivery_Type struct for file generation'); } } - /** - * - */ + public function testDestination() { $generator = self::bingGeneratorInstance(); @@ -299,14 +287,12 @@ public function testDestination() $struct = new StructFile($generator, $model->getName()); $struct->setModel($model); - $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname() . DIRECTORY_SEPARATOR, $model->getContextualPart()), $struct->getFileDestination()); + $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), $generator->getOptionSrcDirname().DIRECTORY_SEPARATOR, $model->getContextualPart()), $struct->getFileDestination()); } else { $this->fail('Unable to find NewsArticle struct for file generation'); } } - /** - * - */ + public function testWriteYandexDirectApiStructCampaignsCompaignGetItem() { $generator = self::yandexDirectApiCampaignsGeneratorInstance(true); @@ -315,15 +301,14 @@ public function testWriteYandexDirectApiStructCampaignsCompaignGetItem() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidCampaignGetItem', $struct); } else { $this->fail('Unable to find CampaignGetItem struct for file generation'); } } - /** - * - */ + public function testWriteYandexDirectApiStructLiveBannerInfo() { $generator = self::yandexDirectApiLiveGeneratorInstance(true); @@ -332,15 +317,14 @@ public function testWriteYandexDirectApiStructLiveBannerInfo() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidBannerInfo', $struct); } else { $this->fail('Unable to find BannerInfo struct for file generation'); } } - /** - * - */ + public function testWritePayPalApiStructSetExpressCheckoutRequestDetailsType() { $generator = self::payPalGeneratorInstance(true); @@ -349,15 +333,14 @@ public function testWritePayPalApiStructSetExpressCheckoutRequestDetailsType() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidSetExpressCheckoutRequestDetailsType', $struct); } else { $this->fail('Unable to find SetExpressCheckoutRequestDetailsType struct for file generation'); } } - /** - * - */ + public function testWriteWhlHotelReservationType() { $generator = self::whlInstance(true); @@ -366,15 +349,14 @@ public function testWriteWhlHotelReservationType() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidHotelReservationType', $struct); } else { $this->fail('Unable to find HotelReservationType struct for file generation'); } } - /** - * - */ + public function testWriteWhlTaxType() { $generator = self::whlInstance(); @@ -383,15 +365,14 @@ public function testWriteWhlTaxType() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidTaxType', $struct); } else { $this->fail('Unable to find TaxType struct for file generation'); } } - /** - * - */ + public function testWriteWhlPaymentCardType() { $generator = self::whlInstance(); @@ -400,15 +381,14 @@ public function testWriteWhlPaymentCardType() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidPaymentCardType', $struct); } else { $this->fail('Unable to find PaymentCardType struct for file generation'); } } - /** - * - */ + public function testWriteWhlAddressType() { $generator = self::whlInstance(); @@ -417,16 +397,15 @@ public function testWriteWhlAddressType() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidAddressType', $struct); } else { $this->fail('Unable to find AddressType struct for file generation'); } } - /** - * - */ - public function testWriteWhlUniqueID_Type() + + public function testWriteWhlUniqueIDType() { $generator = self::whlInstance(); $generator->setOptionValidation(true); @@ -434,15 +413,14 @@ public function testWriteWhlUniqueID_Type() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidUniqueID_Type', $struct); } else { $this->fail('Unable to find UniqueID_Type struct for file generation'); } } - /** - * - */ + public function testStructWithIdenticalPropertiesDifferentByCase() { $generator = self::bingGeneratorInstance(); @@ -451,15 +429,14 @@ public function testStructWithIdenticalPropertiesDifferentByCase() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidApiQueryWithIdenticalPropertiesDifferentByCase', $struct); } else { $this->fail('Unable to find Query struct for file generation'); } } - /** - * - */ + public function testStructResultFromUnitTestsWithBooleanAttribute() { $generator = self::unitTestsInstance(); @@ -467,15 +444,14 @@ public function testStructResultFromUnitTestsWithBooleanAttribute() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidUnitTestsStructResult', $struct); } else { $this->fail('Unable to find Result struct for file generation'); } } - /** - * - */ + public function testWriteDeliveryDetails() { $generator = self::deliveryServiceInstance(); @@ -484,15 +460,14 @@ public function testWriteDeliveryDetails() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidDetails', $struct); } else { $this->fail('Unable to find details struct for file generation'); } } - /** - * - */ + public function testWriteEwsStructWorkingPeriod() { $generator = self::ewsInstance(); @@ -500,15 +475,14 @@ public function testWriteEwsStructWorkingPeriod() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidWorkingPeriod', $struct); } else { $this->assertFalse(true, 'Unable to find WorkingPeriod struct for file generation'); } } - /** - * - */ + public function testWriteEwsStructProposeNewTimeTypeWithNoConstructor() { $generator = self::ewsInstance(); @@ -516,15 +490,14 @@ public function testWriteEwsStructProposeNewTimeTypeWithNoConstructor() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidProposeNewTimeType', $struct); } else { $this->assertFalse(true, 'Unable to find ProposeNewTimeType struct for file generation'); } } - /** - * - */ + public function testWriteVehicleSelectionStructFieldString1000() { $generator = self::vehicleSelectionPackGeneratorInstance(); @@ -532,7 +505,8 @@ public function testWriteVehicleSelectionStructFieldString1000() $struct = new StructFile($generator, $model->getName()); $struct ->setModel($model) - ->write(); + ->write() + ; $this->assertSameFileContent('ValidFieldString1000', $struct); } else { $this->fail('Unable to find fieldString1000 struct for file generation'); diff --git a/tests/File/TutorialTest.php b/tests/File/TutorialTest.php index ff6bd06c..b81c2513 100644 --- a/tests/File/TutorialTest.php +++ b/tests/File/TutorialTest.php @@ -1,16 +1,20 @@ assertSameFileContent('ValidBingTutorial', $tutorial); } - /** - * - */ + public function testBingNotStandalone() { $instance = self::bingGeneratorInstance(); @@ -33,9 +35,7 @@ public function testBingNotStandalone() $this->assertSameFileContent('ValidBingTutorialNotStandalone', $tutorial); } - /** - * - */ + public function testBingNoPrefix() { $instance = self::bingGeneratorInstance(); @@ -46,9 +46,7 @@ public function testBingNoPrefix() $this->assertSameFileContent('ValidBingTutorialNoPrefix', $tutorial); } - /** - * - */ + public function testReforma() { $instance = self::reformaGeneratorInstance(); @@ -58,9 +56,7 @@ public function testReforma() $this->assertSameFileContent('ValidReformaTutorial', $tutorial); } - /** - * - */ + public function testActon() { $instance = self::actonGeneratorInstance(); @@ -70,9 +66,7 @@ public function testActon() $this->assertSameFileContent('ValidActonTutorial', $tutorial); } - /** - * - */ + public function testOmniture() { $instance = self::omnitureGeneratorInstance(); @@ -82,9 +76,7 @@ public function testOmniture() $this->assertSameFileContent('ValidOmnitureTutorial', $tutorial); } - /** - * - */ + public function testActonNone() { $instance = self::actonGeneratorInstance(true, GeneratorOptions::VALUE_NONE); diff --git a/tests/File/Validation/AbstractRuleTest.php b/tests/File/Validation/AbstractRuleTest.php index 2e389d75..3868d98c 100644 --- a/tests/File/Validation/AbstractRuleTest.php +++ b/tests/File/Validation/AbstractRuleTest.php @@ -1,182 +1,192 @@ applyRule('any', $value, $itemType); - $method->addChild('return true;'); - eval(str_replace('public ', '', $method->toString())); - return $methodName; + return self::getClassInstance('actonGeneratorInstance', 'Item', $reset); } - - protected static function createClassInstance(Struct $struct) - { - // generate class' file - if ($struct->isArray()) { - $structFile = new StructArrayFile($struct->getGenerator(), 'any'); - } elseif ($struct->isRestriction()) { - $structFile = new StructEnumFile($struct->getGenerator(), 'any'); - } else { - $structFile = new StructFile($struct->getGenerator(), 'any'); - } - $structFile->setModel($struct)->writeFile(); - - // load class - require_once $structFile->getFileName(); - - // remove no more useful file - @unlink($structFile->getFileName()); - } - - private static function getClassInstance($instanceMethod, $structName, $reset = false) - { - $key = implode('_', [ - $instanceMethod, - $structName, - ]); - - // get struct - $struct = call_user_func_array([ - 'self', - $instanceMethod, - ], [ - false, - ])->getStructByName($structName); - - if (!$struct) { - self::fail(sprintf('Unable to find %s struct for instanciating a new instance using %s', $structName, $instanceMethod)); - } - - // create class' file - $fileCreated = false; - if (!array_key_exists($key, self::$classInstances)) { - self::createClassInstance($struct); - $fileCreated = true; - } - - // instanciate class - if ($reset || $fileCreated) { - $reflection = new \ReflectionClass(($struct->getNamespace() ? $struct->getNamespace() . '\\' : '') . $struct->getPackagedName()); - self::$classInstances[$key] = $reflection->newInstanceArgs(); - } - return self::$classInstances[$key]; - } - - public static function getWhlAddressTypeInstance($reset = false) + public static function getWhlAddressTypeInstance(bool $reset = false) { return self::getClassInstance('whlInstance', 'AddressType', $reset); } - public static function getWhlBookingChannelInstance($reset = false) + public static function getWhlBookingChannelInstance(bool $reset = false) { return self::getClassInstance('whlInstance', 'BookingChannel', $reset); } - public static function getWhlHotelReservationTypeInstance($reset = false) + public static function getWhlHotelReservationTypeInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('whlInstance', 'PMS_ResStatusType'); self::getClassInstance('whlInstance', 'TransactionActionType'); + return self::getClassInstance('whlInstance', 'HotelReservationType', $reset); } - public static function getWhlPaymentCardTypeInstance($reset = false) + public static function getWhlPaymentCardTypeInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('whlInstance', 'PaymentCardCodeType'); + return self::getClassInstance('whlInstance', 'PaymentCardType', $reset); } - public static function getWhlTaxTypeInstance($reset = false) + public static function getWhlTaxTypeInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('whlInstance', 'AmountDeterminationType'); // required for validating itemType self::getClassInstance('whlInstance', 'ParagraphType'); + return self::getClassInstance('whlInstance', 'TaxType', $reset); } - public static function getQueueMessageAttributeValueInstance($reset = false) + public static function getQueueMessageAttributeValueInstance(bool $reset = false) { return self::getClassInstance('queueGeneratorInstance', 'MessageAttributeValue', $reset); } - public static function getBingSearchRequestInstance($reset = false) + public static function getBingSearchRequestInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('bingGeneratorInstance', 'AdultOption'); + return self::getClassInstance('bingGeneratorInstance', 'SearchRequest', $reset); } - public static function getBingNewsArticleInstance($reset = false) + public static function getBingNewsArticleInstance(bool $reset = false) { return self::getClassInstance('bingGeneratorInstance', 'NewsArticle', $reset); } - public static function getOdigeoFareItineraryInstance($reset = false) + public static function getOdigeoFareItineraryInstance(bool $reset = false) { return self::getClassInstance('odigeoGeneratorInstance', 'fareItinerary', $reset); } - public static function getOrderContractAddressDeliveryTypeInstance($reset = false) + public static function getOrderContractAddressDeliveryTypeInstance(bool $reset = false) { return self::getClassInstance('orderContractInstance', 'AddressDelivery_Type', $reset); } - public static function getEwsWorkingPeriodInstance($reset = false) + public static function getEwsWorkingPeriodInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('ewsInstance', 'DayOfWeekType'); + return self::getClassInstance('ewsInstance', 'WorkingPeriod', $reset); } - public static function getDocDataPaymentsShoppperInstance($reset = false) + public static function getDocDataPaymentsShoppperInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('docDataPaymentsGeneratorInstance', 'gender'); + return self::getClassInstance('docDataPaymentsGeneratorInstance', 'shopper', $reset); } - public static function getReformaHouseProfileDataInstance($reset = false) + public static function getReformaHouseProfileDataInstance(bool $reset = false) { // required for validating enumeration values self::getClassInstance('reformaGeneratorInstance', 'HouseTypeEnum'); self::getClassInstance('reformaGeneratorInstance', 'HouseWallMaterialEnum'); self::getClassInstance('reformaGeneratorInstance', 'HouseFloorTypeEnum'); self::getClassInstance('reformaGeneratorInstance', 'HouseEnergyEfficiencyClassEnum'); + return self::getClassInstance('reformaGeneratorInstance', 'HouseProfileData', $reset); } + + protected function createRuleFunction(string $ruleClassName, $value = null, bool $itemType = false, string $structAttributeType = 'string'): string + { + $generator = self::getBingGeneratorInstance(); + $methodName = '_any_'.md5((string) rand(0, time())); + $method = new PhpMethod($methodName, [ + 'any', + ]); + $structFile = new StructFile($generator, 'any'); + $structModel = new StructModel($generator, 'any'); + $methodContainer = new MethodContainer($generator); + $structAttribute = new StructAttributeModel($generator, 'any', $structAttributeType, $structModel); + $rule = new $ruleClassName(new Rules($structFile, $method, $structAttribute, $methodContainer)); + $rule->applyRule('any', $value, $itemType); + $method->addChild('return true;'); + eval(str_replace('public ', '', $method->toString())); + + return $methodName; + } + + protected static function createClassInstance(Struct $struct) + { + // generate class' file + if ($struct->isArray()) { + $structFile = new StructArrayFile($struct->getGenerator(), 'any'); + } elseif ($struct->isRestriction()) { + $structFile = new StructEnumFile($struct->getGenerator(), 'any'); + } else { + $structFile = new StructFile($struct->getGenerator(), 'any'); + } + $structFile->setModel($struct)->writeFile(); + + // load class + require_once $structFile->getFileName(); + + // remove no more useful file + @unlink($structFile->getFileName()); + } + + private static function getClassInstance($instanceMethod, $structName, $reset = false) + { + $key = implode('_', [ + $instanceMethod, + $structName, + ]); + + // get struct + $struct = call_user_func_array([ + 'self', + $instanceMethod, + ], [ + false, + ])->getStructByName($structName); + + if (!$struct) { + self::fail(sprintf('Unable to find %s struct for instantiating a new instance using %s', $structName, $instanceMethod)); + } + + // create class' file + $fileCreated = false; + if (!array_key_exists($key, self::$generators)) { + self::createClassInstance($struct); + $fileCreated = true; + } + + // instantiate class + if ($reset || $fileCreated) { + $reflection = new ReflectionClass(($struct->getNamespace() ? $struct->getNamespace().'\\' : '').$struct->getPackagedName()); + self::$generators[$key] = $reflection->newInstanceWithoutConstructor(); + } + + return self::$generators[$key]; + } } diff --git a/tests/File/Validation/ArrayRuleTest.php b/tests/File/Validation/ArrayRuleTest.php index 775152b1..f0b518c9 100644 --- a/tests/File/Validation/ArrayRuleTest.php +++ b/tests/File/Validation/ArrayRuleTest.php @@ -1,10 +1,19 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('The AddressLine property can only contain items of type string, NULL(NULL) given'); + $instance = self::getWhlAddressTypeInstance(); $this->assertSame( @@ -41,7 +50,8 @@ public function testSetAddressLineWithNullOnOneItemMustThrowAnException() * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] */ public function testSetAddressLineWithStringsMustPass() @@ -57,12 +67,11 @@ public function testSetAddressLineWithStringsMustPass() ); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, string(''), integer(1) given - */ public function testSetTaxDescriptionValueWithStringValueMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, string(\'\'), integer(1) given'); + $instance = self::getWhlTaxTypeInstance(); $instance->setTaxDescription([ @@ -71,26 +80,22 @@ public function testSetTaxDescriptionValueWithStringValueMustThrowAnException() ]); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, Api\StructType\ApiTaxType given - */ public function testSetTaxDescriptionValueWithInvalidObjectItemMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, Api\StructType\ApiTaxType given'); + $instance = self::getWhlTaxTypeInstance(); $this->assertSame( $instance, $instance->setTaxDescription([ - new \Api\StructType\ApiTaxType(), - new \Api\StructType\ApiParagraphType(), + new ApiTaxType(), + new ApiParagraphType(), ]) ); } - /** - * - */ public function testSetTaxDescriptionValueWithValidItemsMustPass() { $instance = self::getWhlTaxTypeInstance(); @@ -98,8 +103,8 @@ public function testSetTaxDescriptionValueWithValidItemsMustPass() $this->assertSame( $instance, $instance->setTaxDescription([ - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), ]) ); } diff --git a/tests/File/Validation/BooleanRuleTest.php b/tests/File/Validation/BooleanRuleTest.php index 36870467..62864074 100644 --- a/tests/File/Validation/BooleanRuleTest.php +++ b/tests/File/Validation/BooleanRuleTest.php @@ -1,24 +1,26 @@ expectException(TypeError::class); + $instance = self::getWhlBookingChannelInstance(); $instance->setPrimary('true'); } - /** - * - */ public function testSetPrimaryWithTrueValueMustPass() { $instance = self::getWhlBookingChannelInstance(); @@ -26,9 +28,6 @@ public function testSetPrimaryWithTrueValueMustPass() $this->assertSame($instance, $instance->setPrimary(true)); } - /** - * - */ public function testSetPrimaryWithFalseValueMustPass() { $instance = self::getWhlBookingChannelInstance(); @@ -36,9 +35,6 @@ public function testSetPrimaryWithFalseValueMustPass() $this->assertSame($instance, $instance->setPrimary(false)); } - /** - * - */ public function testSetPrimaryWithNullValueMustPass() { $instance = self::getWhlBookingChannelInstance(); diff --git a/tests/File/Validation/ChoiceRuleTest.php b/tests/File/Validation/ChoiceRuleTest.php index 46ca1973..9c38605b 100644 --- a/tests/File/Validation/ChoiceRuleTest.php +++ b/tests/File/Validation/ChoiceRuleTest.php @@ -1,30 +1,39 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('The property StringValue can\'t be set as the property BinaryValue is already set. Only one property must be set among these properties: StringValue, BinaryValue.'); + $instance = self::getQueueMessageAttributeValueInstance(); $instance ->setBinaryValue('1234567980') - ->setStringValue('0987654321'); + ->setStringValue('0987654321') + ; } /** * - choice: StringValue | BinaryValue * - choiceMaxOccurs: 1 - * - choiceMinOccurs: 1 + * - choiceMinOccurs: 1. */ public function testSetStringValueAloneMustPass() { @@ -36,7 +45,7 @@ public function testSetStringValueAloneMustPass() /** * - choice: StringValue | BinaryValue * - choiceMaxOccurs: 1 - * - choiceMinOccurs: 1 + * - choiceMinOccurs: 1. */ public function testSetStringValueAloneWithNullMustPass() { diff --git a/tests/File/Validation/EnumerationRuleTest.php b/tests/File/Validation/EnumerationRuleTest.php index 9b4689f3..06bac8d3 100644 --- a/tests/File/Validation/EnumerationRuleTest.php +++ b/tests/File/Validation/EnumerationRuleTest.php @@ -1,34 +1,35 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value(s) \'foo\', please use one of: Off, Moderate, Strict from enumeration class \Api\EnumType\ApiAdultOption'); + $instance = self::getBingSearchRequestInstance(); $instance->setAdult('foo'); } - /** - * - */ public function testSetAdultValueWithValidValueMustPass() { $instance = self::getBingSearchRequestInstance(); - $this->assertSame($instance, $instance->setAdult(\Api\EnumType\ApiAdultOption::VALUE_MODERATE)); + $this->assertSame($instance, $instance->setAdult(ApiAdultOption::VALUE_MODERATE)); } - /** - * - */ public function testSetAdultValueWithNullValueMustPass() { $instance = self::getBingSearchRequestInstance(); diff --git a/tests/File/Validation/FloatRuleTest.php b/tests/File/Validation/FloatRuleTest.php index 39d16a3d..67ed6d24 100644 --- a/tests/File/Validation/FloatRuleTest.php +++ b/tests/File/Validation/FloatRuleTest.php @@ -1,24 +1,26 @@ expectException(TypeError::class); + $instance = self::getWhlTaxTypeInstance(); $instance->setPercent('foo'); } - /** - * - */ public function testSetPercentValueWithIntValueMustPass() { $instance = self::getWhlTaxTypeInstance(); @@ -26,19 +28,6 @@ public function testSetPercentValueWithIntValueMustPass() $this->assertSame($instance, $instance->setPercent(85)); } - /** - * - */ - public function testSetPercentValueWithStringIntValueMustPass() - { - $instance = self::getWhlTaxTypeInstance(); - - $this->assertSame($instance, $instance->setPercent('85')); - } - - /** - * - */ public function testSetPercentValueWithFloatValueMustPass() { $instance = self::getWhlTaxTypeInstance(); @@ -46,19 +35,6 @@ public function testSetPercentValueWithFloatValueMustPass() $this->assertSame($instance, $instance->setPercent(8.5)); } - /** - * - */ - public function testSetPercentValueWithStringFloatValueMustPass() - { - $instance = self::getWhlTaxTypeInstance(); - - $this->assertSame($instance, $instance->setPercent('8.5')); - } - - /** - * - */ public function testSetPercentValueWithNullValueMustPass() { $instance = self::getWhlTaxTypeInstance(); diff --git a/tests/File/Validation/FractionDigitsRuleTest.php b/tests/File/Validation/FractionDigitsRuleTest.php index e6b574d6..f2632d49 100644 --- a/tests/File/Validation/FractionDigitsRuleTest.php +++ b/tests/File/Validation/FractionDigitsRuleTest.php @@ -1,28 +1,34 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value 2.12345, the value must at most contain 3 fraction digits, 5 given'); + // hack as precision can return false negative with 2.1234500000000001 - ini_set('serialize_precision', 6); + ini_set('serialize_precision', '6'); $instance = self::getWhlTaxTypeInstance(); $instance->setAmount(2.12345); } /** - * - fractionDigits: 0 + * - fractionDigits: 0. */ public function testSetWeightValueWithIntegerMustPass() { @@ -32,19 +38,20 @@ public function testSetWeightValueWithIntegerMustPass() } /** - * - fractionDigits: 0 - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 200.01, the value must at most contain 0 fraction digits, 2 given + * - fractionDigits: 0. */ public function testSetWeightValueWithDecimalMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value 200.01, the value must at most contain 0 fraction digits, 2 given'); + $functionName = self::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\FractionDigitsRule', 0); call_user_func($functionName, 200.010); } /** - * - fractionDigits: 3 + * - fractionDigits: 3. */ public function testSetAmountValueWithSameFractionDigitsMustPass() { @@ -54,7 +61,7 @@ public function testSetAmountValueWithSameFractionDigitsMustPass() } /** - * - fractionDigits: 3 + * - fractionDigits: 3. */ public function testSetAmountValueWithLessFractionDigitsMustPass() { @@ -64,7 +71,7 @@ public function testSetAmountValueWithLessFractionDigitsMustPass() } /** - * - fractionDigits: 3 + * - fractionDigits: 3. */ public function testSetAmountValueWithNullValueMustPass() { diff --git a/tests/File/Validation/IntRuleTest.php b/tests/File/Validation/IntRuleTest.php index 9e716ba6..436b25ce 100644 --- a/tests/File/Validation/IntRuleTest.php +++ b/tests/File/Validation/IntRuleTest.php @@ -1,24 +1,26 @@ expectException(TypeError::class); + $instance = self::getWhlTaxTypeInstance(); $instance->setDecimalPlaces('foo'); } - /** - * - */ public function testSetDecimalPlacesValueWithIntValueMustPass() { $instance = self::getWhlTaxTypeInstance(); @@ -26,41 +28,31 @@ public function testSetDecimalPlacesValueWithIntValueMustPass() $this->assertSame($instance, $instance->setDecimalPlaces(18)); } - /** - * - */ public function testSetDecimalPlacesValueWithStringIntValueMustPass() { $instance = self::getWhlTaxTypeInstance(); - $this->assertSame($instance, $instance->setDecimalPlaces('18')); + $this->assertSame($instance, $instance->setDecimalPlaces(18)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 18.5, please provide an integer value, double given - */ public function testSetDecimalPlacesValueWithFloatValueMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getWhlTaxTypeInstance(); $instance->setDecimalPlaces(18.5); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value '18.5', please provide an integer value, string given - */ public function testSetDecimalPlacesValueWithStringFloatValueMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getWhlTaxTypeInstance(); $instance->setDecimalPlaces('18.5'); } - /** - * - */ public function testSetDecimalPlacesValueWithNullValueMustPass() { $instance = self::getWhlTaxTypeInstance(); diff --git a/tests/File/Validation/InvalidRuleClass.php b/tests/File/Validation/InvalidRuleClass.php index 95b9a0b5..15547a5d 100644 --- a/tests/File/Validation/InvalidRuleClass.php +++ b/tests/File/Validation/InvalidRuleClass.php @@ -1,27 +1,29 @@ '; } - public function testConditions($parameterName, $value, $itemType = false) + public function testConditions(string $parameterName, $value, bool $itemType = false): string { return 'true'; } - public function exceptionMessageOnTestFailure($parameterName, $value, $itemType = false) + public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string { return ''; } diff --git a/tests/File/Validation/InvalidRuleTest.php b/tests/File/Validation/InvalidRuleTest.php index 2e98d77a..cdcd8578 100644 --- a/tests/File/Validation/InvalidRuleTest.php +++ b/tests/File/Validation/InvalidRuleTest.php @@ -1,22 +1,27 @@ returned by symbol() method, can't determine comparison string - */ public function testComparisonStringMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value <> returned by symbol() method, can\'t determine comparison string'); + $instance = self::bingGeneratorInstance(); $i = new InvalidRuleClass(new Rules(new Struct($instance, 'Foo'), new PhpMethod('bar'), new StructAttribute($instance, 'FooBar'), new Method($instance))); $i->comparisonString(); diff --git a/tests/File/Validation/ItemTypeRuleTest.php b/tests/File/Validation/ItemTypeRuleTest.php index dceec600..0c7bad13 100644 --- a/tests/File/Validation/ItemTypeRuleTest.php +++ b/tests/File/Validation/ItemTypeRuleTest.php @@ -1,71 +1,64 @@ expectException(TypeError::class); + $instance = self::getWhlTaxTypeInstance(); $instance->addToTaxDescription('foo'); } - /** - * TypeError introduced in PHP 7, https://www.php.net/manual/fr/class.typeerror.php - * @requires PHP 7.0 - * @expectedException \TypeError - */ public function testAddToTaxDescriptionValueWithNullValueMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getWhlTaxTypeInstance(); $instance->addToTaxDescription(null); } - /** - * - */ public function testAddToTaxDescriptionValueWithApiParagraphTypeInstanceMustPass() { // true to avoid the maxoccurs error to occur $instance = self::getWhlTaxTypeInstance(true); - $this->assertSame($instance, $instance->addToTaxDescription(new \Api\StructType\ApiParagraphType())); + $this->assertSame($instance, $instance->addToTaxDescription(new ApiParagraphType())); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The firstSegmentsIds property can only contain items of type int, string given - */ public function testAddToFirstSegmentsIdsValueWithStringValueMustThrowAnException() { + $this->expectException(TypeError::class); + // true to avoid the maxoccurs error to occur $instance = self::getOdigeoFareItineraryInstance(true); $instance->addToFirstSegmentsIds('foo'); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The firstSegmentsIds property can only contain items of type int, NULL given - */ public function testAddToFirstSegmentsIdsValueWithNullValueMustThrowAnException() { + $this->expectException(TypeError::class); + // true to avoid the maxoccurs error to occur $instance = self::getOdigeoFareItineraryInstance(true); $instance->addToFirstSegmentsIds(null); } - /** - * - */ public function testAddToFirstSegmentsIdsValueWithIntValueMustPass() { // true to avoid the maxoccurs error to occur @@ -74,14 +67,11 @@ public function testAddToFirstSegmentsIdsValueWithIntValueMustPass() $this->assertSame($instance, $instance->addToFirstSegmentsIds(18)); } - /** - * - */ public function testAddToFirstSegmentsIdsValueWithStringIntValueMustPass() { // true to avoid the maxoccurs error to occur $instance = self::getOdigeoFareItineraryInstance(true); - $this->assertSame($instance, $instance->addToFirstSegmentsIds('18')); + $this->assertSame($instance, $instance->addToFirstSegmentsIds(18)); } } diff --git a/tests/File/Validation/LengthRuleTest.php b/tests/File/Validation/LengthRuleTest.php index e003968b..fa3ed3a9 100644 --- a/tests/File/Validation/LengthRuleTest.php +++ b/tests/File/Validation/LengthRuleTest.php @@ -1,20 +1,28 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid length of 5, the number of characters/octets contained by the literal must be equal to 4'); + $instance = self::getOrderContractAddressDeliveryTypeInstance(); $instance->setPostalCode('12345'); @@ -24,12 +32,13 @@ public function testAddToAddressLineWithTooManyCharactersLengthMustThrowAnExcept * The PostalCode * Meta informations extracted from the WSDL * - base: string - * - length: 4 - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid length of 3, the number of characters/octets contained by the literal must be equal to 4 + * - length: 4. */ public function testAddToAddressLineWithTooLessCharactersLengthMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid length of 3, the number of characters/octets contained by the literal must be equal to 4'); + $instance = self::getOrderContractAddressDeliveryTypeInstance(); $instance->setPostalCode('123'); @@ -39,7 +48,7 @@ public function testAddToAddressLineWithTooLessCharactersLengthMustThrowAnExcept * The PostalCode * Meta informations extracted from the WSDL * - base: string - * - length: 4 + * - length: 4. */ public function testAddToAddressLineWithSAmeCharactersLengthMustPass() { diff --git a/tests/File/Validation/ListRuleTest.php b/tests/File/Validation/ListRuleTest.php index 6f0681ce..5765da7f 100644 --- a/tests/File/Validation/ListRuleTest.php +++ b/tests/File/Validation/ListRuleTest.php @@ -1,16 +1,23 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value(s) string(\'Today\'), please use one of: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Day, Weekday, WeekendDay from enumeration class \Api\EnumType\ApiDayOfWeekType'); + $instance = self::getEwsWorkingPeriodInstance(); $instance->setDayOfWeek([ @@ -18,24 +25,44 @@ public function testSetDayOfWeekWithInvalidValueMustThrowAnException() ]); } - /** - * - */ - public function testSetDayOfWeekWithValidValuesMustPass() + public function testSetDayOfWeekWithInvalidStringValueMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value(s) string(\'Today\'), please use one of: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Day, Weekday, WeekendDay from enumeration class \Api\EnumType\ApiDayOfWeekType'); + $instance = self::getEwsWorkingPeriodInstance(); - $this->assertSame($instance, $instance->setDayOfWeek([ - \Api\EnumType\ApiDayOfWeekType::VALUE_MONDAY, + $instance->setDayOfWeek('Today'); + } + + public function testSetDayOfWeekWithValidArrayValuesMustPass() + { + $instance = self::getEwsWorkingPeriodInstance(); + + $instance->setDayOfWeek($values = [ + ApiDayOfWeekType::VALUE_MONDAY, + 'Tuesday', + 'Friday', + 'Sunday', + ]); + + $this->assertSame(implode(' ', $values), $instance->getDayOfWeek()); + } + + public function testSetDayOfWeekWithValidStringValueMustPass() + { + $instance = self::getEwsWorkingPeriodInstance(); + + $instance->setDayOfWeek($value = implode(' ', [ + ApiDayOfWeekType::VALUE_MONDAY, 'Tuesday', 'Friday', 'Sunday', ])); + + $this->assertSame($value, $instance->getDayOfWeek()); } - /** - * - */ public function testSetDayOfWeekWithNullValueMustPass() { $instance = self::getEwsWorkingPeriodInstance(); diff --git a/tests/File/Validation/MaxExclusiveRuleTest.php b/tests/File/Validation/MaxExclusiveRuleTest.php index b638a8e6..a3129ad6 100644 --- a/tests/File/Validation/MaxExclusiveRuleTest.php +++ b/tests/File/Validation/MaxExclusiveRuleTest.php @@ -1,71 +1,65 @@ expectException(InvalidArgumentException::class); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', 2); call_user_func($functionName, 2); } - /** - * @expectedException \InvalidArgumentException - */ public function testApplyRuleWithGreaterValue() { + $this->expectException(InvalidArgumentException::class); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', 2); call_user_func($functionName, 3); } - /** - * - */ public function testApplyRuleWithLowerValue() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', 2); $this->assertTrue(call_user_func($functionName, 1.99)); } - /** - * - */ public function testApplyRuleWithNull() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', 2); $this->assertTrue(call_user_func($functionName, null)); } - /** - * - */ public function testApplyRuleWithDateIntervalMustBeTrueWithLowerInterval() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', 'P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, 'P10675199DT2H49M4.4775807S')); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 'P10675199DT2H49M5.4775807S', the value must be chronologically less than P10675199DT2H49M5.4775807S - */ public function testApplyRuleWithDateIntervalMustBeFalseWithSameInterval() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'P10675199DT2H49M5.4775807S\', the value must be chronologically less than P10675199DT2H49M5.4775807S'); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', $interval = 'P10675199DT2H49M5.4775807S'); call_user_func($functionName, $interval); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 'P10675199DT2H49M6.4775807S', the value must be chronologically less than P10675199DT2H49M5.4775807S - */ public function testApplyRuleWithDateIntervalMustBeFalseWithHigherInterval() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'P10675199DT2H49M6.4775807S\', the value must be chronologically less than P10675199DT2H49M5.4775807S'); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxExclusiveRule', 'P10675199DT2H49M5.4775807S'); call_user_func($functionName, 'P10675199DT2H49M6.4775807S'); } diff --git a/tests/File/Validation/MaxInclusiveRuleTest.php b/tests/File/Validation/MaxInclusiveRuleTest.php index c4332d41..fa3f28b5 100644 --- a/tests/File/Validation/MaxInclusiveRuleTest.php +++ b/tests/File/Validation/MaxInclusiveRuleTest.php @@ -1,22 +1,30 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value 100.01, the value must be numerically less than or equal to 100.00'); + $instance = self::getWhlTaxTypeInstance(); $instance->setPercent(100.01); @@ -28,7 +36,7 @@ public function testSetPercentWithHigherFloatValueMustThrowAnException() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithSameFloatValueMustPass() { @@ -43,7 +51,7 @@ public function testSetPercentWithSameFloatValueMustPass() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithSameIntValueMustPass() { @@ -58,7 +66,7 @@ public function testSetPercentWithSameIntValueMustPass() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithLowerIntValueMustPass() { @@ -73,7 +81,7 @@ public function testSetPercentWithLowerIntValueMustPass() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithNullValueMustPass() { @@ -82,30 +90,23 @@ public function testSetPercentWithNullValueMustPass() $this->assertSame($instance, $instance->setPercent(null)); } - /** - * - */ public function testApplyRuleWithDateIntervalMustBeTrueWithLowerInterval() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxInclusiveRule', 'P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, 'P10675199DT2H49M4.4775807S')); } - /** - * - */ public function testApplyRuleWithDateIntervalMustBeTrueWithSameInterval() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxInclusiveRule', $interval = 'P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, $interval)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 'P10675199DT2H49M6.4775807S', the value must be chronologically less than or equal to P10675199DT2H49M5.4775807S - */ public function testApplyRuleWithDateIntervalMustBeFalseWthHigherInterval() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'P10675199DT2H49M6.4775807S\', the value must be chronologically less than or equal to P10675199DT2H49M5.4775807S'); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MaxInclusiveRule', 'P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, 'P10675199DT2H49M6.4775807S')); } diff --git a/tests/File/Validation/MaxLengthRuleTest.php b/tests/File/Validation/MaxLengthRuleTest.php index 3abbf3c4..345b6dcc 100644 --- a/tests/File/Validation/MaxLengthRuleTest.php +++ b/tests/File/Validation/MaxLengthRuleTest.php @@ -1,10 +1,18 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid length of 107, the number of characters/octets contained by the literal must be less than or equal to 100'); + $instance = self::getDocDataPaymentsShoppperInstance(); - $instance->setEmail(str_repeat('a', 99) . '@foo.bar'); + $instance->setEmail(str_repeat('a', 99).'@foo.bar'); } /** @@ -32,13 +41,13 @@ public function testSetEmailWithTooLongCharactersMustThrowAnException() * - minOccurs: 1 * - base: ddp:string100 | normalizedString * - pattern: [_a-zA-Z0-9\-\+\.]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]+) - * - maxLength: 100 + * - maxLength: 100. */ public function testSetEmailWithSameCharactersMustPass() { $instance = self::getDocDataPaymentsShoppperInstance(); - $this->assertSame($instance, $instance->setEmail(str_repeat('a', 92) . '@foo.bar')); + $this->assertSame($instance, $instance->setEmail(str_repeat('a', 92).'@foo.bar')); } /** @@ -49,7 +58,7 @@ public function testSetEmailWithSameCharactersMustPass() * - minOccurs: 1 * - base: ddp:string100 | normalizedString * - pattern: [_a-zA-Z0-9\-\+\.]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]+) - * - maxLength: 100 + * - maxLength: 100. */ public function testSetEmailWithLessCharactersMustPass() { @@ -66,10 +75,12 @@ public function testSetEmailWithLessCharactersMustPass() * - minOccurs: 1 * - base: ddp:string100 | normalizedString * - pattern: [_a-zA-Z0-9\-\+\.]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]+) - * - maxLength: 100 + * - maxLength: 100. */ - public function testSetEmailWithNullMustPass() + public function testSetEmailWithNullMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getDocDataPaymentsShoppperInstance(); $this->assertSame($instance, $instance->setEmail(null)); @@ -84,13 +95,15 @@ public function testSetEmailWithNullMustPass() * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid length for value(s) 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', the number of characters/octets contained by the literal must be less than or equal to 255 */ public function testSetAddressLineWithTooManyCharactersPerItemMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid length for value(s) \'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\', \'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\', the number of characters/octets contained by the literal must be less than or equal to 255'); + $instance = self::getWhlAddressTypeInstance(); $instance->setAddressLine([ @@ -108,7 +121,8 @@ public function testSetAddressLineWithTooManyCharactersPerItemMustThrowAnExcepti * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] */ public function testSetAddressLineWithExactCharactersPerItemMustPass() @@ -133,7 +147,8 @@ public function testSetAddressLineWithExactCharactersPerItemMustPass() * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] */ public function testSetAddressLineWithLessCharactersPerItemMustPass() diff --git a/tests/File/Validation/MaxOccursRuleTest.php b/tests/File/Validation/MaxOccursRuleTest.php index 6eb8b7ec..1180d441 100644 --- a/tests/File/Validation/MaxOccursRuleTest.php +++ b/tests/File/Validation/MaxOccursRuleTest.php @@ -1,30 +1,39 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid count of 6, the number of elements contained by the property must be less than or equal to 5'); + $instance = self::getWhlTaxTypeInstance(); $instance->setTaxDescription([ - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), ]); } @@ -33,18 +42,18 @@ public function testSetTaxDescriptionWithTooManyItemsMustThrowAnException() * Meta informations extracted from the WSDL * - documentation: Text description of the taxes in a given language. * - maxOccurs: 5 - * - minOccurs: 0 + * - minOccurs: 0. */ public function testSetTaxDescriptionWithSameItemsMustPass() { $instance = self::getWhlTaxTypeInstance(); $this->assertSame($instance, $instance->setTaxDescription([ - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), ])); } @@ -53,15 +62,15 @@ public function testSetTaxDescriptionWithSameItemsMustPass() * Meta informations extracted from the WSDL * - documentation: Text description of the taxes in a given language. * - maxOccurs: 5 - * - minOccurs: 0 + * - minOccurs: 0. */ public function testSetTaxDescriptionWithLessItemsMustPass() { $instance = self::getWhlTaxTypeInstance(); $this->assertSame($instance, $instance->setTaxDescription([ - new \Api\StructType\ApiParagraphType(), - new \Api\StructType\ApiParagraphType(), + new ApiParagraphType(), + new ApiParagraphType(), ])); } @@ -70,23 +79,25 @@ public function testSetTaxDescriptionWithLessItemsMustPass() * Meta informations extracted from the WSDL * - documentation: Text description of the taxes in a given language. * - maxOccurs: 5 - * - minOccurs: 0 - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage You can't add anymore element to this property that already contains 5 elements, the number of elements contained by the property must be less than or equal to 5 + * - minOccurs: 0. */ public function testAddToTaxDescriptionWithTooManyItemsMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('You can\'t add anymore element to this property that already contains 5 elements, the number of elements contained by the property must be less than or equal to 5'); + // true to ensure to start from zero for addTo calls $instance = self::getWhlTaxTypeInstance(true); $instance - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()); + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ; } /** @@ -94,7 +105,7 @@ public function testAddToTaxDescriptionWithTooManyItemsMustThrowAnException() * Meta informations extracted from the WSDL * - documentation: Text description of the taxes in a given language. * - maxOccurs: 5 - * - minOccurs: 0 + * - minOccurs: 0. */ public function testAddToTaxDescriptionWithSameItemsMustPass() { @@ -104,11 +115,11 @@ public function testAddToTaxDescriptionWithSameItemsMustPass() $this->assertSame( $instance, $instance - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) ); } @@ -117,7 +128,7 @@ public function testAddToTaxDescriptionWithSameItemsMustPass() * Meta informations extracted from the WSDL * - documentation: Text description of the taxes in a given language. * - maxOccurs: 5 - * - minOccurs: 0 + * - minOccurs: 0. */ public function testAddToTaxDescriptionWithLessItemsMustPass() { @@ -127,8 +138,8 @@ public function testAddToTaxDescriptionWithLessItemsMustPass() $this->assertSame( $instance, $instance - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) - ->addToTaxDescription(new \Api\StructType\ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) + ->addToTaxDescription(new ApiParagraphType()) ); } } diff --git a/tests/File/Validation/MinExclusiveRuleTest.php b/tests/File/Validation/MinExclusiveRuleTest.php index 5411ec2a..5c89f240 100644 --- a/tests/File/Validation/MinExclusiveRuleTest.php +++ b/tests/File/Validation/MinExclusiveRuleTest.php @@ -1,62 +1,63 @@ expectException(InvalidArgumentException::class); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', 2); call_user_func($functionName, 2); } - /** - * - */ + public function testApplyRuleWithGreaterValue() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', 2); $this->assertTrue(call_user_func($functionName, 2.1)); } - /** - * @expectedException \InvalidArgumentException - */ + public function testApplyRuleWithLowerValue() { + $this->expectException(InvalidArgumentException::class); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', 2); call_user_func($functionName, 1.99); } - /** - * - */ + public function testApplyRuleWithNull() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', 2); $this->assertTrue(call_user_func($functionName, null)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value '-P10675199DT2H49M6.4775807S', the value must be chronologically greater than -P10675199DT2H49M5.4775807S - */ + public function testApplyRuleWithDateIntervalMustBeFalseWithLowerInterval() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'-P10675199DT2H49M6.4775807S\', the value must be chronologically greater than -P10675199DT2H49M5.4775807S'); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, '-P10675199DT2H49M6.4775807S')); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value '-P10675199DT2H49M5.4775807S', the value must be chronologically greater than -P10675199DT2H49M5.4775807S - */ + public function testApplyRuleWithDateIntervalMustBeFalseWithSameInterval() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'-P10675199DT2H49M5.4775807S\', the value must be chronologically greater than -P10675199DT2H49M5.4775807S'); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', $interval = '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, $interval)); } - /** - * - */ + public function testApplyRuleWithDateIntervalMustBeTrueWthHigherInterval() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule', '-P10675199DT2H49M5.4775807S'); diff --git a/tests/File/Validation/MinInclusiveRuleTest.php b/tests/File/Validation/MinInclusiveRuleTest.php index 6d2c706f..57ed2c77 100644 --- a/tests/File/Validation/MinInclusiveRuleTest.php +++ b/tests/File/Validation/MinInclusiveRuleTest.php @@ -1,22 +1,30 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value -0.01, the value must be numerically greater than or equal to 0.00'); + $instance = self::getWhlTaxTypeInstance(); $instance->setPercent(-0.01); @@ -28,7 +36,7 @@ public function testSetPercentWithLowerFloatValueMustThrowAnException() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithSameFloatValueMustPass() { @@ -43,7 +51,7 @@ public function testSetPercentWithSameFloatValueMustPass() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithSameIntValueMustPass() { @@ -58,12 +66,13 @@ public function testSetPercentWithSameIntValueMustPass() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value -1, the value must be numerically greater than or equal to 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithLowerIntValueMustPass() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value -1.0, the value must be numerically greater than or equal to 0.00'); + $instance = self::getWhlTaxTypeInstance(); $this->assertSame($instance, $instance->setPercent(-1)); @@ -75,7 +84,7 @@ public function testSetPercentWithLowerIntValueMustPass() * - documentation: Fee percentage; if zero, assume use of the Amount attribute (Amount or Percent must be a zero value). | Used for percentage values. * - base: xs:decimal * - maxInclusive: 100.00 - * - minInclusive: 0.00 + * - minInclusive: 0.00. */ public function testSetPercentWithNullValueMustPass() { @@ -84,28 +93,21 @@ public function testSetPercentWithNullValueMustPass() $this->assertSame($instance, $instance->setPercent(null)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value '-P10675199DT2H49M6.4775807S', the value must be chronologically greater than or equal to -P10675199DT2H49M5.4775807S - */ public function testApplyRuleWithDateIntervalMustBeFalseWithLowerInterval() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'-P10675199DT2H49M6.4775807S\', the value must be chronologically greater than or equal to -P10675199DT2H49M5.4775807S'); + $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinInclusiveRule', '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, '-P10675199DT2H49M6.4775807S')); } - /** - * - */ public function testApplyRuleWithDateIntervalMustBeTrueWithSameInterval() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinInclusiveRule', $interval = '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, $interval)); } - /** - * - */ public function testApplyRuleWithDateIntervalMustBeTrueWthHigherInterval() { $functionName = parent::createRuleFunction('WsdlToPhp\PackageGenerator\File\Validation\MinInclusiveRule', '-P10675199DT2H49M5.4775807S'); diff --git a/tests/File/Validation/MinLengthRuleTest.php b/tests/File/Validation/MinLengthRuleTest.php index 86045d90..f944f3e6 100644 --- a/tests/File/Validation/MinLengthRuleTest.php +++ b/tests/File/Validation/MinLengthRuleTest.php @@ -1,10 +1,17 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid length of 9, the number of characters/octets contained by the literal must be greater than or equal to 10'); + $instance = self::getDocDataPaymentsShoppperInstance(); $instance->setDateOfBirth('123456789'); @@ -32,7 +40,7 @@ public function testSetDateOfBirthWithTooShortCharactersMustThrowAnException() * - minOccurs: 0 * - base: normalizedString * - maxLength: 10 - * - minLength: 10 + * - minLength: 10. */ public function testDateOfBirthWithSameCharactersMustPass() { @@ -49,7 +57,7 @@ public function testDateOfBirthWithSameCharactersMustPass() * - minOccurs: 0 * - base: normalizedString * - maxLength: 10 - * - minLength: 10 + * - minLength: 10. */ public function testDateOfBirthWithHigherCharactersMustPass() { @@ -67,13 +75,15 @@ public function testDateOfBirthWithHigherCharactersMustPass() * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid length for value(s) '', '', the number of characters/octets contained by the literal must be greater than or equal to 1 */ public function testSetAddressLineWithLessCharactersPerItemMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid length for value(s) \'\', \'\', the number of characters/octets contained by the literal must be greater than or equal to 1'); + $instance = self::getWhlAddressTypeInstance(); $instance->setAddressLine([ @@ -91,7 +101,8 @@ public function testSetAddressLineWithLessCharactersPerItemMustThrowAnException( * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] */ public function testSetAddressLineWithExactCharactersPerItemMustPass() @@ -116,7 +127,8 @@ public function testSetAddressLineWithExactCharactersPerItemMustPass() * - minOccurs: 0 * - base: xs:string * - maxLength: 255 - * - minLength: 1 + * - minLength: 1. + * * @var string[] */ public function testSetAddressLineWithMoreCharactersPerItemMustPass() diff --git a/tests/File/Validation/PatternRuleTest.php b/tests/File/Validation/PatternRuleTest.php index 147d760d..95d5794c 100644 --- a/tests/File/Validation/PatternRuleTest.php +++ b/tests/File/Validation/PatternRuleTest.php @@ -1,33 +1,40 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'$^ù\', please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}|0AA.BBBX|^$/'); + $instance = self::getWhlTaxTypeInstance(); $instance->setCode('$^ù'); } - /** * The Code * Meta informations extracted from the WSDL * - documentation: Code identifying the fee (e.g.,agency fee, municipality fee). Refer to OpenTravel Code List Fee Tax Type (FTT). | Used for codes in the OpenTravel Code tables. Possible values of this pattern are 1, 101, 101.EQP, or 101.EQP.X. * - base: xs:string - * - pattern: [0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1} + * - pattern: [0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}. */ public function testSetCodeWithValidEmptyValueMustPass() { @@ -41,7 +48,7 @@ public function testSetCodeWithValidEmptyValueMustPass() * Meta informations extracted from the WSDL * - documentation: Code identifying the fee (e.g.,agency fee, municipality fee). Refer to OpenTravel Code List Fee Tax Type (FTT). | Used for codes in the OpenTravel Code tables. Possible values of this pattern are 1, 101, 101.EQP, or 101.EQP.X. * - base: xs:string - * - pattern: [0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1} + * - pattern: [0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}. */ public function testSetCodeWithValidValueMustPass() { @@ -56,12 +63,13 @@ public function testSetCodeWithValidValueMustPass() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value '', please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9]{1,19}/ + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithInvalidValueTooShortMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'\', please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9]{1,19}/'); + $instance = self::getWhlPaymentCardTypeInstance(); $instance->setCardNumber(str_repeat('0', 0)); @@ -73,12 +81,13 @@ public function testSetCardNumberWithInvalidValueTooShortMustThrowAnException() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 'aaaaa', please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9]{1,19}/ + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithInvalidCharactersMustThrowAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value \'aaaaa\', please provide a literal that is among the set of character sequences denoted by the regular expression /[0-9]{1,19}/'); + $instance = self::getWhlPaymentCardTypeInstance(); $instance->setCardNumber(str_repeat('a', 5)); @@ -90,7 +99,7 @@ public function testSetCardNumberWithInvalidCharactersMustThrowAnException() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithValidValueMustPass() { diff --git a/tests/File/Validation/StringRuleTest.php b/tests/File/Validation/StringRuleTest.php index 78d73f65..6a7fdb2a 100644 --- a/tests/File/Validation/StringRuleTest.php +++ b/tests/File/Validation/StringRuleTest.php @@ -1,22 +1,29 @@ expectException(TypeError::class); + $instance = self::getWhlPaymentCardTypeInstance(); $instance->setCardNumber([]); @@ -28,12 +35,12 @@ public function testSetCardNumberWithArrayValueMustThrowAnException() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value true, please provide a string, boolean given + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithBoolValueMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getWhlPaymentCardTypeInstance(); $instance->setCardNumber(true); @@ -45,12 +52,12 @@ public function testSetCardNumberWithBoolValueMustThrowAnException() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 1, please provide a string, integer given + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithIntValueMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getWhlPaymentCardTypeInstance(); $instance->setCardNumber(1); @@ -62,12 +69,12 @@ public function testSetCardNumberWithIntValueMustThrowAnException() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value 12.5, please provide a string, double given + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithFloatValueMustThrowAnException() { + $this->expectException(TypeError::class); + $instance = self::getWhlPaymentCardTypeInstance(); $instance->setCardNumber(12.5); @@ -79,7 +86,7 @@ public function testSetCardNumberWithFloatValueMustThrowAnException() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithNullValueMustPass() { @@ -94,7 +101,7 @@ public function testSetCardNumberWithNullValueMustPass() * - documentation: Credit card number embossed on the card. | Used for Numeric Strings, length 1 to 19. * - use: optional * - base: xs:string - * - pattern: [0-9]{1,19} + * - pattern: [0-9]{1,19}. */ public function testSetCardNumberWithStringValueMustPass() { diff --git a/tests/File/Validation/TotalDigitsRuleTest.php b/tests/File/Validation/TotalDigitsRuleTest.php index d6625e73..0f6ebe16 100644 --- a/tests/File/Validation/TotalDigitsRuleTest.php +++ b/tests/File/Validation/TotalDigitsRuleTest.php @@ -1,24 +1,32 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value 123456789101112.12, the value must at most contain 2 fraction digits, 17 given'); + // hack as precision can return false negative with 1.23457E+14, - ini_set('serialize_precision', 17); + ini_set('serialize_precision', '17'); $instance = self::getReformaHouseProfileDataInstance(); @@ -31,7 +39,7 @@ public function testSetAreaTotalWithFloatTooManyDigitsMustThrowAnException() * - base: xsd:decimal * - fractionDigits: 2 * - totalDigits: 15 - * - var: float + * - var: float. */ public function testSetAreaTotalWithFloatExactDigitsMustThrowAnException() { @@ -46,7 +54,7 @@ public function testSetAreaTotalWithFloatExactDigitsMustThrowAnException() * - base: xsd:decimal * - fractionDigits: 2 * - totalDigits: 15 - * - var: float + * - var: float. */ public function testSetAreaTotalWithFloatLessDigitsMustThrowAnException() { diff --git a/tests/File/Validation/UnionRuleTest.php b/tests/File/Validation/UnionRuleTest.php index d70db86f..e142d4b1 100644 --- a/tests/File/Validation/UnionRuleTest.php +++ b/tests/File/Validation/UnionRuleTest.php @@ -1,24 +1,31 @@ expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("The value '1234567980' does not match any of the union rules: PMS_ResStatusType, TransactionActionType, UpperCaseAlphaLength1to2. See following errors:\n - Invalid value(s) '1234567980', please use one of: Reserved, Requested, Request denied, No-show, Cancelled, In-house, Checked out, Waitlisted from enumeration class \\Api\\EnumType\\ApiPMS_ResStatusType\n - Invalid value(s) '1234567980', please use one of: Book, Quote, Hold, Initiate, Ignore, Modify, Commit, Cancel, CommitOverrideEdits, VerifyPrice, Ticket from enumeration class \\Api\\EnumType\\ApiTransactionActionType\n - Invalid value '1234567980', please provide a literal that is among the set of character sequences denoted by the regular expression /[A-Z]{1,2}/"); + $instance = self::getWhlHotelReservationTypeInstance(true); $instance->setResStatus('1234567980'); @@ -29,13 +36,13 @@ public function testSetResStatusWithInvalidValueMustThrowAnException() * - documentation: Indicates the status of the reservation. | A union between TransactionActionType and PMS_ResStatusType. Used in messages that communicate between reservation systems as well as between a reservation and property management system. In * addition to the TransactionActionType and PMS_ResStatusType, the UpperCaseAlphaLength1to2 may be used for company specifc codes. * - use: optional - * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2 + * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2. */ public function testSetResStatusWithFirstUnionValidValueMustPass() { $instance = self::getWhlHotelReservationTypeInstance(true); - $this->assertSame($instance, $instance->setResStatus(\Api\EnumType\ApiPMS_ResStatusType::VALUE_RESERVED)); + $this->assertSame($instance, $instance->setResStatus(ApiPMS_ResStatusType::VALUE_RESERVED)); } /** @@ -43,13 +50,13 @@ public function testSetResStatusWithFirstUnionValidValueMustPass() * - documentation: Indicates the status of the reservation. | A union between TransactionActionType and PMS_ResStatusType. Used in messages that communicate between reservation systems as well as between a reservation and property management system. In * addition to the TransactionActionType and PMS_ResStatusType, the UpperCaseAlphaLength1to2 may be used for company specifc codes. * - use: optional - * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2 + * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2. */ public function testSetResStatusWithSecondUnionValidValueMustPass() { $instance = self::getWhlHotelReservationTypeInstance(true); - $this->assertSame($instance, $instance->setResStatus(\Api\EnumType\ApiTransactionActionType::VALUE_BOOK)); + $this->assertSame($instance, $instance->setResStatus(ApiTransactionActionType::VALUE_BOOK)); } /** @@ -57,7 +64,7 @@ public function testSetResStatusWithSecondUnionValidValueMustPass() * - documentation: Indicates the status of the reservation. | A union between TransactionActionType and PMS_ResStatusType. Used in messages that communicate between reservation systems as well as between a reservation and property management system. In * addition to the TransactionActionType and PMS_ResStatusType, the UpperCaseAlphaLength1to2 may be used for company specifc codes. * - use: optional - * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2 + * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2. */ public function testSetResStatusWithThirdUnionValidValueMustPass() { @@ -71,7 +78,7 @@ public function testSetResStatusWithThirdUnionValidValueMustPass() * - documentation: Indicates the status of the reservation. | A union between TransactionActionType and PMS_ResStatusType. Used in messages that communicate between reservation systems as well as between a reservation and property management system. In * addition to the TransactionActionType and PMS_ResStatusType, the UpperCaseAlphaLength1to2 may be used for company specifc codes. * - use: optional - * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2 + * - union: PMS_ResStatusType | TransactionActionType | UpperCaseAlphaLength1to2. */ public function testSetResStatusWithNullValueMustPass() { diff --git a/tests/File/Validation/XmlRuleTest.php b/tests/File/Validation/XmlRuleTest.php new file mode 100644 index 00000000..6605363c --- /dev/null +++ b/tests/File/Validation/XmlRuleTest.php @@ -0,0 +1,81 @@ +expectException(InvalidArgumentException::class); + + $instance = self::getActonItemInstance(); + + $instance->setAny(''); + } + + public function testSetAnyWithInvalidXmlStringMustThrowAnException() + { + $this->expectException(InvalidArgumentException::class); + + $instance = self::getActonItemInstance(); + + @$instance->setAny('1setAny($string = '1'); + + $this->assertSame($string, $instance->getAny()); + } + + public function testSetAnyWithIntMustThrowAnException() + { + $this->expectException(InvalidArgumentException::class); + + $instance = self::getActonItemInstance(); + + $instance->setAny(2); + } + + public function testSetAnyWithDomDocumentMustPass() + { + $instance = self::getActonItemInstance(); + $domDocument = new DOMDocument(); + $domDocument->appendChild($domDocument->createElement('element', '147')); + + $instance->setAny($domDocument); + + $this->assertSame('147', $instance->getAny()); + } + + public function testSetAnyWithInvalidObjectMustThrowAnException() + { + $this->expectException(InvalidArgumentException::class); + + $instance = self::getActonItemInstance(); + + $instance->setAny(new stdClass()); + } + + public function testSetAnyWithArrayMustThrowAnException() + { + $this->expectException(InvalidArgumentException::class); + + $instance = self::getActonItemInstance(); + + $instance->setAny([]); + } +} diff --git a/tests/Generator/GeneratorContainerTest.php b/tests/Generator/GeneratorContainerTest.php index dbd2ca8b..42827690 100644 --- a/tests/Generator/GeneratorContainerTest.php +++ b/tests/Generator/GeneratorContainerTest.php @@ -1,15 +1,22 @@ assertSame([ 'services' => $container->getServices(), 'structs' => $container->getStructs(), diff --git a/tests/Generator/GeneratorSoapClientTest.php b/tests/Generator/GeneratorSoapClientTest.php index 522f3f99..7977a9d3 100644 --- a/tests/Generator/GeneratorSoapClientTest.php +++ b/tests/Generator/GeneratorSoapClientTest.php @@ -1,23 +1,30 @@ setComposerName('wsdltophp/invalid') ->setDestination(self::getTestDirectory()) - ->setOrigin(self::schemaPartnerPath()); + ->setOrigin(self::schemaPartnerPath()) + ; + + $this->expectException(InvalidArgumentException::class); new Generator($options); } diff --git a/tests/Generator/GeneratorTest.php b/tests/Generator/GeneratorTest.php index 34382709..11ab3a77 100755 --- a/tests/Generator/GeneratorTest.php +++ b/tests/Generator/GeneratorTest.php @@ -1,45 +1,48 @@ setOrigin(self::wsdlBingPath()) - ->setDestination(self::getTestDirectory()); + ->setDestination(self::getTestDirectory()) + ; self::$localInstance = new Generator($options); } + return self::$localInstance; } - /** - * - */ + public function testGetOptionPrefix() { $this->assertEmpty(self::localInstance()->getOptionPrefix()); } - /** - * - */ + public function testSetOptionPrefix() { $instance = self::localInstance(); @@ -47,16 +50,12 @@ public function testSetOptionPrefix() $this->assertSame('MyPrefix', $instance->getOptionPrefix()); } - /** - * - */ + public function testGetOptionSuffix() { $this->assertEmpty(self::localInstance()->getOptionSuffix()); } - /** - * - */ + public function testSetOptionSuffix() { $instance = self::localInstance(); @@ -64,16 +63,12 @@ public function testSetOptionSuffix() $this->assertSame('MySuffix', $instance->getOptionSuffix()); } - /** - * - */ + public function testGetOptionDestination() { $this->assertSame(self::getTestDirectory(), self::localInstance()->getOptionDestination()); } - /** - * - */ + public function testSetOptionDestination() { $instance = self::localInstance(); @@ -81,16 +76,12 @@ public function testSetOptionDestination() $this->assertSame(self::getTestDirectory(), $instance->getOptionDestination()); } - /** - * - */ + public function testGetOptionSrcDirname() { $this->assertSame('src', self::localInstance()->getOptionSrcDirname()); } - /** - * - */ + public function testSetOptionSrcDirname() { $instance = self::localInstance(); @@ -98,16 +89,12 @@ public function testSetOptionSrcDirname() $this->assertSame('', $instance->getOptionSrcDirname()); } - /** - * - */ + public function testGetOptionOrigin() { $this->assertSame(self::wsdlBingPath(), self::localInstance()->getOptionOrigin()); } - /** - * - */ + public function testSetOptionOrigin() { $instance = self::localInstance(); @@ -115,16 +102,12 @@ public function testSetOptionOrigin() $this->assertSame(self::wsdlOdigeoPath(), $instance->getOptionOrigin()); } - /** - * - */ + public function testGetOptionBasicLogin() { $this->assertEmpty(self::localInstance()->getOptionBasicLogin()); } - /** - * - */ + public function testSetOptionBasicLogin() { $instance = self::localInstance(); @@ -132,16 +115,12 @@ public function testSetOptionBasicLogin() $this->assertSame('MyLogin', $instance->getOptionBasicLogin()); } - /** - * - */ + public function testGetOptionBasicPassword() { $this->assertEmpty(self::localInstance()->getOptionBasicPassword()); } - /** - * - */ + public function testSetOptionBasicPassword() { $instance = self::localInstance(); @@ -149,16 +128,12 @@ public function testSetOptionBasicPassword() $this->assertSame('MyPassword', $instance->getOptionBasicPassword()); } - /** - * - */ + public function testGetOptionProxyHost() { $this->assertEmpty(self::localInstance()->getOptionProxyHost()); } - /** - * - */ + public function testSetOptionProxyHost() { $instance = self::localInstance(); @@ -166,16 +141,12 @@ public function testSetOptionProxyHost() $this->assertSame('MyProxyHost', $instance->getOptionProxyHost()); } - /** - * - */ + public function testGetOptionProxyPort() { $this->assertEmpty(self::localInstance()->getOptionProxyPort()); } - /** - * - */ + public function testSetOptionProxyPort() { $instance = self::localInstance(); @@ -183,16 +154,12 @@ public function testSetOptionProxyPort() $this->assertSame(3225, $instance->getOptionProxyPort()); } - /** - * - */ + public function testGetOptionProxyLogin() { $this->assertEmpty(self::localInstance()->getOptionProxyLogin()); } - /** - * - */ + public function testSetOptionProxyLogin() { $instance = self::localInstance(); @@ -200,16 +167,12 @@ public function testSetOptionProxyLogin() $this->assertSame('MyProxyLogin', $instance->getOptionProxyLogin()); } - /** - * - */ + public function testGetOptionProxyPassword() { $this->assertEmpty(self::localInstance()->getOptionProxyPassword()); } - /** - * - */ + public function testSetOptionProxyPassword() { $instance = self::localInstance(); @@ -217,16 +180,12 @@ public function testSetOptionProxyPassword() $this->assertSame('MyProxyPassword', $instance->getOptionProxyPassword()); } - /** - * - */ + public function testGetOptionSoapOptions() { $this->assertEmpty(self::localInstance()->getOptionSoapOptions()); } - /** - * - */ + public function testSetOptionSoapOptions() { $soapOptions = [ @@ -239,16 +198,12 @@ public function testSetOptionSoapOptions() $this->assertSame($soapOptions, $instance->getOptionSoapOptions()); } - /** - * - */ + public function testGetOptionCategory() { $this->assertSame(GeneratorOptions::VALUE_CAT, self::localInstance()->getOptionCategory()); } - /** - * - */ + public function testSetOptionCategory() { $instance = self::getBingGeneratorInstance(); @@ -256,16 +211,12 @@ public function testSetOptionCategory() $this->assertSame(GeneratorOptions::VALUE_NONE, $instance->getOptionCategory()); } - /** - * - */ + public function testGetOptionGatherMethods() { $this->assertSame(GeneratorOptions::VALUE_START, self::localInstance()->getOptionGatherMethods()); } - /** - * - */ + public function testSetOptionGatherMethods() { $instance = self::getBingGeneratorInstance(); @@ -273,16 +224,12 @@ public function testSetOptionGatherMethods() $this->assertSame(GeneratorOptions::VALUE_END, $instance->getOptionGatherMethods()); } - /** - * - */ + public function testGetOptionGenerateTutorialFile() { $this->assertTrue(self::localInstance()->getOptionGenerateTutorialFile()); } - /** - * - */ + public function testSetOptionGenerateTutorialFile() { $instance = self::getBingGeneratorInstance(); @@ -290,16 +237,12 @@ public function testSetOptionGenerateTutorialFile() $this->assertFalse($instance->getOptionGenerateTutorialFile()); } - /** - * - */ + public function testGetOptionGenericConstantsNames() { $this->assertFalse(self::localInstance()->getOptionGenericConstantsNames()); } - /** - * - */ + public function testSetOptionGenericConstantsNames() { $instance = self::getBingGeneratorInstance(); @@ -307,16 +250,12 @@ public function testSetOptionGenericConstantsNames() $this->assertTrue($instance->getOptionGenericConstantsNames()); } - /** - * - */ + public function testGetOptionNamespacePrefix() { $this->assertEmpty(self::localInstance()->getOptionNamespacePrefix()); } - /** - * - */ + public function testSetOptionNamespacePrefix() { $instance = self::getBingGeneratorInstance(); @@ -324,16 +263,12 @@ public function testSetOptionNamespacePrefix() $this->assertSame('My\Project', $instance->getOptionNamespacePrefix()); } - /** - * - */ + public function testGetOptionSoapClientClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractSoapClientBase', self::localInstance()->getOptionSoapClientClass()); + $this->assertSame(AbstractSoapClientBase::class, self::localInstance()->getOptionSoapClientClass()); } - /** - * - */ + public function testSetOptionSoapClientClass() { $instance = self::getBingGeneratorInstance(); @@ -341,16 +276,12 @@ public function testSetOptionSoapClientClass() $this->assertSame('My\Project\SoapClientClass', $instance->getOptionSoapClientClass()); } - /** - * - */ + public function testGetOptionStructClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractStructBase', self::localInstance()->getOptionStructClass()); + $this->assertSame(AbstractStructBase::class, self::localInstance()->getOptionStructClass()); } - /** - * - */ + public function testSetOptionStructClass() { $instance = self::getBingGeneratorInstance(); @@ -358,16 +289,12 @@ public function testSetOptionStructClass() $this->assertSame('My\Project\StructClass', $instance->getOptionStructClass()); } - /** - * - */ + public function testGetOptionStructArrayClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractStructArrayBase', self::localInstance()->getOptionStructArrayClass()); + $this->assertSame(AbstractStructArrayBase::class, self::localInstance()->getOptionStructArrayClass()); } - /** - * - */ + public function testSetOptionStructArrayClass() { $instance = self::getBingGeneratorInstance(); @@ -375,16 +302,12 @@ public function testSetOptionStructArrayClass() $this->assertSame('My\Project\StructArrayClass', $instance->getOptionStructArrayClass()); } - /** - * - */ + public function testGetOptionStructEnumClass() { - $this->assertSame('\WsdlToPhp\PackageBase\AbstractStructEnumBase', self::localInstance()->getOptionStructEnumClass()); + $this->assertSame(AbstractStructEnumBase::class, self::localInstance()->getOptionStructEnumClass()); } - /** - * - */ + public function testSetOptionStructEnumClass() { $instance = self::getBingGeneratorInstance(); @@ -392,16 +315,12 @@ public function testSetOptionStructEnumClass() $this->assertSame('My\Project\StructEnumClass', $instance->getOptionStructEnumClass()); } - /** - * - */ + public function testGetOptionStandalone() { $this->assertTrue(self::localInstance()->getOptionStandalone()); } - /** - * - */ + public function testSetOptionStandalone() { $instance = self::getBingGeneratorInstance(); @@ -409,16 +328,12 @@ public function testSetOptionStandalone() $this->assertFalse($instance->getOptionStandalone()); } - /** - * - */ + public function testGetOptionValidation() { $this->assertTrue(self::localInstance()->getOptionValidation()); } - /** - * - */ + public function testSetOptionValidation() { $instance = self::getBingGeneratorInstance(); @@ -426,16 +341,12 @@ public function testSetOptionValidation() $this->assertFalse($instance->getOptionValidation()); } - /** - * - */ + public function testGetOptionAddComments() { $this->assertEmpty(self::localInstance()->getOptionAddComments()); } - /** - * - */ + public function testSetOptionAddComments() { $comments = [ @@ -447,9 +358,7 @@ public function testSetOptionAddComments() $this->assertSame($comments, $instance->getOptionAddComments()); } - /** - * - */ + public function testSetPackageName() { $instance = self::getBingGeneratorInstance(); @@ -457,9 +366,7 @@ public function testSetPackageName() $this->assertSame('samplePackageName', $instance->getOptionPrefix(false)); } - /** - * - */ + public function testSetOptionComposerName() { $instance = self::getBingGeneratorInstance(); @@ -467,9 +374,7 @@ public function testSetOptionComposerName() $this->assertSame('foo/bar', $instance->getOptionComposerName()); } - /** - * - */ + public function testSetOptionComposerSettings() { $instance = self::getBingGeneratorInstance(); @@ -495,9 +400,7 @@ public function testSetOptionComposerSettings() ], ], $instance->getOptionComposerSettings()); } - /** - * - */ + public function testSetStructsFolder() { $instance = self::getBingGeneratorInstance(); @@ -505,9 +408,7 @@ public function testSetStructsFolder() $this->assertSame('Structs', $instance->getOptionStructsFolder()); } - /** - * - */ + public function testSetArraysFolder() { $instance = self::getBingGeneratorInstance(); @@ -515,9 +416,7 @@ public function testSetArraysFolder() $this->assertSame('Arrays', $instance->getOptionArraysFolder()); } - /** - * - */ + public function testSetEnumsFolder() { $instance = self::getBingGeneratorInstance(); @@ -525,9 +424,7 @@ public function testSetEnumsFolder() $this->assertSame('Enums', $instance->getOptionEnumsFolder()); } - /** - * - */ + public function testSetServicesFolder() { $instance = self::getBingGeneratorInstance(); @@ -535,9 +432,7 @@ public function testSetServicesFolder() $this->assertSame('Services', $instance->getOptionServicesFolder()); } - /** - * - */ + public function testSetSchemasSave() { $instance = self::getBingGeneratorInstance(); @@ -545,9 +440,7 @@ public function testSetSchemasSave() $this->assertSame(false, $instance->getOptionSchemasSave()); } - /** - * - */ + public function testSetSchemasFolder() { $instance = self::getBingGeneratorInstance(); @@ -555,9 +448,7 @@ public function testSetSchemasFolder() $this->assertSame('wsdl', $instance->getOptionSchemasFolder()); } - /** - * - */ + public function testOptionXsdTypesPath() { $instance = self::localInstance(); @@ -568,9 +459,7 @@ public function testOptionXsdTypesPath() $this->assertSame('/some/path/file.yml', $instance->getOptionXsdTypesPath()); } - /** - * - */ + public function testSetPackageNameUcFirst() { $instance = self::getBingGeneratorInstance(); @@ -578,119 +467,52 @@ public function testSetPackageNameUcFirst() $this->assertSame('SamplePackageName', $instance->getOptionPrefix(true)); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnInvalidDestination() { + $this->expectException(InvalidArgumentException::class); + $instance = self::getBingGeneratorInstance(); $instance->setOptionDestination(''); $instance->generatePackage(); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnInvalidComposerName() { + $this->expectException(InvalidArgumentException::class); + $instance = self::getBingGeneratorInstance(); $instance->setOptionComposerName(''); $instance->generatePackage(); } - /** - * - */ + public function testGenerateBing() { $this->generate('bing', self::wsdlBingPath()); } - /** - * - */ + public function testGeneratePartner() { $this->generate('partner', self::wsdlPartnerPath()); } - /** - * - */ + public function testGenerateMyBoard() { $this->generate('myboard', self::wsdlMyBoardPackPath()); } - /** - * - */ + public function testGenerateOdigeo() { $this->generate('odigeo', self::wsdlOdigeoPath()); } - /** - * - */ + public function testGenerateReforma() { $this->generate('reforma', self::wsdlReformaPath(), false); } - /** - * @param string $dir - * @param string $wsdl - */ - private function generate($dir, $wsdl, $standalone = true) - { - Utils::createDirectory($destination = self::getTestDirectory() . $dir); - - $options = GeneratorOptions::instance(); - $options - ->setGenerateTutorialFile(false) - ->setAddComments([]) - ->setArraysFolder('ArrayType') - ->setBasicLogin(null) - ->setBasicPassword(null) - ->setCategory(GeneratorOptions::VALUE_CAT) - ->setComposerName($standalone ? 'wsdltophp/' . $dir : '') - ->setComposerSettings($standalone ? [ - 'require.wsdltophp/wssecurity:dev-master', - 'config.disable-tls:true', - ] : []) - ->setDestination($destination) - ->setEnumsFolder('EnumType') - ->setGatherMethods(GeneratorOptions::VALUE_START) - ->setGenerateTutorialFile(true) - ->setGenericConstantsName(false) - ->setNamespace('') - ->setOrigin($wsdl) - ->setPrefix('') - ->setProxyHost(null) - ->setProxyLogin(null) - ->setProxyPassword(null) - ->setProxyPort(null) - ->setServicesFolder('ServiceType') - ->setSchemasSave(false) - ->setSchemasFolder('wsdl') - ->setSoapClientClass('\WsdlToPhp\PackageBase\AbstractSoapClientBase') - ->setSoapOptions([]) - ->setStandalone($standalone) - ->setStructArrayClass('\WsdlToPhp\PackageBase\AbstractStructArrayBase') - ->setStructClass('\WsdlToPhp\PackageBase\AbstractStructBase') - ->setStructsFolder('StructType') - ->setSuffix(''); - $generator = new Generator($options); - $generator->generatePackage(); - - $this->assertTrue(is_dir($destination)); - if ($standalone) { - $this->assertTrue(is_file(sprintf('%s/composer.json', $destination))); - $this->assertTrue(is_file(sprintf('%s/composer.lock', $destination))); - } - $this->assertTrue(is_file(sprintf('%s/tutorial.php', $destination))); - $this->assertTrue(is_file($generator->getFiles()->getClassmapFile()->getFileName())); - } - /** - * - */ public function testGetUrlContent() { $generator = self::getBingGeneratorInstance(); @@ -702,23 +524,22 @@ public function testGetUrlContent() $content = $generator->getUrlContent('https://phar.wsdltophp.com/bingsearch.wsdl'); $this->assertNotNull($content); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOntInitDirectory() { - Utils::createDirectory($destination = self::getTestDirectory() . 'notwritable', 0444); + $this->expectException(InvalidArgumentException::class); + + Utils::createDirectory($destination = self::getTestDirectory().'notwritable', 0444); $generator = self::getBingGeneratorInstance(); $generator ->setOptionComposerName('wsdltophp/invalid') - ->setOptionDestination($destination); + ->setOptionDestination($destination) + ; $generator->generatePackage(); } - /** - * - */ + public function testGetEmptySoapClientStreamContextOptions() { $instance = self::getBingGeneratorInstance(); @@ -736,9 +557,7 @@ public function testGetEmptySoapClientStreamContextOptions() ], $instance->getSoapClient()->getSoapClientStreamContextOptions()); } } - /** - * - */ + public function testGetSoapClientStreamContextOptions() { $options = GeneratorOptionsTest::optionsInstance(); @@ -755,7 +574,8 @@ public function testGetSoapClientStreamContextOptions() 'ca_path' => __DIR__, ], ]), - ]); + ]) + ; $instance = new Generator($options); // HTTP headers are added to the context options with certain PHP version on certain platform @@ -763,7 +583,7 @@ public function testGetSoapClientStreamContextOptions() // so we remove those we are not interested in! $contextOptions = $instance->getSoapClient()->getSoapClientStreamContextOptions(); foreach (array_keys($contextOptions) as $index) { - if ($index !== 'https' && $index !== 'ssl') { + if ('https' !== $index && 'ssl' !== $index) { unset($contextOptions[$index]); } } @@ -778,9 +598,7 @@ public function testGetSoapClientStreamContextOptions() ], ], $contextOptions); } - /** - * - */ + public function testJsonSerialize() { $generator = self::getBingGeneratorInstance(true); @@ -796,48 +614,98 @@ public function testJsonSerialize() ], $jsonContent); $this->assertSame(trim($jsonContent), trim(json_encode($generator, JSON_PRETTY_PRINT))); } - /** - * - */ + public function testGetServices() { $generator = self::actonGeneratorInstance(); $this->assertCount(8, $generator->getServices()); $this->assertCount(8, $generator->getServices()->getMethods()); } - /** - * - */ + public function testGetServicesGathered() { $generator = self::actonGeneratorInstance(true, GeneratorOptions::VALUE_NONE); $this->assertCount(1, $generator->getServices(true)); $this->assertCount(8, $generator->getServices()->getMethods()); } - /** - * - */ + public function testGetStructByNameAndTypeMustReturnAStruct() { $generator = self::getBingGeneratorInstance(); - $this->assertInstanceOf('\WSdlToPhp\PackageGenerator\Model\Struct', $generator->getStructByNameAndType('AdultOption', 'string')); + $this->assertInstanceOf(Struct::class, $generator->getStructByNameAndType('AdultOption', 'string')); } - /** - * - */ + public function testGetUrlContentMustReturnNull() { $generator = self::getBingGeneratorInstance(); $this->assertNull($generator->getUrlContent('my-file.txt')); } + + public function testInstanceFromSerializedJsonMustThrowAnError() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Json is invalid, please check error 4'); + + Generator::instanceFromSerializedJson('{"the":\'key\'}'); + } + /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Json is invalid, please check error 4 + * @param string $dir + * @param string $wsdl + * @param mixed $standalone */ - public function testinstanceFromSerializedJsonMustThrowAnError() + private function generate($dir, $wsdl, $standalone = true) { - Generator::instanceFromSerializedJson('{"the":\'key\'}'); + Utils::createDirectory($destination = self::getTestDirectory().$dir); + + $options = GeneratorOptions::instance(); + $options + ->setGenerateTutorialFile(false) + ->setAddComments([]) + ->setArraysFolder('ArrayType') + ->setBasicLogin(null) + ->setBasicPassword(null) + ->setCategory(GeneratorOptions::VALUE_CAT) + ->setComposerName($standalone ? 'wsdltophp/'.$dir : '') + ->setComposerSettings($standalone ? [ + 'require.wsdltophp/wssecurity:dev-master', + 'config.disable-tls:true', + ] : []) + ->setDestination($destination) + ->setEnumsFolder('EnumType') + ->setGatherMethods(GeneratorOptions::VALUE_START) + ->setGenerateTutorialFile(true) + ->setGenericConstantsName(false) + ->setNamespace('') + ->setOrigin($wsdl) + ->setPrefix('') + ->setProxyHost(null) + ->setProxyLogin(null) + ->setProxyPassword(null) + ->setProxyPort(null) + ->setServicesFolder('ServiceType') + ->setSchemasSave(false) + ->setSchemasFolder('wsdl') + ->setSoapClientClass('WsdlToPhp\PackageBase\AbstractSoapClientBase') + ->setSoapOptions([]) + ->setStandalone($standalone) + ->setStructArrayClass('WsdlToPhp\PackageBase\AbstractStructArrayBase') + ->setStructClass('WsdlToPhp\PackageBase\AbstractStructBase') + ->setStructsFolder('StructType') + ->setSuffix('') + ; + + $generator = new Generator($options); + $generator->generatePackage(); + + $this->assertTrue(is_dir($destination)); + if ($standalone) { + $this->assertTrue(is_file(sprintf('%s/composer.json', $destination))); + $this->assertTrue(is_file(sprintf('%s/composer.lock', $destination))); + } + $this->assertTrue(is_file(sprintf('%s/tutorial.php', $destination))); + $this->assertTrue(is_file($generator->getFiles()->getClassmapFile()->getFileName())); } } diff --git a/tests/Generator/UtilsTest.php b/tests/Generator/UtilsTest.php index ea5d47da..877daafd 100755 --- a/tests/Generator/UtilsTest.php +++ b/tests/Generator/UtilsTest.php @@ -1,16 +1,20 @@ assertSame(sprintf('http://www.foo.com/my/folder/index.%d.xsd', __LINE__), Utils::resolveCompletePath('http://www.foo.com/my/xml.wsdl', sprintf('./folder/index.%d.xsd', __LINE__))); @@ -18,9 +22,7 @@ public function testResolveCompleteUrl() $this->assertSame(sprintf('http://www.foo.com/my/titi/index.%d.xsd', __LINE__), Utils::resolveCompletePath('http://www.foo.com/my/xml.wsdl', sprintf('./titi/index.%d.xsd', __LINE__))); $this->assertSame(sprintf('http://www.foo.com/my/titi/index.%d.xsd', __LINE__), Utils::resolveCompletePath('http://www.foo.com/my/xml.wsdl', sprintf('folder/toto/../../titi/index.%d.xsd', __LINE__))); } - /** - * - */ + public function testResolveCompletePath() { $dirname = __DIR__; @@ -29,9 +31,7 @@ public function testResolveCompletePath() $this->assertSame(sprintf('%s/../resources/aukro.wsdl', $dirname), Utils::resolveCompletePath(sprintf('%s/../resources/ebaySvc.wsdl', $dirname), 'folder/../toto/../aukro.wsdl')); $this->assertSame(sprintf('%s/../resources/aukro.wsdl', $dirname), Utils::resolveCompletePath(sprintf('%s/../resources/ebaySvc.wsdl', $dirname), 'aukro.wsdl')); } - /** - * - */ + public function testGetValueWithinItsType() { $this->assertSame('020', Utils::getValueWithinItsType('020', 'string')); @@ -40,41 +40,26 @@ public function testGetValueWithinItsType() $this->assertSame(true, Utils::getValueWithinItsType('true', 'bool')); $this->assertSame(false, Utils::getValueWithinItsType('false', 'bool')); } - /** - * - */ + public function testGetPartStart() { $this->assertSame('events', Utils::getPart(GeneratorOptions::VALUE_START, 'eventsGet')); $this->assertSame('events', Utils::getPart(GeneratorOptions::VALUE_START, '_events')); } - /** - * - */ + public function testGetPartEnd() { $this->assertSame('Get', Utils::getPart(GeneratorOptions::VALUE_END, 'eventsGet')); $this->assertSame('Partition', Utils::getPart(GeneratorOptions::VALUE_END, 'eventsGetPartition')); $this->assertSame('events', Utils::getPart(GeneratorOptions::VALUE_END, '_events')); } - /** - * - */ - public function testGetPartUndefined() - { - $this->assertSame('', Utils::getPart(null, 'eventsGet')); - } - /** - * - */ + public function testCleanComment() { $this->assertEmpty(Utils::cleanComment(null)); - $this->assertEmpty(Utils::cleanComment(new \stdClass())); + $this->assertEmpty(Utils::cleanComment(new stdClass())); } - /** - * - */ + public function testGetContentFromUrlContextOptionsBasicAuth() { $this->assertSame([ @@ -85,9 +70,7 @@ public function testGetContentFromUrlContextOptionsBasicAuth() ], ], Utils::getStreamContextOptions('foo', 'bar')); } - /** - * - */ + public function testGetContentFromUrlContextOptionsProxy() { $this->assertSame([ @@ -99,9 +82,7 @@ public function testGetContentFromUrlContextOptionsProxy() ], ], Utils::getStreamContextOptions(null, null, 'dns.proxy.com', 4545, 'foo', 'bar')); } - /** - * - */ + public function testGetContentFromUrlContextOptionsBasicAuthProxy() { $this->assertSame([ @@ -114,9 +95,7 @@ public function testGetContentFromUrlContextOptionsBasicAuthProxy() ], ], Utils::getStreamContextOptions('foo', 'bar', 'dns.proxy.com', 4545, 'foo', 'bar')); } - /** - * - */ + public function testGetContentFromUrlContextOptions() { $this->assertSame([ @@ -140,44 +119,32 @@ public function testGetContentFromUrlContextOptions() ], ])); } - /** - * - */ - public function testGetPartStringBeginingWithInt() + + public function testGetPartStringBeginningWithInt() { $this->assertSame('My', Utils::getPart(GeneratorOptions::VALUE_START, '0MyOperation')); } - /** - * - */ - public function testGetPartStringBeginingWithMultipleInt() + + public function testGetPartStringBeginningWithMultipleInt() { $this->assertSame('My', Utils::getPart(GeneratorOptions::VALUE_START, '0123456789MyOperation')); } - /** - * - */ - public function testGetEndPartStringBeginingWithMultipleInt() + + public function testGetEndPartStringBeginningWithMultipleInt() { $this->assertSame('Operation', Utils::getPart(GeneratorOptions::VALUE_END, '012345678MyOperation')); } - /** - * - */ - public function testGetEndPartStringBeginingWithMultipleIntAndOnlyCaps() + + public function testGetEndPartStringBeginningWithMultipleIntAndOnlyCaps() { $this->assertSame('MO', Utils::getPart(GeneratorOptions::VALUE_END, '1234567890MO')); } - /** - * - */ + public function testGetEndPartStringEndingWithInt() { $this->assertSame('Operation', Utils::getPart(GeneratorOptions::VALUE_END, 'MyOperation0')); } - /** - * - */ + public function testCleanString() { $this->assertSame('КонтактнаяИнформация', Utils::cleanString('КонтактнаяИнформация')); @@ -186,22 +153,20 @@ public function testCleanString() $this->assertSame('äöüß', Utils::cleanString('äöüß')); $this->assertSame('θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ', 'θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ'); } - /** - * - */ + public function testSaveSchemas() { - $path = __DIR__ . '/../resources/generated'; + $path = __DIR__.'/../resources/generated'; $wsdlFolder = 'schema_save_folder'; // test file name extracted from url - $this->assertSame($path . '/' . $wsdlFolder . '/webservice.wsdl', Utils::saveSchemas($path, $wsdlFolder, 'http://www.foo.com/webservice.wsdl', 'Save schema to folder')); + $this->assertSame($path.'/'.$wsdlFolder.'/webservice.wsdl', Utils::saveSchemas($path, $wsdlFolder, 'http://www.foo.com/webservice.wsdl', 'Save schema to folder')); // test file name not set in url - $this->assertSame($path . '/' . $wsdlFolder . '/schema.wsdl', Utils::saveSchemas($path, $wsdlFolder, 'http://www.foo.com/index.php?WSDL', 'Save schema to folder')); + $this->assertSame($path.'/'.$wsdlFolder.'/schema.wsdl', Utils::saveSchemas($path, $wsdlFolder, 'http://www.foo.com/index.php?WSDL', 'Save schema to folder')); // test save folder is empty - $this->assertSame($path . '/wsdl/schema.wsdl', Utils::saveSchemas($path, '', 'http://www.foo.com/index.php?WSDL', 'Save schema to folder')); + $this->assertSame($path.'/wsdl/schema.wsdl', Utils::saveSchemas($path, '', 'http://www.foo.com/index.php?WSDL', 'Save schema to folder')); // test get saved content - $this->assertSame('Save schema to folder', file_get_contents($path . '/' . $wsdlFolder . '/webservice.wsdl')); - $this->assertSame('Save schema to folder', file_get_contents($path . '/' . $wsdlFolder . '/schema.wsdl')); - $this->assertSame('Save schema to folder', file_get_contents($path . '/wsdl/schema.wsdl')); + $this->assertSame('Save schema to folder', file_get_contents($path.'/'.$wsdlFolder.'/webservice.wsdl')); + $this->assertSame('Save schema to folder', file_get_contents($path.'/'.$wsdlFolder.'/schema.wsdl')); + $this->assertSame('Save schema to folder', file_get_contents($path.'/wsdl/schema.wsdl')); } } diff --git a/tests/Model/MethodTest.php b/tests/Model/MethodTest.php index 3935b38a..c8b9d086 100755 --- a/tests/Model/MethodTest.php +++ b/tests/Model/MethodTest.php @@ -1,15 +1,19 @@ assertSame('getIdStringString', $service->getMethod('getIdString')->getMethodName()); $this->assertSame('getIdIntInt', $service->getMethod('getIdInt')->getMethodName()); } - /** - * - */ + public function testGetMethodNameCalledTwice() { $service = new Service(self::getBingGeneratorInstance(), 'Foo'); @@ -43,9 +45,7 @@ public function testGetMethodNameCalledTwice() $this->assertSame('_list', $method->getMethodName()); $this->assertSame('_list', $method->getMethodName()); } - /** - * - */ + public function testMultipleServicesSameMethods() { Service::purgeUniqueNames(); @@ -62,17 +62,15 @@ public function testMultipleServicesSameMethods() $service4->addMethod('Login', 'int', 'id', false); $service5 = new Service(self::getBingGeneratorInstance(), 'login'); - $service5->addMethod('Login', ['int',' string'], 'id', false); + $service5->addMethod('Login', ['int', ' string'], 'id', false); $this->assertSame('Login', $service1->getMethod('Login')->getMethodName()); $this->assertSame('login_1', $service2->getMethod('login')->getMethodName()); $this->assertSame('Login', $service3->getMethod('Login')->getMethodName()); $this->assertSame('LoginInt', $service4->getMethod('Login')->getMethodName()); - $this->assertSame(sprintf('Login_%s', md5(var_export(['int',' string'], true))), $service5->getMethod('Login')->getMethodName()); + $this->assertSame(sprintf('Login_%s', md5(var_export(['int', ' string'], true))), $service5->getMethod('Login')->getMethodName()); } - /** - * - */ + public function testMultipleServicesSameMethodsWithoutPurging() { Service::purgeUniqueNames(); @@ -89,9 +87,7 @@ public function testMultipleServicesSameMethodsWithoutPurging() $this->assertSame('login_1', $service2->getMethod('login')->getMethodName()); $this->assertSame('Login', $service3->getMethod('Login')->getMethodName()); } - /** - * - */ + public function testGetCleanNameWithOneInt() { Service::purgeUniqueNames(); @@ -100,9 +96,7 @@ public function testGetCleanNameWithOneInt() $this->assertSame('_MyOperation', $service1->getMethod('0MyOperation')->getCleanName()); } - /** - * - */ + public function testGetCleanNameWithMultipleInt() { Service::purgeUniqueNames(); @@ -111,9 +105,7 @@ public function testGetCleanNameWithMultipleInt() $this->assertSame('_MyOperation', $service1->getMethod('0123456789MyOperation')->getCleanName()); } - /** - * - */ + public function testNameIsCleanWithOneInt() { Service::purgeUniqueNames(); @@ -122,9 +114,7 @@ public function testNameIsCleanWithOneInt() $this->assertFalse($service1->getMethod('0MyOperation')->nameIsClean()); } - /** - * - */ + public function testNameIsCleanWithMultipleInt() { Service::purgeUniqueNames(); @@ -133,18 +123,14 @@ public function testNameIsCleanWithMultipleInt() $this->assertFalse($service1->getMethod('0123456789MyOperation')->nameIsClean()); } - /** - * - */ + public function testGetReservedMethodsInstance() { $service = new Service(self::getBingGeneratorInstance(), 'Foo'); $service->addMethod('getId', 'string', 'string'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\ConfigurationReader\ServiceReservedMethod', $service->getMethod('getId')->getReservedMethodsInstance()); + $this->assertInstanceOf(ServiceReservedMethod::class, $service->getMethod('getId')->getReservedMethodsInstance()); } - /** - * - */ + public function testReplaceReservedMethod() { $service = new Service(self::getBingGeneratorInstance(), 'Foo'); diff --git a/tests/Model/ModelTest.php b/tests/Model/ModelTest.php index d2e236ee..cb005210 100755 --- a/tests/Model/ModelTest.php +++ b/tests/Model/ModelTest.php @@ -1,23 +1,26 @@ assertEquals('_foo_', self::instance('-foo-')->getCleanName()); @@ -26,9 +29,7 @@ public function testGetCleanName() $this->assertEquals('_é_àç_çfoo', self::instance('___é%àç_çfoo')->getCleanName(false)); $this->assertEquals('_é_àç_çfoo_245', self::instance('___é%àç_çfoo----245')->getCleanName(false)); } - /** - * - */ + public function testNameIsClean() { $this->assertTrue(self::instance('foo_')->nameIsClean()); @@ -37,30 +38,26 @@ public function testNameIsClean() $this->assertFalse(self::instance('-foo_')->nameIsClean()); $this->asserttrue(self::instance('éfoo_')->nameIsClean()); } - /** - * - */ + public function testGetDocSubPackages() { $this->assertEmpty(self::instance('Foo')->getDocSubPackages()); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnAddMetaName() { + $this->expectException(TypeError::class); + self::instance('foo')->addMeta(null, 'bar'); } - /** - * @expectedException \InvalidArgumentException - */ + public function testExceptionOnAddMetaValue() { - self::instance('foo')->addMeta('', new \stdClass()); + $this->expectException(InvalidArgumentException::class); + + self::instance('foo')->addMeta('', new stdClass()); } - /** - * - */ + public function testAddMeta() { $instance = self::instance('foo'); @@ -77,16 +74,14 @@ public function testAddMeta() ], ], $instance->getMeta()); } - /** - * @expectedException \InvalidArgumentException - */ + public function testGetReservedMethodsInstance() { + $this->expectException(InvalidArgumentException::class); + self::instance('foo')->getReservedMethodsInstance(); } - /** - * - */ + public function testToJsonSerialize() { $this->assertSame([ @@ -94,35 +89,28 @@ public function testToJsonSerialize() 'abstract' => false, 'meta' => [], 'name' => 'foo_', - '__CLASS__' => 'WsdlToPhp\PackageGenerator\Model\EmptyModel', + '__CLASS__' => EmptyModel::class, ], self::instance('foo_')->jsonSerialize()); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage __CLASS__ key is missing from "array ( - 'inheritance' => '', - 'abstract' => false, - 'meta' => - array ( - ), - 'name' => 'foo_', - )" - */ + public function testInstanceFromSerializedJsonMustThrowAnExceptionForMissingClass() { - EmptyModel::instanceFromSerializedJson(self::bingGeneratorInstance(), [ + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage(sprintf('__CLASS__ key is missing from "%s"', var_export($array = [ 'inheritance' => '', 'abstract' => false, 'meta' => [], 'name' => 'foo_', - ]); + ], true))); + + EmptyModel::instanceFromSerializedJson(self::bingGeneratorInstance(), $array); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Class WsdlToPhp\PackageGenerator\Model\EmptyFakeModel is unknown - */ - public function testInstanceFromSerializedJsonMustThrowAnAxceptionForInexistingClass() + + public function testInstanceFromSerializedJsonMustThrowAnExceptionForInexistingClass() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Class "WsdlToPhp\PackageGenerator\Model\EmptyFakeModel" is unknown'); + EmptyModel::instanceFromSerializedJson(self::bingGeneratorInstance(), [ 'inheritance' => '', 'abstract' => false, @@ -131,24 +119,17 @@ public function testInstanceFromSerializedJsonMustThrowAnAxceptionForInexistingC '__CLASS__' => 'WsdlToPhp\PackageGenerator\Model\EmptyFakeModel', ]); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage name key is missing from array ( - 'inheritance' => '', - 'abstract' => false, - 'meta' => - array ( - ), - '__CLASS__' => 'WsdlToPhp\\PackageGenerator\\Model\\EmptyModel', - ) - */ + public function testInstanceFromSerializedJsonMustThrowAnAxceptionForMissingName() { - EmptyModel::instanceFromSerializedJson(self::bingGeneratorInstance(), [ + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage(sprintf('name key is missing from "%s"', var_export($array = [ 'inheritance' => '', 'abstract' => false, 'meta' => [], - '__CLASS__' => 'WsdlToPhp\PackageGenerator\Model\EmptyModel', - ]); + '__CLASS__' => EmptyModel::class, + ], true))); + + EmptyModel::instanceFromSerializedJson(self::bingGeneratorInstance(), $array); } } diff --git a/tests/Model/ServiceTest.php b/tests/Model/ServiceTest.php index 991f6d8f..eeef86e0 100755 --- a/tests/Model/ServiceTest.php +++ b/tests/Model/ServiceTest.php @@ -1,37 +1,40 @@ addMethod('getBar', 'string', 'int'); $service->addMethod('getFoo', 'string', 'int'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Method', $service->getMethod('getBar')); - $this->assertNotInstanceOf('\WsdlToPhp\PackageGenerator\Model\Method', $service->getMethod('getbar')); + $this->assertInstanceOf(Method::class, $service->getMethod('getBar')); + $this->assertNotInstanceOf(Method::class, $service->getMethod('getbar')); $service->getMethod('getBar')->setName('getbar'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Method', $service->getMethod('getbar')); + $this->assertInstanceOf(Method::class, $service->getMethod('getbar')); } + public function testGetReservedMethodsInstance() { - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\ConfigurationReader\ServiceReservedMethod', self::instance('foo')->getReservedMethodsInstance()); + $this->assertInstanceOf(ServiceReservedMethod::class, self::instance('foo')->getReservedMethodsInstance()); } } diff --git a/tests/Model/StructAttributeTest.php b/tests/Model/StructAttributeTest.php index ff18c8bf..b5af60f2 100755 --- a/tests/Model/StructAttributeTest.php +++ b/tests/Model/StructAttributeTest.php @@ -1,63 +1,64 @@ addAttribute('id', 'int') ->addAttribute('name', 'string') - ->addAttribute('Name', 'string'); + ->addAttribute('Name', 'string') + ; $this->assertSame('id', $struct->getAttribute('id')->getUniqueName()); $this->assertSame('name', $struct->getAttribute('name')->getUniqueName()); $this->assertSame('Name_1', $struct->getAttribute('Name')->getUniqueName()); } - /** - * - */ + public function testGetUniqueNameMustGenerateOriginalNameBetweenTwoIndependentStructsSamelyCaseInsensitivelyNamed() { $Foo = StructTest::instance('Foo', true) ->addAttribute('id', 'int') ->addAttribute('name', 'string') - ->addAttribute('bar', 'string'); + ->addAttribute('bar', 'string') + ; $foo = StructTest::instance('foo', true) ->addAttribute('id', 'int') - ->addAttribute('name', 'string'); + ->addAttribute('name', 'string') + ; $this->assertSame('id', $Foo->getAttribute('id')->getUniqueName()); $this->assertSame('id', $foo->getAttribute('id')->getUniqueName()); $this->assertSame('name', $Foo->getAttribute('name')->getUniqueName()); $this->assertSame('name', $foo->getAttribute('name')->getUniqueName()); } - /** - * - */ + public function testGetReservedMethodsInstance() { $struct = StructTest::instance('Foo', true)->addAttribute('id', 'int'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\ConfigurationReader\StructReservedMethod', $struct->getAttribute('id')->getReservedMethodsInstance()); + $this->assertInstanceOf(StructReservedMethod::class, $struct->getAttribute('id')->getReservedMethodsInstance()); } - /** - * - */ + public function testGetUniqueNameWithConflict() { /** - * previous context + * previous context. */ $service = new Service(self::getBingGeneratorInstance(), 'Query'); $service->addMethod('query', '', ''); $service->getMethod('query')->getMethodName(); /** - * current context + * current context. */ $struct = StructTest::instance('query', true); $struct->addAttribute('query', 'string'); @@ -67,9 +68,7 @@ public function testGetUniqueNameWithConflict() $this->assertSame('getQuery', $structAttribute->getGetterName()); $this->assertSame('setQuery', $structAttribute->getSetterName()); } - /** - * - */ + public function testStructAttributeTypeMustBeBool() { $structAttribute = self::unitTestsInstance()->getStructByName('Result')->getAttribute('Success'); diff --git a/tests/Model/StructTest.php b/tests/Model/StructTest.php index d6abd0d8..5cb8bfdc 100755 --- a/tests/Model/StructTest.php +++ b/tests/Model/StructTest.php @@ -1,18 +1,24 @@ addValue('id'); $struct->addValue('name'); $struct->addValue('_key'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructValue', $struct->getValue('id')); - $this->assertNotInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructValue', $struct->getValue('_id')); + $this->assertInstanceOf(StructValue::class, $struct->getValue('id')); + $this->assertNotInstanceOf(StructValue::class, $struct->getValue('_id')); } public function testGetAttibute() @@ -110,38 +116,36 @@ public function testGetAttibute() $struct->addAttribute('id', 'int'); $struct->addAttribute('name', 'string'); $struct->addAttribute('_key', 'string'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructAttribute', $struct->getAttribute('id')); - $this->assertNotInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructAttribute', $struct->getAttribute('_id')); + $this->assertInstanceOf(StructAttribute::class, $struct->getAttribute('id')); + $this->assertNotInstanceOf(StructAttribute::class, $struct->getAttribute('_id')); } - /** - * @expectedException \InvalidArgumentException - */ public function testAddEmptyAttributeNameWithException() { + $this->expectException(InvalidArgumentException::class); + $struct = self::instance('Foo', true); $struct->addAttribute('', 'string'); } - /** - * @expectedException \InvalidArgumentException - */ public function testAddEmptyAttributeTypeWithException() { + $this->expectException(InvalidArgumentException::class); + $struct = self::instance('Foo', true); $struct->addAttribute('bar', ''); } public function testGetReservedMethodsInstance() { - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\ConfigurationReader\StructReservedMethod', self::instance('foo', true)->getReservedMethodsInstance()); + $this->assertInstanceOf(StructReservedMethod::class, self::instance('foo', true)->getReservedMethodsInstance()); } public function testGetReservedMethodsInstanceForArray() { $instance = self::instance('array', true); $instance->addAttribute('bar', 'string'); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\ConfigurationReader\StructArrayReservedMethod', $instance->getReservedMethodsInstance()); + $this->assertInstanceOf(StructArrayReservedMethod::class, $instance->getReservedMethodsInstance()); } public function testSetListMustSetTheListProperty() diff --git a/tests/Model/StructValueTest.php b/tests/Model/StructValueTest.php index 5f75033a..a3c6b880 100755 --- a/tests/Model/StructValueTest.php +++ b/tests/Model/StructValueTest.php @@ -1,15 +1,19 @@ assertNotSame('1', $struct->getValue(1)->getValue()); $this->assertSame('5.3', $struct->getValue('5.3')->getValue()); } - /** - * @expectedException \InvalidArgumentException - */ + public function testInvalidIndexValue() { + $this->expectException(InvalidArgumentException::class); + $struct = StructTest::instance('Foot', true); new StructValue($struct->getGenerator(), 'foo', -1, $struct); new StructValue($struct->getGenerator(), 'foo', 'bar', $struct); } - /** - * @expectedException \InvalidArgumentException - */ + public function testSetInvalidIndexValue() { + $this->expectException(InvalidArgumentException::class); + $struct = StructTest::instance('Foot', true); $struct->addValue(1); - $struct->getValue(1)->setIndex('1'); + $struct->getValue(1)->setIndex(-1); } - /** - * - */ + public function testGetCleanName() { $struct = StructTest::instance('Foo', true); diff --git a/tests/Model/WsdlTest.php b/tests/Model/WsdlTest.php index 8b1346be..e722c0cb 100755 --- a/tests/Model/WsdlTest.php +++ b/tests/Model/WsdlTest.php @@ -1,158 +1,130 @@ assertSame(self::wsdlBingPath(), self::wsdlBingInstance()->getName()); } - /** - * @return Wsdl - */ - public static function wsdlActonInstance() + + public static function wsdlActonInstance(): Wsdl { return self::getWsdl(self::wsdlActonPath()); } - /** - * @return Wsdl - */ - public static function wsdlOdigeoInstance() + + public static function wsdlOdigeoInstance(): Wsdl { return self::getWsdl(self::wsdlOdigeoPath()); } - /** - * @return Wsdl - */ - public static function wsdlOrderContractInstance() + + public static function wsdlOrderContractInstance(): Wsdl { return self::getWsdl(self::wsdlOrderContractPath()); } - /** - * @return Wsdl - */ - public static function wsdlWhlInstance() + + public static function wsdlWhlInstance(): Wsdl { return self::getWsdl(self::wsdlWhlPath()); } - /** - * @return Wsdl - */ - public static function wsdlDeliveryInstance() + + public static function wsdlDeliveryInstance(): Wsdl { return self::getWsdl(self::wsdlDeliveryServicePath()); } - /** - * @return Wsdl - */ - public static function wsdlEwsInstance() + + public static function wsdlEwsInstance(): Wsdl { return self::getWsdl(self::wsdlEwsPath()); } - /** - * @return Wsdl - */ - public static function schemaEwsTypesInstance() + + public static function schemaEwsTypesInstance(): Schema { return self::getSchema(self::schemaEwsTypesPath()); } - /** - * @return Wsdl - */ - public static function schemaEwsMessagesInstance() + + public static function schemaEwsMessagesInstance(): Schema { return self::getSchema(self::schemaEwsMessagesPath()); } - /** - * @expectedException \InvalidArgumentException - */ + public function testException() { - new Wsdl(self::getBingGeneratorInstance(), __DIR__ . '/../resources/empty.wsdl', file_get_contents(__DIR__ . '/../resources/empty.wsdl')); + $this->expectException(InvalidArgumentException::class); + + new Wsdl(self::getBingGeneratorInstance(), __DIR__.'/../resources/empty.wsdl', file_get_contents(__DIR__.'/../resources/empty.wsdl')); } - /** - * @return Schema - */ - public static function wsdlNumericEnumerationInstance() + + public static function wsdlNumericEnumerationInstance(): Schema { - return self::getSchema(__DIR__ . '/../resources/numeric_enumeration.xml'); + return self::getSchema(__DIR__.'/../resources/numeric_enumeration.xml'); } - /** - * - */ + public function testJsonSerialize() { $this->assertSame([ @@ -160,7 +132,7 @@ public function testJsonSerialize() 'abstract' => false, 'meta' => [], 'name' => self::wsdlBingPath(), - '__CLASS__' => 'WsdlToPhp\PackageGenerator\Model\Wsdl', + '__CLASS__' => Wsdl::class, ], self::getWsdl(self::wsdlBingPath())->jsonSerialize()); } } diff --git a/tests/Parser/SoapClient/FunctionsTest.php b/tests/Parser/SoapClient/FunctionsTest.php index bff9ebcd..ebbc93b4 100755 --- a/tests/Parser/SoapClient/FunctionsTest.php +++ b/tests/Parser/SoapClient/FunctionsTest.php @@ -1,15 +1,19 @@ fail('Unable to find parsed Login operation'); } } - /** - * - */ + public function testBullhornstaffing() { $generator = self::getBullhornstaffingInstance(); @@ -36,12 +38,10 @@ public function testBullhornstaffing() $parser = new Functions($generator); $parser->parse(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Service', $generator->getService('Events')); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\Service', $generator->getService('Export')); + $this->assertInstanceOf(Service::class, $generator->getService('Events')); + $this->assertInstanceOf(Service::class, $generator->getService('Export')); } - /** - * - */ + public function testOmniture() { $generator = self::getOmnitureInstance(); @@ -70,9 +70,7 @@ public function testOmniture() $this->fail('Unable to find Saint.CheckJobStatus method'); } } - /** - * - */ + public function testLnp() { $generator = self::getLnpInstance(); @@ -89,75 +87,98 @@ public function testLnp() 'baseNumber' => 'string', 'groupSize' => 'int', ]; - $count++; + ++$count; + break; + case 'createPortingOrderCatA': $expected = [ 'portingOrderCatACreationParameters' => 'UNKNOWN', ]; - $count++; + ++$count; + break; + case 'createPortingOrderCatC': $expected = [ 'portingOrderCatCCreationParameters' => 'UNKNOWN', ]; - $count++; + ++$count; + break; + case 'uploadPaf': $expected = [ 'orderId' => 'long', 'fileName' => 'string', 'fileContent' => 'base64Binary', ]; - $count++; + ++$count; + break; + case 'getPortingOrderStatus': $expected = [ 'orderId' => 'long', ]; - $count++; + ++$count; + break; + case 'cancelPortingOrder': $expected = [ 'orderId' => 'long', ]; - $count++; + ++$count; + break; + case 'listActorPortingOrders': $expected = null; - $count++; + ++$count; + break; + case 'listAvailablePublicNumberGroups': $expected = [ 'publicNumberGroupSearchParams' => 'UNKNOWN', ]; - $count++; + ++$count; + break; + case 'importPublicNumberGroup': $expected = [ 'importPublicNumberGroupParams' => 'UNKNOWN', ]; - $count++; + ++$count; + break; + case 'leasePublicNumberGroup': $expected = [ 'params' => 'UNKNOWN', ]; - $count++; + ++$count; + break; + case 'unleasePublicNumberGroup': $expected = [ 'actorId' => 'long', 'baseNumber' => 'string', ]; - $count++; + ++$count; + break; + case 'mapIpndDetailsToNumber': $expected = [ 'number' => 'string', 'ipndInformation' => 'UNKNOWN', ]; - $count++; + ++$count; + break; } $this->assertSame($expected, $method->getParameterType()); diff --git a/tests/Parser/SoapClient/SoapClientParser.php b/tests/Parser/SoapClient/SoapClientParser.php index 379ef56e..bd9bfe24 100755 --- a/tests/Parser/SoapClient/SoapClientParser.php +++ b/tests/Parser/SoapClient/SoapClientParser.php @@ -1,9 +1,11 @@ getStructByName('offer'); if ($offer instanceof Struct) { - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructAttribute', $offer->getAttribute('offerClassMember')); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructAttribute', $offer->getAttribute('offer')); + $this->assertInstanceOf(StructAttribute::class, $offer->getAttribute('offerClassMember')); + $this->assertInstanceOf(StructAttribute::class, $offer->getAttribute('offer')); $this->assertSame('offer', $offer->getAttribute('offer')->getType()); } else { $this->fail('Unable to get offer struct'); @@ -30,16 +34,14 @@ public function testWcf() $order = $generator->getStructByName('order'); if ($offer instanceof Struct) { - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructAttribute', $order->getAttribute('orderClassMember')); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\Model\StructAttribute', $order->getAttribute('order')); + $this->assertInstanceOf(StructAttribute::class, $order->getAttribute('orderClassMember')); + $this->assertInstanceOf(StructAttribute::class, $order->getAttribute('order')); $this->assertSame('order', $order->getAttribute('order')->getType()); } else { $this->fail('Unable to get order struct'); } } - /** - * - */ + public function testLnp() { $generator = self::getLnpInstance(); @@ -54,9 +56,7 @@ public function testLnp() $this->assertEquals(0, $count); } - /** - * - */ + public function testWhl() { $generator = self::getWhlInstance(true); diff --git a/tests/Parser/Wsdl/TagAttributeTest.php b/tests/Parser/Wsdl/TagAttributeTest.php index 5a5095fd..71d6e0dc 100755 --- a/tests/Parser/Wsdl/TagAttributeTest.php +++ b/tests/Parser/Wsdl/TagAttributeTest.php @@ -1,29 +1,28 @@ assertTrue((bool) $ok); } - /** - * - */ + public function testParseWhl() { $tagAttributeParser = self::whlInstanceParser(); @@ -66,14 +63,14 @@ public function testParseWhl() if (($struct = $structs->getStructByName('DestinationType')) instanceof Struct) { $this->assertSame('integer', $struct->getAttribute('ID')->getType()); $this->assertSame('integer', $struct->getAttribute('CountryID')->getType()); - $count++; + ++$count; } if (($struct = $structs->getStructByName('InventoryType')) instanceof Struct) { $this->assertSame('string', $struct->getAttribute('RatePlanId')->getType()); $this->assertSame('string', $struct->getAttribute('Availability')->getType()); $this->assertSame('string', $struct->getAttribute('StartDate')->getType()); $this->assertSame('string', $struct->getAttribute('EndDate')->getType()); - $count++; + ++$count; } if (($struct = $structs->getStructByName('UniqueID_Type')) instanceof Struct) { $this->assertSame('optional', $struct->getAttribute('URL')->getMetaValue('use')); @@ -91,7 +88,7 @@ public function testParseWhl() $this->assertSame('required', $struct->getAttribute('ID')->getMetaValue('use')); $this->assertSame('whlsoap:StringLength1to32', $struct->getAttribute('ID')->getMetaValue('type')); $this->assertTrue($struct->getAttribute('ID')->isRequired()); - $count++; + ++$count; } } $this->assertSame(3, $count); diff --git a/tests/Parser/Wsdl/TagChoiceTest.php b/tests/Parser/Wsdl/TagChoiceTest.php index 78289523..30edf500 100644 --- a/tests/Parser/Wsdl/TagChoiceTest.php +++ b/tests/Parser/Wsdl/TagChoiceTest.php @@ -1,116 +1,113 @@ - - Ways of providing funds and guarantees for travel by the individual. - - - - - Details of a debit or credit card. - - - - - Details of a bank account. - - - - - Details of a direct billing arrangement. - - - - - Used to indicate payment in cash. - - - - - If true, this indicates cash is being used. - - true - - - - - - - - - Provides a reference to a specific form of payment. - - - + * . + * + * Ways of providing funds and guarantees for travel by the individual. + * + * + * + * + * Details of a debit or credit card. + * + * + * + * + * Details of a bank account. + * + * + * + * + * Details of a direct billing arrangement. + * + * + * + * + * Used to indicate payment in cash. + * + * + * + * + * If true, this indicates cash is being used. + * + * true + * + * + * + * + * + * + * + * + * Provides a reference to a specific form of payment. + * + * + * . * * - - Information to acknowledge the receipt of a message. - - - - - - - Returning an empty element of this type indicates the successful processing of an OpenTravel message. This is used in conjunction with Warnings to report any warnings or business errors. - - - - - Used when a message has been successfully processed to report any warnings or business errors that occurred. - - - - - - Indicates an error occurred during the processing of an OpenTravel message. If the message successfully processes, but there are business errors, those errors should be passed in the warning element. - - - - - - May be used to return the unique id from the request message. - - - - - - The OTA_PayloadStdAttributes defines the standard attributes that appear on the root element for all OpenTravel Messages. - - - + * + * Information to acknowledge the receipt of a message. + * + * + * + * + * + * + * Returning an empty element of this type indicates the successful processing of an OpenTravel message. This is used in conjunction with Warnings to report any warnings or business errors. + * + * + * + * + * Used when a message has been successfully processed to report any warnings or business errors that occurred. + * + * + * + * + * + * Indicates an error occurred during the processing of an OpenTravel message. If the message successfully processes, but there are business errors, those errors should be passed in the warning element. + * + * + * + * + * + * May be used to return the unique id from the request message. + * + * + * + * + * + * The OTA_PayloadStdAttributes defines the standard attributes that appear on the root element for all OpenTravel Messages. + * + * + * */ public function testParseWhlMustAssignMetaOfChoice() { @@ -133,8 +130,10 @@ public function testParseWhlMustAssignMetaOfChoice() 'DirectBill', 'Cash', ], $struct->getAttribute('PaymentCard')->getMetaValue('choice')); - $count++; + ++$count; + break; + case 'MessageAcknowledgementType': $this->assertSame(1, $struct->getAttribute('Errors')->getMetaValue('choiceMaxOccurs')); $this->assertSame(1, $struct->getAttribute('Errors')->getMetaValue('choiceMinOccurs')); @@ -143,7 +142,8 @@ public function testParseWhlMustAssignMetaOfChoice() 'Warnings', 'Errors', ], $struct->getAttribute('Errors')->getMetaValue('choice')); - $count++; + ++$count; + break; } } @@ -152,48 +152,48 @@ public function testParseWhlMustAssignMetaOfChoice() } /** - * - - - - - - - - - - - - - - - + * . + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * . * * - - - - - - - - - - - - - - - - - - - - - - - - + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * */ public function testParseEwsMustAssignMetaOfChoice() { @@ -214,8 +214,10 @@ public function testParseEwsMustAssignMetaOfChoice() 'IndexedPageFolderView', 'FractionalPageFolderView', ], $struct->getAttribute('IndexedPageFolderView')->getMetaValue('choice')); - $count++; + ++$count; + break; + case 'FindItemType': $this->assertSame(1, $struct->getAttribute('SeekToConditionPageItemView')->getMetaValue('choiceMaxOccurs')); $this->assertSame(0, $struct->getAttribute('SeekToConditionPageItemView')->getMetaValue('choiceMinOccurs')); @@ -226,7 +228,8 @@ public function testParseEwsMustAssignMetaOfChoice() 'CalendarView', 'ContactsView', ], $struct->getAttribute('SeekToConditionPageItemView')->getMetaValue('choice')); - $count++; + ++$count; + break; } } @@ -235,31 +238,31 @@ public function testParseEwsMustAssignMetaOfChoice() } /** - * - - - - - - - - - - - - - - - - - - - - - - - - + * . + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * . */ public function testParseDeliveryMustAssignMetaOfChoice() { @@ -295,7 +298,8 @@ public function testParseDeliveryMustAssignMetaOfChoice() 'mutualSettlementDetailSafeCustodyCalculation', 'mutualSettlementDetailRegisterStorage', ], $struct->getAttribute('mutualSettlementDetailCalcCostShipping')->getMetaValue('choice')); - $count++; + ++$count; + break; } } diff --git a/tests/Parser/Wsdl/TagComplexTypeTest.php b/tests/Parser/Wsdl/TagComplexTypeTest.php index dbe462fe..4b382eec 100755 --- a/tests/Parser/Wsdl/TagComplexTypeTest.php +++ b/tests/Parser/Wsdl/TagComplexTypeTest.php @@ -1,37 +1,34 @@ assertTrue((bool) $ok); } - /** - * - */ + public function testParseOrderContract() { $tagComplexTypeParser = self::partnerInstanceParser(); @@ -65,9 +60,7 @@ public function testParseOrderContract() } $this->assertTrue((bool) $ok); } - /** - * - */ + public function testParseDocDataPaymnts() { $tagComplexTypeParser = self::docDataPaymentsInstanceParser(); @@ -92,7 +85,7 @@ public function testParseDocDataPaymnts() 'maxLength' => '19', 'minLength' => '19', ], $exchangeRateDate->getMeta()); - $count++; + ++$count; } } $shopper = $structs->getStructByName('shopper'); @@ -111,7 +104,7 @@ public function testParseDocDataPaymnts() 'minOccurs' => '1', 'pattern' => '[_a-zA-Z0-9\-\+\.]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]+)', ], $email->getMeta()); - $count++; + ++$count; } } $this->assertEquals(2, $count); diff --git a/tests/Parser/Wsdl/TagDocumentationTest.php b/tests/Parser/Wsdl/TagDocumentationTest.php index 00b1f8f2..9a673935 100755 --- a/tests/Parser/Wsdl/TagDocumentationTest.php +++ b/tests/Parser/Wsdl/TagDocumentationTest.php @@ -1,82 +1,77 @@ parse(); $ok = false; foreach ($tagDocumentationParser->getGenerator()->getStructs() as $struct) { - if ($struct instanceof Struct && $struct->isRestriction() === false) { - if ($struct->getName() === 'imgRequest') { + if ($struct instanceof Struct && false === $struct->isRestriction()) { + if ('imgRequest' === $struct->getName()) { $this->assertEquals([ 'PRO is deprecated; provided for backward compatibility', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); $ok = true; - } elseif ($struct->getName() === 'ProType') { + } elseif ('ProType' === $struct->getName()) { $this->assertEquals([ 'PRO is 10 digits or 11 digits with dash.', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); $ok = true; - } elseif ($struct->getName() === 'SearchCriteriaType') { + } elseif ('SearchCriteriaType' === $struct->getName()) { $this->assertEquals([ 'Generic search criteria for image search', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); $ok = true; - } elseif ($struct->getName() === 'SearchItemType') { + } elseif ('SearchItemType' === $struct->getName()) { $this->assertEquals([ 'Image search item', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); $ok = true; - } elseif ($struct->getName() === 'DocumentType') { + } elseif ('DocumentType' === $struct->getName()) { $this->assertEquals([ 'Document type code', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); $ok = true; - } elseif ($struct->getName() === 'ImagesType') { + } elseif ('ImagesType' === $struct->getName()) { $this->assertEquals([ 'Image file name and Base64 encoded binary source data', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); $ok = true; - } elseif ($struct->getName() === 'availRequest') { + } elseif ('availRequest' === $struct->getName()) { $this->assertEquals([ 'PRO is deprecated; provided for backward compatibility', ], $struct->getMetaValue(Struct::META_DOCUMENTATION)); @@ -86,9 +81,7 @@ public function testParseImageViewService() } $this->assertTrue((bool) $ok); } - /** - * - */ + public function testParseWhlPaymentCardCodeType() { $tagDocumentationParser = self::whlInstanceParser(); @@ -121,9 +114,7 @@ public function testParseWhlPaymentCardCodeType() $this->fail('Unabel to find PaymentCardCodeType restriction for tests'); } } - /** - * - */ + public function testParseActon() { $tagDocumentationParser = self::actonInstanceParser(); @@ -138,9 +129,7 @@ public function testParseActon() $this->fail('Unable to find Id struct for tests'); } } - /** - * - */ + public function testParsePayPal() { $tagDocumentationParser = self::payPalInstanceParser(); @@ -168,9 +157,7 @@ public function testParsePayPal() } $this->assertSame(count($attributes), $okCount); } - /** - * - */ + public function testParseWhlTransactionActionType() { $tagDocumentationParser = self::whlInstanceParser(); diff --git a/tests/Parser/Wsdl/TagElementTest.php b/tests/Parser/Wsdl/TagElementTest.php index c7b758c0..2d9df383 100755 --- a/tests/Parser/Wsdl/TagElementTest.php +++ b/tests/Parser/Wsdl/TagElementTest.php @@ -1,43 +1,38 @@ assertSame('string', $structs->getStructByName('SearchRequest')->getAttribute('Version')->getType()); $this->assertFalse($structs->getStructByName('SearchRequest')->getAttribute('Version')->getContainsElements()); $this->assertFalse($structs->getStructByName('SearchRequest')->getAttribute('Version')->getRemovableFromRequest()); - $count++; + ++$count; } if ($structs->getStructByName('ArrayOfNewsRelatedSearch') instanceof Struct) { $this->assertSame([ @@ -64,14 +59,12 @@ public function testParseBing() $this->assertSame('NewsRelatedSearch', $structs->getStructByName('ArrayOfNewsRelatedSearch')->getAttribute('NewsRelatedSearch')->getType()); $this->assertTrue($structs->getStructByName('ArrayOfNewsRelatedSearch')->getAttribute('NewsRelatedSearch')->getContainsElements()); $this->assertFalse($structs->getStructByName('ArrayOfNewsRelatedSearch')->getAttribute('NewsRelatedSearch')->getRemovableFromRequest()); - $count++; + ++$count; } } $this->assertEquals(2, $count); } - /** - * - */ + public function testParseYandexAdGroups() { $tagElementParser = self::yandexAdGroupsInstanceParser(); @@ -88,14 +81,12 @@ public function testParseYandexAdGroups() $this->assertSame('ArrayOfString', $structs->getStructByName('AdGroupBase')->getAttribute('NegativeKeywords')->getType()); $this->assertFalse($structs->getStructByName('AdGroupBase')->getAttribute('NegativeKeywords')->getContainsElements()); $this->assertTrue($structs->getStructByName('AdGroupBase')->getAttribute('NegativeKeywords')->getRemovableFromRequest()); - $count++; + ++$count; } } $this->assertEquals(1, $count); } - /** - * - */ + public function testParseActon() { $tagElementParser = self::actonInstanceParser(); @@ -110,14 +101,12 @@ public function testParseActon() $this->assertSame('string', $structs->getStructByName('LoginResult')->getAttribute('serverUrl')->getType()); $this->assertFalse($structs->getStructByName('LoginResult')->getAttribute('serverUrl')->getContainsElements()); $this->assertFalse($structs->getStructByName('LoginResult')->getAttribute('serverUrl')->getRemovableFromRequest()); - $count++; + ++$count; } } $this->assertEquals(1, $count); } - /** - * - */ + public function testParsePayPal() { $tagElementParser = self::payPalInstanceParser(); diff --git a/tests/Parser/Wsdl/TagEnumerationTest.php b/tests/Parser/Wsdl/TagEnumerationTest.php index e80c8f77..2f803c13 100755 --- a/tests/Parser/Wsdl/TagEnumerationTest.php +++ b/tests/Parser/Wsdl/TagEnumerationTest.php @@ -1,31 +1,30 @@ getGenerator()->getStructs() as $struct) { - if ($struct instanceof Struct && $struct->isRestriction() === true) { - if ($struct->getName() === 'AdultOption') { + if ($struct instanceof Struct && true === $struct->isRestriction()) { + if ('AdultOption' === $struct->getName()) { $values = new StructValueContainer($tagEnumerationParser->getGenerator()); $values->add(new StructValue($tagEnumerationParser->getGenerator(), 'Off', 0, $struct)); $values->add(new StructValue($tagEnumerationParser->getGenerator(), 'Moderate', 1, $struct)); @@ -43,23 +42,21 @@ public function testBing() $struct->getValues()->rewind(); $this->assertEquals($values, $struct->getValues()); - $count++; - } elseif ($struct->getName() === 'SearchOption') { + ++$count; + } elseif ('SearchOption' === $struct->getName()) { $values = new StructValueContainer($tagEnumerationParser->getGenerator()); $values->add(new StructValue($tagEnumerationParser->getGenerator(), 'DisableLocationDetection', 0, $struct)); $values->add(new StructValue($tagEnumerationParser->getGenerator(), 'EnableHighlighting', 1, $struct)); $struct->getValues()->rewind(); $this->assertEquals($values, $struct->getValues()); - $count++; + ++$count; } } } $this->assertSame(2, $count); } - /** - * - */ + public function testReforma() { $tagEnumerationParser = self::reformaInstanceParser(); @@ -68,8 +65,8 @@ public function testReforma() $count = 0; foreach ($tagEnumerationParser->getGenerator()->getStructs() as $struct) { - if ($struct instanceof Struct && $struct->isRestriction() === true) { - if ($struct->getName() === 'HouseStateEnum') { + if ($struct instanceof Struct && true === $struct->isRestriction()) { + if ('HouseStateEnum' === $struct->getName()) { $values = new StructValueContainer($tagEnumerationParser->getGenerator()); $one = new StructValue($tagEnumerationParser->getGenerator(), '1', 0, $struct); $one->setMeta([ @@ -96,8 +93,8 @@ public function testReforma() ]); $values->add($four); $this->assertEquals($values, $struct->getValues()); - $count++; - } elseif ($struct->getName() === 'HouseStageEnum') { + ++$count; + } elseif ('HouseStageEnum' === $struct->getName()) { $values = new StructValueContainer($tagEnumerationParser->getGenerator()); $one = new StructValue($tagEnumerationParser->getGenerator(), '1', 0, $struct); $one->setMeta([ @@ -120,7 +117,7 @@ public function testReforma() $struct->getValues()->rewind(); $this->assertEquals($values, $struct->getValues()); - $count++; + ++$count; } } } diff --git a/tests/Parser/Wsdl/TagExtensionTest.php b/tests/Parser/Wsdl/TagExtensionTest.php index f58895ff..83c3b151 100755 --- a/tests/Parser/Wsdl/TagExtensionTest.php +++ b/tests/Parser/Wsdl/TagExtensionTest.php @@ -1,29 +1,28 @@ count() > 0) { if ($structs->getStructByName('AddDisputeRequestType') instanceof Struct) { $this->assertSame('AbstractRequestType', $structs->getStructByName('AddDisputeRequestType')->getInheritance()); - $count++; + ++$count; } if ($structs->getStructByName('TaxIdentifierAttributeType') instanceof Struct) { $this->assertSame('string', $structs->getStructByName('TaxIdentifierAttributeType')->getInheritance()); - $count++; + ++$count; } } $this->assertSame(2, $count); } - /** - * - */ + public function testParseWcf() { $tagEnumerationParser = self::wcfInstanceParser(); @@ -58,11 +55,11 @@ public function testParseWcf() if ($structs->count() > 0) { if ($structs->getStructByName('offer') instanceof Struct) { $this->assertSame('order', $structs->getStructByName('offer')->getInheritance()); - $count++; + ++$count; } if ($structs->getStructByName('order') instanceof Struct) { $this->assertSame('', $structs->getStructByName('order')->getInheritance()); - $count++; + ++$count; } } $this->assertSame(2, $count); diff --git a/tests/Parser/Wsdl/TagHeaderTest.php b/tests/Parser/Wsdl/TagHeaderTest.php index 617e630f..e531bd7d 100755 --- a/tests/Parser/Wsdl/TagHeaderTest.php +++ b/tests/Parser/Wsdl/TagHeaderTest.php @@ -1,42 +1,37 @@ getGenerator()->getServices(); if ($services->count() > 0) { foreach ($services as $service) { - if ($service->getName() === 'Image') { + if ('Image' === $service->getName()) { foreach ($service->getMethods() as $method) { $this->assertSame([ 'auth', @@ -68,9 +63,7 @@ public function testParseImageViewService() } $this->assertTrue((bool) $ok); } - /** - * - */ + public function testParseActon() { $tagHeaderParser = self::paypalInstanceParserParser(); @@ -81,7 +74,7 @@ public function testParseActon() $services = $tagHeaderParser->getGenerator()->getServices(); if ($services->count() > 0) { foreach ($services as $service) { - if ($service->getName() === 'Send') { + if ('Send' === $service->getName()) { foreach ($service->getMethods() as $method) { $this->assertSame([ 'SessionHeader', @@ -101,7 +94,7 @@ public function testParseActon() ], $method->getMetaValue(TagHeader::META_SOAP_HEADERS)); $ok = true; } - } elseif ($service->getName() === 'List') { + } elseif ('List' === $service->getName()) { foreach ($service->getMethods() as $method) { $this->assertSame([ 'SessionHeader', @@ -121,7 +114,7 @@ public function testParseActon() ], $method->getMetaValue(TagHeader::META_SOAP_HEADERS)); $ok = true; } - } elseif ($service->getName() === 'Login') { + } elseif ('Login' === $service->getName()) { foreach ($service->getMethods() as $method) { $this->assertSame([ 'ClusterHeader', @@ -142,9 +135,7 @@ public function testParseActon() } $this->assertTrue((bool) $ok); } - /** - * - */ + public function testParsePayPal() { $tagHeaderParser = self::paypalInstance(); @@ -168,23 +159,22 @@ public function testParsePayPal() $this->assertSame([ 'required', ], $method->getMetaValue(TagHeader::META_SOAP_HEADERS)); - $count++; + ++$count; } } } $this->assertSame(57, $count); } - /** - * - */ + public function testParseEws() { $tagHeaderParser = self::ewsInstanceParser(); // parsing the whole structs/functions is too long for only tests purpose! $tagHeaderParser ->getGenerator() - ->getServices() - ->addService('Update', 'UpdateItemInRecoverableItems', 'string', 'string'); + ->getServices() + ->addService('Update', 'UpdateItemInRecoverableItems', 'string', 'string') + ; $tagHeaderParser->parse(); @@ -193,7 +183,7 @@ public function testParseEws() if ($services->count() > 0) { foreach ($services as $service) { foreach ($service->getMethods() as $method) { - if ($method->getName() === 'UpdateItemInRecoverableItems') { + if ('UpdateItemInRecoverableItems' === $method->getName()) { $this->assertSame([ 'ExchangeImpersonation', 'MailboxCulture', @@ -222,7 +212,7 @@ public function testParseEws() 'http://schemas.microsoft.com/exchange/services/2006/types', 'http://schemas.microsoft.com/exchange/services/2006/types', ], $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMESPACES)); - $count++; + ++$count; } } } diff --git a/tests/Parser/Wsdl/TagImportTest.php b/tests/Parser/Wsdl/TagImportTest.php index 311b3e67..0310f55c 100755 --- a/tests/Parser/Wsdl/TagImportTest.php +++ b/tests/Parser/Wsdl/TagImportTest.php @@ -1,46 +1,44 @@ assertTrue($tagImportParser->isWsdlParsed(new Wsdl($tagImportParser->getGenerator(), self::wsdlPartnerPath(), file_get_contents(self::wsdlPartnerPath())))); } - /** - * - */ + public function testGetExternalSchemas() { $tagImportParser = self::partnerInstanceParser(); @@ -59,18 +55,15 @@ public function testGetExternalSchemas() $tagImportParser->parse(); $schemaContainer = new SchemaContainer($tagImportParser->getGenerator()); - for ($i = 0; $i < 19; $i++) { - $schemaPath = realpath(sprintf(__DIR__ . '/../../resources/partner/PartnerService.%d.xsd', $i)); + for ($i = 0; $i < 19; ++$i) { + $schemaPath = realpath(sprintf(__DIR__.'/../../resources/partner/PartnerService.%d.xsd', $i)); $schema = new Schema($tagImportParser->getGenerator(), $schemaPath, file_get_contents($schemaPath)); $schemaContainer->add($schema); } - $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()->rewind(); - $this->assertEquals($schemaContainer, $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $this->assertCount($schemaContainer->count(), $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); } - /** - * - */ + public function testGetExternalSchemasScd() { $tagImportParser = self::partnerInstanceParserScd(); @@ -78,18 +71,15 @@ public function testGetExternalSchemasScd() $tagImportParser->parse(); $schemaContainer = new SchemaContainer($tagImportParser->getGenerator()); - for ($i = 0; $i < 19; $i++) { - $schemaPath = realpath(sprintf(__DIR__ . '/../../resources/partner/PartnerService.%d.xsd', $i)); + for ($i = 0; $i < 19; ++$i) { + $schemaPath = realpath(sprintf(__DIR__.'/../../resources/partner/PartnerService.%d.xsd', $i)); $schema = new Schema($tagImportParser->getGenerator(), $schemaPath, file_get_contents($schemaPath)); $schemaContainer->add($schema); } - $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()->rewind(); - $this->assertEquals($schemaContainer, $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $this->assertCount($schemaContainer->count(), $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); } - /** - * - */ + public function testGetExternalSchemasThird() { $tagImportParser = self::partnerInstanceParserThird(); @@ -97,18 +87,15 @@ public function testGetExternalSchemasThird() $tagImportParser->parse(); $schemaContainer = new SchemaContainer($tagImportParser->getGenerator()); - for ($i = 0; $i < 19; $i++) { - $schemaPath = realpath(sprintf(__DIR__ . '/../../resources/partner/PartnerService.%d.xsd', $i)); + for ($i = 0; $i < 19; ++$i) { + $schemaPath = realpath(sprintf(__DIR__.'/../../resources/partner/PartnerService.%d.xsd', $i)); $schema = new Schema($tagImportParser->getGenerator(), $schemaPath, file_get_contents($schemaPath)); $schemaContainer->add($schema); } - $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()->rewind(); - $this->assertEquals($schemaContainer, $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $this->assertCount($schemaContainer->count(), $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); } - /** - * - */ + public function testGetExternalSchemasFourth() { $tagImportParser = self::partnerInstanceParserFourth(); @@ -117,44 +104,37 @@ public function testGetExternalSchemasFourth() $schemaContainer = new SchemaContainer($tagImportParser->getGenerator()); - $schemaPath = realpath(__DIR__ . '/../../resources/docdatapayments/1_3.1.xsd'); + $schemaPath = realpath(__DIR__.'/../../resources/docdatapayments/1_3.1.xsd'); $schema = new Schema($tagImportParser->getGenerator(), $schemaPath, file_get_contents($schemaPath)); $schemaContainer->add($schema); - $schemaPath = realpath(__DIR__ . '/../../resources/docdatapayments/1_3.2.xsd'); + $schemaPath = realpath(__DIR__.'/../../resources/docdatapayments/1_3.2.xsd'); $schema = new Schema($tagImportParser->getGenerator(), $schemaPath, file_get_contents($schemaPath)); $schemaContainer->add($schema); - $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()->rewind(); - $this->assertEquals($schemaContainer, $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $this->assertCount($schemaContainer->count(), $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); } - /** - * - */ + public function testGetRestrictionFromExternalSchemas() { $tagImportParser = self::partnerInstanceParser(); $tagImportParser->parse(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagRestriction', $tagImportParser->getGenerator()->getWsdl()->getContent()->getElementByName(WsdlDocument::TAG_RESTRICTION, true)); + $this->assertInstanceOf(TagRestriction::class, $tagImportParser->getGenerator()->getWsdl()->getContent()->getElementByName(WsdlDocument::TAG_RESTRICTION, true)); } - /** - * - */ + public function testGetEnumerationByAttributesFromExternalSchemas() { $tagImportParser = self::partnerInstanceParser(); $tagImportParser->parse(); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagEnumeration', $tagImportParser->getGenerator()->getWsdl()->getContent()->getElementByNameAndAttributes(WsdlDocument::TAG_ENUMERATION, [ + $this->assertInstanceOf(TagEnumeration::class, $tagImportParser->getGenerator()->getWsdl()->getContent()->getElementByNameAndAttributes(WsdlDocument::TAG_ENUMERATION, [ 'value' => 'InternalServerError', ], true)); } - /** - * - */ + public function testGetElementsFromExternalSchemas() { $tagImportParser = self::partnerInstanceParser(); @@ -162,22 +142,24 @@ public function testGetElementsFromExternalSchemas() $tagImportParser->parse(); $restrictions = $tagImportParser->getGenerator()->getWsdl()->getContent()->getElementsByName(WsdlDocument::TAG_RESTRICTION, true); - $this->assertNotEmpty($restrictions); - $this->assertContainsOnlyInstancesOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagRestriction', $restrictions); + $this->assertCount(12, $restrictions); + $this->assertContainsOnlyInstancesOf(TagRestriction::class, $restrictions); } - /** - * - */ + public function testGetElementsByAttributeFromExternalSchemas() { $tagImportParser = self::partnerInstanceParser(); $tagImportParser->parse(); + + $this->assertCount(19, $tagImportParser->getGenerator()->getWsdl()->getSchemas()); + $this->assertCount(19, $tagImportParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $elements = $tagImportParser->getGenerator()->getWsdl()->getContent()->getElementsByNameAndAttributes(WsdlDocument::TAG_ELEMENT, [ 'name' => 'PartnerCredentials', ], null, true); - $this->assertNotEmpty($elements); - $this->assertContainsOnlyInstancesOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagElement', $elements); + $this->assertCount(2, $elements); + $this->assertContainsOnlyInstancesOf(TagElement::class, $elements); } } diff --git a/tests/Parser/Wsdl/TagIncludeTest.php b/tests/Parser/Wsdl/TagIncludeTest.php index 3a40eb11..33b20eb6 100755 --- a/tests/Parser/Wsdl/TagIncludeTest.php +++ b/tests/Parser/Wsdl/TagIncludeTest.php @@ -1,31 +1,30 @@ assertTrue($tagIncludeParser->isWsdlParsed(new Wsdl($tagIncludeParser->getGenerator(), self::wsdlImageViewServicePath(), file_get_contents(self::wsdlImageViewServicePath())))); } - /** - * - */ + public function testGetExternalSchemas() { $tagIncludeParser = self::partnerInstanceParser(); @@ -52,17 +49,14 @@ public function testGetExternalSchemas() ]; $schemaContainer = new SchemaContainer($tagIncludeParser->getGenerator()); foreach ($schemas as $schemaPath) { - $schemaPath = realpath(sprintf(__DIR__ . '/../../resources/image/%s', $schemaPath)); + $schemaPath = realpath(sprintf(__DIR__.'/../../resources/image/%s', $schemaPath)); $schema = new Schema($tagIncludeParser->getGenerator(), $schemaPath, file_get_contents($schemaPath)); $schemaContainer->add($schema); } - $tagIncludeParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()->rewind(); - $this->assertEquals($schemaContainer, $tagIncludeParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $this->assertCount($schemaContainer->count(), $tagIncludeParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); } - /** - * - */ + public function testGetExternalSchemasScd() { // import tag must be parsed first @@ -72,15 +66,14 @@ public function testGetExternalSchemasScd() $schemaContainer = new SchemaContainer($tagIncludeParser->getGenerator()); - $schema1Path = realpath(__DIR__ . '/../../resources/docdatapayments/1_3.1.xsd'); + $schema1Path = realpath(__DIR__.'/../../resources/docdatapayments/1_3.1.xsd'); $schema1 = new Schema($tagIncludeParser->getGenerator(), $schema1Path, file_get_contents($schema1Path)); $schemaContainer->add($schema1); - $schema2Path = realpath(__DIR__ . '/../../resources/docdatapayments/1_3.2.xsd'); + $schema2Path = realpath(__DIR__.'/../../resources/docdatapayments/1_3.2.xsd'); $schema2 = new Schema($tagIncludeParser->getGenerator(), $schema2Path, file_get_contents($schema2Path)); $schemaContainer->add($schema2); - $tagIncludeParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()->rewind(); - $this->assertEquals($schemaContainer, $tagIncludeParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); + $this->assertCount($schemaContainer->count(), $tagIncludeParser->getGenerator()->getWsdl()->getContent()->getExternalSchemas()); } } diff --git a/tests/Parser/Wsdl/TagInputTest.php b/tests/Parser/Wsdl/TagInputTest.php index 7edce917..a36a73cf 100755 --- a/tests/Parser/Wsdl/TagInputTest.php +++ b/tests/Parser/Wsdl/TagInputTest.php @@ -1,42 +1,38 @@ getGenerator()->getServiceMethod($methodData['name']); - if (strtolower($methodData['parameter']) === TagInput::UNKNOWN) { + if (TagInput::UNKNOWN === strtolower($methodData['parameter'])) { $this->assertNotSame(TagInput::UNKNOWN, strtolower($method->getParameterType())); - $count++; + ++$count; } } $this->assertSame(128, $count); } - /** - * - */ + public function testParseLnp() { $tagInputParser = self::lnpInstanceParser(); @@ -71,7 +65,7 @@ public function testParseLnp() foreach ($soapFunctions as $soapFunction) { $methodData = self::getMethodDataFromSoapFunction($soapFunction); $method = $tagInputParser->getGenerator()->getServiceMethod($methodData['name']); - if (strtolower($methodData['parameter']) === TagInput::UNKNOWN) { + if (TagInput::UNKNOWN === strtolower($methodData['parameter'])) { if (is_array($method->getParameterType())) { foreach ($method->getParameterType() as $methodParameterType) { $this->assertNotSame(TagInput::UNKNOWN, strtolower($methodParameterType)); @@ -79,26 +73,29 @@ public function testParseLnp() } else { $this->assertNotSame(TagInput::UNKNOWN, strtolower($method->getParameterType())); } - $count++; + ++$count; } } $this->assertSame(7, $count); } + /** * @param string $soapFunction + * * @return string[] */ public static function getMethodDataFromSoapFunction($soapFunction) { - if (stripos($soapFunction, TagInput::UNKNOWN) !== false) { + if (false !== stripos($soapFunction, TagInput::UNKNOWN)) { $parameterType = TagInput::UNKNOWN; } else { $parameterType = '[a-zA-Z_]*'; } $matches = []; preg_match(sprintf('/[a-zA-Z_]*\s([a-zA-Z_]*)\(.*(%s)\s/i', $parameterType), $soapFunction, $matches); - $name = isset($matches[1]) ? $matches[1] : ''; - $parameter = isset($matches[2]) ? $matches[2] : ''; + $name = $matches[1] ?? ''; + $parameter = $matches[2] ?? ''; + return [ 'name' => $name, 'parameter' => $parameter, diff --git a/tests/Parser/Wsdl/TagListTest.php b/tests/Parser/Wsdl/TagListTest.php index f871c75d..17e93d73 100755 --- a/tests/Parser/Wsdl/TagListTest.php +++ b/tests/Parser/Wsdl/TagListTest.php @@ -1,37 +1,34 @@ assertSame('int', $attribute->getInheritance()); - $count++; + ++$count; + break; } } + break; + case 'segment': if ($struct->getAttribute('sectionIds') instanceof StructAttribute) { $this->assertSame('int', $struct->getAttribute('sectionIds')->getInheritance()); - $count++; + ++$count; } + break; } } } $this->assertSame(4, $count); } - /** - * - */ + public function testParseMyBoard() { $tagListParser = self::myBaordInstanceParser(); @@ -83,7 +82,8 @@ public function testParseMyBoard() switch ($struct->getName()) { case 'Rights': $this->assertSame('string[]', $struct->getInheritance()); - $count++; + ++$count; + break; } } diff --git a/tests/Parser/Wsdl/TagOutputTest.php b/tests/Parser/Wsdl/TagOutputTest.php index 3b1b4b12..fe1cbd3c 100755 --- a/tests/Parser/Wsdl/TagOutputTest.php +++ b/tests/Parser/Wsdl/TagOutputTest.php @@ -1,28 +1,28 @@ getGenerator()->getServiceMethod($methodData['name']); - if (strtolower($methodData['return']) === TagOutput::UNKNOWN) { + if (TagOutput::UNKNOWN === strtolower($methodData['return'])) { $this->assertNotSame(TagOutput::UNKNOWN, strtolower($method->getReturnType())); - $count++; + ++$count; } } $this->assertSame(126, $count); } + /** * @param string $soapFunction + * * @return string[] */ public static function getMethodDataFromSoapFunction($soapFunction) { - if (stripos($soapFunction, TagOutput::UNKNOWN) === 0) { + if (0 === stripos($soapFunction, TagOutput::UNKNOWN)) { $returnType = sprintf('(%s)', TagOutput::UNKNOWN); } else { $returnType = '([a-zA-Z_]*)'; } $matches = []; preg_match(sprintf('/%s\s([a-zA-Z_]*)\(.*/i', $returnType), $soapFunction, $matches); + return [ 'name' => $matches[2], 'return' => $matches[1], diff --git a/tests/Parser/Wsdl/TagRestrictionTest.php b/tests/Parser/Wsdl/TagRestrictionTest.php index 2272b981..ce7257a0 100755 --- a/tests/Parser/Wsdl/TagRestrictionTest.php +++ b/tests/Parser/Wsdl/TagRestrictionTest.php @@ -1,43 +1,38 @@ getGenerator()->getStructs() as $struct) { - if ($struct instanceof Struct && $struct->isRestriction() === false) { - if ($struct->getName() === 'EchoRequestType') { + if ($struct instanceof Struct && false === $struct->isRestriction()) { + if ('EchoRequestType' === $struct->getName()) { $this->assertSame('string', $struct->getInheritance()); $this->assertEquals([ 'maxLength' => '100', 'base' => 'xsd:string', ], $struct->getMeta()); - $count++; - } elseif ($struct->getName() === 'PasswordType') { + ++$count; + } elseif ('PasswordType' === $struct->getName()) { $this->assertSame('string', $struct->getInheritance()); $this->assertEquals([ 'minLength' => '5', 'maxLength' => '10', 'base' => 'xsd:string', ], $struct->getMeta()); - $count++; + ++$count; } } } $this->assertEquals(2, $count); } - /** - * - */ + public function testParseActonService() { $tagRestrictionParser = self::actonInstanceParser(); @@ -79,7 +72,7 @@ public function testParseActonService() $ok = false; foreach ($tagRestrictionParser->getGenerator()->getStructs() as $struct) { if ($struct instanceof Struct) { - if ($struct->getName() === 'ID') { + if ('ID' === $struct->getName()) { $this->assertFalse($struct->isStruct()); $ok = true; } @@ -87,9 +80,7 @@ public function testParseActonService() } $this->assertTrue($ok); } - /** - * - */ + public function testParseDocDataPayments() { $tagRestrictionParser = self::docDataPaymentsViewInstanceParser(); @@ -105,15 +96,18 @@ public function testParseDocDataPayments() $this->assertSame('19', $struct->getMetaValue('minLength')); $this->assertSame('19', $struct->getMetaValue('maxLength')); $this->assertSame('normalizedString', $struct->getInheritance()); - $count++; + ++$count; } + break; + case 'emailAddress': if (!$struct->isStruct()) { $this->assertSame('[_a-zA-Z0-9\-\+\.]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]+)', $struct->getMetaValue('pattern')); $this->assertSame('string100', $struct->getInheritance()); - $count++; + ++$count; } + break; } } @@ -121,9 +115,7 @@ public function testParseDocDataPayments() $this->assertEquals(2, $count); } - /** - * - */ + public function testParseWhlMustFetchAllRestrictionPatterns() { $tagRestrictionParser = self::whlInstanceParser(); diff --git a/tests/Parser/Wsdl/TagUnionTest.php b/tests/Parser/Wsdl/TagUnionTest.php index e188236d..27285f39 100755 --- a/tests/Parser/Wsdl/TagUnionTest.php +++ b/tests/Parser/Wsdl/TagUnionTest.php @@ -1,29 +1,28 @@ getName()) { case 'RelationshipTypeOpenEnum': $this->assertSame('anyURI', $struct->getInheritance()); - $count++; + ++$count; + break; + case 'FaultCodesOpenEnumType': $this->assertSame('QName', $struct->getInheritance()); - $count++; + ++$count; + break; } } @@ -49,9 +51,6 @@ public function testParseOrderContract() $this->assertSame(2, $count); } - /** - * - */ public function testParseEws() { $tagUnionParser = self::ewsInstanceParser(); @@ -71,15 +70,18 @@ public function testParseEws() 'string', ], ], $struct->getAttribute('PropertyTag')->getMeta()); - $count++; + ++$count; + break; + case 'ItemType': $this->assertSame([ 'union' => [ 'int', ], ], $struct->getAttribute('ReminderMinutesBeforeStart')->getMeta()); - $count++; + ++$count; + break; } } diff --git a/tests/Parser/Wsdl/WsdlParser.php b/tests/Parser/Wsdl/WsdlParser.php index 4e4b9ab3..59766a42 100755 --- a/tests/Parser/Wsdl/WsdlParser.php +++ b/tests/Parser/Wsdl/WsdlParser.php @@ -1,39 +1,38 @@ parse(); } + return $generator; } } diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100755 index b76cc9e8..00000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,626 +0,0 @@ -setOrigin($wsdlPath) - ->setDestination(self::getTestDirectory()); - return new Generator($options); - } - - /** - * @return Generator - */ - public static function getBingGeneratorInstance($reset = false) - { - return self::getInstance(self::wsdlBingPath(), $reset); - } - - /** - * @return Generator - */ - public static function getOmnitureInstance() - { - return self::getInstance(self::wsdlOmniturePath()); - } - - /** - * @return Generator - */ - public static function getBullhornstaffingInstance() - { - return self::getInstance(self::wsdlBullhornstaffingPath()); - } - - /** - * @return Generator - */ - public static function getReformaInstance() - { - return self::getInstance(self::wsdlReformaPath()); - } - - /** - * @return Generator - */ - public static function getWcfInstance() - { - return self::getInstance(self::wsdlWcfPath()); - } - - /** - * @return Generator - */ - public static function getLnpInstance() - { - return self::getInstance(self::wsdlLnpPath(), true); - } - - /** - * @return Generator - */ - public static function getEwsInstance() - { - return self::getInstance(self::wsdlEwsPath()); - } - - /** - * @return Generator - */ - public static function getYandexDirectApiCampaignsInstance() - { - return self::getInstance(self::wsdlYandexDirectApiCampaignsPath()); - } - - /** - * @return Generator - */ - public static function getYandexDirectApiAdGroupsInstance() - { - return self::getInstance(self::wsdlYandexDirectApiAdGroupsPath()); - } - - /** - * @return Generator - */ - public static function getDocDataPAymentsInstance() - { - return self::getInstance(self::wsdlDocDataPaymentsPath()); - } - - /** - * @return Generator - */ - public static function getDeliveryServiceInstance() - { - return self::getInstance(self::wsdlDeliveryServicePath()); - } - - /** - * @return Generator - */ - public static function getWhlInstance($reset = false) - { - return self::getInstance(self::wsdlWhlPath(), $reset); - } - - /** - * @return Generator - */ - public static function getVehicleSelectionInstance($reset = false) - { - return self::getInstance(self::wsdlVehicleSelectionPath(), $reset); - } - - /** - * @return Generator - */ - public static function getUnitTestsInstance($reset = false) - { - return self::getInstance(self::wsdlUnitTestsPath(), $reset); - } - - /** - * @param string $wsdlPath - * @param $reset bool - * @return Generator - */ - public static function getInstance($wsdlPath, $reset = false) - { - if (!isset(self::$instances[$wsdlPath]) || $reset) { - self::$instances[$wsdlPath] = self::getGeneratorInstance($wsdlPath); - } - return self::$instances[$wsdlPath]; - } - - /** - * @param string $id - * @return Generator - */ - public static function getInstanceFromSerializedJson($id, $gatherMethods, $origin, $reset = true) - { - AbstractModel::purgeUniqueNames(); - AbstractModel::purgePhpReservedKeywords(); - if (!array_key_exists($id . $gatherMethods, self::$ids) || $reset) { - $json = file_get_contents(sprintf('%sparsed_%s_%s.json', self::getTestDirectory(), $id, $gatherMethods)); - $json = str_replace([ - '__DESTINATION__', - '__ORIGIN__', - ], [ - self::getTestDirectory(), - $origin, - ], $json); - self::$ids[$id . $gatherMethods] = Generator::instanceFromSerializedJson($json); - } - return self::$ids[$id . $gatherMethods]; - } - - /** - * @return Generator - */ - public static function bingGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('bingsearch', $gatherMethods, self::wsdlBingPath(), $reset); - } - - /** - * @return Generator - */ - public static function actonGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('actonservice2', $gatherMethods, self::wsdlActonPath(), $reset); - } - - /** - * @return Generator - */ - public static function portalGeneratorInstance($reset = true) - { - return self::getInstanceFromSerializedJson('portaplusapi', 'start', self::wsdlPortalPath(), $reset); - } - - /** - * @return Generator - */ - public static function reformaGeneratorInstance($reset = true) - { - return self::getInstanceFromSerializedJson('reformagkh', 'start', self::wsdlReformaPath(), $reset); - } - - /** - * @return Generator - */ - public static function queueGeneratorInstance($reset = true) - { - return self::getInstanceFromSerializedJson('queueservice', 'start', self::wsdlQueuePath(), $reset); - } - - /** - * @return Generator - */ - public static function omnitureGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('omnitureadminservices', $gatherMethods, self::wsdlOmniturePath(), $reset); - } - - /** - * @return Generator - */ - public static function odigeoGeneratorInstance($reset = true) - { - return self::getInstanceFromSerializedJson('odigeo', 'start', self::wsdlOdigeoPath(), $reset); - } - - /** - * @return Generator - */ - public static function payPalGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('paypal', $gatherMethods, self::wsdlPayPalPath(), $reset); - } - - /** - * @return Generator - */ - public static function wcfGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('wcf', $gatherMethods, self::wsdlWcfPath(), $reset); - } - - /** - * @return Generator - */ - public static function yandexDirectApiAdGroupsGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('yandex_groups', $gatherMethods, self::wsdlYandexDirectApiAdGroupsPath(), $reset); - } - - /** - * @return Generator - */ - public static function yandexDirectApiCampaignsGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('yandex_campaigns', $gatherMethods, self::wsdlYandexDirectApiCampaignsPath(), $reset); - } - - /** - * @return Generator - */ - public static function yandexDirectApiLiveGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('yandex_live', $gatherMethods, self::wsdlYandexDirectApiLivePath(), $reset); - } - - /** - * @return Generator - */ - public static function docDataPaymentsGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('docdatapayments', $gatherMethods, self::wsdlDocDataPaymentsPath(), $reset); - } - - /** - * @return Generator - */ - public static function deliveryServiceInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('deliveryservice', $gatherMethods, self::wsdlDeliveryServicePath(), $reset); - } - - /** - * @return Generator - */ - public static function orderContractInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('ordercontract', $gatherMethods, self::wsdlOrderContractPath(), $reset); - } - - /** - * @return Generator - */ - public static function whlInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('whl', $gatherMethods, self::wsdlWhlPath(), $reset); - } - - /** - * @return Generator - */ - public static function ewsInstance() - { - return self::getInstanceFromSerializedJson('ews', 'start', self::wsdlEwsPath()); - } - - /** - * @return Generator - */ - public static function myBoardPackGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('myboard', $gatherMethods, self::wsdlMyBoardPackPath(), $reset); - } - - /** - * @return Generator - */ - public static function vehicleSelectionPackGeneratorInstance($reset = true, $gatherMethods = GeneratorOptions::VALUE_START) - { - return self::getInstanceFromSerializedJson('vehicleselection', $gatherMethods, self::wsdlVehicleSelectionPath(), $reset); - } - - /** - * @return Generator - */ - public static function unitTestsInstance() - { - return self::getInstanceFromSerializedJson('unit_tests', 'start', self::wsdlUnitTestsPath()); - } - - /** - * @return string - */ - public static function getTestDirectory() - { - return __DIR__ . '/resources/generated/'; - } -} diff --git a/tests/WsdlHandler/Tag/TagAttributeGroupTest.php b/tests/WsdlHandler/Tag/TagAttributeGroupTest.php deleted file mode 100644 index 0acae398..00000000 --- a/tests/WsdlHandler/Tag/TagAttributeGroupTest.php +++ /dev/null @@ -1,249 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP); - $attributeRefs = [ - 'PrimaryLangID_Group', - 'ID_Group', - 'CurrencyAmountGroup', - 'CurrencyCodeGroup', - 'PrivacyGroup', - 'TelephoneAttributesGroup', - 'FormattedInd', - 'TelephoneGroup', - 'DefaultIndGroup', - 'LanguageGroup', - 'ErrorWarningAttributeGroup', - 'ErrorWarningAttributeGroup', - 'CompanyID_AttributesGroup', - 'UniqueID_Group', - 'OTA_PayloadStdAttributes', - 'BookingChannelGroup', - 'ID_OptionalGroup', - 'CurrencyAmountGroup', - 'FeeTaxGroup', - 'IssuerNameGroup', - 'TelephoneInfoGroup', - 'PrivacyGroup', - 'PaymentCardDateGroup', - 'FormattedInd', - 'PrivacyGroup', - 'PrivacyGroup', - 'DefaultIndGroup', - 'PrivacyGroup', - 'TelephoneInfoGroup', - 'PrivacyGroup', - 'DefaultIndGroup', - 'FeeTaxGroup', - 'ChargeUnitGroup', - 'PrivacyGroup', - 'PrivacyGroup', - 'DefaultIndGroup', - 'MultimediaDescriptionGroup', - 'ID_OptionalGroup', - 'MultimediaItemGroup', - 'ID_OptionalGroup', - 'MultimediaDescriptionGroup', - 'MultimediaDescriptionGroup', - 'DateTimeSpanGroup', - 'CurrencyCodeGroup', - 'TelephoneInfoGroup', - 'CitizenCountryNameGroup', - 'GenderGroup', - 'BirthDateGroup', - 'CurrencyCodeGroup', - 'ProfileTypeGroup', - 'DateTimeSpanGroup', - 'RatePlanGroup', - 'InventoryGroup', - 'CodeInfoGroup', - 'CodeInfoGroup', - 'CodeInfoGroup', - 'PositionGroup', - 'DeadlineGroup', - 'CurrencyAmountGroup', - 'CurrencyCodeGroup', - 'ID_OptionalGroup', - 'CodeInfoGroup', - 'GenderGroup', - 'ID_OptionalGroup', - 'ID_OptionalGroup', - 'TelephoneInfoGroup', - 'ID_OptionalGroup', - 'ID_OptionalGroup', - 'ID_OptionalGroup', - 'ID_OptionalGroup', - 'PositionGroup', - 'ID_OptionalGroup', - 'RoomGroup', - 'CodeInfoGroup', - 'ID_OptionalGroup', - 'ID_OptionalGroup', - 'ID_Group', - 'GuestCountGroup', - 'HotelReferenceGroup', - 'ID_Group', - 'CurrencyCodeGroup', - 'HotelReferenceGroup', - 'StatusApplicationGroup', - 'RestrictionStatusGroup', - 'OTA_PayloadStdAttributes', - 'RoomGroup', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'HotelReferenceGroup', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'OTA_PayloadStdAttributes', - 'HotelReferenceGroup', - 'OTA_PayloadStdAttributes', - ]; - $indexRef = 0; - foreach ($attributeGroups as $attributeGroup) { - if ($attributeGroup->getAttributeRef() !== '') { - $this->assertSame($attributeRefs[$indexRef++], $attributeGroup->getAttributeRef()); - } - } - } - /** - * - */ - public function testGetAttributeName() - { - $schema = WsdlTest::wsdlWhlInstance(); - $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP); - $attributeNames = [ - 'ErrorWarningAttributeGroup', - 'LanguageGroup', - 'PrimaryLangID_Group', - 'OTA_PayloadStdAttributes', - 'CompanyID_AttributesGroup', - 'UniqueID_Group', - 'ID_Group', - 'PositionGroup', - 'BookingChannelGroup', - 'NameOptionalCodeGroup', - 'CodeInfoGroup', - 'DeadlineGroup', - 'FeeTaxGroup', - 'CurrencyAmountGroup', - 'CurrencyCodeGroup', - 'IssuerNameGroup', - 'FormattedInd', - 'PrivacyGroup', - 'TelephoneAttributesGroup', - 'TelephoneGroup', - 'TelephoneInfoGroup', - 'DefaultIndGroup', - 'PaymentCardDateGroup', - 'GenderGroup', - 'MultimediaItemGroup', - 'MultimediaDescriptionGroup', - 'RoomGroup', - 'ID_OptionalGroup', - 'ChargeUnitGroup', - 'DateTimeSpanGroup', - 'GuestCountGroup', - 'BirthDateGroup', - 'ProfileTypeGroup', - 'CitizenCountryNameGroup', - 'HotelReferenceGroup', - 'RestrictionStatusGroup', - 'InventoryGroup', - 'RatePlanGroup', - 'StatusApplicationGroup', - ]; - $indexName = 0; - foreach ($attributeGroups as $attributeGroup) { - if ($attributeGroup->getAttributeName() !== '') { - $this->assertSame($attributeNames[$indexName++], $attributeGroup->getAttributeName()); - } - } - } - /** - * - */ - public function testGetReferencingElements() - { - $schema = WsdlTest::wsdlWhlInstance(); - $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP); - $attributeGroupCounts = [ - 'ErrorWarningAttributeGroup' => 2, - 'LanguageGroup' => 1, - 'PrimaryLangID_Group' => 20, - 'OTA_PayloadStdAttributes' => 20, - 'CompanyID_AttributesGroup' => 1, - 'UniqueID_Group' => 1, - 'ID_Group' => 3, - 'PositionGroup' => 2, - 'BookingChannelGroup' => 1, - 'NameOptionalCodeGroup' => 0, - 'CodeInfoGroup' => 5, - 'DeadlineGroup' => 1, - 'FeeTaxGroup' => 2, - 'CurrencyAmountGroup' => 4, - 'CurrencyCodeGroup' => 8, - 'IssuerNameGroup' => 1, - 'FormattedInd' => 5, - 'PrivacyGroup' => 11, - 'TelephoneAttributesGroup' => 4, - 'TelephoneGroup' => 4, - 'TelephoneInfoGroup' => 4, - 'DefaultIndGroup' => 4, - 'PaymentCardDateGroup' => 1, - 'GenderGroup' => 2, - 'MultimediaItemGroup' => 1, - 'MultimediaDescriptionGroup' => 3, - 'RoomGroup' => 2, - 'ID_OptionalGroup' => 13, - 'ChargeUnitGroup' => 1, - 'DateTimeSpanGroup' => 2, - 'GuestCountGroup' => 1, - 'BirthDateGroup' => 1, - 'ProfileTypeGroup' => 1, - 'CitizenCountryNameGroup' => 1, - 'HotelReferenceGroup' => 4, - 'RestrictionStatusGroup' => 1, - 'InventoryGroup' => 1, - 'RatePlanGroup' => 1, - 'StatusApplicationGroup' => 1, - ]; - $testedCount = 0; - /** @var TagAttributeGroup $attributeGroup */ - foreach ($attributeGroups as $attributeGroup) { - if ($attributeGroup->getAttributeName() !== '') { - $elements = $attributeGroup->getReferencingElements(); - $this->assertCount($attributeGroupCounts[$attributeGroup->getAttributeName()], $elements, sprintf('Failed with attributeGroup is "%s"', $attributeGroup->getAttributeName())); - $this->assertContainsOnlyInstancesOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\Tag', $elements); - $testedCount++; - } - } - $this->assertCount($testedCount, $attributeGroupCounts); - } -} diff --git a/tests/WsdlHandler/Tag/TagAttributeTest.php b/tests/WsdlHandler/Tag/TagAttributeTest.php deleted file mode 100644 index c3b91ffe..00000000 --- a/tests/WsdlHandler/Tag/TagAttributeTest.php +++ /dev/null @@ -1,29 +0,0 @@ -getContent()->getElementByNameAndAttributes(Wsdl::TAG_ATTRIBUTE, [ - 'name' => 'ShortText', - 'type' => 'whlsoap:StringLength1to64', - 'use' => 'optional', - ]); - $this->assertInstanceOf('WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagAttribute', $attribute); - $parent = $attribute->getSuitableParent(); - $this->assertInstanceOf('WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagAttributeGroup', $parent); - $this->assertSame(Wsdl::TAG_ATTRIBUTE_GROUP, $parent->getName()); - } -} diff --git a/tests/WsdlHandler/Tag/TagChoiceTest.php b/tests/WsdlHandler/Tag/TagChoiceTest.php deleted file mode 100644 index c282f900..00000000 --- a/tests/WsdlHandler/Tag/TagChoiceTest.php +++ /dev/null @@ -1,312 +0,0 @@ -assertSame([ - 'element', - 'group', - 'choice', - 'any', - ], TagChoice::getChildrenElementsTags()); - } - - public function testGetForbiddenParentTagsMustReturnTheListOfForbiddenParentTags() - { - $this->assertSame([ - 'complexType', - ], TagChoice::getForbiddenParentTags()); - } - - public function testGetChildrenElementsMustReturnAnArray() - { - $schema = WsdlTest::schemaEwsMessagesInstance(); - - /** @var TagChoice $choice */ - $choice = $schema->getContent()->getElementByName(Wsdl::TAG_CHOICE); - - $this->assertTrue(is_array($choice->getChildrenElements())); - } - - /** - * - * - * - * - */ - public function testGetChildrenElementsMustReturnDirectChildrenTags() - { - $schema = WsdlTest::schemaEwsMessagesInstance(); - - /** @var TagChoice $choice */ - $choice = $schema->getContent()->getElementByNameAndAttributes(Wsdl::TAG_CHOICE, [ - 'maxOccurs' => '1', - 'minOccurs' => '0', - ]); - - $children = $choice->getChildrenElements(); - - $this->assertCount(2, $children); - $this->assertSame('IndexedPageFolderView', $children[0]->getAttributeName()); - $this->assertSame('FractionalPageFolderView', $children[1]->getAttributeName()); - } - - /** - * - * - * - * Formatted text content. - * - * - * - * - * An image for this paragraph. - * - * - * - * - * A URL for this paragraph. - * - * - * - * - * Formatted text content and an associated item or sequence number. - * - * - * - * - * - * - * The item or sequence number. - * - * - * - * - * - * - * - */ - public function testGetChildrenElementsMustReturnNestedChildrenTags() - { - $schema = WsdlTest::wsdlWhlInstance(); - - /** @var TagChoice $choice */ - $choice = $schema->getContent()->getElementByNameAndAttributes(Wsdl::TAG_CHOICE, [ - 'minOccurs' => '0', - 'maxOccurs' => 'unbounded', - ]); - - $children = $choice->getChildrenElements(); - - $this->assertCount(4, $children); - $this->assertSame('Text', $children[0]->getAttributeName()); - $this->assertSame('Image', $children[1]->getAttributeName()); - $this->assertSame('URL', $children[2]->getAttributeName()); - $this->assertSame('ListItem', $children[3]->getAttributeName()); - } - - /** - * - - The Hotel Descriptive Info Response is a message used to provide detailed descriptive information about a hotel property. - - - - - - - The presence of the empty Success element explicitly indicates that the OpenTravel message succeeded. - - - - - Used in conjunction with the Success element to define one or more business errors. - - - - - A collection of hotel descriptive information. - - - - - - Hotel descriptive information. - - - - - - - Used to identify the specific hotel. - - - - - - - - - - - - - Errors are returned if the request was unable to be processed. - - - - - - This element defines standard attributes that appear on the root element for all OpenTravel Messages. - - - - - */ - public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfHotelDescriptiveInfoRS() - { - $schema = WsdlTest::wsdlWhlInstance(); - - /** @var TagChoice $choice */ - $choice = $schema->getContent()->getElementByNameAndAttributes(Wsdl::TAG_ELEMENT, [ - 'name' => 'HotelDescriptiveInfoRS', - ])->getChildByNameAndAttributes(Wsdl::TAG_CHOICE, []); - - $children = $choice->getChildrenElements(); - - $this->assertCount(4, $children); - $this->assertSame('Success', $children[0]->getAttributeName()); - $this->assertSame('Warnings', $children[1]->getAttributeName()); - $this->assertSame('HotelDescriptiveContents', $children[2]->getAttributeName()); - $this->assertSame('Errors', $children[3]->getAttributeName()); - } - - /** - * - - Returns information about hotel availability that meet the requested criteria. - - - - - - - The presence of the empty Success element explicitly indicates that the request message was successful. - - - - - Used in conjunction with the Success element to define one or more business errors. - - - - - A collection of details on the Room Stay including Guest Counts, Time Span of this Room Stay, and financial information related to the Room Stay, including Guarantee, Deposit and Payment and Cancellation Penalties. - - - - - - Details on the Room Stay including Guest Counts, Time Span of this Room Stay, and financial information related to the Room Stay, including Guarantee, Deposit and Payment and Cancellation Penalties. - - - - - - - Used to specify an availability status at the room stay level for a property. - - - - - - - - - - - - - Errors are returned if the request was unable to be processed. - - - - - - This element defines standard attributes that appear on the root element for all OpenTravel Messages. - - - - - */ - public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfHotelAvailRS() - { - $schema = WsdlTest::wsdlWhlInstance(); - - /** @var TagChoice $choice */ - $choice = $schema->getContent()->getElementByNameAndAttributes(Wsdl::TAG_ELEMENT, [ - 'name' => 'HotelAvailRS', - ])->getChildByNameAndAttributes(Wsdl::TAG_CHOICE, []); - - $children = $choice->getChildrenElements(); - - $this->assertCount(4, $children); - $this->assertSame('Success', $children[0]->getAttributeName()); - $this->assertSame('Warnings', $children[1]->getAttributeName()); - $this->assertSame('RoomStays', $children[2]->getAttributeName()); - $this->assertSame('Errors', $children[3]->getAttributeName()); - } - - /** - * - - - - - - - - - - - - - - - - - - - - - - - - - */ - public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfDetails() - { - $schema = WsdlTest::wsdlDeliveryInstance(); - - /** @var TagChoice $choice */ - $choice = $schema->getContent()->getElementByNameAndAttributes(Wsdl::TAG_ELEMENT, [ - 'name' => 'details', - 'form' => 'qualified', - 'minOccurs' => 0, - ])->getChildByNameAndAttributes(Wsdl::TAG_CHOICE, []); - - $children = $choice->getChildrenElements(); - - $this->assertCount(17, $children); - $this->assertSame('mutualSettlementDetailCalcCostShipping', $children[0]->getAttributeRef()); - $this->assertSame('mutualSettlementDetailRegisterStorage', $children[16]->getAttributeRef()); - } -} diff --git a/tests/WsdlHandler/Tag/TagDocumentationTest.php b/tests/WsdlHandler/Tag/TagDocumentationTest.php deleted file mode 100644 index 82047ee8..00000000 --- a/tests/WsdlHandler/Tag/TagDocumentationTest.php +++ /dev/null @@ -1,45 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_DOCUMENTATION); - $ok = false; - foreach ($documentations as $documentation) { - $parent = $documentation->getSuitableParent(); - if ($parent instanceof AbstractTag) { - $this->assertSame('availRequest', $parent->getAttributeName()); - $ok = true; - } - } - $this->assertTrue($ok); - } - /** - * - */ - public function testGetSuitableParentAsEnumeration() - { - $wsdl = WsdlTest::wsdlEbayInstance(); - $enumeration = $wsdl->getContent()->getElementByNameAndAttributes(Wsdl::TAG_ENUMERATION, [ - 'value' => 'Success', - ]); - $this->assertSame('Success', $enumeration->getValue()); - $documentation = $enumeration->getChildByNameAndAttributes(Wsdl::TAG_DOCUMENTATION, []); - $this->assertSame('(out) Request processing succeeded', $documentation->getValue()); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagDocumentation', $documentation); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagEnumeration', $documentation->getSuitableParent()); - $this->assertSame($enumeration->getValue(), $documentation->getSuitableParent()->getValue()); - } -} diff --git a/tests/WsdlHandler/Tag/TagEnumerationTest.php b/tests/WsdlHandler/Tag/TagEnumerationTest.php deleted file mode 100644 index f1113acb..00000000 --- a/tests/WsdlHandler/Tag/TagEnumerationTest.php +++ /dev/null @@ -1,24 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_ENUMERATION); - - foreach ($enumerations as $index => $enumeration) { - $this->assertSame(sprintf('0%s', $index + 1), $enumeration->getValue()); - } - } -} diff --git a/tests/WsdlHandler/Tag/TagHeaderTest.php b/tests/WsdlHandler/Tag/TagHeaderTest.php deleted file mode 100644 index 40188465..00000000 --- a/tests/WsdlHandler/Tag/TagHeaderTest.php +++ /dev/null @@ -1,112 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_HEADER); - - foreach ($headers as $header) { - if ($header->getParentInput() instanceof TagInput) { - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagOperation', $header->getParentOperation()); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagInput', $header->getParentInput()); - $this->assertSame('RequesterCredentials', $header->getAttributePart()); - $this->assertSame('RequesterCredentials', $header->getAttributeMessage()); - $this->assertSame('', $header->getAttributeNamespace()); - } - } - } - /** - * - */ - public function testGetMessage() - { - $wsdl = WsdlTest::wsdlEbayInstance(); - - $header = $wsdl->getContent()->getElementByName(Wsdl::TAG_HEADER); - - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagMessage', $header->getMessage()); - } - /** - * - */ - public function testGetPart() - { - $wsdl = WsdlTest::wsdlEbayInstance(); - - $header = $wsdl->getContent()->getElementByName(Wsdl::TAG_HEADER); - - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagPart', $header->getPartTag()); - } - /** - * - */ - public function testGetPartFinalType() - { - $wsdl = WsdlTest::wsdlEbayInstance(); - - $header = $wsdl->getContent()->getElementByName(Wsdl::TAG_HEADER); - - $this->assertSame('CustomSecurityHeaderType', $header->getPartTag()->getFinalType()); - } - /** - * - */ - public function testGetPartFinalNamespace() - { - $wsdl = WsdlTest::wsdlEbayInstance(); - - $header = $wsdl->getContent()->getElementByName(Wsdl::TAG_HEADER); - - $this->assertSame('ns', $header->getPartTag()->getFinalNamespace()); - } - /** - * - */ - public function testGetHeaderNamespace() - { - $wsdl = WsdlTest::wsdlEbayInstance(); - - $header = $wsdl->getContent()->getElementByName(Wsdl::TAG_HEADER); - - $this->assertSame('urn:ebay:apis:eBLBaseComponents', $header->getHeaderNamespace()); - } - /** - * - */ - public function testGetAttributeRequired() - { - $wsdl = WsdlTest::wsdlActonInstance(); - - $binding = $wsdl->getContent()->getElementByNameAndAttributes(Wsdl::TAG_BINDING, [ - 'name' => 'SoapBinding', - 'type' => 'tns:SOAP', - ]); - - $operation = $binding->getChildByNameAndAttributes(Wsdl::TAG_OPERATION, [ - 'name' => 'list', - ]); - - $sessionHeader = $operation->getChildByNameAndAttributes(Wsdl::TAG_HEADER, [ - 'part' => 'SessionHeader', - ]); - $clusterHeader = $operation->getChildByNameAndAttributes(Wsdl::TAG_HEADER, [ - 'part' => 'ClusterHeader', - ]); - - $this->assertFalse($sessionHeader->getAttributeRequired()); - $this->assertTrue($clusterHeader->getAttributeRequired()); - } -} diff --git a/tests/WsdlHandler/Tag/TagImportTest.php b/tests/WsdlHandler/Tag/TagImportTest.php deleted file mode 100644 index 3258a5ca..00000000 --- a/tests/WsdlHandler/Tag/TagImportTest.php +++ /dev/null @@ -1,27 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_IMPORT); - - $count = 0; - foreach ($imports as $index => $import) { - $this->assertSame(sprintf('PartnerService.%d.xsd', $index), $import->getLocationAttribute()); - $count++; - } - $this->assertSame(19, $count); - } -} diff --git a/tests/WsdlHandler/Tag/TagListTest.php b/tests/WsdlHandler/Tag/TagListTest.php deleted file mode 100644 index eb64fe6c..00000000 --- a/tests/WsdlHandler/Tag/TagListTest.php +++ /dev/null @@ -1,73 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_LIST); - - $this->assertCount(4, $lists); - - /** @var TagList $list */ - foreach ($lists as $list) { - $this->assertSame('int', $list->getItemType()); - } - } - - public function testGetItemTypeMustReturnCorrespondingValueFromRestrictionChildOrItemType() - { - $wsdl = WsdlTest::schemaEwsTypesInstance(); - $lists = $wsdl->getContent()->getElementsByName(Wsdl::TAG_LIST); - $types = [ - 'string', - 'string', - 'string', - 'string', - 'string', - 'DayOfWeekType', - 'string', - 'string', - 'string', - 'string', - 'string', - 'string', - 'string', - 'string', - 'string', - ]; - $itemTypes = [ - '', - '', - '', - '', - '', - 'DayOfWeekType', - '', - '', - '', - '', - '', - '', - '', - '', - '', - ]; - - $this->assertCount(15, $lists); - - /** @var TagList $list */ - foreach ($lists as $index => $list) { - $this->assertSame($itemTypes[$index], $list->getAttributeItemType()); - $this->assertSame($types[$index], $list->getItemType()); - } - } -} diff --git a/tests/WsdlHandler/Tag/TagMessageTest.php b/tests/WsdlHandler/Tag/TagMessageTest.php deleted file mode 100644 index feb2d55d..00000000 --- a/tests/WsdlHandler/Tag/TagMessageTest.php +++ /dev/null @@ -1,22 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_MESSAGE); - - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagPart', $messages[0]->getPart('RequesterCredentials')); - } -} diff --git a/tests/WsdlHandler/Tag/TagRestrictionTest.php b/tests/WsdlHandler/Tag/TagRestrictionTest.php deleted file mode 100644 index 4b811a2b..00000000 --- a/tests/WsdlHandler/Tag/TagRestrictionTest.php +++ /dev/null @@ -1,27 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_RESTRICTION); - - /** @var TagRestriction $restriction */ - foreach ($restrictions as $restriction) { - $this->assertTrue($restriction->isEnumeration()); - $this->assertTrue($restriction->hasAttributeBase()); - } - } -} diff --git a/tests/WsdlHandler/Tag/TagUnionTest.php b/tests/WsdlHandler/Tag/TagUnionTest.php deleted file mode 100644 index 468e8d0d..00000000 --- a/tests/WsdlHandler/Tag/TagUnionTest.php +++ /dev/null @@ -1,124 +0,0 @@ -getContent()->getElementsByName(Wsdl::TAG_UNION); - - $this->assertCount(2, $unions); - - $ok = false; - foreach ($unions as $union) { - switch ($union->getSuitableParent()->getAttributeName()) { - case 'RelationshipTypeOpenEnum': - $this->assertSame([ - 'RelationshipType', - 'anyURI', - ], $union->getAttributeMemberTypes()); - $ok |= true; - break; - case 'FaultCodesOpenEnumType': - $this->assertSame([ - 'FaultCodesType', - 'QName', - ], $union->getAttributeMemberTypes()); - $ok |= true; - break; - } - } - $this->assertTrue((bool) $ok); - } - /** - * - */ - public function testHasMemberTypesAsChildrenMustReturnFalse() - { - $wsdl = WsdlTest::wsdlOrderContractInstance(); - - $unions = $wsdl->getContent()->getElementsByName(Wsdl::TAG_UNION); - - $this->assertCount(2, $unions); - - $tests = 0; - /** @var TagUnion $union */ - foreach ($unions as $union) { - switch ($union->getSuitableParent()->getAttributeName()) { - case 'RelationshipTypeOpenEnum': - $this->assertFalse($union->hasMemberTypesAsChildren()); - $tests++; - break; - case 'FaultCodesOpenEnumType': - $this->assertFalse($union->hasMemberTypesAsChildren()); - $tests++; - break; - } - } - - $this->assertSame(2, $tests); - } - /** - * - */ - public function testHasMemberTypesAsChildrenMustReturnTrue() - { - $schema = WsdlTest::schemaEwsTypesInstance(); - - $unions = $schema->getContent()->getElementsByName(Wsdl::TAG_UNION); - - $tests = 0; - /** @var TagUnion $union */ - foreach ($unions as $union) { - switch ($union->getSuitableParent()->getAttributeName()) { - case 'ReminderMinutesBeforeStartType': - $this->assertTrue($union->hasMemberTypesAsChildren()); - $tests++; - break; - case 'PropertyTagType': - $this->assertTrue($union->hasMemberTypesAsChildren()); - $tests++; - break; - } - } - - $this->assertSame(2, $tests); - } - /** - * - */ - public function testGetMemberTypesChildrenMustReturnTheChildren() - { - $schema = WsdlTest::schemaEwsTypesInstance(); - - $unions = $schema->getContent()->getElementsByName(Wsdl::TAG_UNION); - - $tests = 0; - /** @var TagUnion $union */ - foreach ($unions as $union) { - switch ($union->getSuitableParent()->getAttributeName()) { - case 'ReminderMinutesBeforeStartType': - $this->assertCount(2, $union->getMemberTypesChildren()); - $tests++; - break; - case 'PropertyTagType': - $this->assertCount(1, $union->getMemberTypesChildren()); - $tests++; - break; - } - } - - $this->assertSame(2, $tests); - } -} diff --git a/tests/WsdlHandler/WsdlHandlerTest.php b/tests/WsdlHandler/WsdlHandlerTest.php deleted file mode 100644 index f941f6ed..00000000 --- a/tests/WsdlHandler/WsdlHandlerTest.php +++ /dev/null @@ -1,92 +0,0 @@ -load(__DIR__ . '/../resources/ebaySvc.wsdl'); - self::$ebayInstance = new Wsdl($doc, self::getBingGeneratorInstance()); - } - return self::$ebayInstance; - } - /** - * @return WsdlHandler - */ - public static function bingInstance() - { - if (!isset(self::$bingInstance)) { - $doc = new \DOMDocument('1.0', 'utf-8'); - $doc->load(__DIR__ . '/../resources/bingsearch.wsdl'); - self::$bingInstance = new Wsdl($doc, self::getBingGeneratorInstance()); - } - return self::$bingInstance; - } - /** - * @return WsdlHandler - */ - public static function partnerInstance() - { - if (!isset(self::$partnerInstance)) { - $doc = new \DOMDocument('1.0', 'utf-8'); - $doc->load(__DIR__ . '/../resources/PartnerService.wsdl'); - self::$partnerInstance = new Wsdl($doc, self::getBingGeneratorInstance()); - } - return self::$partnerInstance; - } - /** - * @return WsdlHandler - */ - public static function aukroInstance() - { - if (!isset(self::$aukroInstance)) { - $doc = new \DOMDocument('1.0', 'utf-8'); - $doc->load(__DIR__ . '/../resources/aukro.wsdl'); - self::$aukroInstance = new Wsdl($doc, self::getBingGeneratorInstance()); - } - return self::$aukroInstance; - } - /** - * - */ - public function testGetElementByNameFromWsdl() - { - $bing = self::bingInstance(); - - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagComplexType', $bing->getElementByName(Wsdl::TAG_COMPLEX_TYPE)); - } - /** - * - */ - public function testGetRootElement() - { - $bing = self::bingInstance(); - - $this->assertSame('definitions', $bing->getRootElement()->getName()); - $this->assertInstanceOf('\WsdlToPhp\PackageGenerator\WsdlHandler\Tag\TagDefinitions', $bing->getRootElement()); - } - public function testGetNamespaceUri() - { - $bing = self::bingInstance(); - - $this->assertSame('http://www.w3.org/2001/XMLSchema-instance', $bing->getNamespaceUri('xsi')); - $this->assertSame('http://schemas.xmlsoap.org/wsdl/soap/', $bing->getNamespaceUri('soap')); - $this->assertSame('http://schemas.xmlsoap.org/wsdl/', $bing->getNamespaceUri('wsdl')); - $this->assertSame('http://schemas.xmlsoap.org/ws/2004/08/addressing', $bing->getNamespaceUri('wsa')); - $this->assertSame('http://schemas.microsoft.com/LiveSearch/2008/03/Search', $bing->getNamespaceUri('tns')); - $this->assertSame('http://www.w3.org/2001/XMLSchema', $bing->getNamespaceUri('xsd')); - } -} diff --git a/tests/generate_serialized_jsons.php b/tests/generate_serialized_jsons.php index cbb4e6a5..3329bc2f 100644 --- a/tests/generate_serialized_jsons.php +++ b/tests/generate_serialized_jsons.php @@ -1,158 +1,159 @@ [ - 'origin' => __DIR__ . '/resources/unit_tests.wsdl', + 'origin' => __DIR__.'/resources/unit_tests.wsdl', 'methods' => [ 'none', 'start', ], ], 'bingsearch' => [ - 'origin' => __DIR__ . '/resources/bingsearch.wsdl', + 'origin' => __DIR__.'/resources/bingsearch.wsdl', 'methods' => [ 'none', 'start', ], ], 'actonservice2' => [ - 'origin' => __DIR__ . '/resources/ActonService2.local.wsdl', + 'origin' => __DIR__.'/resources/ActonService2.local.wsdl', 'methods' => [ 'none', 'start', ], ], 'portaplusapi' => [ - 'origin' => __DIR__ . '/resources/portaplusapi.wsdl', + 'origin' => __DIR__.'/resources/portaplusapi.wsdl', 'methods' => [ 'none', 'start', ], ], 'reformagkh' => [ - 'origin' => __DIR__ . '/resources/reformagkh.wsdl', + 'origin' => __DIR__.'/resources/reformagkh.wsdl', 'methods' => [ 'none', 'start', ], ], 'queueservice' => [ - 'origin' => __DIR__ . '/resources/QueueService.wsdl', + 'origin' => __DIR__.'/resources/QueueService.wsdl', 'methods' => [ 'none', 'start', ], ], 'omnitureadminservices' => [ - 'origin' => __DIR__ . '/resources/OmnitureAdminServices.wsdl', + 'origin' => __DIR__.'/resources/OmnitureAdminServices.wsdl', 'methods' => [ 'none', 'start', ], ], 'odigeo' => [ - 'origin' => __DIR__ . '/resources/odigeo.wsdl', + 'origin' => __DIR__.'/resources/odigeo.wsdl', 'methods' => [ 'none', 'start', ], ], 'paypal' => [ - 'origin' => __DIR__ . '/resources/paypal/PayPalSvc.wsdl', + 'origin' => __DIR__.'/resources/paypal/PayPalSvc.wsdl', 'methods' => [ 'none', 'start', ], ], 'wcf' => [ - 'origin' => __DIR__ . '/resources/wcf/Service1.wsdl', + 'origin' => __DIR__.'/resources/wcf/Service1.wsdl', 'methods' => [ 'none', 'start', ], ], 'ews' => [ - 'origin' => __DIR__ . '/resources/ews/services.wsdl', + 'origin' => __DIR__.'/resources/ews/services.wsdl', 'methods' => [ 'none', 'start', ], ], 'yandex_groups' => [ - 'origin' => __DIR__ . '/resources/directapi/adgroups.wsdl', + 'origin' => __DIR__.'/resources/directapi/adgroups.wsdl', 'methods' => [ 'none', 'start', ], ], 'yandex_campaigns' => [ - 'origin' => __DIR__ . '/resources/directapi/campaigns.wsdl', + 'origin' => __DIR__.'/resources/directapi/campaigns.wsdl', 'methods' => [ 'none', 'start', ], ], 'yandex_live' => [ - 'origin' => __DIR__ . '/resources/directapi/live.wsdl', + 'origin' => __DIR__.'/resources/directapi/live.wsdl', 'methods' => [ 'none', 'start', ], ], 'docdatapayments' => [ - 'origin' => __DIR__ . '/resources/docdatapayments/1_3.wsdl', + 'origin' => __DIR__.'/resources/docdatapayments/1_3.wsdl', 'methods' => [ 'none', 'start', ], ], 'deliveryservice' => [ - 'origin' => __DIR__ . '/resources/DeliveryService.wsdl', + 'origin' => __DIR__.'/resources/DeliveryService.wsdl', 'methods' => [ 'none', 'start', ], ], 'deliveryservice' => [ - 'origin' => __DIR__ . '/resources/DeliveryService.wsdl', + 'origin' => __DIR__.'/resources/DeliveryService.wsdl', 'methods' => [ 'none', 'start', ], ], 'ordercontract' => [ - 'origin' => __DIR__ . '/resources/OrderContract.wsdl', + 'origin' => __DIR__.'/resources/OrderContract.wsdl', 'methods' => [ 'none', 'start', ], ], 'whl' => [ - 'origin' => __DIR__ . '/resources/whl.wsdl', + 'origin' => __DIR__.'/resources/whl.wsdl', 'methods' => [ 'none', 'start', ], ], 'myboard' => [ - 'origin' => __DIR__ . '/resources/MyBoardPack.wsdl', + 'origin' => __DIR__.'/resources/MyBoardPack.wsdl', 'methods' => [ 'none', 'start', ], ], 'vehicleselection' => [ - 'origin' => __DIR__ . '/resources/VehicleSelectionService/VehicleSelectionService.wsdl', + 'origin' => __DIR__.'/resources/VehicleSelectionService/VehicleSelectionService.wsdl', 'methods' => [ 'none', 'start', @@ -162,7 +163,7 @@ foreach ($jsons as $id => $settings) { foreach ($settings['methods'] as $gatherMethod) { - fwrite(STDERR, PHP_EOL . sprintf('Start generation of %sparsed_%s_%s.json', TestCase::getTestDirectory(), $id, $gatherMethod)); + fwrite(STDERR, PHP_EOL.sprintf('Start generation of %sparsed_%s_%s.json', AbstractTestCase::getTestDirectory(), $id, $gatherMethod)); AbstractModel::purgeUniqueNames(); AbstractModel::purgePhpReservedKeywords(); $options = GeneratorOptions::instance() @@ -172,15 +173,16 @@ ->setOrigin($settings['origin']) ->setGatherMethods($gatherMethod) ->setPrefix('Api') - ->setDestination(TestCase::getTestDirectory()) + ->setDestination(AbstractTestCase::getTestDirectory()) ->setSchemasSave(false) - ->setSchemasFolder('wsdl'); + ->setSchemasFolder('wsdl') + ; $generator = new Generator($options); $generator->parse(); $json = json_encode($generator, JSON_PRETTY_PRINT); $json = str_replace(json_encode($settings['origin']), '"__ORIGIN__"', $json); - $json = str_replace(json_encode(TestCase::getTestDirectory()), '"__DESTINATION__"', $json); - file_put_contents(sprintf('%sparsed_%s_%s.json', TestCase::getTestDirectory(), $id, $gatherMethod), $json); + $json = str_replace(json_encode(AbstractTestCase::getTestDirectory()), '"__DESTINATION__"', $json); + file_put_contents(sprintf('%sparsed_%s_%s.json', AbstractTestCase::getTestDirectory(), $id, $gatherMethod), $json); fwrite(STDERR, ' -> generated'); } } diff --git a/tests/resources/existing_config/wsdltophp.yml b/tests/resources/existing_config/wsdltophp.yml index ca97fa03..96f5feb8 100644 --- a/tests/resources/existing_config/wsdltophp.yml +++ b/tests/resources/existing_config/wsdltophp.yml @@ -27,13 +27,13 @@ standalone: default: true values: [ true, false ] struct_class: - default: '\WsdlToPhp\PackageBase\AbstractStructBase' + default: 'WsdlToPhp\PackageBase\AbstractStructBase' values: '' struct_array_class: - default: '\WsdlToPhp\PackageBase\AbstractStructArrayBase' + default: 'WsdlToPhp\PackageBase\AbstractStructArrayBase' values: '' soap_client_class: - default: '\WsdlToPhp\PackageBase\AbstractSoapClientBase' + default: 'WsdlToPhp\PackageBase\AbstractSoapClientBase' values: '' origin: default: '' diff --git a/tests/resources/generated/ValidActonApiService.php b/tests/resources/generated/ValidActonApiService.php index 5e5fa7a0..bd39b8eb 100755 --- a/tests/resources/generated/ValidActonApiService.php +++ b/tests/resources/generated/ValidActonApiService.php @@ -1,8 +1,11 @@ setSoapHeader($nameSpace, 'ClusterHeader', $clusterHeader, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'ClusterHeader', $clusterHeader, $mustUnderstand, $actor); } /** * Sets the SessionHeader SoapHeader param * @uses AbstractSoapClientBase::setSoapHeader() * @param \Api\StructType\ApiSessionHeader $sessionHeader - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiService */ - public function setSoapHeaderSessionHeader(\Api\StructType\ApiSessionHeader $sessionHeader, $nameSpace = 'urn:api.actonsoftware.com', $mustUnderstand = false, $actor = null) + public function setSoapHeaderSessionHeader(\Api\StructType\ApiSessionHeader $sessionHeader, string $namespace = 'urn:api.actonsoftware.com', bool $mustUnderstand = false, ?string $actor = null): self { - return $this->setSoapHeader($nameSpace, 'SessionHeader', $sessionHeader, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'SessionHeader', $sessionHeader, $mustUnderstand, $actor); } /** * Method to call the operation originally named login @@ -48,7 +51,6 @@ public function setSoapHeaderSessionHeader(\Api\StructType\ApiSessionHeader $ses * - documentation: Login to the service. This must be the first call to obtain the SessionID for all subsequent API calls * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiLogin $parameter * @return \Api\StructType\ApiLoginResponse|bool @@ -56,12 +58,14 @@ public function setSoapHeaderSessionHeader(\Api\StructType\ApiSessionHeader $ses public function login(\Api\StructType\ApiLogin $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('login', array( + $this->setResult($resultLogin = $this->getSoapClient()->__soapCall('login', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -75,7 +79,6 @@ public function login(\Api\StructType\ApiLogin $parameter) * - documentation: Schedule an email to be sent. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSendEmail $parameter * @return \Api\StructType\ApiSendEmailResponse|bool @@ -83,12 +86,14 @@ public function login(\Api\StructType\ApiLogin $parameter) public function sendEmail(\Api\StructType\ApiSendEmail $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('sendEmail', array( + $this->setResult($resultSendEmail = $this->getSoapClient()->__soapCall('sendEmail', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSendEmail; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -102,7 +107,6 @@ public function sendEmail(\Api\StructType\ApiSendEmail $parameter) * - documentation: Obtain a listing of different types of items in the system (e.g. CONTACT_LISTS) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiList $parameter * @return \Api\StructType\ApiListResponse|bool @@ -110,12 +114,14 @@ public function sendEmail(\Api\StructType\ApiSendEmail $parameter) public function _list(\Api\StructType\ApiList $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('list', array( + $this->setResult($resultList = $this->getSoapClient()->__soapCall('list', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -129,7 +135,6 @@ public function _list(\Api\StructType\ApiList $parameter) * - documentation: Upload a new contact list or merge records into an existing list. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiUploadList $parameter * @return \Api\StructType\ApiUploadListResponse|bool @@ -137,12 +142,14 @@ public function _list(\Api\StructType\ApiList $parameter) public function uploadList(\Api\StructType\ApiUploadList $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('uploadList', array( + $this->setResult($resultUploadList = $this->getSoapClient()->__soapCall('uploadList', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUploadList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -156,7 +163,6 @@ public function uploadList(\Api\StructType\ApiUploadList $parameter) * - documentation: Poll for the results of an asynchronous running upload/merge request * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetUploadResultRequest $parameter * @return \Api\StructType\ApiGetUploadResultResponse|bool @@ -164,12 +170,14 @@ public function uploadList(\Api\StructType\ApiUploadList $parameter) public function getUploadResult(\Api\StructType\ApiGetUploadResultRequest $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('getUploadResult', array( + $this->setResult($resultGetUploadResult = $this->getSoapClient()->__soapCall('getUploadResult', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetUploadResult; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -183,7 +191,6 @@ public function getUploadResult(\Api\StructType\ApiGetUploadResultRequest $param * - documentation: Download the records of a contact list * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDownloadList $parameter * @return \Api\StructType\ApiAttachmentType|bool @@ -191,12 +198,14 @@ public function getUploadResult(\Api\StructType\ApiGetUploadResultRequest $param public function downloadList(\Api\StructType\ApiDownloadList $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('downloadList', array( + $this->setResult($resultDownloadList = $this->getSoapClient()->__soapCall('downloadList', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDownloadList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -209,7 +218,6 @@ public function downloadList(\Api\StructType\ApiDownloadList $parameter) * - SOAPHeaders: optional, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiMessageReport $parameter * @return \Api\StructType\ApiMessageReportResponse|bool @@ -217,12 +225,14 @@ public function downloadList(\Api\StructType\ApiDownloadList $parameter) public function messageReport(\Api\StructType\ApiMessageReport $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('messageReport', array( + $this->setResult($resultMessageReport = $this->getSoapClient()->__soapCall('messageReport', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultMessageReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -235,7 +245,6 @@ public function messageReport(\Api\StructType\ApiMessageReport $parameter) * - SOAPHeaders: optional, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDeleteList $parameter * @return void|bool @@ -243,12 +252,14 @@ public function messageReport(\Api\StructType\ApiMessageReport $parameter) public function deleteList(\Api\StructType\ApiDeleteList $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('deleteList', array( + $this->setResult($resultDeleteList = $this->getSoapClient()->__soapCall('deleteList', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDeleteList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidActonClassMap.php b/tests/resources/generated/ValidActonClassMap.php index 01118eef..1a77b7cb 100755 --- a/tests/resources/generated/ValidActonClassMap.php +++ b/tests/resources/generated/ValidActonClassMap.php @@ -1,5 +1,7 @@ '\\Api\\StructType\\ApiBase64Binary', 'hexBinary' => '\\Api\\StructType\\ApiHexBinary', 'AttachmentType' => '\\Api\\StructType\\ApiAttachmentType', @@ -59,6 +61,6 @@ final public static function get() 'actionRecordDetailType' => '\\Api\\StructType\\ApiActionRecordDetailType', 'actionRecord' => '\\Api\\StructType\\ApiActionRecord', 'contactField' => '\\Api\\StructType\\ApiContactField', - ); + ]; } } diff --git a/tests/resources/generated/ValidActonClassMapWihoutNamespace.php b/tests/resources/generated/ValidActonClassMapWihoutNamespace.php index 0b29b098..e7b008cc 100644 --- a/tests/resources/generated/ValidActonClassMapWihoutNamespace.php +++ b/tests/resources/generated/ValidActonClassMapWihoutNamespace.php @@ -1,7 +1,8 @@ '\\StructType\\Base64Binary', 'hexBinary' => '\\StructType\\HexBinary', 'AttachmentType' => '\\StructType\\AttachmentType', @@ -56,6 +57,6 @@ final public static function get() 'actionRecordDetailType' => '\\StructType\\ActionRecordDetailType', 'actionRecord' => '\\StructType\\ActionRecord', 'contactField' => '\\StructType\\ContactField', - ); + ]; } } diff --git a/tests/resources/generated/ValidActonClassMapWihoutNamespaceAndCategory.php b/tests/resources/generated/ValidActonClassMapWihoutNamespaceAndCategory.php index d190ad4a..0e3c0e68 100644 --- a/tests/resources/generated/ValidActonClassMapWihoutNamespaceAndCategory.php +++ b/tests/resources/generated/ValidActonClassMapWihoutNamespaceAndCategory.php @@ -1,7 +1,8 @@ 'Base64Binary', 'hexBinary' => 'HexBinary', 'AttachmentType' => 'AttachmentType', @@ -56,6 +57,6 @@ final public static function get() 'actionRecordDetailType' => 'ActionRecordDetailType', 'actionRecord' => 'ActionRecord', 'contactField' => 'ContactField', - ); + ]; } } diff --git a/tests/resources/generated/ValidActonNoneTutorial.php b/tests/resources/generated/ValidActonNoneTutorial.php index 24e1ad7d..0931efd0 100755 --- a/tests/resources/generated/ValidActonNoneTutorial.php +++ b/tests/resources/generated/ValidActonNoneTutorial.php @@ -5,22 +5,22 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... */ require_once __DIR__ . '/vendor/autoload.php'; /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), +]; /** * Samples for Service ServiceType */ diff --git a/tests/resources/generated/ValidActonTutorial.php b/tests/resources/generated/ValidActonTutorial.php index 84432b71..e8320361 100755 --- a/tests/resources/generated/ValidActonTutorial.php +++ b/tests/resources/generated/ValidActonTutorial.php @@ -5,22 +5,22 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... */ require_once __DIR__ . '/vendor/autoload.php'; /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), +]; /** * Samples for Login ServiceType */ diff --git a/tests/resources/generated/ValidAdGroupsSelectionCriteria.php b/tests/resources/generated/ValidAdGroupsSelectionCriteria.php index 28ee6364..f3b3b1ae 100644 --- a/tests/resources/generated/ValidAdGroupsSelectionCriteria.php +++ b/tests/resources/generated/ValidAdGroupsSelectionCriteria.php @@ -1,8 +1,11 @@ setCampaignIds($campaignIds) @@ -98,9 +101,9 @@ public function __construct(array $campaignIds = array(), array $ids = array(), } /** * Get CampaignIds value - * @return int[]|null + * @return int[] */ - public function getCampaignIds() + public function getCampaignIds(): array { return $this->CampaignIds; } @@ -110,7 +113,7 @@ public function getCampaignIds() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateCampaignIdsForArrayConstraintsFromSetCampaignIds(array $values = array()) + public static function validateCampaignIdsForArrayConstraintsFromSetCampaignIds(array $values = []): string { $message = ''; $invalidValues = []; @@ -121,46 +124,49 @@ public static function validateCampaignIdsForArrayConstraintsFromSetCampaignIds( } } if (!empty($invalidValues)) { - $message = sprintf('The CampaignIds property can only contain items of type long, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + $message = sprintf('The CampaignIds property can only contain items of type int, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set CampaignIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int[] $campaignIds * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setCampaignIds(array $campaignIds = array()) + public function setCampaignIds(array $campaignIds = []): self { // validation for constraint: array if ('' !== ($campaignIdsArrayErrorMessage = self::validateCampaignIdsForArrayConstraintsFromSetCampaignIds($campaignIds))) { - throw new \InvalidArgumentException($campaignIdsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($campaignIdsArrayErrorMessage, __LINE__); } $this->CampaignIds = $campaignIds; + return $this; } /** * Add item to CampaignIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToCampaignIds($item) + public function addToCampaignIds(int $item): self { // validation for constraint: itemType if (!(is_int($item) || ctype_digit($item))) { - throw new \InvalidArgumentException(sprintf('The CampaignIds property can only contain items of type long, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The CampaignIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->CampaignIds[] = $item; + return $this; } /** * Get Ids value - * @return int[]|null + * @return int[] */ - public function getIds() + public function getIds(): array { return $this->Ids; } @@ -170,7 +176,7 @@ public function getIds() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateIdsForArrayConstraintsFromSetIds(array $values = array()) + public static function validateIdsForArrayConstraintsFromSetIds(array $values = []): string { $message = ''; $invalidValues = []; @@ -181,46 +187,49 @@ public static function validateIdsForArrayConstraintsFromSetIds(array $values = } } if (!empty($invalidValues)) { - $message = sprintf('The Ids property can only contain items of type long, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + $message = sprintf('The Ids property can only contain items of type int, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Ids value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int[] $ids * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setIds(array $ids = array()) + public function setIds(array $ids = []): self { // validation for constraint: array if ('' !== ($idsArrayErrorMessage = self::validateIdsForArrayConstraintsFromSetIds($ids))) { - throw new \InvalidArgumentException($idsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($idsArrayErrorMessage, __LINE__); } $this->Ids = $ids; + return $this; } /** * Add item to Ids value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToIds($item) + public function addToIds(int $item): self { // validation for constraint: itemType if (!(is_int($item) || ctype_digit($item))) { - throw new \InvalidArgumentException(sprintf('The Ids property can only contain items of type long, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Ids property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->Ids[] = $item; + return $this; } /** * Get Types value - * @return string[]|null + * @return string[] */ - public function getTypes() + public function getTypes(): array { return $this->Types; } @@ -230,7 +239,7 @@ public function getTypes() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateTypesForArrayConstraintsFromSetTypes(array $values = array()) + public static function validateTypesForArrayConstraintsFromSetTypes(array $values = []): string { $message = ''; $invalidValues = []; @@ -244,47 +253,50 @@ public static function validateTypesForArrayConstraintsFromSetTypes(array $value $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAdGroupTypesEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \Api\EnumType\ApiAdGroupTypesEnum::getValidValues())); } unset($invalidValues); + return $message; } /** * Set Types value * @uses \Api\EnumType\ApiAdGroupTypesEnum::valueIsValid() * @uses \Api\EnumType\ApiAdGroupTypesEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $types * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setTypes(array $types = array()) + public function setTypes(array $types = []): self { // validation for constraint: array if ('' !== ($typesArrayErrorMessage = self::validateTypesForArrayConstraintsFromSetTypes($types))) { - throw new \InvalidArgumentException($typesArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($typesArrayErrorMessage, __LINE__); } $this->Types = $types; + return $this; } /** * Add item to Types value * @uses \Api\EnumType\ApiAdGroupTypesEnum::valueIsValid() * @uses \Api\EnumType\ApiAdGroupTypesEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToTypes($item) + public function addToTypes(string $item): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiAdGroupTypesEnum::valueIsValid($item)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAdGroupTypesEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiAdGroupTypesEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAdGroupTypesEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiAdGroupTypesEnum::getValidValues())), __LINE__); } $this->Types[] = $item; + return $this; } /** * Get Statuses value - * @return string[]|null + * @return string[] */ - public function getStatuses() + public function getStatuses(): array { return $this->Statuses; } @@ -294,7 +306,7 @@ public function getStatuses() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateStatusesForArrayConstraintsFromSetStatuses(array $values = array()) + public static function validateStatusesForArrayConstraintsFromSetStatuses(array $values = []): string { $message = ''; $invalidValues = []; @@ -308,47 +320,50 @@ public static function validateStatusesForArrayConstraintsFromSetStatuses(array $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiStatusSelectionEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \Api\EnumType\ApiStatusSelectionEnum::getValidValues())); } unset($invalidValues); + return $message; } /** * Set Statuses value * @uses \Api\EnumType\ApiStatusSelectionEnum::valueIsValid() * @uses \Api\EnumType\ApiStatusSelectionEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $statuses * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setStatuses(array $statuses = array()) + public function setStatuses(array $statuses = []): self { // validation for constraint: array if ('' !== ($statusesArrayErrorMessage = self::validateStatusesForArrayConstraintsFromSetStatuses($statuses))) { - throw new \InvalidArgumentException($statusesArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($statusesArrayErrorMessage, __LINE__); } $this->Statuses = $statuses; + return $this; } /** * Add item to Statuses value * @uses \Api\EnumType\ApiStatusSelectionEnum::valueIsValid() * @uses \Api\EnumType\ApiStatusSelectionEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToStatuses($item) + public function addToStatuses(string $item): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiStatusSelectionEnum::valueIsValid($item)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiStatusSelectionEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiStatusSelectionEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiStatusSelectionEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiStatusSelectionEnum::getValidValues())), __LINE__); } $this->Statuses[] = $item; + return $this; } /** * Get TagIds value - * @return int[]|null + * @return int[] */ - public function getTagIds() + public function getTagIds(): array { return $this->TagIds; } @@ -358,7 +373,7 @@ public function getTagIds() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateTagIdsForArrayConstraintsFromSetTagIds(array $values = array()) + public static function validateTagIdsForArrayConstraintsFromSetTagIds(array $values = []): string { $message = ''; $invalidValues = []; @@ -369,46 +384,49 @@ public static function validateTagIdsForArrayConstraintsFromSetTagIds(array $val } } if (!empty($invalidValues)) { - $message = sprintf('The TagIds property can only contain items of type long, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + $message = sprintf('The TagIds property can only contain items of type int, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set TagIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int[] $tagIds * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setTagIds(array $tagIds = array()) + public function setTagIds(array $tagIds = []): self { // validation for constraint: array if ('' !== ($tagIdsArrayErrorMessage = self::validateTagIdsForArrayConstraintsFromSetTagIds($tagIds))) { - throw new \InvalidArgumentException($tagIdsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($tagIdsArrayErrorMessage, __LINE__); } $this->TagIds = $tagIds; + return $this; } /** * Add item to TagIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToTagIds($item) + public function addToTagIds(int $item): self { // validation for constraint: itemType if (!(is_int($item) || ctype_digit($item))) { - throw new \InvalidArgumentException(sprintf('The TagIds property can only contain items of type long, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The TagIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->TagIds[] = $item; + return $this; } /** * Get Tags value - * @return string[]|null + * @return string[] */ - public function getTags() + public function getTags(): array { return $this->Tags; } @@ -418,7 +436,7 @@ public function getTags() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateTagsForArrayConstraintsFromSetTags(array $values = array()) + public static function validateTagsForArrayConstraintsFromSetTags(array $values = []): string { $message = ''; $invalidValues = []; @@ -432,43 +450,46 @@ public static function validateTagsForArrayConstraintsFromSetTags(array $values $message = sprintf('The Tags property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Tags value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $tags * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setTags(array $tags = array()) + public function setTags(array $tags = []): self { // validation for constraint: array if ('' !== ($tagsArrayErrorMessage = self::validateTagsForArrayConstraintsFromSetTags($tags))) { - throw new \InvalidArgumentException($tagsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($tagsArrayErrorMessage, __LINE__); } $this->Tags = $tags; + return $this; } /** * Add item to Tags value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToTags($item) + public function addToTags(string $item): self { // validation for constraint: itemType if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The Tags property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Tags property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->Tags[] = $item; + return $this; } /** * Get AppIconStatuses value - * @return string[]|null + * @return string[] */ - public function getAppIconStatuses() + public function getAppIconStatuses(): array { return $this->AppIconStatuses; } @@ -478,7 +499,7 @@ public function getAppIconStatuses() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAppIconStatusesForArrayConstraintsFromSetAppIconStatuses(array $values = array()) + public static function validateAppIconStatusesForArrayConstraintsFromSetAppIconStatuses(array $values = []): string { $message = ''; $invalidValues = []; @@ -492,40 +513,43 @@ public static function validateAppIconStatusesForArrayConstraintsFromSetAppIconS $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiStatusSelectionEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \Api\EnumType\ApiStatusSelectionEnum::getValidValues())); } unset($invalidValues); + return $message; } /** * Set AppIconStatuses value * @uses \Api\EnumType\ApiStatusSelectionEnum::valueIsValid() * @uses \Api\EnumType\ApiStatusSelectionEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $appIconStatuses * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function setAppIconStatuses(array $appIconStatuses = array()) + public function setAppIconStatuses(array $appIconStatuses = []): self { // validation for constraint: array if ('' !== ($appIconStatusesArrayErrorMessage = self::validateAppIconStatusesForArrayConstraintsFromSetAppIconStatuses($appIconStatuses))) { - throw new \InvalidArgumentException($appIconStatusesArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($appIconStatusesArrayErrorMessage, __LINE__); } $this->AppIconStatuses = $appIconStatuses; + return $this; } /** * Add item to AppIconStatuses value * @uses \Api\EnumType\ApiStatusSelectionEnum::valueIsValid() * @uses \Api\EnumType\ApiStatusSelectionEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiAdGroupsSelectionCriteria */ - public function addToAppIconStatuses($item) + public function addToAppIconStatuses(string $item): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiStatusSelectionEnum::valueIsValid($item)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiStatusSelectionEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiStatusSelectionEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiStatusSelectionEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiStatusSelectionEnum::getValidValues())), __LINE__); } $this->AppIconStatuses[] = $item; + return $this; } } diff --git a/tests/resources/generated/ValidAddRequest.php b/tests/resources/generated/ValidAddRequest.php index 7e4fd4b8..fdcbe36a 100644 --- a/tests/resources/generated/ValidAddRequest.php +++ b/tests/resources/generated/ValidAddRequest.php @@ -1,8 +1,11 @@ setAdGroups($adGroups); @@ -34,7 +37,7 @@ public function __construct(array $adGroups = array()) * Get AdGroups value * @return \Api\StructType\ApiAdGroupAddItem[] */ - public function getAdGroups() + public function getAdGroups(): array { return $this->AdGroups; } @@ -44,7 +47,7 @@ public function getAdGroups() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAdGroupsForArrayConstraintsFromSetAdGroups(array $values = array()) + public static function validateAdGroupsForArrayConstraintsFromSetAdGroups(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,36 +61,39 @@ public static function validateAdGroupsForArrayConstraintsFromSetAdGroups(array $message = sprintf('The AdGroups property can only contain items of type \Api\StructType\ApiAdGroupAddItem, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set AdGroups value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiAdGroupAddItem[] $adGroups * @return \Api\StructType\ApiAddRequest */ - public function setAdGroups(array $adGroups = array()) + public function setAdGroups(array $adGroups): self { // validation for constraint: array if ('' !== ($adGroupsArrayErrorMessage = self::validateAdGroupsForArrayConstraintsFromSetAdGroups($adGroups))) { - throw new \InvalidArgumentException($adGroupsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($adGroupsArrayErrorMessage, __LINE__); } $this->AdGroups = $adGroups; + return $this; } /** * Add item to AdGroups value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiAdGroupAddItem $item * @return \Api\StructType\ApiAddRequest */ - public function addToAdGroups(\Api\StructType\ApiAdGroupAddItem $item) + public function addToAdGroups(\Api\StructType\ApiAdGroupAddItem $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiAdGroupAddItem) { - throw new \InvalidArgumentException(sprintf('The AdGroups property can only contain items of type \Api\StructType\ApiAdGroupAddItem, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The AdGroups property can only contain items of type \Api\StructType\ApiAdGroupAddItem, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->AdGroups[] = $item; + return $this; } } diff --git a/tests/resources/generated/ValidAddRequestRepeatedMaxOccurs.php b/tests/resources/generated/ValidAddRequestRepeatedMaxOccurs.php index 1bb92ce0..c655374e 100644 --- a/tests/resources/generated/ValidAddRequestRepeatedMaxOccurs.php +++ b/tests/resources/generated/ValidAddRequestRepeatedMaxOccurs.php @@ -1,8 +1,11 @@ setAdGroups($adGroups); @@ -34,7 +37,7 @@ public function __construct(array $adGroups = array()) * Get AdGroups value * @return \Api\StructType\ApiAdGroupAddItem[] */ - public function getAdGroups() + public function getAdGroups(): array { return $this->AdGroups; } @@ -44,7 +47,7 @@ public function getAdGroups() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAdGroupsForArrayConstraintsFromSetAdGroups(array $values = array()) + public static function validateAdGroupsForArrayConstraintsFromSetAdGroups(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,36 +61,39 @@ public static function validateAdGroupsForArrayConstraintsFromSetAdGroups(array $message = sprintf('The AdGroups property can only contain items of type \Api\StructType\ApiAdGroupAddItem, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set AdGroups value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiAdGroupAddItem[] $adGroups * @return \Api\StructType\ApiAddRequest */ - public function setAdGroups(array $adGroups = array()) + public function setAdGroups(array $adGroups): self { // validation for constraint: array if ('' !== ($adGroupsArrayErrorMessage = self::validateAdGroupsForArrayConstraintsFromSetAdGroups($adGroups))) { - throw new \InvalidArgumentException($adGroupsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($adGroupsArrayErrorMessage, __LINE__); } $this->AdGroups = $adGroups; + return $this; } /** * Add item to AdGroups value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiAdGroupAddItem $item * @return \Api\StructType\ApiAddRequest */ - public function addToAdGroups(\Api\StructType\ApiAdGroupAddItem $item) + public function addToAdGroups(\Api\StructType\ApiAdGroupAddItem $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiAdGroupAddItem) { - throw new \InvalidArgumentException(sprintf('The AdGroups property can only contain items of type \Api\StructType\ApiAdGroupAddItem, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The AdGroups property can only contain items of type \Api\StructType\ApiAdGroupAddItem, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->AdGroups[] = $item; + return $this; } } diff --git a/tests/resources/generated/ValidAddress.php b/tests/resources/generated/ValidAddress.php index 2ded6973..cff29e8a 100644 --- a/tests/resources/generated/ValidAddress.php +++ b/tests/resources/generated/ValidAddress.php @@ -1,8 +1,11 @@ setСубъектРФ($СубъектРФ) @@ -94,7 +97,7 @@ public function __construct($СубъектРФ = null, \Api\StructType\ApiСв * Get СубъектРФ value * @return string|null */ - public function getСубъектРФ() + public function getСубъектРФ(): ?string { return $this->СубъектРФ; } @@ -103,20 +106,21 @@ public function getСубъектРФ() * @param string $СубъектРФ * @return \Api\StructType\ApiАдресРФ */ - public function setСубъектРФ($СубъектРФ = null) + public function setСубъектРФ(?string $СубъектРФ = null): self { // validation for constraint: string if (!is_null($СубъектРФ) && !is_string($СубъектРФ)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($СубъектРФ, true), gettype($СубъектРФ)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($СубъектРФ, true), gettype($СубъектРФ)), __LINE__); } $this->СубъектРФ = $СубъектРФ; + return $this; } /** * Get СвРайМО value * @return \Api\StructType\ApiСвРайМО|null */ - public function getСвРайМО() + public function getСвРайМО(): ?\Api\StructType\ApiСвРайМО { return $this->СвРайМО; } @@ -125,16 +129,17 @@ public function getСвРайМО() * @param \Api\StructType\ApiСвРайМО $СвРайМО * @return \Api\StructType\ApiАдресРФ */ - public function setСвРайМО(\Api\StructType\ApiСвРайМО $СвРайМО = null) + public function setСвРайМО(?\Api\StructType\ApiСвРайМО $СвРайМО = null): self { $this->СвРайМО = $СвРайМО; + return $this; } /** * Get Город value * @return string|null */ - public function getГород() + public function getГород(): ?string { return $this->Город; } @@ -143,20 +148,21 @@ public function getГород() * @param string $Город * @return \Api\StructType\ApiАдресРФ */ - public function setГород($Город = null) + public function setГород(?string $Город = null): self { // validation for constraint: string if (!is_null($Город) && !is_string($Город)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($Город, true), gettype($Город)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($Город, true), gettype($Город)), __LINE__); } $this->Город = $Город; + return $this; } /** * Get ВнутригРайон value * @return string|null */ - public function getВнутригРайон() + public function getВнутригРайон(): ?string { return $this->ВнутригРайон; } @@ -165,20 +171,21 @@ public function getВнутригРайон() * @param string $ВнутригРайон * @return \Api\StructType\ApiАдресРФ */ - public function setВнутригРайон($ВнутригРайон = null) + public function setВнутригРайон(?string $ВнутригРайон = null): self { // validation for constraint: string if (!is_null($ВнутригРайон) && !is_string($ВнутригРайон)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($ВнутригРайон, true), gettype($ВнутригРайон)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($ВнутригРайон, true), gettype($ВнутригРайон)), __LINE__); } $this->ВнутригРайон = $ВнутригРайон; + return $this; } /** * Get НаселПункт value * @return string|null */ - public function getНаселПункт() + public function getНаселПункт(): ?string { return $this->НаселПункт; } @@ -187,20 +194,21 @@ public function getНаселПункт() * @param string $НаселПункт * @return \Api\StructType\ApiАдресРФ */ - public function setНаселПункт($НаселПункт = null) + public function setНаселПункт(?string $НаселПункт = null): self { // validation for constraint: string if (!is_null($НаселПункт) && !is_string($НаселПункт)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($НаселПункт, true), gettype($НаселПункт)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($НаселПункт, true), gettype($НаселПункт)), __LINE__); } $this->НаселПункт = $НаселПункт; + return $this; } /** * Get Улица value * @return string|null */ - public function getУлица() + public function getУлица(): ?string { return $this->Улица; } @@ -209,20 +217,21 @@ public function getУлица() * @param string $Улица * @return \Api\StructType\ApiАдресРФ */ - public function setУлица($Улица = null) + public function setУлица(?string $Улица = null): self { // validation for constraint: string if (!is_null($Улица) && !is_string($Улица)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($Улица, true), gettype($Улица)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($Улица, true), gettype($Улица)), __LINE__); } $this->Улица = $Улица; + return $this; } /** * Get ДопАдрЭл value - * @return \Api\StructType\ApiДопАдрЭл[]|null + * @return \Api\StructType\ApiДопАдрЭл[] */ - public function getДопАдрЭл() + public function getДопАдрЭл(): array { return $this->ДопАдрЭл; } @@ -232,7 +241,7 @@ public function getДопАдрЭл() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateДопАдрЭлForArrayConstraintsFromSetДопАдрЭл(array $values = array()) + public static function validateДопАдрЭлForArrayConstraintsFromSetДопАдрЭл(array $values = []): string { $message = ''; $invalidValues = []; @@ -246,36 +255,39 @@ public static function validateДопАдрЭлForArrayConstraintsFromSetДоп $message = sprintf('The ДопАдрЭл property can only contain items of type \Api\StructType\ApiДопАдрЭл, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set ДопАдрЭл value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiДопАдрЭл[] $ДопАдрЭл * @return \Api\StructType\ApiАдресРФ */ - public function setДопАдрЭл(array $ДопАдрЭл = array()) + public function setДопАдрЭл(array $ДопАдрЭл = []): self { // validation for constraint: array if ('' !== ($ДопАдрЭлArrayErrorMessage = self::validateДопАдрЭлForArrayConstraintsFromSetДопАдрЭл($ДопАдрЭл))) { - throw new \InvalidArgumentException($ДопАдрЭлArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($ДопАдрЭлArrayErrorMessage, __LINE__); } $this->ДопАдрЭл = $ДопАдрЭл; + return $this; } /** * Add item to ДопАдрЭл value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiДопАдрЭл $item * @return \Api\StructType\ApiАдресРФ */ - public function addToДопАдрЭл(\Api\StructType\ApiДопАдрЭл $item) + public function addToДопАдрЭл(\Api\StructType\ApiДопАдрЭл $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiДопАдрЭл) { - throw new \InvalidArgumentException(sprintf('The ДопАдрЭл property can only contain items of type \Api\StructType\ApiДопАдрЭл, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The ДопАдрЭл property can only contain items of type \Api\StructType\ApiДопАдрЭл, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->ДопАдрЭл[] = $item; + return $this; } } diff --git a/tests/resources/generated/ValidAddressDelivery_Type.php b/tests/resources/generated/ValidAddressDelivery_Type.php index c6922709..697338dd 100644 --- a/tests/resources/generated/ValidAddressDelivery_Type.php +++ b/tests/resources/generated/ValidAddressDelivery_Type.php @@ -1,8 +1,11 @@ setStreet1($street1) @@ -81,7 +84,7 @@ public function __construct($street1 = null, $street2 = null, $street3 = null, $ * Get Street1 value * @return string|null */ - public function getStreet1() + public function getStreet1(): ?string { return $this->Street1; } @@ -90,20 +93,21 @@ public function getStreet1() * @param string $street1 * @return \Api\StructType\ApiAddressDelivery_Type */ - public function setStreet1($street1 = null) + public function setStreet1(?string $street1 = null): self { // validation for constraint: string if (!is_null($street1) && !is_string($street1)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street1, true), gettype($street1)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street1, true), gettype($street1)), __LINE__); } $this->Street1 = $street1; + return $this; } /** * Get Street2 value * @return string|null */ - public function getStreet2() + public function getStreet2(): ?string { return $this->Street2; } @@ -112,20 +116,21 @@ public function getStreet2() * @param string $street2 * @return \Api\StructType\ApiAddressDelivery_Type */ - public function setStreet2($street2 = null) + public function setStreet2(?string $street2 = null): self { // validation for constraint: string if (!is_null($street2) && !is_string($street2)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street2, true), gettype($street2)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street2, true), gettype($street2)), __LINE__); } $this->Street2 = $street2; + return $this; } /** * Get Street3 value * @return string|null */ - public function getStreet3() + public function getStreet3(): ?string { return $this->Street3; } @@ -134,20 +139,21 @@ public function getStreet3() * @param string $street3 * @return \Api\StructType\ApiAddressDelivery_Type */ - public function setStreet3($street3 = null) + public function setStreet3(?string $street3 = null): self { // validation for constraint: string if (!is_null($street3) && !is_string($street3)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street3, true), gettype($street3)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street3, true), gettype($street3)), __LINE__); } $this->Street3 = $street3; + return $this; } /** * Get City value * @return string|null */ - public function getCity() + public function getCity(): ?string { return $this->City; } @@ -156,20 +162,21 @@ public function getCity() * @param string $city * @return \Api\StructType\ApiAddressDelivery_Type */ - public function setCity($city = null) + public function setCity(?string $city = null): self { // validation for constraint: string if (!is_null($city) && !is_string($city)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($city, true), gettype($city)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($city, true), gettype($city)), __LINE__); } $this->City = $city; + return $this; } /** * Get PostalCode value * @return string|null */ - public function getPostalCode() + public function getPostalCode(): ?string { return $this->PostalCode; } @@ -178,17 +185,18 @@ public function getPostalCode() * @param string $postalCode * @return \Api\StructType\ApiAddressDelivery_Type */ - public function setPostalCode($postalCode = null) + public function setPostalCode(?string $postalCode = null): self { // validation for constraint: string if (!is_null($postalCode) && !is_string($postalCode)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($postalCode, true), gettype($postalCode)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($postalCode, true), gettype($postalCode)), __LINE__); } // validation for constraint: length(4) - if (!is_null($postalCode) && mb_strlen($postalCode) !== 4) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be equal to 4', mb_strlen($postalCode)), __LINE__); + if (!is_null($postalCode) && mb_strlen((string) $postalCode) !== 4) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be equal to 4', mb_strlen((string) $postalCode)), __LINE__); } $this->PostalCode = $postalCode; + return $this; } } diff --git a/tests/resources/generated/ValidAddressType.php b/tests/resources/generated/ValidAddressType.php index aa93947c..88b41a2c 100644 --- a/tests/resources/generated/ValidAddressType.php +++ b/tests/resources/generated/ValidAddressType.php @@ -1,8 +1,11 @@ setStreetNmbr($streetNmbr) @@ -171,7 +174,7 @@ public function __construct(\Api\StructType\ApiStreetNmbr $streetNmbr = null, ar * Get StreetNmbr value * @return \Api\StructType\ApiStreetNmbr|null */ - public function getStreetNmbr() + public function getStreetNmbr(): ?\Api\StructType\ApiStreetNmbr { return $this->StreetNmbr; } @@ -180,16 +183,17 @@ public function getStreetNmbr() * @param \Api\StructType\ApiStreetNmbr $streetNmbr * @return \Api\StructType\ApiAddressType */ - public function setStreetNmbr(\Api\StructType\ApiStreetNmbr $streetNmbr = null) + public function setStreetNmbr(?\Api\StructType\ApiStreetNmbr $streetNmbr = null): self { $this->StreetNmbr = $streetNmbr; + return $this; } /** * Get AddressLine value - * @return string[]|null + * @return string[] */ - public function getAddressLine() + public function getAddressLine(): array { return $this->AddressLine; } @@ -199,7 +203,7 @@ public function getAddressLine() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAddressLineForArrayConstraintsFromSetAddressLine(array $values = array()) + public static function validateAddressLineForArrayConstraintsFromSetAddressLine(array $values = []): string { $message = ''; $invalidValues = []; @@ -213,6 +217,7 @@ public static function validateAddressLineForArrayConstraintsFromSetAddressLine( $message = sprintf('The AddressLine property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** @@ -222,13 +227,13 @@ public static function validateAddressLineForArrayConstraintsFromSetAddressLine( * @param mixed $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAddressLineForMaxLengthConstraintFromSetAddressLine($values) + public static function validateAddressLineForMaxLengthConstraintFromSetAddressLine($values): string { $message = ''; $invalidValues = []; foreach ($values as $addressTypeAddressLineItem) { // validation for constraint: maxLength(255) - if (mb_strlen($addressTypeAddressLineItem) > 255) { + if (mb_strlen((string) $addressTypeAddressLineItem) > 255) { $invalidValues[] = var_export($addressTypeAddressLineItem, true); } } @@ -236,6 +241,7 @@ public static function validateAddressLineForMaxLengthConstraintFromSetAddressLi $message = sprintf('Invalid length for value(s) %s, the number of characters/octets contained by the literal must be less than or equal to 255', implode(', ', $invalidValues)); } unset($invalidValues); + return $message; } /** @@ -245,13 +251,13 @@ public static function validateAddressLineForMaxLengthConstraintFromSetAddressLi * @param mixed $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAddressLineForMinLengthConstraintFromSetAddressLine($values) + public static function validateAddressLineForMinLengthConstraintFromSetAddressLine($values): string { $message = ''; $invalidValues = []; foreach ($values as $addressTypeAddressLineItem) { // validation for constraint: minLength(1) - if (mb_strlen($addressTypeAddressLineItem) < 1) { + if (mb_strlen((string) $addressTypeAddressLineItem) < 1) { $invalidValues[] = var_export($addressTypeAddressLineItem, true); } } @@ -259,67 +265,70 @@ public static function validateAddressLineForMinLengthConstraintFromSetAddressLi $message = sprintf('Invalid length for value(s) %s, the number of characters/octets contained by the literal must be greater than or equal to 1', implode(', ', $invalidValues)); } unset($invalidValues); + return $message; } /** * Set AddressLine value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $addressLine * @return \Api\StructType\ApiAddressType */ - public function setAddressLine(array $addressLine = array()) + public function setAddressLine(array $addressLine = []): self { // validation for constraint: array if ('' !== ($addressLineArrayErrorMessage = self::validateAddressLineForArrayConstraintsFromSetAddressLine($addressLine))) { - throw new \InvalidArgumentException($addressLineArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($addressLineArrayErrorMessage, __LINE__); } // validation for constraint: maxLength(255) if ('' !== ($addressLineMaxLengthErrorMessage = self::validateAddressLineForMaxLengthConstraintFromSetAddressLine($addressLine))) { - throw new \InvalidArgumentException($addressLineMaxLengthErrorMessage, __LINE__); + throw new InvalidArgumentException($addressLineMaxLengthErrorMessage, __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($addressLine) && count($addressLine) > 5) { - throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($addressLine)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($addressLine)), __LINE__); } // validation for constraint: minLength(1) if ('' !== ($addressLineMinLengthErrorMessage = self::validateAddressLineForMinLengthConstraintFromSetAddressLine($addressLine))) { - throw new \InvalidArgumentException($addressLineMinLengthErrorMessage, __LINE__); + throw new InvalidArgumentException($addressLineMinLengthErrorMessage, __LINE__); } $this->AddressLine = $addressLine; + return $this; } /** * Add item to AddressLine value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiAddressType */ - public function addToAddressLine($item) + public function addToAddressLine(string $item): self { // validation for constraint: itemType if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The AddressLine property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The AddressLine property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } // validation for constraint: maxLength(255) - if (mb_strlen($item) > 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($item)), __LINE__); + if (mb_strlen((string) $item) > 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) $item)), __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($this->AddressLine) && count($this->AddressLine) >= 5) { - throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->AddressLine)), __LINE__); + throw new InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->AddressLine)), __LINE__); } // validation for constraint: minLength(1) - if (mb_strlen($item) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($item)), __LINE__); + if (mb_strlen((string) $item) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $item)), __LINE__); } $this->AddressLine[] = $item; + return $this; } /** * Get CityName value * @return string|null */ - public function getCityName() + public function getCityName(): ?string { return $this->CityName; } @@ -328,28 +337,29 @@ public function getCityName() * @param string $cityName * @return \Api\StructType\ApiAddressType */ - public function setCityName($cityName = null) + public function setCityName(?string $cityName = null): self { // validation for constraint: string if (!is_null($cityName) && !is_string($cityName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cityName, true), gettype($cityName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cityName, true), gettype($cityName)), __LINE__); } // validation for constraint: maxLength(64) - if (!is_null($cityName) && mb_strlen($cityName) > 64) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 64', mb_strlen($cityName)), __LINE__); + if (!is_null($cityName) && mb_strlen((string) $cityName) > 64) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 64', mb_strlen((string) $cityName)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($cityName) && mb_strlen($cityName) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($cityName)), __LINE__); + if (!is_null($cityName) && mb_strlen((string) $cityName) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $cityName)), __LINE__); } $this->CityName = $cityName; + return $this; } /** * Get PostalCode value * @return string|null */ - public function getPostalCode() + public function getPostalCode(): ?string { return $this->PostalCode; } @@ -358,28 +368,29 @@ public function getPostalCode() * @param string $postalCode * @return \Api\StructType\ApiAddressType */ - public function setPostalCode($postalCode = null) + public function setPostalCode(?string $postalCode = null): self { // validation for constraint: string if (!is_null($postalCode) && !is_string($postalCode)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($postalCode, true), gettype($postalCode)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($postalCode, true), gettype($postalCode)), __LINE__); } // validation for constraint: maxLength(16) - if (!is_null($postalCode) && mb_strlen($postalCode) > 16) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 16', mb_strlen($postalCode)), __LINE__); + if (!is_null($postalCode) && mb_strlen((string) $postalCode) > 16) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 16', mb_strlen((string) $postalCode)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($postalCode) && mb_strlen($postalCode) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($postalCode)), __LINE__); + if (!is_null($postalCode) && mb_strlen((string) $postalCode) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $postalCode)), __LINE__); } $this->PostalCode = $postalCode; + return $this; } /** * Get County value * @return string|null */ - public function getCounty() + public function getCounty(): ?string { return $this->County; } @@ -388,28 +399,29 @@ public function getCounty() * @param string $county * @return \Api\StructType\ApiAddressType */ - public function setCounty($county = null) + public function setCounty(?string $county = null): self { // validation for constraint: string if (!is_null($county) && !is_string($county)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($county, true), gettype($county)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($county, true), gettype($county)), __LINE__); } // validation for constraint: maxLength(32) - if (!is_null($county) && mb_strlen($county) > 32) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 32', mb_strlen($county)), __LINE__); + if (!is_null($county) && mb_strlen((string) $county) > 32) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 32', mb_strlen((string) $county)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($county) && mb_strlen($county) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($county)), __LINE__); + if (!is_null($county) && mb_strlen((string) $county) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $county)), __LINE__); } $this->County = $county; + return $this; } /** * Get StateProv value * @return \Api\StructType\ApiStateProvType|null */ - public function getStateProv() + public function getStateProv(): ?\Api\StructType\ApiStateProvType { return $this->StateProv; } @@ -418,16 +430,17 @@ public function getStateProv() * @param \Api\StructType\ApiStateProvType $stateProv * @return \Api\StructType\ApiAddressType */ - public function setStateProv(\Api\StructType\ApiStateProvType $stateProv = null) + public function setStateProv(?\Api\StructType\ApiStateProvType $stateProv = null): self { $this->StateProv = $stateProv; + return $this; } /** * Get CountryName value * @return \Api\StructType\ApiCountryNameType|null */ - public function getCountryName() + public function getCountryName(): ?\Api\StructType\ApiCountryNameType { return $this->CountryName; } @@ -436,16 +449,17 @@ public function getCountryName() * @param \Api\StructType\ApiCountryNameType $countryName * @return \Api\StructType\ApiAddressType */ - public function setCountryName(\Api\StructType\ApiCountryNameType $countryName = null) + public function setCountryName(?\Api\StructType\ApiCountryNameType $countryName = null): self { $this->CountryName = $countryName; + return $this; } /** * Get Type value * @return string|null */ - public function getType() + public function getType(): ?string { return $this->Type; } @@ -454,24 +468,25 @@ public function getType() * @param string $type * @return \Api\StructType\ApiAddressType */ - public function setType($type = null) + public function setType(?string $type = null): self { // validation for constraint: string if (!is_null($type) && !is_string($type)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); } // validation for constraint: pattern([0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}, 0AA.BBBX, ) if (!is_null($type) && !preg_match('/[0-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', $type)) { - 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($type, true)), __LINE__); + 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($type, true)), __LINE__); } $this->Type = $type; + return $this; } /** * Get Remark value * @return string|null */ - public function getRemark() + public function getRemark(): ?string { return $this->Remark; } @@ -480,28 +495,29 @@ public function getRemark() * @param string $remark * @return \Api\StructType\ApiAddressType */ - public function setRemark($remark = null) + public function setRemark(?string $remark = null): self { // validation for constraint: string if (!is_null($remark) && !is_string($remark)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($remark, true), gettype($remark)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($remark, true), gettype($remark)), __LINE__); } // validation for constraint: maxLength(128) - if (!is_null($remark) && mb_strlen($remark) > 128) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 128', mb_strlen($remark)), __LINE__); + if (!is_null($remark) && mb_strlen((string) $remark) > 128) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 128', mb_strlen((string) $remark)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($remark) && mb_strlen($remark) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($remark)), __LINE__); + if (!is_null($remark) && mb_strlen((string) $remark) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $remark)), __LINE__); } $this->Remark = $remark; + return $this; } /** * Get FormattedInd value * @return bool|null */ - public function getFormattedInd() + public function getFormattedInd(): ?bool { return $this->FormattedInd; } @@ -510,20 +526,21 @@ public function getFormattedInd() * @param bool $formattedInd * @return \Api\StructType\ApiAddressType */ - public function setFormattedInd($formattedInd = null) + public function setFormattedInd(?bool $formattedInd = null): self { // validation for constraint: boolean if (!is_null($formattedInd) && !is_bool($formattedInd)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($formattedInd, true), gettype($formattedInd)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($formattedInd, true), gettype($formattedInd)), __LINE__); } $this->FormattedInd = $formattedInd; + return $this; } /** * Get ShareSynchInd value * @return string|null */ - public function getShareSynchInd() + public function getShareSynchInd(): ?string { return $this->ShareSynchInd; } @@ -532,20 +549,21 @@ public function getShareSynchInd() * @param string $shareSynchInd * @return \Api\StructType\ApiAddressType */ - public function setShareSynchInd($shareSynchInd = null) + public function setShareSynchInd(?string $shareSynchInd = null): self { // validation for constraint: string if (!is_null($shareSynchInd) && !is_string($shareSynchInd)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareSynchInd, true), gettype($shareSynchInd)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareSynchInd, true), gettype($shareSynchInd)), __LINE__); } $this->ShareSynchInd = $shareSynchInd; + return $this; } /** * Get ShareMarketInd value * @return string|null */ - public function getShareMarketInd() + public function getShareMarketInd(): ?string { return $this->ShareMarketInd; } @@ -554,13 +572,14 @@ public function getShareMarketInd() * @param string $shareMarketInd * @return \Api\StructType\ApiAddressType */ - public function setShareMarketInd($shareMarketInd = null) + public function setShareMarketInd(?string $shareMarketInd = null): self { // validation for constraint: string if (!is_null($shareMarketInd) && !is_string($shareMarketInd)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareMarketInd, true), gettype($shareMarketInd)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareMarketInd, true), gettype($shareMarketInd)), __LINE__); } $this->ShareMarketInd = $shareMarketInd; + return $this; } } diff --git a/tests/resources/generated/ValidApiAdultOption.php b/tests/resources/generated/ValidApiAdultOption.php index 1e8a6585..7e811a15 100755 --- a/tests/resources/generated/ValidApiAdultOption.php +++ b/tests/resources/generated/ValidApiAdultOption.php @@ -1,8 +1,11 @@ setError($error); } /** * Get Error value - * @return \Api\StructType\ApiError[]|null + * @return \Api\StructType\ApiError[] */ - public function getError() + public function getError(): array { return $this->Error; } @@ -44,7 +47,7 @@ public function getError() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateErrorForArrayConstraintsFromSetError(array $values = array()) + public static function validateErrorForArrayConstraintsFromSetError(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,36 +61,23 @@ public static function validateErrorForArrayConstraintsFromSetError(array $value $message = sprintf('The Error property can only contain items of type \Api\StructType\ApiError, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Error value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiError[] $error * @return \Api\ArrayType\ApiArrayOfError */ - public function setError(array $error = array()) + public function setError(array $error = []): self { // validation for constraint: array if ('' !== ($errorArrayErrorMessage = self::validateErrorForArrayConstraintsFromSetError($error))) { - throw new \InvalidArgumentException($errorArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($errorArrayErrorMessage, __LINE__); } $this->Error = $error; - return $this; - } - /** - * Add item to Error value - * @throws \InvalidArgumentException - * @param \Api\StructType\ApiError $item - * @return \Api\ArrayType\ApiArrayOfError - */ - public function addToError(\Api\StructType\ApiError $item) - { - // validation for constraint: itemType - if (!$item instanceof \Api\StructType\ApiError) { - throw new \InvalidArgumentException(sprintf('The Error property can only contain items of type \Api\StructType\ApiError, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); - } - $this->Error[] = $item; + return $this; } /** @@ -95,7 +85,7 @@ public function addToError(\Api\StructType\ApiError $item) * @see AbstractStructArrayBase::current() * @return \Api\StructType\ApiError|null */ - public function current() + public function current(): ?\Api\StructType\ApiError { return parent::current(); } @@ -105,7 +95,7 @@ public function current() * @param int $index * @return \Api\StructType\ApiError|null */ - public function item($index) + public function item($index): ?\Api\StructType\ApiError { return parent::item($index); } @@ -114,7 +104,7 @@ public function item($index) * @see AbstractStructArrayBase::first() * @return \Api\StructType\ApiError|null */ - public function first() + public function first(): ?\Api\StructType\ApiError { return parent::first(); } @@ -123,7 +113,7 @@ public function first() * @see AbstractStructArrayBase::last() * @return \Api\StructType\ApiError|null */ - public function last() + public function last(): ?\Api\StructType\ApiError { return parent::last(); } @@ -133,16 +123,27 @@ public function last() * @param int $offset * @return \Api\StructType\ApiError|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?\Api\StructType\ApiError { return parent::offsetGet($offset); } + /** + * Add element to array + * @see AbstractStructArrayBase::add() + * @throws InvalidArgumentException + * @param \Api\StructType\ApiError $item + * @return \Api\ArrayType\ApiArrayOfError + */ + public function add(\Api\StructType\ApiError $item): self + { + return parent::add($item); + } /** * Returns the attribute name * @see AbstractStructArrayBase::getAttributeName() * @return string Error */ - public function getAttributeName() + public function getAttributeName(): string { return 'Error'; } diff --git a/tests/resources/generated/ValidApiArrayOfErrorProject.php b/tests/resources/generated/ValidApiArrayOfErrorProject.php index 87066983..5c9265a6 100755 --- a/tests/resources/generated/ValidApiArrayOfErrorProject.php +++ b/tests/resources/generated/ValidApiArrayOfErrorProject.php @@ -1,8 +1,11 @@ setError($error); } /** * Get Error value - * @return \Api\StructType\ApiErrorProject[]|null + * @return \Api\StructType\ApiErrorProject[] */ - public function getError() + public function getError(): array { return $this->Error; } @@ -44,7 +47,7 @@ public function getError() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateErrorForArrayConstraintsFromSetError(array $values = array()) + public static function validateErrorForArrayConstraintsFromSetError(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,36 +61,23 @@ public static function validateErrorForArrayConstraintsFromSetError(array $value $message = sprintf('The Error property can only contain items of type \Api\StructType\ApiErrorProject, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Error value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiErrorProject[] $error * @return \Api\ArrayType\ApiArrayOfErrorProject */ - public function setError(array $error = array()) + public function setError(array $error = []): self { // validation for constraint: array if ('' !== ($errorArrayErrorMessage = self::validateErrorForArrayConstraintsFromSetError($error))) { - throw new \InvalidArgumentException($errorArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($errorArrayErrorMessage, __LINE__); } $this->Error = $error; - return $this; - } - /** - * Add item to Error value - * @throws \InvalidArgumentException - * @param \Api\StructType\ApiErrorProject $item - * @return \Api\ArrayType\ApiArrayOfErrorProject - */ - public function addToError(\Api\StructType\ApiErrorProject $item) - { - // validation for constraint: itemType - if (!$item instanceof \Api\StructType\ApiErrorProject) { - throw new \InvalidArgumentException(sprintf('The Error property can only contain items of type \Api\StructType\ApiErrorProject, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); - } - $this->Error[] = $item; + return $this; } /** @@ -95,7 +85,7 @@ public function addToError(\Api\StructType\ApiErrorProject $item) * @see AbstractStructArrayBase::current() * @return \Api\StructType\ApiErrorProject|null */ - public function current() + public function current(): ?\Api\StructType\ApiErrorProject { return parent::current(); } @@ -105,7 +95,7 @@ public function current() * @param int $index * @return \Api\StructType\ApiErrorProject|null */ - public function item($index) + public function item($index): ?\Api\StructType\ApiErrorProject { return parent::item($index); } @@ -114,7 +104,7 @@ public function item($index) * @see AbstractStructArrayBase::first() * @return \Api\StructType\ApiErrorProject|null */ - public function first() + public function first(): ?\Api\StructType\ApiErrorProject { return parent::first(); } @@ -123,7 +113,7 @@ public function first() * @see AbstractStructArrayBase::last() * @return \Api\StructType\ApiErrorProject|null */ - public function last() + public function last(): ?\Api\StructType\ApiErrorProject { return parent::last(); } @@ -133,16 +123,27 @@ public function last() * @param int $offset * @return \Api\StructType\ApiErrorProject|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?\Api\StructType\ApiErrorProject { return parent::offsetGet($offset); } + /** + * Add element to array + * @see AbstractStructArrayBase::add() + * @throws InvalidArgumentException + * @param \Api\StructType\ApiErrorProject $item + * @return \Api\ArrayType\ApiArrayOfErrorProject + */ + public function add(\Api\StructType\ApiErrorProject $item): self + { + return parent::add($item); + } /** * Returns the attribute name * @see AbstractStructArrayBase::getAttributeName() * @return string Error */ - public function getAttributeName() + public function getAttributeName(): string { return 'Error'; } diff --git a/tests/resources/generated/ValidApiArrayOfNewsRelatedSearch.php b/tests/resources/generated/ValidApiArrayOfNewsRelatedSearch.php index f88083d7..6d2c5d99 100755 --- a/tests/resources/generated/ValidApiArrayOfNewsRelatedSearch.php +++ b/tests/resources/generated/ValidApiArrayOfNewsRelatedSearch.php @@ -1,8 +1,11 @@ setNewsRelatedSearch($newsRelatedSearch); } /** * Get NewsRelatedSearch value - * @return \Api\StructType\ApiNewsRelatedSearch[]|null + * @return \Api\StructType\ApiNewsRelatedSearch[] */ - public function getNewsRelatedSearch() + public function getNewsRelatedSearch(): array { return $this->NewsRelatedSearch; } @@ -44,7 +47,7 @@ public function getNewsRelatedSearch() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateNewsRelatedSearchForArrayConstraintsFromSetNewsRelatedSearch(array $values = array()) + public static function validateNewsRelatedSearchForArrayConstraintsFromSetNewsRelatedSearch(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,36 +61,23 @@ public static function validateNewsRelatedSearchForArrayConstraintsFromSetNewsRe $message = sprintf('The NewsRelatedSearch property can only contain items of type \Api\StructType\ApiNewsRelatedSearch, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set NewsRelatedSearch value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiNewsRelatedSearch[] $newsRelatedSearch * @return \Api\ArrayType\ApiArrayOfNewsRelatedSearch */ - public function setNewsRelatedSearch(array $newsRelatedSearch = array()) + public function setNewsRelatedSearch(array $newsRelatedSearch = []): self { // validation for constraint: array if ('' !== ($newsRelatedSearchArrayErrorMessage = self::validateNewsRelatedSearchForArrayConstraintsFromSetNewsRelatedSearch($newsRelatedSearch))) { - throw new \InvalidArgumentException($newsRelatedSearchArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($newsRelatedSearchArrayErrorMessage, __LINE__); } $this->NewsRelatedSearch = $newsRelatedSearch; - return $this; - } - /** - * Add item to NewsRelatedSearch value - * @throws \InvalidArgumentException - * @param \Api\StructType\ApiNewsRelatedSearch $item - * @return \Api\ArrayType\ApiArrayOfNewsRelatedSearch - */ - public function addToNewsRelatedSearch(\Api\StructType\ApiNewsRelatedSearch $item) - { - // validation for constraint: itemType - if (!$item instanceof \Api\StructType\ApiNewsRelatedSearch) { - throw new \InvalidArgumentException(sprintf('The NewsRelatedSearch property can only contain items of type \Api\StructType\ApiNewsRelatedSearch, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); - } - $this->NewsRelatedSearch[] = $item; + return $this; } /** @@ -95,7 +85,7 @@ public function addToNewsRelatedSearch(\Api\StructType\ApiNewsRelatedSearch $ite * @see AbstractStructArrayBase::current() * @return \Api\StructType\ApiNewsRelatedSearch|null */ - public function current() + public function current(): ?\Api\StructType\ApiNewsRelatedSearch { return parent::current(); } @@ -105,7 +95,7 @@ public function current() * @param int $index * @return \Api\StructType\ApiNewsRelatedSearch|null */ - public function item($index) + public function item($index): ?\Api\StructType\ApiNewsRelatedSearch { return parent::item($index); } @@ -114,7 +104,7 @@ public function item($index) * @see AbstractStructArrayBase::first() * @return \Api\StructType\ApiNewsRelatedSearch|null */ - public function first() + public function first(): ?\Api\StructType\ApiNewsRelatedSearch { return parent::first(); } @@ -123,7 +113,7 @@ public function first() * @see AbstractStructArrayBase::last() * @return \Api\StructType\ApiNewsRelatedSearch|null */ - public function last() + public function last(): ?\Api\StructType\ApiNewsRelatedSearch { return parent::last(); } @@ -133,16 +123,27 @@ public function last() * @param int $offset * @return \Api\StructType\ApiNewsRelatedSearch|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?\Api\StructType\ApiNewsRelatedSearch { return parent::offsetGet($offset); } + /** + * Add element to array + * @see AbstractStructArrayBase::add() + * @throws InvalidArgumentException + * @param \Api\StructType\ApiNewsRelatedSearch $item + * @return \Api\ArrayType\ApiArrayOfNewsRelatedSearch + */ + public function add(\Api\StructType\ApiNewsRelatedSearch $item): self + { + return parent::add($item); + } /** * Returns the attribute name * @see AbstractStructArrayBase::getAttributeName() * @return string NewsRelatedSearch */ - public function getAttributeName() + public function getAttributeName(): string { return 'NewsRelatedSearch'; } diff --git a/tests/resources/generated/ValidApiArrayOfString.php b/tests/resources/generated/ValidApiArrayOfString.php index bfc5b10d..f0ab81e7 100755 --- a/tests/resources/generated/ValidApiArrayOfString.php +++ b/tests/resources/generated/ValidApiArrayOfString.php @@ -1,8 +1,11 @@ setString($string); } /** * Get string value - * @return string[]|null + * @return string[] */ - public function getString() + public function getString(): array { return $this->string; } @@ -44,7 +47,7 @@ public function getString() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateStringForArrayConstraintsFromSetString(array $values = array()) + public static function validateStringForArrayConstraintsFromSetString(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,36 +61,23 @@ public static function validateStringForArrayConstraintsFromSetString(array $val $message = sprintf('The string property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set string value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $string * @return \Api\ArrayType\ApiArrayOfString */ - public function setString(array $string = array()) + public function setString(array $string = []): self { // validation for constraint: array if ('' !== ($stringArrayErrorMessage = self::validateStringForArrayConstraintsFromSetString($string))) { - throw new \InvalidArgumentException($stringArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($stringArrayErrorMessage, __LINE__); } $this->string = $string; - return $this; - } - /** - * Add item to string value - * @throws \InvalidArgumentException - * @param string $item - * @return \Api\ArrayType\ApiArrayOfString - */ - public function addToString($item) - { - // validation for constraint: itemType - if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The string property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); - } - $this->string[] = $item; + return $this; } /** @@ -95,7 +85,7 @@ public function addToString($item) * @see AbstractStructArrayBase::current() * @return string|null */ - public function current() + public function current(): ?string { return parent::current(); } @@ -105,7 +95,7 @@ public function current() * @param int $index * @return string|null */ - public function item($index) + public function item($index): ?string { return parent::item($index); } @@ -114,7 +104,7 @@ public function item($index) * @see AbstractStructArrayBase::first() * @return string|null */ - public function first() + public function first(): ?string { return parent::first(); } @@ -123,7 +113,7 @@ public function first() * @see AbstractStructArrayBase::last() * @return string|null */ - public function last() + public function last(): ?string { return parent::last(); } @@ -133,7 +123,7 @@ public function last() * @param int $offset * @return string|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?string { return parent::offsetGet($offset); } @@ -142,7 +132,7 @@ public function offsetGet($offset) * @see AbstractStructArrayBase::getAttributeName() * @return string string */ - public function getAttributeName() + public function getAttributeName(): string { return 'string'; } diff --git a/tests/resources/generated/ValidApiArrayOfWebSearchOption.php b/tests/resources/generated/ValidApiArrayOfWebSearchOption.php index 64ff811f..b44279cd 100755 --- a/tests/resources/generated/ValidApiArrayOfWebSearchOption.php +++ b/tests/resources/generated/ValidApiArrayOfWebSearchOption.php @@ -1,8 +1,11 @@ setWebSearchOption($webSearchOption); } /** * Get WebSearchOption value - * @return string[]|null + * @return string[] */ - public function getWebSearchOption() + public function getWebSearchOption(): array { return $this->WebSearchOption; } @@ -44,7 +47,7 @@ public function getWebSearchOption() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateWebSearchOptionForArrayConstraintsFromSetWebSearchOption(array $values = array()) + public static function validateWebSearchOptionForArrayConstraintsFromSetWebSearchOption(array $values = []): string { $message = ''; $invalidValues = []; @@ -58,40 +61,25 @@ public static function validateWebSearchOptionForArrayConstraintsFromSetWebSearc $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiWebSearchOption', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \Api\EnumType\ApiWebSearchOption::getValidValues())); } unset($invalidValues); + return $message; } /** * Set WebSearchOption value * @uses \Api\EnumType\ApiWebSearchOption::valueIsValid() * @uses \Api\EnumType\ApiWebSearchOption::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $webSearchOption * @return \Api\ArrayType\ApiArrayOfWebSearchOption */ - public function setWebSearchOption(array $webSearchOption = array()) + public function setWebSearchOption(array $webSearchOption = []): self { // validation for constraint: array if ('' !== ($webSearchOptionArrayErrorMessage = self::validateWebSearchOptionForArrayConstraintsFromSetWebSearchOption($webSearchOption))) { - throw new \InvalidArgumentException($webSearchOptionArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($webSearchOptionArrayErrorMessage, __LINE__); } $this->WebSearchOption = $webSearchOption; - return $this; - } - /** - * Add item to WebSearchOption value - * @uses \Api\EnumType\ApiWebSearchOption::valueIsValid() - * @uses \Api\EnumType\ApiWebSearchOption::getValidValues() - * @throws \InvalidArgumentException - * @param string $item - * @return \Api\ArrayType\ApiArrayOfWebSearchOption - */ - public function addToWebSearchOption($item) - { - // validation for constraint: enumeration - if (!\Api\EnumType\ApiWebSearchOption::valueIsValid($item)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiWebSearchOption', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiWebSearchOption::getValidValues())), __LINE__); - } - $this->WebSearchOption[] = $item; + return $this; } /** @@ -99,7 +87,7 @@ public function addToWebSearchOption($item) * @see AbstractStructArrayBase::current() * @return string|null */ - public function current() + public function current(): ?string { return parent::current(); } @@ -109,7 +97,7 @@ public function current() * @param int $index * @return string|null */ - public function item($index) + public function item($index): ?string { return parent::item($index); } @@ -118,7 +106,7 @@ public function item($index) * @see AbstractStructArrayBase::first() * @return string|null */ - public function first() + public function first(): ?string { return parent::first(); } @@ -127,7 +115,7 @@ public function first() * @see AbstractStructArrayBase::last() * @return string|null */ - public function last() + public function last(): ?string { return parent::last(); } @@ -137,23 +125,22 @@ public function last() * @param int $offset * @return string|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?string { return parent::offsetGet($offset); } /** * Add element to array * @see AbstractStructArrayBase::add() - * @throws \InvalidArgumentException - * @uses \Api\EnumType\ApiWebSearchOption::valueIsValid() + * @throws InvalidArgumentException * @param string $item * @return \Api\ArrayType\ApiArrayOfWebSearchOption */ - public function add($item) + public function add(string $item): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiWebSearchOption::valueIsValid($item)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiWebSearchOption', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiWebSearchOption::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiWebSearchOption', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \Api\EnumType\ApiWebSearchOption::getValidValues())), __LINE__); } return parent::add($item); } @@ -162,7 +149,7 @@ public function add($item) * @see AbstractStructArrayBase::getAttributeName() * @return string WebSearchOption */ - public function getAttributeName() + public function getAttributeName(): string { return 'WebSearchOption'; } diff --git a/tests/resources/generated/ValidApiAuthenticate.php b/tests/resources/generated/ValidApiAuthenticate.php index f4d8d2a5..c6c69786 100755 --- a/tests/resources/generated/ValidApiAuthenticate.php +++ b/tests/resources/generated/ValidApiAuthenticate.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('AuthenticateAccount', array( + $this->setResult($resultAuthenticateAccount = $this->getSoapClient()->__soapCall('AuthenticateAccount', [ $authenticateAccount, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultAuthenticateAccount; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -37,7 +41,6 @@ public function AuthenticateAccount($authenticateAccount) * Method to call the operation originally named AuthenticateAdmin * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param AuthenticateAdmin $authenticateAdmin * @return AuthenticateAdminResponse|bool @@ -45,12 +48,14 @@ public function AuthenticateAccount($authenticateAccount) public function AuthenticateAdmin($authenticateAdmin) { try { - $this->setResult($this->getSoapClient()->__soapCall('AuthenticateAdmin', array( + $this->setResult($resultAuthenticateAdmin = $this->getSoapClient()->__soapCall('AuthenticateAdmin', [ $authenticateAdmin, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultAuthenticateAdmin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -58,7 +63,6 @@ public function AuthenticateAdmin($authenticateAdmin) * Method to call the operation originally named AuthenticateReseller * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param AuthenticateReseller $authenticateReseller * @return AuthenticateResellerResponse|bool @@ -66,12 +70,14 @@ public function AuthenticateAdmin($authenticateAdmin) public function AuthenticateReseller($authenticateReseller) { try { - $this->setResult($this->getSoapClient()->__soapCall('AuthenticateReseller', array( + $this->setResult($resultAuthenticateReseller = $this->getSoapClient()->__soapCall('AuthenticateReseller', [ $authenticateReseller, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultAuthenticateReseller; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -79,7 +85,6 @@ public function AuthenticateReseller($authenticateReseller) * Method to call the operation originally named AuthenticateCustomer * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param AuthenticateCustomer $authenticateCustomer * @return AuthenticateCustomerResponse|bool @@ -87,12 +92,14 @@ public function AuthenticateReseller($authenticateReseller) public function AuthenticateCustomer($authenticateCustomer) { try { - $this->setResult($this->getSoapClient()->__soapCall('AuthenticateCustomer', array( + $this->setResult($resultAuthenticateCustomer = $this->getSoapClient()->__soapCall('AuthenticateCustomer', [ $authenticateCustomer, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultAuthenticateCustomer; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiCreate.php b/tests/resources/generated/ValidApiCreate.php index 7074502f..bf27190b 100755 --- a/tests/resources/generated/ValidApiCreate.php +++ b/tests/resources/generated/ValidApiCreate.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('CreateQueue', array( + $this->setResult($resultCreateQueue = $this->getSoapClient()->__soapCall('CreateQueue', [ $body, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCreateQueue; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiDelete.php b/tests/resources/generated/ValidApiDelete.php index c5cc8053..7a8421ca 100755 --- a/tests/resources/generated/ValidApiDelete.php +++ b/tests/resources/generated/ValidApiDelete.php @@ -1,8 +1,11 @@ setSoapHeader($nameSpace, 'SessionHeader', $sessionHeader, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'SessionHeader', $sessionHeader, $mustUnderstand, $actor); } /** * Sets the ClusterHeader SoapHeader param * @uses AbstractSoapClientBase::setSoapHeader() * @param \Api\StructType\ApiClusterHeader $clusterHeader - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiDelete */ - public function setSoapHeaderClusterHeader(\Api\StructType\ApiClusterHeader $clusterHeader, $nameSpace = 'urn:api.actonsoftware.com', $mustUnderstand = false, $actor = null) + public function setSoapHeaderClusterHeader(\Api\StructType\ApiClusterHeader $clusterHeader, string $namespace = 'urn:api.actonsoftware.com', bool $mustUnderstand = false, ?string $actor = null): self { - return $this->setSoapHeader($nameSpace, 'ClusterHeader', $clusterHeader, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'ClusterHeader', $clusterHeader, $mustUnderstand, $actor); } /** * Method to call the operation originally named deleteList @@ -47,7 +50,6 @@ public function setSoapHeaderClusterHeader(\Api\StructType\ApiClusterHeader $clu * - SOAPHeaders: optional, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDeleteList $parameter * @return void|bool @@ -55,12 +57,14 @@ public function setSoapHeaderClusterHeader(\Api\StructType\ApiClusterHeader $clu public function deleteList(\Api\StructType\ApiDeleteList $parameter) { try { - $this->setResult($this->getSoapClient()->__soapCall('deleteList', array( + $this->setResult($resultDeleteList = $this->getSoapClient()->__soapCall('deleteList', [ $parameter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDeleteList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiDo.php b/tests/resources/generated/ValidApiDo.php index 5b585eef..92f336f7 100755 --- a/tests/resources/generated/ValidApiDo.php +++ b/tests/resources/generated/ValidApiDo.php @@ -1,8 +1,11 @@ setSoapHeader($nameSpace, 'RequesterCredentials', $requesterCredentials, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'RequesterCredentials', $requesterCredentials, $mustUnderstand, $actor); } /** * Method to call the operation originally named DoMobileCheckoutPayment @@ -34,7 +37,6 @@ public function setSoapHeaderRequesterCredentials(\Api\StructType\ApiCustomSecur * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest * @return \Api\StructType\ApiDoMobileCheckoutPaymentResponseType|bool @@ -42,12 +44,14 @@ public function setSoapHeaderRequesterCredentials(\Api\StructType\ApiCustomSecur public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', array( + $this->setResult($resultDoMobileCheckoutPayment = $this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', [ $doMobileCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoMobileCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -60,7 +64,6 @@ public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPayme * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest * @return \Api\StructType\ApiDoExpressCheckoutPaymentResponseType|bool @@ -68,12 +71,14 @@ public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPayme public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', array( + $this->setResult($resultDoExpressCheckoutPayment = $this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', [ $doExpressCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoExpressCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -86,7 +91,6 @@ public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPay * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest * @return \Api\StructType\ApiDoUATPExpressCheckoutPaymentResponseType|bool @@ -94,12 +98,14 @@ public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPay public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', array( + $this->setResult($resultDoUATPExpressCheckoutPayment = $this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', [ $doUATPExpressCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoUATPExpressCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -112,7 +118,6 @@ public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressChe * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoDirectPaymentReq $doDirectPaymentRequest * @return \Api\StructType\ApiDoDirectPaymentResponseType|bool @@ -120,12 +125,14 @@ public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressChe public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoDirectPayment', array( + $this->setResult($resultDoDirectPayment = $this->getSoapClient()->__soapCall('DoDirectPayment', [ $doDirectPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoDirectPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -138,7 +145,6 @@ public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectP * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoCancelReq $doCancelRequest * @return \Api\StructType\ApiDoCancelResponseType|bool @@ -146,12 +152,14 @@ public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectP public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoCancel', array( + $this->setResult($resultDoCancel = $this->getSoapClient()->__soapCall('DoCancel', [ $doCancelRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoCancel; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -164,7 +172,6 @@ public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoCaptureReq $doCaptureRequest * @return \Api\StructType\ApiDoCaptureResponseType|bool @@ -172,12 +179,14 @@ public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest) public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoCapture', array( + $this->setResult($resultDoCapture = $this->getSoapClient()->__soapCall('DoCapture', [ $doCaptureRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoCapture; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -190,7 +199,6 @@ public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoReauthorizationReq $doReauthorizationRequest * @return \Api\StructType\ApiDoReauthorizationResponseType|bool @@ -198,12 +206,14 @@ public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest) public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doReauthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoReauthorization', array( + $this->setResult($resultDoReauthorization = $this->getSoapClient()->__soapCall('DoReauthorization', [ $doReauthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoReauthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -216,7 +226,6 @@ public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doRea * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoVoidReq $doVoidRequest * @return \Api\StructType\ApiDoVoidResponseType|bool @@ -224,12 +233,14 @@ public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doRea public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoVoid', array( + $this->setResult($resultDoVoid = $this->getSoapClient()->__soapCall('DoVoid', [ $doVoidRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoVoid; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -242,7 +253,6 @@ public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoAuthorizationReq $doAuthorizationRequest * @return \Api\StructType\ApiDoAuthorizationResponseType|bool @@ -250,12 +260,14 @@ public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest) public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoAuthorization', array( + $this->setResult($resultDoAuthorization = $this->getSoapClient()->__soapCall('DoAuthorization', [ $doAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -268,7 +280,6 @@ public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthori * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoUATPAuthorizationReq $doUATPAuthorizationRequest * @return \Api\StructType\ApiDoUATPAuthorizationResponseType|bool @@ -276,12 +287,14 @@ public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthori public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $doUATPAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoUATPAuthorization', array( + $this->setResult($resultDoUATPAuthorization = $this->getSoapClient()->__soapCall('DoUATPAuthorization', [ $doUATPAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoUATPAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -294,7 +307,6 @@ public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $d * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoReferenceTransactionReq $doReferenceTransactionRequest * @return \Api\StructType\ApiDoReferenceTransactionResponseType|bool @@ -302,12 +314,14 @@ public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $d public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransactionReq $doReferenceTransactionRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoReferenceTransaction', array( + $this->setResult($resultDoReferenceTransaction = $this->getSoapClient()->__soapCall('DoReferenceTransaction', [ $doReferenceTransactionRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoReferenceTransaction; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -320,7 +334,6 @@ public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransaction * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoNonReferencedCreditReq $doNonReferencedCreditRequest * @return \Api\StructType\ApiDoNonReferencedCreditResponseType|bool @@ -328,12 +341,14 @@ public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransaction public function DoNonReferencedCredit(\Api\StructType\ApiDoNonReferencedCreditReq $doNonReferencedCreditRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoNonReferencedCredit', array( + $this->setResult($resultDoNonReferencedCredit = $this->getSoapClient()->__soapCall('DoNonReferencedCredit', [ $doNonReferencedCreditRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoNonReferencedCredit; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiDs_weblog_formats.php b/tests/resources/generated/ValidApiDs_weblog_formats.php index 9564be55..7d1b8493 100755 --- a/tests/resources/generated/ValidApiDs_weblog_formats.php +++ b/tests/resources/generated/ValidApiDs_weblog_formats.php @@ -1,8 +1,11 @@ setPrice($price) @@ -89,7 +92,7 @@ public function __construct(\Api\StructType\ApiFareItineraryPrice $price = null, * Get price value * @return \Api\StructType\ApiFareItineraryPrice */ - public function getPrice() + public function getPrice(): \Api\StructType\ApiFareItineraryPrice { return $this->price; } @@ -98,16 +101,17 @@ public function getPrice() * @param \Api\StructType\ApiFareItineraryPrice $price * @return \Api\StructType\ApiFareItinerary */ - public function setPrice(\Api\StructType\ApiFareItineraryPrice $price = null) + public function setPrice(\Api\StructType\ApiFareItineraryPrice $price): self { $this->price = $price; + return $this; } /** * Get key value * @return string */ - public function getKey() + public function getKey(): string { return $this->key; } @@ -116,20 +120,21 @@ public function getKey() * @param string $key * @return \Api\StructType\ApiFareItinerary */ - public function setKey($key = null) + public function setKey(string $key): self { // validation for constraint: string if (!is_null($key) && !is_string($key)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($key, true), gettype($key)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($key, true), gettype($key)), __LINE__); } $this->key = $key; + return $this; } /** * Get firstSegmentsIds value * @return int[] */ - public function getFirstSegmentsIds() + public function getFirstSegmentsIds(): array { return $this->firstSegmentsIds; } @@ -139,7 +144,7 @@ public function getFirstSegmentsIds() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateFirstSegmentsIdsForArrayConstraintsFromSetFirstSegmentsIds(array $values = array()) + public static function validateFirstSegmentsIdsForArrayConstraintsFromSetFirstSegmentsIds(array $values = []): string { $message = ''; $invalidValues = []; @@ -153,43 +158,46 @@ public static function validateFirstSegmentsIdsForArrayConstraintsFromSetFirstSe $message = sprintf('The firstSegmentsIds property can only contain items of type int, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set firstSegmentsIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int[] $firstSegmentsIds * @return \Api\StructType\ApiFareItinerary */ - public function setFirstSegmentsIds(array $firstSegmentsIds = array()) + public function setFirstSegmentsIds(array $firstSegmentsIds): self { // validation for constraint: array if ('' !== ($firstSegmentsIdsArrayErrorMessage = self::validateFirstSegmentsIdsForArrayConstraintsFromSetFirstSegmentsIds($firstSegmentsIds))) { - throw new \InvalidArgumentException($firstSegmentsIdsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($firstSegmentsIdsArrayErrorMessage, __LINE__); } $this->firstSegmentsIds = $firstSegmentsIds; + return $this; } /** * Add item to firstSegmentsIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int $item * @return \Api\StructType\ApiFareItinerary */ - public function addToFirstSegmentsIds($item) + public function addToFirstSegmentsIds(int $item): self { // validation for constraint: itemType if (!(is_int($item) || ctype_digit($item))) { - throw new \InvalidArgumentException(sprintf('The firstSegmentsIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The firstSegmentsIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->firstSegmentsIds[] = $item; + return $this; } /** * Get clickoutURLParams value * @return string|null */ - public function getClickoutURLParams() + public function getClickoutURLParams(): ?string { return $this->clickoutURLParams; } @@ -198,20 +206,21 @@ public function getClickoutURLParams() * @param string $clickoutURLParams * @return \Api\StructType\ApiFareItinerary */ - public function setClickoutURLParams($clickoutURLParams = null) + public function setClickoutURLParams(?string $clickoutURLParams = null): self { // validation for constraint: string if (!is_null($clickoutURLParams) && !is_string($clickoutURLParams)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($clickoutURLParams, true), gettype($clickoutURLParams)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($clickoutURLParams, true), gettype($clickoutURLParams)), __LINE__); } $this->clickoutURLParams = $clickoutURLParams; + return $this; } /** * Get resident value * @return bool|null */ - public function getResident() + public function getResident(): ?bool { return $this->resident; } @@ -220,20 +229,21 @@ public function getResident() * @param bool $resident * @return \Api\StructType\ApiFareItinerary */ - public function setResident($resident = null) + public function setResident(?bool $resident = null): self { // validation for constraint: boolean if (!is_null($resident) && !is_bool($resident)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($resident, true), gettype($resident)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($resident, true), gettype($resident)), __LINE__); } $this->resident = $resident; + return $this; } /** * Get secondSegmentsIds value - * @return int[]|null + * @return int[] */ - public function getSecondSegmentsIds() + public function getSecondSegmentsIds(): array { return $this->secondSegmentsIds; } @@ -243,7 +253,7 @@ public function getSecondSegmentsIds() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateSecondSegmentsIdsForArrayConstraintsFromSetSecondSegmentsIds(array $values = array()) + public static function validateSecondSegmentsIdsForArrayConstraintsFromSetSecondSegmentsIds(array $values = []): string { $message = ''; $invalidValues = []; @@ -257,43 +267,46 @@ public static function validateSecondSegmentsIdsForArrayConstraintsFromSetSecond $message = sprintf('The secondSegmentsIds property can only contain items of type int, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set secondSegmentsIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int[] $secondSegmentsIds * @return \Api\StructType\ApiFareItinerary */ - public function setSecondSegmentsIds(array $secondSegmentsIds = array()) + public function setSecondSegmentsIds(array $secondSegmentsIds = []): self { // validation for constraint: array if ('' !== ($secondSegmentsIdsArrayErrorMessage = self::validateSecondSegmentsIdsForArrayConstraintsFromSetSecondSegmentsIds($secondSegmentsIds))) { - throw new \InvalidArgumentException($secondSegmentsIdsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($secondSegmentsIdsArrayErrorMessage, __LINE__); } $this->secondSegmentsIds = $secondSegmentsIds; + return $this; } /** * Add item to secondSegmentsIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int $item * @return \Api\StructType\ApiFareItinerary */ - public function addToSecondSegmentsIds($item) + public function addToSecondSegmentsIds(int $item): self { // validation for constraint: itemType if (!(is_int($item) || ctype_digit($item))) { - throw new \InvalidArgumentException(sprintf('The secondSegmentsIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The secondSegmentsIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->secondSegmentsIds[] = $item; + return $this; } /** * Get thirdSegmentsIds value - * @return int[]|null + * @return int[] */ - public function getThirdSegmentsIds() + public function getThirdSegmentsIds(): array { return $this->thirdSegmentsIds; } @@ -303,7 +316,7 @@ public function getThirdSegmentsIds() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateThirdSegmentsIdsForArrayConstraintsFromSetThirdSegmentsIds(array $values = array()) + public static function validateThirdSegmentsIdsForArrayConstraintsFromSetThirdSegmentsIds(array $values = []): string { $message = ''; $invalidValues = []; @@ -317,36 +330,39 @@ public static function validateThirdSegmentsIdsForArrayConstraintsFromSetThirdSe $message = sprintf('The thirdSegmentsIds property can only contain items of type int, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set thirdSegmentsIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int[] $thirdSegmentsIds * @return \Api\StructType\ApiFareItinerary */ - public function setThirdSegmentsIds(array $thirdSegmentsIds = array()) + public function setThirdSegmentsIds(array $thirdSegmentsIds = []): self { // validation for constraint: array if ('' !== ($thirdSegmentsIdsArrayErrorMessage = self::validateThirdSegmentsIdsForArrayConstraintsFromSetThirdSegmentsIds($thirdSegmentsIds))) { - throw new \InvalidArgumentException($thirdSegmentsIdsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($thirdSegmentsIdsArrayErrorMessage, __LINE__); } $this->thirdSegmentsIds = $thirdSegmentsIds; + return $this; } /** * Add item to thirdSegmentsIds value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param int $item * @return \Api\StructType\ApiFareItinerary */ - public function addToThirdSegmentsIds($item) + public function addToThirdSegmentsIds(int $item): self { // validation for constraint: itemType if (!(is_int($item) || ctype_digit($item))) { - throw new \InvalidArgumentException(sprintf('The thirdSegmentsIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The thirdSegmentsIds property can only contain items of type int, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->thirdSegmentsIds[] = $item; + return $this; } } diff --git a/tests/resources/generated/ValidApiFind.php b/tests/resources/generated/ValidApiFind.php index df8e0932..168d981f 100644 --- a/tests/resources/generated/ValidApiFind.php +++ b/tests/resources/generated/ValidApiFind.php @@ -1,8 +1,11 @@ setSoapHeader($nameSpace, 'ExchangeImpersonation', $exchangeImpersonation, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'ExchangeImpersonation', $exchangeImpersonation, $mustUnderstand, $actor); } /** * Sets the MailboxCulture SoapHeader param * @uses AbstractSoapClientBase::setSoapHeader() * @param \Api\StructType\ApiMailboxCultureType $mailboxCulture - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiFind */ - public function setSoapHeaderMailboxCulture(\Api\StructType\ApiMailboxCultureType $mailboxCulture, $nameSpace = 'http://schemas.microsoft.com/exchange/services/2006/types', $mustUnderstand = false, $actor = null) + public function setSoapHeaderMailboxCulture(\Api\StructType\ApiMailboxCultureType $mailboxCulture, string $namespace = 'http://schemas.microsoft.com/exchange/services/2006/types', bool $mustUnderstand = false, ?string $actor = null): self { - return $this->setSoapHeader($nameSpace, 'MailboxCulture', $mailboxCulture, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'MailboxCulture', $mailboxCulture, $mustUnderstand, $actor); } /** * Sets the RequestServerVersion SoapHeader param * @uses AbstractSoapClientBase::setSoapHeader() * @param \Api\StructType\ApiRequestServerVersion $requestServerVersion - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiFind */ - public function setSoapHeaderRequestServerVersion(\Api\StructType\ApiRequestServerVersion $requestServerVersion, $nameSpace = 'http://schemas.microsoft.com/exchange/services/2006/types', $mustUnderstand = false, $actor = null) + public function setSoapHeaderRequestServerVersion(\Api\StructType\ApiRequestServerVersion $requestServerVersion, string $namespace = 'http://schemas.microsoft.com/exchange/services/2006/types', bool $mustUnderstand = false, ?string $actor = null): self { - return $this->setSoapHeader($nameSpace, 'RequestServerVersion', $requestServerVersion, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'RequestServerVersion', $requestServerVersion, $mustUnderstand, $actor); } /** * Sets the TimeZoneContext SoapHeader param * @uses AbstractSoapClientBase::setSoapHeader() * @param \Api\StructType\ApiTimeZoneContextType $timeZoneContext - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiFind */ - public function setSoapHeaderTimeZoneContext(\Api\StructType\ApiTimeZoneContextType $timeZoneContext, $nameSpace = 'http://schemas.microsoft.com/exchange/services/2006/types', $mustUnderstand = false, $actor = null) + public function setSoapHeaderTimeZoneContext(\Api\StructType\ApiTimeZoneContextType $timeZoneContext, string $namespace = 'http://schemas.microsoft.com/exchange/services/2006/types', bool $mustUnderstand = false, ?string $actor = null): self { - return $this->setSoapHeader($nameSpace, 'TimeZoneContext', $timeZoneContext, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'TimeZoneContext', $timeZoneContext, $mustUnderstand, $actor); } /** * Sets the ManagementRole SoapHeader param * @uses AbstractSoapClientBase::setSoapHeader() * @param \Api\StructType\ApiManagementRoleType $managementRole - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiFind */ - public function setSoapHeaderManagementRole(\Api\StructType\ApiManagementRoleType $managementRole, $nameSpace = 'http://schemas.microsoft.com/exchange/services/2006/types', $mustUnderstand = false, $actor = null) + public function setSoapHeaderManagementRole(\Api\StructType\ApiManagementRoleType $managementRole, string $namespace = 'http://schemas.microsoft.com/exchange/services/2006/types', bool $mustUnderstand = false, ?string $actor = null): self { - return $this->setSoapHeader($nameSpace, 'ManagementRole', $managementRole, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'ManagementRole', $managementRole, $mustUnderstand, $actor); } /** * Sets the DateTimePrecision SoapHeader param * @uses \Api\EnumType\ApiDateTimePrecisionType::valueIsValid() * @uses \Api\EnumType\ApiDateTimePrecisionType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @uses AbstractSoapClientBase::setSoapHeader() * @param string $dateTimePrecision - * @param string $nameSpace + * @param string $namespace * @param bool $mustUnderstand * @param string $actor - * @return bool + * @return \Api\ServiceType\ApiFind */ - public function setSoapHeaderDateTimePrecision($dateTimePrecision, $nameSpace = 'http://schemas.microsoft.com/exchange/services/2006/types', $mustUnderstand = false, $actor = null) + public function setSoapHeaderDateTimePrecision(string $dateTimePrecision, string $namespace = 'http://schemas.microsoft.com/exchange/services/2006/types', bool $mustUnderstand = false, ?string $actor = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiDateTimePrecisionType::valueIsValid($dateTimePrecision)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiDateTimePrecisionType', is_array($dateTimePrecision) ? implode(', ', $dateTimePrecision) : var_export($dateTimePrecision, true), implode(', ', \Api\EnumType\ApiDateTimePrecisionType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiDateTimePrecisionType', is_array($dateTimePrecision) ? implode(', ', $dateTimePrecision) : var_export($dateTimePrecision, true), implode(', ', \Api\EnumType\ApiDateTimePrecisionType::getValidValues())), __LINE__); } - return $this->setSoapHeader($nameSpace, 'DateTimePrecision', $dateTimePrecision, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'DateTimePrecision', $dateTimePrecision, $mustUnderstand, $actor); } /** * Method to call the operation originally named FindFolder @@ -106,7 +109,6 @@ public function setSoapHeaderDateTimePrecision($dateTimePrecision, $nameSpace = * - SOAPHeaders: required, required, required, required, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindFolderType $request * @return \Api\StructType\ApiFindFolderResponseType|bool @@ -114,12 +116,14 @@ public function setSoapHeaderDateTimePrecision($dateTimePrecision, $nameSpace = public function FindFolder(\Api\StructType\ApiFindFolderType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindFolder', array( + $this->setResult($resultFindFolder = $this->getSoapClient()->__soapCall('FindFolder', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindFolder; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -132,7 +136,6 @@ public function FindFolder(\Api\StructType\ApiFindFolderType $request) * - SOAPHeaders: required, required, required, required, required, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindItemType $request * @return \Api\StructType\ApiFindItemResponseType|bool @@ -140,12 +143,14 @@ public function FindFolder(\Api\StructType\ApiFindFolderType $request) public function FindItem(\Api\StructType\ApiFindItemType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindItem', array( + $this->setResult($resultFindItem = $this->getSoapClient()->__soapCall('FindItem', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindItem; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -158,7 +163,6 @@ public function FindItem(\Api\StructType\ApiFindItemType $request) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindMessageTrackingReportRequestType $request * @return \Api\StructType\ApiFindMessageTrackingReportResponseMessageType|bool @@ -166,12 +170,14 @@ public function FindItem(\Api\StructType\ApiFindItemType $request) public function FindMessageTrackingReport(\Api\StructType\ApiFindMessageTrackingReportRequestType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindMessageTrackingReport', array( + $this->setResult($resultFindMessageTrackingReport = $this->getSoapClient()->__soapCall('FindMessageTrackingReport', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindMessageTrackingReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -184,7 +190,6 @@ public function FindMessageTrackingReport(\Api\StructType\ApiFindMessageTracking * - SOAPHeaders: required, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindConversationType $request * @return \Api\StructType\ApiFindConversationResponseMessageType|bool @@ -192,12 +197,14 @@ public function FindMessageTrackingReport(\Api\StructType\ApiFindMessageTracking public function FindConversation(\Api\StructType\ApiFindConversationType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindConversation', array( + $this->setResult($resultFindConversation = $this->getSoapClient()->__soapCall('FindConversation', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindConversation; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -210,7 +217,6 @@ public function FindConversation(\Api\StructType\ApiFindConversationType $reques * - SOAPHeaders: required, required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindPeopleType $request * @return \Api\StructType\ApiFindPeopleResponseMessageType|bool @@ -218,12 +224,14 @@ public function FindConversation(\Api\StructType\ApiFindConversationType $reques public function FindPeople(\Api\StructType\ApiFindPeopleType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindPeople', array( + $this->setResult($resultFindPeople = $this->getSoapClient()->__soapCall('FindPeople', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindPeople; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -236,7 +244,6 @@ public function FindPeople(\Api\StructType\ApiFindPeopleType $request) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindAvailableMeetingTimesType $request * @return \Api\StructType\ApiFindAvailableMeetingTimesResponseMessageType|bool @@ -244,12 +251,14 @@ public function FindPeople(\Api\StructType\ApiFindPeopleType $request) public function FindAvailableMeetingTimes(\Api\StructType\ApiFindAvailableMeetingTimesType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindAvailableMeetingTimes', array( + $this->setResult($resultFindAvailableMeetingTimes = $this->getSoapClient()->__soapCall('FindAvailableMeetingTimes', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindAvailableMeetingTimes; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -262,7 +271,6 @@ public function FindAvailableMeetingTimes(\Api\StructType\ApiFindAvailableMeetin * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFindMeetingTimeCandidatesType $request * @return \Api\StructType\ApiFindMeetingTimeCandidatesResponseMessageType|bool @@ -270,12 +278,14 @@ public function FindAvailableMeetingTimes(\Api\StructType\ApiFindAvailableMeetin public function FindMeetingTimeCandidates(\Api\StructType\ApiFindMeetingTimeCandidatesType $request) { try { - $this->setResult($this->getSoapClient()->__soapCall('FindMeetingTimeCandidates', array( + $this->setResult($resultFindMeetingTimeCandidates = $this->getSoapClient()->__soapCall('FindMeetingTimeCandidates', [ $request, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultFindMeetingTimeCandidates; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiHouseStageEnum.php b/tests/resources/generated/ValidApiHouseStageEnum.php index 4e6a94be..b8b4eae6 100755 --- a/tests/resources/generated/ValidApiHouseStageEnum.php +++ b/tests/resources/generated/ValidApiHouseStageEnum.php @@ -1,8 +1,11 @@ setItemType($itemType) @@ -58,7 +61,7 @@ public function __construct($itemType = null, $id = null, $displayName = null, \ * Get itemType value * @return string|null */ - public function getItemType() + public function getItemType(): ?string { return $this->itemType; } @@ -66,24 +69,25 @@ public function getItemType() * Set itemType value * @uses \Api\EnumType\ApiItemType::valueIsValid() * @uses \Api\EnumType\ApiItemType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $itemType * @return \Api\StructType\ApiItem */ - public function setItemType($itemType = null) + public function setItemType(?string $itemType = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiItemType::valueIsValid($itemType)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiItemType', is_array($itemType) ? implode(', ', $itemType) : var_export($itemType, true), implode(', ', \Api\EnumType\ApiItemType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiItemType', is_array($itemType) ? implode(', ', $itemType) : var_export($itemType, true), implode(', ', \Api\EnumType\ApiItemType::getValidValues())), __LINE__); } $this->itemType = $itemType; + return $this; } /** * Get id value * @return string|null */ - public function getId() + public function getId(): ?string { return $this->id; } @@ -92,20 +96,21 @@ public function getId() * @param string $id * @return \Api\StructType\ApiItem */ - public function setId($id = null) + public function setId(?string $id = null): 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__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($id, true), gettype($id)), __LINE__); } $this->id = $id; + return $this; } /** * Get displayName value * @return string|null */ - public function getDisplayName() + public function getDisplayName(): ?string { return $this->displayName; } @@ -114,41 +119,47 @@ public function getDisplayName() * @param string $displayName * @return \Api\StructType\ApiItem */ - public function setDisplayName($displayName = null) + public function setDisplayName(?string $displayName = null): self { // validation for constraint: string if (!is_null($displayName) && !is_string($displayName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($displayName, true), gettype($displayName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($displayName, true), gettype($displayName)), __LINE__); } $this->displayName = $displayName; + return $this; } /** * Get any value * @uses \DOMDocument::loadXML() * @param bool $asString true: returns XML string, false: returns \DOMDocument - * @return \DOMDocument|null + * @return \DOMDocument|string|null */ - public function getAny($asString = true) + public function getAny(bool $asDomDocument = false) { $domDocument = null; - if (!empty($this->any) && !$asString) { + if (!empty($this->any) && $asDomDocument) { $domDocument = new \DOMDocument('1.0', 'UTF-8'); $domDocument->loadXML($this->any); } - return $asString ? $this->any : $domDocument; + return $asDomDocument ? $domDocument : $this->any; } /** * Set any value * @uses \DOMDocument::hasChildNodes() * @uses \DOMDocument::saveXML() * @uses \DOMNode::item() - * @param \DOMDocument $any + * @param \DOMDocument|string|null $any * @return \Api\StructType\ApiItem */ - public function setAny(\DOMDocument $any = null) + public function setAny($any = null): self { - $this->any = ($any instanceof \DOMDocument) && $any->hasChildNodes() ? $any->saveXML($any->childNodes->item(0)) : $any; + // 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/tests/resources/generated/ValidApiLogin.php b/tests/resources/generated/ValidApiLogin.php index fc8bd975..d3ba329c 100755 --- a/tests/resources/generated/ValidApiLogin.php +++ b/tests/resources/generated/ValidApiLogin.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('Login', array( + $this->setResult($resultLogin = $this->getSoapClient()->__soapCall('Login', [ $login, $password, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiNewsArticle.php b/tests/resources/generated/ValidApiNewsArticle.php index 0a88fc74..0d8e8698 100755 --- a/tests/resources/generated/ValidApiNewsArticle.php +++ b/tests/resources/generated/ValidApiNewsArticle.php @@ -1,7 +1,10 @@ setTitle($title) @@ -78,7 +81,7 @@ public function __construct($title = null, $url = null, $source = null, $snippet * Get Title value * @return string|null */ - public function getTitle() + public function getTitle(): ?string { return $this->Title; } @@ -87,20 +90,21 @@ public function getTitle() * @param string $title * @return \Api\StructType\ApiNewsArticle */ - public function setTitle($title = null) + public function setTitle(?string $title = null): self { // validation for constraint: string if (!is_null($title) && !is_string($title)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($title, true), gettype($title)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($title, true), gettype($title)), __LINE__); } $this->Title = $title; + return $this; } /** * Get Url value * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->Url; } @@ -109,20 +113,21 @@ public function getUrl() * @param string $url * @return \Api\StructType\ApiNewsArticle */ - public function setUrl($url = null) + public function setUrl(?string $url = null): self { // validation for constraint: string if (!is_null($url) && !is_string($url)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($url, true), gettype($url)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($url, true), gettype($url)), __LINE__); } $this->Url = $url; + return $this; } /** * Get Source value * @return string|null */ - public function getSource() + public function getSource(): ?string { return $this->Source; } @@ -131,20 +136,21 @@ public function getSource() * @param string $source * @return \Api\StructType\ApiNewsArticle */ - public function setSource($source = null) + public function setSource(?string $source = null): self { // validation for constraint: string if (!is_null($source) && !is_string($source)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($source, true), gettype($source)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($source, true), gettype($source)), __LINE__); } $this->Source = $source; + return $this; } /** * Get Snippet value * @return string|null */ - public function getSnippet() + public function getSnippet(): ?string { return $this->Snippet; } @@ -153,20 +159,21 @@ public function getSnippet() * @param string $snippet * @return \Api\StructType\ApiNewsArticle */ - public function setSnippet($snippet = null) + public function setSnippet(?string $snippet = null): self { // validation for constraint: string if (!is_null($snippet) && !is_string($snippet)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($snippet, true), gettype($snippet)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($snippet, true), gettype($snippet)), __LINE__); } $this->Snippet = $snippet; + return $this; } /** * Get Date value * @return string|null */ - public function getDate() + public function getDate(): ?string { return $this->Date; } @@ -175,13 +182,14 @@ public function getDate() * @param string $date * @return \Api\StructType\ApiNewsArticle */ - public function setDate($date = null) + public function setDate(?string $date = null): self { // validation for constraint: string if (!is_null($date) && !is_string($date)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($date, true), gettype($date)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($date, true), gettype($date)), __LINE__); } $this->Date = $date; + return $this; } } diff --git a/tests/resources/generated/ValidApiOffer.php b/tests/resources/generated/ValidApiOffer.php index 94892b8b..00cb66da 100644 --- a/tests/resources/generated/ValidApiOffer.php +++ b/tests/resources/generated/ValidApiOffer.php @@ -1,8 +1,11 @@ setOfferClassMember($offerClassMember) @@ -51,7 +54,7 @@ public function __construct($offerClassMember = null, \Api\StructType\ApiOffer $ * removable from the request (nillable=true+minOccurs=0) * @return string|null */ - public function getOfferClassMember() + public function getOfferClassMember(): ?string { return isset($this->offerClassMember) ? $this->offerClassMember : null; } @@ -62,17 +65,18 @@ public function getOfferClassMember() * @param string $offerClassMember * @return \Api\StructType\ApiOffer */ - public function setOfferClassMember($offerClassMember = null) + public function setOfferClassMember(?string $offerClassMember = null): self { // validation for constraint: string if (!is_null($offerClassMember) && !is_string($offerClassMember)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($offerClassMember, true), gettype($offerClassMember)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($offerClassMember, true), gettype($offerClassMember)), __LINE__); } if (is_null($offerClassMember) || (is_array($offerClassMember) && empty($offerClassMember))) { unset($this->offerClassMember); } else { $this->offerClassMember = $offerClassMember; } + return $this; } /** @@ -82,7 +86,7 @@ public function setOfferClassMember($offerClassMember = null) * removable from the request (nillable=true+minOccurs=0) * @return \Api\StructType\ApiOffer|null */ - public function getOffer() + public function getOffer(): ?\Api\StructType\ApiOffer { return isset($this->offer) ? $this->offer : null; } @@ -93,13 +97,14 @@ public function getOffer() * @param \Api\StructType\ApiOffer $offer * @return \Api\StructType\ApiOffer */ - public function setOffer(\Api\StructType\ApiOffer $offer = null) + public function setOffer(?\Api\StructType\ApiOffer $offer = null): self { if (is_null($offer) || (is_array($offer) && empty($offer))) { unset($this->offer); } else { $this->offer = $offer; } + return $this; } } diff --git a/tests/resources/generated/ValidApiPhonebookSortOption.php b/tests/resources/generated/ValidApiPhonebookSortOption.php index cd279bc3..f298da6d 100755 --- a/tests/resources/generated/ValidApiPhonebookSortOption.php +++ b/tests/resources/generated/ValidApiPhonebookSortOption.php @@ -1,8 +1,11 @@ setSearchTerms($searchTerms) @@ -56,7 +59,7 @@ public function __construct($searchTerms = null, $alteredQuery = null, $alterati * Get SearchTerms value * @return string|null */ - public function getSearchTerms() + public function getSearchTerms(): ?string { return $this->SearchTerms; } @@ -65,20 +68,21 @@ public function getSearchTerms() * @param string $searchTerms * @return \Api\StructType\ApiQuery */ - public function setSearchTerms($searchTerms = null) + public function setSearchTerms(?string $searchTerms = null): self { // validation for constraint: string if (!is_null($searchTerms) && !is_string($searchTerms)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($searchTerms, true), gettype($searchTerms)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($searchTerms, true), gettype($searchTerms)), __LINE__); } $this->SearchTerms = $searchTerms; + return $this; } /** * Get AlteredQuery value * @return string|null */ - public function getAlteredQuery() + public function getAlteredQuery(): ?string { return $this->AlteredQuery; } @@ -87,20 +91,21 @@ public function getAlteredQuery() * @param string $alteredQuery * @return \Api\StructType\ApiQuery */ - public function setAlteredQuery($alteredQuery = null) + public function setAlteredQuery(?string $alteredQuery = null): self { // validation for constraint: string if (!is_null($alteredQuery) && !is_string($alteredQuery)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alteredQuery, true), gettype($alteredQuery)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alteredQuery, true), gettype($alteredQuery)), __LINE__); } $this->AlteredQuery = $alteredQuery; + return $this; } /** * Get AlterationOverrideQuery value * @return string|null */ - public function getAlterationOverrideQuery() + public function getAlterationOverrideQuery(): ?string { return $this->AlterationOverrideQuery; } @@ -109,13 +114,14 @@ public function getAlterationOverrideQuery() * @param string $alterationOverrideQuery * @return \Api\StructType\ApiQuery */ - public function setAlterationOverrideQuery($alterationOverrideQuery = null) + public function setAlterationOverrideQuery(?string $alterationOverrideQuery = null): self { // validation for constraint: string if (!is_null($alterationOverrideQuery) && !is_string($alterationOverrideQuery)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alterationOverrideQuery, true), gettype($alterationOverrideQuery)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alterationOverrideQuery, true), gettype($alterationOverrideQuery)), __LINE__); } $this->AlterationOverrideQuery = $alterationOverrideQuery; + return $this; } } diff --git a/tests/resources/generated/ValidApiQueryWithIdenticalPropertiesDifferentByCase.php b/tests/resources/generated/ValidApiQueryWithIdenticalPropertiesDifferentByCase.php index 0f8eb40e..b3f8f405 100644 --- a/tests/resources/generated/ValidApiQueryWithIdenticalPropertiesDifferentByCase.php +++ b/tests/resources/generated/ValidApiQueryWithIdenticalPropertiesDifferentByCase.php @@ -1,8 +1,11 @@ setSearchTerms($searchTerms) @@ -64,7 +67,7 @@ public function __construct($searchTerms = null, $alteredQuery = null, $alterati * Get SearchTerms value * @return string|null */ - public function getSearchTerms() + public function getSearchTerms(): ?string { return $this->SearchTerms; } @@ -73,20 +76,21 @@ public function getSearchTerms() * @param string $searchTerms * @return \Api\StructType\ApiQuery */ - public function setSearchTerms($searchTerms = null) + public function setSearchTerms(?string $searchTerms = null): self { // validation for constraint: string if (!is_null($searchTerms) && !is_string($searchTerms)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($searchTerms, true), gettype($searchTerms)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($searchTerms, true), gettype($searchTerms)), __LINE__); } $this->SearchTerms = $searchTerms; + return $this; } /** * Get AlteredQuery value * @return string|null */ - public function getAlteredQuery() + public function getAlteredQuery(): ?string { return $this->AlteredQuery; } @@ -95,20 +99,21 @@ public function getAlteredQuery() * @param string $alteredQuery * @return \Api\StructType\ApiQuery */ - public function setAlteredQuery($alteredQuery = null) + public function setAlteredQuery(?string $alteredQuery = null): self { // validation for constraint: string if (!is_null($alteredQuery) && !is_string($alteredQuery)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alteredQuery, true), gettype($alteredQuery)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alteredQuery, true), gettype($alteredQuery)), __LINE__); } $this->AlteredQuery = $alteredQuery; + return $this; } /** * Get AlterationOverrideQuery value * @return string|null */ - public function getAlterationOverrideQuery() + public function getAlterationOverrideQuery(): ?string { return $this->AlterationOverrideQuery; } @@ -117,20 +122,21 @@ public function getAlterationOverrideQuery() * @param string $alterationOverrideQuery * @return \Api\StructType\ApiQuery */ - public function setAlterationOverrideQuery($alterationOverrideQuery = null) + public function setAlterationOverrideQuery(?string $alterationOverrideQuery = null): self { // validation for constraint: string if (!is_null($alterationOverrideQuery) && !is_string($alterationOverrideQuery)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alterationOverrideQuery, true), gettype($alterationOverrideQuery)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alterationOverrideQuery, true), gettype($alterationOverrideQuery)), __LINE__); } $this->AlterationOverrideQuery = $alterationOverrideQuery; + return $this; } /** * Get SearchTerms value * @return string|null */ - public function getSearchTerms_1() + public function getSearchTerms_1(): ?string { return $this->searchTerms; } @@ -139,13 +145,14 @@ public function getSearchTerms_1() * @param string $searchTerms * @return \Api\StructType\ApiQuery */ - public function setSearchTerms_1($searchTerms_1 = null) + public function setSearchTerms_1(?string $searchTerms_1 = null): self { // validation for constraint: string if (!is_null($searchTerms_1) && !is_string($searchTerms_1)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($searchTerms_1, true), gettype($searchTerms_1)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($searchTerms_1, true), gettype($searchTerms_1)), __LINE__); } $this->searchTerms = $searchTerms_1; + return $this; } } diff --git a/tests/resources/generated/ValidApiSaint.php b/tests/resources/generated/ValidApiSaint.php index f18c48dd..0d8e4fd9 100755 --- a/tests/resources/generated/ValidApiSaint.php +++ b/tests/resources/generated/ValidApiSaint.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('Saint.CheckJobStatus', array( + $this->setResult($resultSaint_CheckJobStatus = $this->getSoapClient()->__soapCall('Saint.CheckJobStatus', [ $job_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_CheckJobStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -41,7 +45,6 @@ public function Saint_CheckJobStatus($job_id) * - documentation: Creates an ftp account for the given parameters and returns the ftp account info * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $description * @param string $email @@ -54,17 +57,19 @@ public function Saint_CheckJobStatus($job_id) public function Saint_CreateFTP($description, $email, $export, $overwrite, $relation_id, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.CreateFTP', array( + $this->setResult($resultSaint_CreateFTP = $this->getSoapClient()->__soapCall('Saint.CreateFTP', [ $description, $email, $export, $overwrite, $relation_id, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_CreateFTP; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -74,7 +79,6 @@ public function Saint_CreateFTP($description, $email, $export, $overwrite, $rela * - documentation: Creates Saint Export Job. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $campaign_filter_begin_range * @param string $campaign_filter_end_range @@ -95,7 +99,7 @@ public function Saint_CreateFTP($description, $email, $export, $overwrite, $rela public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_filter_end_range, $campaign_filter_option, $date_filter_row_end_date, $date_filter_row_start_date, $email_address, $encoding, $relation_id, array $report_suite_array, $row_match_filter_empty_column_name, $row_match_filter_match_column_name, $row_match_filter_match_column_value, $select_all_rows, $select_number_of_rows) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ExportCreateJob', array( + $this->setResult($resultSaint_ExportCreateJob = $this->getSoapClient()->__soapCall('Saint.ExportCreateJob', [ $campaign_filter_begin_range, $campaign_filter_end_range, $campaign_filter_option, @@ -110,10 +114,12 @@ public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_fi $row_match_filter_match_column_value, $select_all_rows, $select_number_of_rows, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ExportCreateJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -123,7 +129,6 @@ public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_fi * - documentation: Returns the page details of a given file_id * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $file_id * @param string $segment_id @@ -132,13 +137,15 @@ public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_fi public function Saint_ExportGetFileSegment($file_id, $segment_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ExportGetFileSegment', array( + $this->setResult($resultSaint_ExportGetFileSegment = $this->getSoapClient()->__soapCall('Saint.ExportGetFileSegment', [ $file_id, $segment_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ExportGetFileSegment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -148,7 +155,6 @@ public function Saint_ExportGetFileSegment($file_id, $segment_id) * - documentation: Returns Array of compatability information for a report suite(s), * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $report_suite_array * @return \Api\StructType\ApiCompatability[]|bool @@ -156,12 +162,14 @@ public function Saint_ExportGetFileSegment($file_id, $segment_id) public function Saint_GetCompatabiltyMetrics(array $report_suite_array) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.GetCompatabiltyMetrics', array( + $this->setResult($resultSaint_GetCompatabiltyMetrics = $this->getSoapClient()->__soapCall('Saint.GetCompatabiltyMetrics', [ $report_suite_array, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_GetCompatabiltyMetrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -171,7 +179,6 @@ public function Saint_GetCompatabiltyMetrics(array $report_suite_array) * - documentation: Get SAINT export filters. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $relation_id * @param string[] $report_suite_array @@ -180,13 +187,15 @@ public function Saint_GetCompatabiltyMetrics(array $report_suite_array) public function Saint_GetFilters($relation_id, array $report_suite_array) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.GetFilters', array( + $this->setResult($resultSaint_GetFilters = $this->getSoapClient()->__soapCall('Saint.GetFilters', [ $relation_id, $report_suite_array, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_GetFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -196,7 +205,6 @@ public function Saint_GetFilters($relation_id, array $report_suite_array) * - documentation: Returns the template to be used in the SAINT browser or FTP download * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $encoding * @param int[] $numeric_div_nums @@ -208,16 +216,18 @@ public function Saint_GetFilters($relation_id, array $report_suite_array) public function Saint_GetTemplate($encoding, array $numeric_div_nums, $relation_id, $report_suite, array $text_div_nums) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.GetTemplate', array( + $this->setResult($resultSaint_GetTemplate = $this->getSoapClient()->__soapCall('Saint.GetTemplate', [ $encoding, $numeric_div_nums, $relation_id, $report_suite, $text_div_nums, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_GetTemplate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -227,7 +237,6 @@ public function Saint_GetTemplate($encoding, array $numeric_div_nums, $relation_ * - documentation: Commits a specified Saint Import job for processing. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $job_id * @return string|bool @@ -235,12 +244,14 @@ public function Saint_GetTemplate($encoding, array $numeric_div_nums, $relation_ public function Saint_ImportCommitJob($job_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ImportCommitJob', array( + $this->setResult($resultSaint_ImportCommitJob = $this->getSoapClient()->__soapCall('Saint.ImportCommitJob', [ $job_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ImportCommitJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -250,7 +261,6 @@ public function Saint_ImportCommitJob($job_id) * - documentation: Creates a Saint Import Job * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $check_divisions * @param string $description @@ -265,7 +275,7 @@ public function Saint_ImportCommitJob($job_id) public function Saint_ImportCreateJob($check_divisions, $description, $email_address, $export_results, array $header, $overwrite_conflicts, $relation_id, array $report_suite_array) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ImportCreateJob', array( + $this->setResult($resultSaint_ImportCreateJob = $this->getSoapClient()->__soapCall('Saint.ImportCreateJob', [ $check_divisions, $description, $email_address, @@ -274,10 +284,12 @@ public function Saint_ImportCreateJob($check_divisions, $description, $email_add $overwrite_conflicts, $relation_id, $report_suite_array, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ImportCreateJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -287,7 +299,6 @@ public function Saint_ImportCreateJob($check_divisions, $description, $email_add * - documentation: Attaches Import data to a given Saint Import job. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $job_id * @param string $page @@ -297,14 +308,16 @@ public function Saint_ImportCreateJob($check_divisions, $description, $email_add public function Saint_ImportPopulateJob($job_id, $page, array $rows) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ImportPopulateJob', array( + $this->setResult($resultSaint_ImportPopulateJob = $this->getSoapClient()->__soapCall('Saint.ImportPopulateJob', [ $job_id, $page, $rows, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ImportPopulateJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -314,17 +327,18 @@ public function Saint_ImportPopulateJob($job_id, $page, array $rows) * - documentation: Returns a list of the ftp accounts configured for this company * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiSaint_ftp[]|bool */ public function Saint_ListFTP() { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ListFTP', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultSaint_ListFTP = $this->getSoapClient()->__soapCall('Saint.ListFTP', [], [], [], $this->outputHeaders)); + + return $resultSaint_ListFTP; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiSearch.php b/tests/resources/generated/ValidApiSearch.php index 35b1b6c3..ba46f853 100755 --- a/tests/resources/generated/ValidApiSearch.php +++ b/tests/resources/generated/ValidApiSearch.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('Search', array( + $this->setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ $parameters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiSearchBingApi.php b/tests/resources/generated/ValidApiSearchBingApi.php index 36f35ea6..804b84b7 100755 --- a/tests/resources/generated/ValidApiSearchBingApi.php +++ b/tests/resources/generated/ValidApiSearchBingApi.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('Search', array( + $this->setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ $parameters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidApiSearchRequest.php b/tests/resources/generated/ValidApiSearchRequest.php index 1ca5363d..a2d45982 100755 --- a/tests/resources/generated/ValidApiSearchRequest.php +++ b/tests/resources/generated/ValidApiSearchRequest.php @@ -1,8 +1,11 @@ setQuery($query) @@ -233,7 +236,7 @@ public function __construct($query = null, $appId = null, \Api\ArrayType\ApiArra * Get Query value * @return string */ - public function getQuery() + public function getQuery(): string { return $this->Query; } @@ -242,20 +245,21 @@ public function getQuery() * @param string $query * @return \Api\StructType\ApiSearchRequest */ - public function setQuery($query = null) + public function setQuery(string $query): self { // validation for constraint: string if (!is_null($query) && !is_string($query)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($query, true), gettype($query)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($query, true), gettype($query)), __LINE__); } $this->Query = $query; + return $this; } /** * Get AppId value * @return string */ - public function getAppId() + public function getAppId(): string { return $this->AppId; } @@ -264,20 +268,21 @@ public function getAppId() * @param string $appId * @return \Api\StructType\ApiSearchRequest */ - public function setAppId($appId = null) + public function setAppId(string $appId): self { // validation for constraint: string if (!is_null($appId) && !is_string($appId)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($appId, true), gettype($appId)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($appId, true), gettype($appId)), __LINE__); } $this->AppId = $appId; + return $this; } /** * Get Sources value * @return \Api\ArrayType\ApiArrayOfSourceType */ - public function getSources() + public function getSources(): \Api\ArrayType\ApiArrayOfSourceType { return $this->Sources; } @@ -286,16 +291,17 @@ public function getSources() * @param \Api\ArrayType\ApiArrayOfSourceType $sources * @return \Api\StructType\ApiSearchRequest */ - public function setSources(\Api\ArrayType\ApiArrayOfSourceType $sources = null) + public function setSources(\Api\ArrayType\ApiArrayOfSourceType $sources): self { $this->Sources = $sources; + return $this; } /** * Get parameters value * @return \Api\StructType\ApiSearchRequest */ - public function getParameters() + public function getParameters(): \Api\StructType\ApiSearchRequest { return $this->parameters; } @@ -304,16 +310,17 @@ public function getParameters() * @param \Api\StructType\ApiSearchRequest $parameters * @return \Api\StructType\ApiSearchRequest */ - public function setParameters(\Api\StructType\ApiSearchRequest $parameters = null) + public function setParameters(\Api\StructType\ApiSearchRequest $parameters): self { $this->parameters = $parameters; + return $this; } /** * Get Version value * @return string|null */ - public function getVersion() + public function getVersion(): ?string { return $this->Version; } @@ -322,20 +329,21 @@ public function getVersion() * @param string $version * @return \Api\StructType\ApiSearchRequest */ - public function setVersion($version = '2.2') + public function setVersion(?string $version = '2.2'): self { // validation for constraint: string if (!is_null($version) && !is_string($version)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($version, true), gettype($version)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($version, true), gettype($version)), __LINE__); } $this->Version = $version; + return $this; } /** * Get Market value * @return string|null */ - public function getMarket() + public function getMarket(): ?string { return $this->Market; } @@ -344,20 +352,21 @@ public function getMarket() * @param string $market * @return \Api\StructType\ApiSearchRequest */ - public function setMarket($market = null) + public function setMarket(?string $market = null): self { // validation for constraint: string if (!is_null($market) && !is_string($market)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($market, true), gettype($market)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($market, true), gettype($market)), __LINE__); } $this->Market = $market; + return $this; } /** * Get UILanguage value * @return string|null */ - public function getUILanguage() + public function getUILanguage(): ?string { return $this->UILanguage; } @@ -366,20 +375,21 @@ public function getUILanguage() * @param string $uILanguage * @return \Api\StructType\ApiSearchRequest */ - public function setUILanguage($uILanguage = null) + public function setUILanguage(?string $uILanguage = null): self { // validation for constraint: string if (!is_null($uILanguage) && !is_string($uILanguage)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uILanguage, true), gettype($uILanguage)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uILanguage, true), gettype($uILanguage)), __LINE__); } $this->UILanguage = $uILanguage; + return $this; } /** * Get Adult value * @return string|null */ - public function getAdult() + public function getAdult(): ?string { return $this->Adult; } @@ -387,24 +397,25 @@ public function getAdult() * Set Adult value * @uses \Api\EnumType\ApiAdultOption::valueIsValid() * @uses \Api\EnumType\ApiAdultOption::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $adult * @return \Api\StructType\ApiSearchRequest */ - public function setAdult($adult = null) + public function setAdult(?string $adult = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiAdultOption::valueIsValid($adult)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAdultOption', is_array($adult) ? implode(', ', $adult) : var_export($adult, true), implode(', ', \Api\EnumType\ApiAdultOption::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAdultOption', is_array($adult) ? implode(', ', $adult) : var_export($adult, true), implode(', ', \Api\EnumType\ApiAdultOption::getValidValues())), __LINE__); } $this->Adult = $adult; + return $this; } /** * Get Latitude value * @return float|null */ - public function getLatitude() + public function getLatitude(): ?float { return $this->Latitude; } @@ -413,20 +424,21 @@ public function getLatitude() * @param float $latitude * @return \Api\StructType\ApiSearchRequest */ - public function setLatitude($latitude = null) + public function setLatitude(?float $latitude = null): self { // validation for constraint: float if (!is_null($latitude) && !(is_float($latitude) || is_numeric($latitude))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($latitude, true), gettype($latitude)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($latitude, true), gettype($latitude)), __LINE__); } $this->Latitude = $latitude; + return $this; } /** * Get Longitude value * @return float|null */ - public function getLongitude() + public function getLongitude(): ?float { return $this->Longitude; } @@ -435,20 +447,21 @@ public function getLongitude() * @param float $longitude * @return \Api\StructType\ApiSearchRequest */ - public function setLongitude($longitude = null) + public function setLongitude(?float $longitude = null): self { // validation for constraint: float if (!is_null($longitude) && !(is_float($longitude) || is_numeric($longitude))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($longitude, true), gettype($longitude)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($longitude, true), gettype($longitude)), __LINE__); } $this->Longitude = $longitude; + return $this; } /** * Get Radius value * @return float|null */ - public function getRadius() + public function getRadius(): ?float { return $this->Radius; } @@ -457,20 +470,21 @@ public function getRadius() * @param float $radius * @return \Api\StructType\ApiSearchRequest */ - public function setRadius($radius = null) + public function setRadius(?float $radius = null): self { // validation for constraint: float if (!is_null($radius) && !(is_float($radius) || is_numeric($radius))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($radius, true), gettype($radius)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($radius, true), gettype($radius)), __LINE__); } $this->Radius = $radius; + return $this; } /** * Get Options value * @return \Api\ArrayType\ApiArrayOfSearchOption|null */ - public function getOptions() + public function getOptions(): ?\Api\ArrayType\ApiArrayOfSearchOption { return $this->Options; } @@ -479,16 +493,17 @@ public function getOptions() * @param \Api\ArrayType\ApiArrayOfSearchOption $options * @return \Api\StructType\ApiSearchRequest */ - public function setOptions(\Api\ArrayType\ApiArrayOfSearchOption $options = null) + public function setOptions(?\Api\ArrayType\ApiArrayOfSearchOption $options = null): self { $this->Options = $options; + return $this; } /** * Get Web value * @return \Api\StructType\ApiWebRequest|null */ - public function getWeb() + public function getWeb(): ?\Api\StructType\ApiWebRequest { return $this->Web; } @@ -497,16 +512,17 @@ public function getWeb() * @param \Api\StructType\ApiWebRequest $web * @return \Api\StructType\ApiSearchRequest */ - public function setWeb(\Api\StructType\ApiWebRequest $web = null) + public function setWeb(?\Api\StructType\ApiWebRequest $web = null): self { $this->Web = $web; + return $this; } /** * Get Image value * @return \Api\StructType\ApiImageRequest|null */ - public function getImage() + public function getImage(): ?\Api\StructType\ApiImageRequest { return $this->Image; } @@ -515,16 +531,17 @@ public function getImage() * @param \Api\StructType\ApiImageRequest $image * @return \Api\StructType\ApiSearchRequest */ - public function setImage(\Api\StructType\ApiImageRequest $image = null) + public function setImage(?\Api\StructType\ApiImageRequest $image = null): self { $this->Image = $image; + return $this; } /** * Get Phonebook value * @return \Api\StructType\ApiPhonebookRequest|null */ - public function getPhonebook() + public function getPhonebook(): ?\Api\StructType\ApiPhonebookRequest { return $this->Phonebook; } @@ -533,16 +550,17 @@ public function getPhonebook() * @param \Api\StructType\ApiPhonebookRequest $phonebook * @return \Api\StructType\ApiSearchRequest */ - public function setPhonebook(\Api\StructType\ApiPhonebookRequest $phonebook = null) + public function setPhonebook(?\Api\StructType\ApiPhonebookRequest $phonebook = null): self { $this->Phonebook = $phonebook; + return $this; } /** * Get Video value * @return \Api\StructType\ApiVideoRequest|null */ - public function getVideo() + public function getVideo(): ?\Api\StructType\ApiVideoRequest { return $this->Video; } @@ -551,16 +569,17 @@ public function getVideo() * @param \Api\StructType\ApiVideoRequest $video * @return \Api\StructType\ApiSearchRequest */ - public function setVideo(\Api\StructType\ApiVideoRequest $video = null) + public function setVideo(?\Api\StructType\ApiVideoRequest $video = null): self { $this->Video = $video; + return $this; } /** * Get News value * @return \Api\StructType\ApiNewsRequest|null */ - public function getNews() + public function getNews(): ?\Api\StructType\ApiNewsRequest { return $this->News; } @@ -569,16 +588,17 @@ public function getNews() * @param \Api\StructType\ApiNewsRequest $news * @return \Api\StructType\ApiSearchRequest */ - public function setNews(\Api\StructType\ApiNewsRequest $news = null) + public function setNews(?\Api\StructType\ApiNewsRequest $news = null): self { $this->News = $news; + return $this; } /** * Get MobileWeb value * @return \Api\StructType\ApiMobileWebRequest|null */ - public function getMobileWeb() + public function getMobileWeb(): ?\Api\StructType\ApiMobileWebRequest { return $this->MobileWeb; } @@ -587,16 +607,17 @@ public function getMobileWeb() * @param \Api\StructType\ApiMobileWebRequest $mobileWeb * @return \Api\StructType\ApiSearchRequest */ - public function setMobileWeb(\Api\StructType\ApiMobileWebRequest $mobileWeb = null) + public function setMobileWeb(?\Api\StructType\ApiMobileWebRequest $mobileWeb = null): self { $this->MobileWeb = $mobileWeb; + return $this; } /** * Get Translation value * @return \Api\StructType\ApiTranslationRequest|null */ - public function getTranslation() + public function getTranslation(): ?\Api\StructType\ApiTranslationRequest { return $this->Translation; } @@ -605,9 +626,10 @@ public function getTranslation() * @param \Api\StructType\ApiTranslationRequest $translation * @return \Api\StructType\ApiSearchRequest */ - public function setTranslation(\Api\StructType\ApiTranslationRequest $translation = null) + public function setTranslation(?\Api\StructType\ApiTranslationRequest $translation = null): self { $this->Translation = $translation; + return $this; } } diff --git a/tests/resources/generated/ValidApiSourceType.php b/tests/resources/generated/ValidApiSourceType.php index 027c4294..6da31327 100755 --- a/tests/resources/generated/ValidApiSourceType.php +++ b/tests/resources/generated/ValidApiSourceType.php @@ -1,8 +1,11 @@ setOffset($offset) @@ -67,7 +70,7 @@ public function __construct($offset = null, $count = null, \Api\ArrayType\ApiArr * Get Offset value * @return int|null */ - public function getOffset() + public function getOffset(): ?int { return $this->Offset; } @@ -76,20 +79,21 @@ public function getOffset() * @param int $offset * @return \Api\StructType\ApiVideoRequest */ - public function setOffset($offset = null) + public function setOffset(?int $offset = null): self { // validation for constraint: int if (!is_null($offset) && !(is_int($offset) || ctype_digit($offset))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($offset, true), gettype($offset)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($offset, true), gettype($offset)), __LINE__); } $this->Offset = $offset; + return $this; } /** * Get Count value * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->Count; } @@ -98,20 +102,21 @@ public function getCount() * @param int $count * @return \Api\StructType\ApiVideoRequest */ - public function setCount($count = null) + public function setCount(?int $count = null): self { // validation for constraint: int if (!is_null($count) && !(is_int($count) || ctype_digit($count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($count, true), gettype($count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($count, true), gettype($count)), __LINE__); } $this->Count = $count; + return $this; } /** * Get Filters value * @return \Api\ArrayType\ApiArrayOfString|null */ - public function getFilters() + public function getFilters(): ?\Api\ArrayType\ApiArrayOfString { return $this->Filters; } @@ -120,16 +125,17 @@ public function getFilters() * @param \Api\ArrayType\ApiArrayOfString $filters * @return \Api\StructType\ApiVideoRequest */ - public function setFilters(\Api\ArrayType\ApiArrayOfString $filters = null) + public function setFilters(?\Api\ArrayType\ApiArrayOfString $filters = null): self { $this->Filters = $filters; + return $this; } /** * Get SortBy value * @return string|null */ - public function getSortBy() + public function getSortBy(): ?string { return $this->SortBy; } @@ -137,17 +143,18 @@ public function getSortBy() * Set SortBy value * @uses \Api\EnumType\ApiVideoSortOption::valueIsValid() * @uses \Api\EnumType\ApiVideoSortOption::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $sortBy * @return \Api\StructType\ApiVideoRequest */ - public function setSortBy($sortBy = null) + public function setSortBy(?string $sortBy = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiVideoSortOption::valueIsValid($sortBy)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiVideoSortOption', is_array($sortBy) ? implode(', ', $sortBy) : var_export($sortBy, true), implode(', ', \Api\EnumType\ApiVideoSortOption::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiVideoSortOption', is_array($sortBy) ? implode(', ', $sortBy) : var_export($sortBy, true), implode(', ', \Api\EnumType\ApiVideoSortOption::getValidValues())), __LINE__); } $this->SortBy = $sortBy; + return $this; } } diff --git a/tests/resources/generated/ValidApiWebSearchOption.php b/tests/resources/generated/ValidApiWebSearchOption.php index 794befe7..e27cd1a3 100755 --- a/tests/resources/generated/ValidApiWebSearchOption.php +++ b/tests/resources/generated/ValidApiWebSearchOption.php @@ -1,8 +1,11 @@ setBannerID($bannerID) @@ -338,7 +341,7 @@ public function __construct($bannerID = null, $campaignID = null, $title = null, * Get BannerID value * @return int|null */ - public function getBannerID() + public function getBannerID(): ?int { return $this->BannerID; } @@ -347,20 +350,21 @@ public function getBannerID() * @param int $bannerID * @return \Api\StructType\ApiBannerInfo */ - public function setBannerID($bannerID = null) + public function setBannerID(?int $bannerID = null): self { // validation for constraint: int if (!is_null($bannerID) && !(is_int($bannerID) || ctype_digit($bannerID))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($bannerID, true), gettype($bannerID)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($bannerID, true), gettype($bannerID)), __LINE__); } $this->BannerID = $bannerID; + return $this; } /** * Get CampaignID value * @return int|null */ - public function getCampaignID() + public function getCampaignID(): ?int { return $this->CampaignID; } @@ -369,20 +373,21 @@ public function getCampaignID() * @param int $campaignID * @return \Api\StructType\ApiBannerInfo */ - public function setCampaignID($campaignID = null) + public function setCampaignID(?int $campaignID = null): self { // validation for constraint: int if (!is_null($campaignID) && !(is_int($campaignID) || ctype_digit($campaignID))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($campaignID, true), gettype($campaignID)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($campaignID, true), gettype($campaignID)), __LINE__); } $this->CampaignID = $campaignID; + return $this; } /** * Get Title value * @return string|null */ - public function getTitle() + public function getTitle(): ?string { return $this->Title; } @@ -391,20 +396,21 @@ public function getTitle() * @param string $title * @return \Api\StructType\ApiBannerInfo */ - public function setTitle($title = null) + public function setTitle(?string $title = null): self { // validation for constraint: string if (!is_null($title) && !is_string($title)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($title, true), gettype($title)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($title, true), gettype($title)), __LINE__); } $this->Title = $title; + return $this; } /** * Get Text value * @return string|null */ - public function getText() + public function getText(): ?string { return $this->Text; } @@ -413,20 +419,21 @@ public function getText() * @param string $text * @return \Api\StructType\ApiBannerInfo */ - public function setText($text = null) + public function setText(?string $text = null): self { // validation for constraint: string if (!is_null($text) && !is_string($text)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($text, true), gettype($text)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($text, true), gettype($text)), __LINE__); } $this->Text = $text; + return $this; } /** * Get Href value * @return string|null */ - public function getHref() + public function getHref(): ?string { return $this->Href; } @@ -435,20 +442,21 @@ public function getHref() * @param string $href * @return \Api\StructType\ApiBannerInfo */ - public function setHref($href = null) + public function setHref(?string $href = null): self { // validation for constraint: string if (!is_null($href) && !is_string($href)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($href, true), gettype($href)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($href, true), gettype($href)), __LINE__); } $this->Href = $href; + return $this; } /** * Get Domain value * @return string|null */ - public function getDomain() + public function getDomain(): ?string { return $this->Domain; } @@ -457,20 +465,21 @@ public function getDomain() * @param string $domain * @return \Api\StructType\ApiBannerInfo */ - public function setDomain($domain = null) + public function setDomain(?string $domain = null): self { // validation for constraint: string if (!is_null($domain) && !is_string($domain)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($domain, true), gettype($domain)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($domain, true), gettype($domain)), __LINE__); } $this->Domain = $domain; + return $this; } /** * Get ContactInfo value * @return \Api\StructType\ApiContactInfo|null */ - public function getContactInfo() + public function getContactInfo(): ?\Api\StructType\ApiContactInfo { return $this->ContactInfo; } @@ -479,16 +488,17 @@ public function getContactInfo() * @param \Api\StructType\ApiContactInfo $contactInfo * @return \Api\StructType\ApiBannerInfo */ - public function setContactInfo(\Api\StructType\ApiContactInfo $contactInfo = null) + public function setContactInfo(?\Api\StructType\ApiContactInfo $contactInfo = null): self { $this->ContactInfo = $contactInfo; + return $this; } /** * Get Geo value * @return string|null */ - public function getGeo() + public function getGeo(): ?string { return $this->Geo; } @@ -497,20 +507,21 @@ public function getGeo() * @param string $geo * @return \Api\StructType\ApiBannerInfo */ - public function setGeo($geo = null) + public function setGeo(?string $geo = null): self { // validation for constraint: string if (!is_null($geo) && !is_string($geo)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($geo, true), gettype($geo)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($geo, true), gettype($geo)), __LINE__); } $this->Geo = $geo; + return $this; } /** * Get Phrases value - * @return \Api\StructType\ApiBannerPhraseInfo[]|null + * @return \Api\StructType\ApiBannerPhraseInfo[] */ - public function getPhrases() + public function getPhrases(): array { return $this->Phrases; } @@ -520,7 +531,7 @@ public function getPhrases() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validatePhrasesForArrayConstraintsFromSetPhrases(array $values = array()) + public static function validatePhrasesForArrayConstraintsFromSetPhrases(array $values = []): string { $message = ''; $invalidValues = []; @@ -534,43 +545,46 @@ public static function validatePhrasesForArrayConstraintsFromSetPhrases(array $v $message = sprintf('The Phrases property can only contain items of type \Api\StructType\ApiBannerPhraseInfo, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Phrases value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiBannerPhraseInfo[] $phrases * @return \Api\StructType\ApiBannerInfo */ - public function setPhrases(array $phrases = array()) + public function setPhrases(array $phrases = []): self { // validation for constraint: array if ('' !== ($phrasesArrayErrorMessage = self::validatePhrasesForArrayConstraintsFromSetPhrases($phrases))) { - throw new \InvalidArgumentException($phrasesArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($phrasesArrayErrorMessage, __LINE__); } $this->Phrases = $phrases; + return $this; } /** * Add item to Phrases value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiBannerPhraseInfo $item * @return \Api\StructType\ApiBannerInfo */ - public function addToPhrases(\Api\StructType\ApiBannerPhraseInfo $item) + public function addToPhrases(\Api\StructType\ApiBannerPhraseInfo $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiBannerPhraseInfo) { - throw new \InvalidArgumentException(sprintf('The Phrases property can only contain items of type \Api\StructType\ApiBannerPhraseInfo, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Phrases property can only contain items of type \Api\StructType\ApiBannerPhraseInfo, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->Phrases[] = $item; + return $this; } /** * Get MinusKeywords value - * @return string[]|null + * @return string[] */ - public function getMinusKeywords() + public function getMinusKeywords(): array { return $this->MinusKeywords; } @@ -580,7 +594,7 @@ public function getMinusKeywords() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateMinusKeywordsForArrayConstraintsFromSetMinusKeywords(array $values = array()) + public static function validateMinusKeywordsForArrayConstraintsFromSetMinusKeywords(array $values = []): string { $message = ''; $invalidValues = []; @@ -594,43 +608,46 @@ public static function validateMinusKeywordsForArrayConstraintsFromSetMinusKeywo $message = sprintf('The MinusKeywords property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set MinusKeywords value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $minusKeywords * @return \Api\StructType\ApiBannerInfo */ - public function setMinusKeywords(array $minusKeywords = array()) + public function setMinusKeywords(array $minusKeywords = []): self { // validation for constraint: array if ('' !== ($minusKeywordsArrayErrorMessage = self::validateMinusKeywordsForArrayConstraintsFromSetMinusKeywords($minusKeywords))) { - throw new \InvalidArgumentException($minusKeywordsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($minusKeywordsArrayErrorMessage, __LINE__); } $this->MinusKeywords = $minusKeywords; + return $this; } /** * Add item to MinusKeywords value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiBannerInfo */ - public function addToMinusKeywords($item) + public function addToMinusKeywords(string $item): self { // validation for constraint: itemType if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The MinusKeywords property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The MinusKeywords property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->MinusKeywords[] = $item; + return $this; } /** * Get StatusActivating value * @return string|null */ - public function getStatusActivating() + public function getStatusActivating(): ?string { return $this->StatusActivating; } @@ -639,20 +656,21 @@ public function getStatusActivating() * @param string $statusActivating * @return \Api\StructType\ApiBannerInfo */ - public function setStatusActivating($statusActivating = null) + public function setStatusActivating(?string $statusActivating = null): self { // validation for constraint: string if (!is_null($statusActivating) && !is_string($statusActivating)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusActivating, true), gettype($statusActivating)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusActivating, true), gettype($statusActivating)), __LINE__); } $this->StatusActivating = $statusActivating; + return $this; } /** * Get StatusArchive value * @return string|null */ - public function getStatusArchive() + public function getStatusArchive(): ?string { return $this->StatusArchive; } @@ -661,20 +679,21 @@ public function getStatusArchive() * @param string $statusArchive * @return \Api\StructType\ApiBannerInfo */ - public function setStatusArchive($statusArchive = null) + public function setStatusArchive(?string $statusArchive = null): self { // validation for constraint: string if (!is_null($statusArchive) && !is_string($statusArchive)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusArchive, true), gettype($statusArchive)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusArchive, true), gettype($statusArchive)), __LINE__); } $this->StatusArchive = $statusArchive; + return $this; } /** * Get StatusBannerModerate value * @return string|null */ - public function getStatusBannerModerate() + public function getStatusBannerModerate(): ?string { return $this->StatusBannerModerate; } @@ -683,20 +702,21 @@ public function getStatusBannerModerate() * @param string $statusBannerModerate * @return \Api\StructType\ApiBannerInfo */ - public function setStatusBannerModerate($statusBannerModerate = null) + public function setStatusBannerModerate(?string $statusBannerModerate = null): self { // validation for constraint: string if (!is_null($statusBannerModerate) && !is_string($statusBannerModerate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusBannerModerate, true), gettype($statusBannerModerate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusBannerModerate, true), gettype($statusBannerModerate)), __LINE__); } $this->StatusBannerModerate = $statusBannerModerate; + return $this; } /** * Get StatusPhrasesModerate value * @return string|null */ - public function getStatusPhrasesModerate() + public function getStatusPhrasesModerate(): ?string { return $this->StatusPhrasesModerate; } @@ -705,20 +725,21 @@ public function getStatusPhrasesModerate() * @param string $statusPhrasesModerate * @return \Api\StructType\ApiBannerInfo */ - public function setStatusPhrasesModerate($statusPhrasesModerate = null) + public function setStatusPhrasesModerate(?string $statusPhrasesModerate = null): self { // validation for constraint: string if (!is_null($statusPhrasesModerate) && !is_string($statusPhrasesModerate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusPhrasesModerate, true), gettype($statusPhrasesModerate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusPhrasesModerate, true), gettype($statusPhrasesModerate)), __LINE__); } $this->StatusPhrasesModerate = $statusPhrasesModerate; + return $this; } /** * Get StatusPhoneModerate value * @return string|null */ - public function getStatusPhoneModerate() + public function getStatusPhoneModerate(): ?string { return $this->StatusPhoneModerate; } @@ -727,20 +748,21 @@ public function getStatusPhoneModerate() * @param string $statusPhoneModerate * @return \Api\StructType\ApiBannerInfo */ - public function setStatusPhoneModerate($statusPhoneModerate = null) + public function setStatusPhoneModerate(?string $statusPhoneModerate = null): self { // validation for constraint: string if (!is_null($statusPhoneModerate) && !is_string($statusPhoneModerate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusPhoneModerate, true), gettype($statusPhoneModerate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusPhoneModerate, true), gettype($statusPhoneModerate)), __LINE__); } $this->StatusPhoneModerate = $statusPhoneModerate; + return $this; } /** * Get StatusShow value * @return string|null */ - public function getStatusShow() + public function getStatusShow(): ?string { return $this->StatusShow; } @@ -749,20 +771,21 @@ public function getStatusShow() * @param string $statusShow * @return \Api\StructType\ApiBannerInfo */ - public function setStatusShow($statusShow = null) + public function setStatusShow(?string $statusShow = null): self { // validation for constraint: string if (!is_null($statusShow) && !is_string($statusShow)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusShow, true), gettype($statusShow)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusShow, true), gettype($statusShow)), __LINE__); } $this->StatusShow = $statusShow; + return $this; } /** * Get IsActive value * @return string|null */ - public function getIsActive() + public function getIsActive(): ?string { return $this->IsActive; } @@ -771,20 +794,21 @@ public function getIsActive() * @param string $isActive * @return \Api\StructType\ApiBannerInfo */ - public function setIsActive($isActive = null) + public function setIsActive(?string $isActive = null): self { // validation for constraint: string if (!is_null($isActive) && !is_string($isActive)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($isActive, true), gettype($isActive)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($isActive, true), gettype($isActive)), __LINE__); } $this->IsActive = $isActive; + return $this; } /** * Get StatusSitelinksModerate value * @return string|null */ - public function getStatusSitelinksModerate() + public function getStatusSitelinksModerate(): ?string { return $this->StatusSitelinksModerate; } @@ -793,20 +817,21 @@ public function getStatusSitelinksModerate() * @param string $statusSitelinksModerate * @return \Api\StructType\ApiBannerInfo */ - public function setStatusSitelinksModerate($statusSitelinksModerate = null) + public function setStatusSitelinksModerate(?string $statusSitelinksModerate = null): self { // validation for constraint: string if (!is_null($statusSitelinksModerate) && !is_string($statusSitelinksModerate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusSitelinksModerate, true), gettype($statusSitelinksModerate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusSitelinksModerate, true), gettype($statusSitelinksModerate)), __LINE__); } $this->StatusSitelinksModerate = $statusSitelinksModerate; + return $this; } /** * Get Sitelinks value - * @return \Api\StructType\ApiSitelink[]|null + * @return \Api\StructType\ApiSitelink[] */ - public function getSitelinks() + public function getSitelinks(): array { return $this->Sitelinks; } @@ -816,7 +841,7 @@ public function getSitelinks() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateSitelinksForArrayConstraintsFromSetSitelinks(array $values = array()) + public static function validateSitelinksForArrayConstraintsFromSetSitelinks(array $values = []): string { $message = ''; $invalidValues = []; @@ -830,43 +855,46 @@ public static function validateSitelinksForArrayConstraintsFromSetSitelinks(arra $message = sprintf('The Sitelinks property can only contain items of type \Api\StructType\ApiSitelink, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Sitelinks value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiSitelink[] $sitelinks * @return \Api\StructType\ApiBannerInfo */ - public function setSitelinks(array $sitelinks = array()) + public function setSitelinks(array $sitelinks = []): self { // validation for constraint: array if ('' !== ($sitelinksArrayErrorMessage = self::validateSitelinksForArrayConstraintsFromSetSitelinks($sitelinks))) { - throw new \InvalidArgumentException($sitelinksArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($sitelinksArrayErrorMessage, __LINE__); } $this->Sitelinks = $sitelinks; + return $this; } /** * Add item to Sitelinks value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiSitelink $item * @return \Api\StructType\ApiBannerInfo */ - public function addToSitelinks(\Api\StructType\ApiSitelink $item) + public function addToSitelinks(\Api\StructType\ApiSitelink $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiSitelink) { - throw new \InvalidArgumentException(sprintf('The Sitelinks property can only contain items of type \Api\StructType\ApiSitelink, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Sitelinks property can only contain items of type \Api\StructType\ApiSitelink, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->Sitelinks[] = $item; + return $this; } /** * Get AdWarnings value - * @return string[]|null + * @return string[] */ - public function getAdWarnings() + public function getAdWarnings(): array { return $this->AdWarnings; } @@ -876,7 +904,7 @@ public function getAdWarnings() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateAdWarningsForArrayConstraintsFromSetAdWarnings(array $values = array()) + public static function validateAdWarningsForArrayConstraintsFromSetAdWarnings(array $values = []): string { $message = ''; $invalidValues = []; @@ -890,43 +918,46 @@ public static function validateAdWarningsForArrayConstraintsFromSetAdWarnings(ar $message = sprintf('The AdWarnings property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set AdWarnings value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $adWarnings * @return \Api\StructType\ApiBannerInfo */ - public function setAdWarnings(array $adWarnings = array()) + public function setAdWarnings(array $adWarnings = []): self { // validation for constraint: array if ('' !== ($adWarningsArrayErrorMessage = self::validateAdWarningsForArrayConstraintsFromSetAdWarnings($adWarnings))) { - throw new \InvalidArgumentException($adWarningsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($adWarningsArrayErrorMessage, __LINE__); } $this->AdWarnings = $adWarnings; + return $this; } /** * Add item to AdWarnings value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiBannerInfo */ - public function addToAdWarnings($item) + public function addToAdWarnings(string $item): self { // validation for constraint: itemType if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The AdWarnings property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The AdWarnings property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->AdWarnings[] = $item; + return $this; } /** * Get FixedOnModeration value * @return string|null */ - public function getFixedOnModeration() + public function getFixedOnModeration(): ?string { return $this->FixedOnModeration; } @@ -935,20 +966,21 @@ public function getFixedOnModeration() * @param string $fixedOnModeration * @return \Api\StructType\ApiBannerInfo */ - public function setFixedOnModeration($fixedOnModeration = null) + public function setFixedOnModeration(?string $fixedOnModeration = null): self { // validation for constraint: string if (!is_null($fixedOnModeration) && !is_string($fixedOnModeration)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fixedOnModeration, true), gettype($fixedOnModeration)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fixedOnModeration, true), gettype($fixedOnModeration)), __LINE__); } $this->FixedOnModeration = $fixedOnModeration; + return $this; } /** * Get ModerateRejectionReasons value - * @return \Api\StructType\ApiRejectReason[]|null + * @return \Api\StructType\ApiRejectReason[] */ - public function getModerateRejectionReasons() + public function getModerateRejectionReasons(): array { return $this->ModerateRejectionReasons; } @@ -958,7 +990,7 @@ public function getModerateRejectionReasons() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateModerateRejectionReasonsForArrayConstraintsFromSetModerateRejectionReasons(array $values = array()) + public static function validateModerateRejectionReasonsForArrayConstraintsFromSetModerateRejectionReasons(array $values = []): string { $message = ''; $invalidValues = []; @@ -972,43 +1004,46 @@ public static function validateModerateRejectionReasonsForArrayConstraintsFromSe $message = sprintf('The ModerateRejectionReasons property can only contain items of type \Api\StructType\ApiRejectReason, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set ModerateRejectionReasons value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiRejectReason[] $moderateRejectionReasons * @return \Api\StructType\ApiBannerInfo */ - public function setModerateRejectionReasons(array $moderateRejectionReasons = array()) + public function setModerateRejectionReasons(array $moderateRejectionReasons = []): self { // validation for constraint: array if ('' !== ($moderateRejectionReasonsArrayErrorMessage = self::validateModerateRejectionReasonsForArrayConstraintsFromSetModerateRejectionReasons($moderateRejectionReasons))) { - throw new \InvalidArgumentException($moderateRejectionReasonsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($moderateRejectionReasonsArrayErrorMessage, __LINE__); } $this->ModerateRejectionReasons = $moderateRejectionReasons; + return $this; } /** * Add item to ModerateRejectionReasons value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiRejectReason $item * @return \Api\StructType\ApiBannerInfo */ - public function addToModerateRejectionReasons(\Api\StructType\ApiRejectReason $item) + public function addToModerateRejectionReasons(\Api\StructType\ApiRejectReason $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiRejectReason) { - throw new \InvalidArgumentException(sprintf('The ModerateRejectionReasons property can only contain items of type \Api\StructType\ApiRejectReason, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The ModerateRejectionReasons property can only contain items of type \Api\StructType\ApiRejectReason, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->ModerateRejectionReasons[] = $item; + return $this; } /** * Get Type value * @return string|null */ - public function getType() + public function getType(): ?string { return $this->Type; } @@ -1017,20 +1052,21 @@ public function getType() * @param string $type * @return \Api\StructType\ApiBannerInfo */ - public function setType($type = null) + public function setType(?string $type = null): self { // validation for constraint: string if (!is_null($type) && !is_string($type)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); } $this->Type = $type; + return $this; } /** * Get AdGroupID value * @return int|null */ - public function getAdGroupID() + public function getAdGroupID(): ?int { return $this->AdGroupID; } @@ -1039,20 +1075,21 @@ public function getAdGroupID() * @param int $adGroupID * @return \Api\StructType\ApiBannerInfo */ - public function setAdGroupID($adGroupID = null) + public function setAdGroupID(?int $adGroupID = null): self { // validation for constraint: int if (!is_null($adGroupID) && !(is_int($adGroupID) || ctype_digit($adGroupID))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($adGroupID, true), gettype($adGroupID)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($adGroupID, true), gettype($adGroupID)), __LINE__); } $this->AdGroupID = $adGroupID; + return $this; } /** * Get AdGroupName value * @return string|null */ - public function getAdGroupName() + public function getAdGroupName(): ?string { return $this->AdGroupName; } @@ -1061,20 +1098,21 @@ public function getAdGroupName() * @param string $adGroupName * @return \Api\StructType\ApiBannerInfo */ - public function setAdGroupName($adGroupName = null) + public function setAdGroupName(?string $adGroupName = null): self { // validation for constraint: string if (!is_null($adGroupName) && !is_string($adGroupName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($adGroupName, true), gettype($adGroupName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($adGroupName, true), gettype($adGroupName)), __LINE__); } $this->AdGroupName = $adGroupName; + return $this; } /** * Get AutoMinusWords value * @return string|null */ - public function getAutoMinusWords() + public function getAutoMinusWords(): ?string { return $this->AutoMinusWords; } @@ -1083,20 +1121,21 @@ public function getAutoMinusWords() * @param string $autoMinusWords * @return \Api\StructType\ApiBannerInfo */ - public function setAutoMinusWords($autoMinusWords = null) + public function setAutoMinusWords(?string $autoMinusWords = null): self { // validation for constraint: string if (!is_null($autoMinusWords) && !is_string($autoMinusWords)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($autoMinusWords, true), gettype($autoMinusWords)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($autoMinusWords, true), gettype($autoMinusWords)), __LINE__); } $this->AutoMinusWords = $autoMinusWords; + return $this; } /** * Get AgeLabel value * @return string|null */ - public function getAgeLabel() + public function getAgeLabel(): ?string { return $this->AgeLabel; } @@ -1105,20 +1144,21 @@ public function getAgeLabel() * @param string $ageLabel * @return \Api\StructType\ApiBannerInfo */ - public function setAgeLabel($ageLabel = null) + public function setAgeLabel(?string $ageLabel = null): self { // validation for constraint: string if (!is_null($ageLabel) && !is_string($ageLabel)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($ageLabel, true), gettype($ageLabel)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($ageLabel, true), gettype($ageLabel)), __LINE__); } $this->AgeLabel = $ageLabel; + return $this; } /** * Get AdImageHash value * @return string|null */ - public function getAdImageHash() + public function getAdImageHash(): ?string { return $this->AdImageHash; } @@ -1127,20 +1167,21 @@ public function getAdImageHash() * @param string $adImageHash * @return \Api\StructType\ApiBannerInfo */ - public function setAdImageHash($adImageHash = null) + public function setAdImageHash(?string $adImageHash = null): self { // validation for constraint: string if (!is_null($adImageHash) && !is_string($adImageHash)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($adImageHash, true), gettype($adImageHash)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($adImageHash, true), gettype($adImageHash)), __LINE__); } $this->AdImageHash = $adImageHash; + return $this; } /** * Get StatusAdImageModerate value * @return string|null */ - public function getStatusAdImageModerate() + public function getStatusAdImageModerate(): ?string { return $this->StatusAdImageModerate; } @@ -1149,20 +1190,21 @@ public function getStatusAdImageModerate() * @param string $statusAdImageModerate * @return \Api\StructType\ApiBannerInfo */ - public function setStatusAdImageModerate($statusAdImageModerate = null) + public function setStatusAdImageModerate(?string $statusAdImageModerate = null): self { // validation for constraint: string if (!is_null($statusAdImageModerate) && !is_string($statusAdImageModerate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusAdImageModerate, true), gettype($statusAdImageModerate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($statusAdImageModerate, true), gettype($statusAdImageModerate)), __LINE__); } $this->StatusAdImageModerate = $statusAdImageModerate; + return $this; } /** * Get AdGroupMobileBidAdjustment value * @return int|null */ - public function getAdGroupMobileBidAdjustment() + public function getAdGroupMobileBidAdjustment(): ?int { return $this->AdGroupMobileBidAdjustment; } @@ -1171,13 +1213,14 @@ public function getAdGroupMobileBidAdjustment() * @param int $adGroupMobileBidAdjustment * @return \Api\StructType\ApiBannerInfo */ - public function setAdGroupMobileBidAdjustment($adGroupMobileBidAdjustment = null) + public function setAdGroupMobileBidAdjustment(?int $adGroupMobileBidAdjustment = null): self { // validation for constraint: int if (!is_null($adGroupMobileBidAdjustment) && !(is_int($adGroupMobileBidAdjustment) || ctype_digit($adGroupMobileBidAdjustment))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($adGroupMobileBidAdjustment, true), gettype($adGroupMobileBidAdjustment)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($adGroupMobileBidAdjustment, true), gettype($adGroupMobileBidAdjustment)), __LINE__); } $this->AdGroupMobileBidAdjustment = $adGroupMobileBidAdjustment; + return $this; } } diff --git a/tests/resources/generated/ValidBingApiService.php b/tests/resources/generated/ValidBingApiService.php index daa49b05..f2647017 100755 --- a/tests/resources/generated/ValidBingApiService.php +++ b/tests/resources/generated/ValidBingApiService.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('Search', array( + $this->setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ $parameters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidBingClassMap.php b/tests/resources/generated/ValidBingClassMap.php index 17d75adf..4a7399a0 100755 --- a/tests/resources/generated/ValidBingClassMap.php +++ b/tests/resources/generated/ValidBingClassMap.php @@ -1,5 +1,7 @@ '\\Api\\StructType\\ApiSearchRequest', 'ArrayOfSearchOption' => '\\Api\\ArrayType\\ApiArrayOfSearchOption', 'ArrayOfSourceType' => '\\Api\\ArrayType\\ApiArrayOfSourceType', @@ -68,6 +70,6 @@ final public static function get() 'MobileWebResult' => '\\Api\\StructType\\ApiMobileWebResult', 'ArrayOfError' => '\\Api\\ArrayType\\ApiArrayOfError', 'Error' => '\\Api\\StructType\\ApiError', - ); + ]; } } diff --git a/tests/resources/generated/ValidBingComposer.json b/tests/resources/generated/ValidBingComposer.json index e198797c..c9d08454 100755 --- a/tests/resources/generated/ValidBingComposer.json +++ b/tests/resources/generated/ValidBingComposer.json @@ -2,14 +2,15 @@ "name": "wsdltophp/bing", "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", "require": { - "php": ">=5.3.3", - "ext-soap": "*", + "php": ">=7.4", + "ext-dom": "*", "ext-mbstring": "*", - "wsdltophp/packagebase": "~2.0" + "ext-soap": "*", + "wsdltophp/packagebase": "~5.0" }, "autoload": { "psr-4": { - "Api\\": "./src/" + "Api\\": "./src/Api" } } } \ No newline at end of file diff --git a/tests/resources/generated/ValidBingComposerEmptySrcDirname.json b/tests/resources/generated/ValidBingComposerEmptySrcDirname.json index 91094aa1..289ff034 100644 --- a/tests/resources/generated/ValidBingComposerEmptySrcDirname.json +++ b/tests/resources/generated/ValidBingComposerEmptySrcDirname.json @@ -2,14 +2,15 @@ "name": "wsdltophp/bing", "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", "require": { - "php": ">=5.3.3", - "ext-soap": "*", + "php": ">=7.4", + "ext-dom": "*", "ext-mbstring": "*", - "wsdltophp/packagebase": "~2.0" + "ext-soap": "*", + "wsdltophp/packagebase": "~5.0" }, "autoload": { "psr-4": { - "Api\\": "./" + "Api\\": "./Api" } } } \ No newline at end of file diff --git a/tests/resources/generated/ValidBingComposerSettings.json b/tests/resources/generated/ValidBingComposerSettings.json index 4ec9fb62..cdc8b365 100644 --- a/tests/resources/generated/ValidBingComposerSettings.json +++ b/tests/resources/generated/ValidBingComposerSettings.json @@ -2,15 +2,16 @@ "name": "wsdltophp/bing", "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", "require": { - "php": ">=5.3.3", - "ext-soap": "*", + "php": ">=7.4", + "ext-dom": "*", "ext-mbstring": "*", - "wsdltophp/packagebase": "~2.0", + "ext-soap": "*", + "wsdltophp/packagebase": "~5.0", "wsdltophp/wssecurity": "dev-master" }, "autoload": { "psr-4": { - "Api\\": "./src/" + "Api\\": "./src/Api" } }, "config": { diff --git a/tests/resources/generated/ValidBingComposerSlashSrcDirname.json b/tests/resources/generated/ValidBingComposerSlashSrcDirname.json index 91094aa1..289ff034 100644 --- a/tests/resources/generated/ValidBingComposerSlashSrcDirname.json +++ b/tests/resources/generated/ValidBingComposerSlashSrcDirname.json @@ -2,14 +2,15 @@ "name": "wsdltophp/bing", "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", "require": { - "php": ">=5.3.3", - "ext-soap": "*", + "php": ">=7.4", + "ext-dom": "*", "ext-mbstring": "*", - "wsdltophp/packagebase": "~2.0" + "ext-soap": "*", + "wsdltophp/packagebase": "~5.0" }, "autoload": { "psr-4": { - "Api\\": "./" + "Api\\": "./Api" } } } \ No newline at end of file diff --git a/tests/resources/generated/ValidBingTutorial.php b/tests/resources/generated/ValidBingTutorial.php index 06d509c3..39ad39ba 100755 --- a/tests/resources/generated/ValidBingTutorial.php +++ b/tests/resources/generated/ValidBingTutorial.php @@ -5,22 +5,22 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... */ require_once __DIR__ . '/vendor/autoload.php'; /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), +]; /** * Samples for Search ServiceType */ diff --git a/tests/resources/generated/ValidBingTutorialNoPrefix.php b/tests/resources/generated/ValidBingTutorialNoPrefix.php index fdc23881..9ae425c6 100644 --- a/tests/resources/generated/ValidBingTutorialNoPrefix.php +++ b/tests/resources/generated/ValidBingTutorialNoPrefix.php @@ -5,22 +5,22 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... */ require_once __DIR__ . '/vendor/autoload.php'; /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(), +]; /** * Samples for Search ServiceType */ diff --git a/tests/resources/generated/ValidBingTutorialNotStandalone.php b/tests/resources/generated/ValidBingTutorialNotStandalone.php index 382adb93..5986c2b8 100755 --- a/tests/resources/generated/ValidBingTutorialNotStandalone.php +++ b/tests/resources/generated/ValidBingTutorialNotStandalone.php @@ -5,24 +5,24 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... * ################################################################################ - * Don't forget to add wsdltophp/packagebase:dev-master to your main composer.json. + * Don't forget to add wsdltophp/packagebase:~5.0 to your main composer.json. * ################################################################################ */ /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), +]; /** * Samples for Search ServiceType */ diff --git a/tests/resources/generated/ValidCampaignGetItem.php b/tests/resources/generated/ValidCampaignGetItem.php index cc25f0d2..db5bc759 100644 --- a/tests/resources/generated/ValidCampaignGetItem.php +++ b/tests/resources/generated/ValidCampaignGetItem.php @@ -1,8 +1,10 @@ setId($id) @@ -260,7 +262,7 @@ public function __construct($id = null, $name = null, $startDate = null, $type = * Get Id value * @return int|null */ - public function getId() + public function getId(): ?int { return $this->Id; } @@ -269,16 +271,17 @@ public function getId() * @param int $id * @return \Api\StructType\ApiCampaignGetItem */ - public function setId($id = null) + public function setId(?int $id = null): self { $this->Id = $id; + return $this; } /** * Get Name value * @return string|null */ - public function getName() + public function getName(): ?string { return $this->Name; } @@ -287,16 +290,17 @@ public function getName() * @param string $name * @return \Api\StructType\ApiCampaignGetItem */ - public function setName($name = null) + public function setName(?string $name = null): self { $this->Name = $name; + return $this; } /** * Get StartDate value * @return string|null */ - public function getStartDate() + public function getStartDate(): ?string { return $this->StartDate; } @@ -305,16 +309,17 @@ public function getStartDate() * @param string $startDate * @return \Api\StructType\ApiCampaignGetItem */ - public function setStartDate($startDate = null) + public function setStartDate(?string $startDate = null): self { $this->StartDate = $startDate; + return $this; } /** * Get Type value * @return string|null */ - public function getType() + public function getType(): ?string { return $this->Type; } @@ -323,16 +328,17 @@ public function getType() * @param string $type * @return \Api\StructType\ApiCampaignGetItem */ - public function setType($type = null) + public function setType(?string $type = null): self { $this->Type = $type; + return $this; } /** * Get Status value * @return string|null */ - public function getStatus() + public function getStatus(): ?string { return $this->Status; } @@ -341,16 +347,17 @@ public function getStatus() * @param string $status * @return \Api\StructType\ApiCampaignGetItem */ - public function setStatus($status = null) + public function setStatus(?string $status = null): self { $this->Status = $status; + return $this; } /** * Get State value * @return string|null */ - public function getState() + public function getState(): ?string { return $this->State; } @@ -359,16 +366,17 @@ public function getState() * @param string $state * @return \Api\StructType\ApiCampaignGetItem */ - public function setState($state = null) + public function setState(?string $state = null): self { $this->State = $state; + return $this; } /** * Get StatusPayment value * @return string|null */ - public function getStatusPayment() + public function getStatusPayment(): ?string { return $this->StatusPayment; } @@ -377,16 +385,17 @@ public function getStatusPayment() * @param string $statusPayment * @return \Api\StructType\ApiCampaignGetItem */ - public function setStatusPayment($statusPayment = null) + public function setStatusPayment(?string $statusPayment = null): self { $this->StatusPayment = $statusPayment; + return $this; } /** * Get StatusClarification value * @return string|null */ - public function getStatusClarification() + public function getStatusClarification(): ?string { return $this->StatusClarification; } @@ -395,9 +404,10 @@ public function getStatusClarification() * @param string $statusClarification * @return \Api\StructType\ApiCampaignGetItem */ - public function setStatusClarification($statusClarification = null) + public function setStatusClarification(?string $statusClarification = null): self { $this->StatusClarification = $statusClarification; + return $this; } /** @@ -407,7 +417,7 @@ public function setStatusClarification($statusClarification = null) * removable from the request (nillable=true+minOccurs=0) * @return int|null */ - public function getSourceId() + public function getSourceId(): ?int { return isset($this->SourceId) ? $this->SourceId : null; } @@ -418,20 +428,21 @@ public function getSourceId() * @param int $sourceId * @return \Api\StructType\ApiCampaignGetItem */ - public function setSourceId($sourceId = null) + public function setSourceId(?int $sourceId = null): self { if (is_null($sourceId) || (is_array($sourceId) && empty($sourceId))) { unset($this->SourceId); } else { $this->SourceId = $sourceId; } + return $this; } /** * Get Statistics value * @return \Api\StructType\ApiStatistics|null */ - public function getStatistics() + public function getStatistics(): ?\Api\StructType\ApiStatistics { return $this->Statistics; } @@ -440,16 +451,17 @@ public function getStatistics() * @param \Api\StructType\ApiStatistics $statistics * @return \Api\StructType\ApiCampaignGetItem */ - public function setStatistics(\Api\StructType\ApiStatistics $statistics = null) + public function setStatistics(?\Api\StructType\ApiStatistics $statistics = null): self { $this->Statistics = $statistics; + return $this; } /** * Get Currency value * @return string|null */ - public function getCurrency() + public function getCurrency(): ?string { return $this->Currency; } @@ -458,16 +470,17 @@ public function getCurrency() * @param string $currency * @return \Api\StructType\ApiCampaignGetItem */ - public function setCurrency($currency = null) + public function setCurrency(?string $currency = null): self { $this->Currency = $currency; + return $this; } /** * Get Funds value * @return \Api\StructType\ApiFundsParam|null */ - public function getFunds() + public function getFunds(): ?\Api\StructType\ApiFundsParam { return $this->Funds; } @@ -476,16 +489,17 @@ public function getFunds() * @param \Api\StructType\ApiFundsParam $funds * @return \Api\StructType\ApiCampaignGetItem */ - public function setFunds(\Api\StructType\ApiFundsParam $funds = null) + public function setFunds(?\Api\StructType\ApiFundsParam $funds = null): self { $this->Funds = $funds; + return $this; } /** * Get RepresentedBy value * @return \Api\StructType\ApiCampaignAssistant|null */ - public function getRepresentedBy() + public function getRepresentedBy(): ?\Api\StructType\ApiCampaignAssistant { return $this->RepresentedBy; } @@ -494,9 +508,10 @@ public function getRepresentedBy() * @param \Api\StructType\ApiCampaignAssistant $representedBy * @return \Api\StructType\ApiCampaignGetItem */ - public function setRepresentedBy(\Api\StructType\ApiCampaignAssistant $representedBy = null) + public function setRepresentedBy(?\Api\StructType\ApiCampaignAssistant $representedBy = null): self { $this->RepresentedBy = $representedBy; + return $this; } /** @@ -506,7 +521,7 @@ public function setRepresentedBy(\Api\StructType\ApiCampaignAssistant $represent * removable from the request (nillable=true+minOccurs=0) * @return \Api\StructType\ApiDailyBudget|null */ - public function getDailyBudget() + public function getDailyBudget(): ?\Api\StructType\ApiDailyBudget { return isset($this->DailyBudget) ? $this->DailyBudget : null; } @@ -517,13 +532,14 @@ public function getDailyBudget() * @param \Api\StructType\ApiDailyBudget $dailyBudget * @return \Api\StructType\ApiCampaignGetItem */ - public function setDailyBudget(\Api\StructType\ApiDailyBudget $dailyBudget = null) + public function setDailyBudget(?\Api\StructType\ApiDailyBudget $dailyBudget = null): self { if (is_null($dailyBudget) || (is_array($dailyBudget) && empty($dailyBudget))) { unset($this->DailyBudget); } else { $this->DailyBudget = $dailyBudget; } + return $this; } /** @@ -533,7 +549,7 @@ public function setDailyBudget(\Api\StructType\ApiDailyBudget $dailyBudget = nul * removable from the request (nillable=true+minOccurs=0) * @return string|null */ - public function getEndDate() + public function getEndDate(): ?string { return isset($this->EndDate) ? $this->EndDate : null; } @@ -544,13 +560,14 @@ public function getEndDate() * @param string $endDate * @return \Api\StructType\ApiCampaignGetItem */ - public function setEndDate($endDate = null) + public function setEndDate(?string $endDate = null): self { if (is_null($endDate) || (is_array($endDate) && empty($endDate))) { unset($this->EndDate); } else { $this->EndDate = $endDate; } + return $this; } /** @@ -560,7 +577,7 @@ public function setEndDate($endDate = null) * removable from the request (nillable=true+minOccurs=0) * @return \Api\ArrayType\ApiArrayOfString|null */ - public function getNegativeKeywords() + public function getNegativeKeywords(): ?\Api\ArrayType\ApiArrayOfString { return isset($this->NegativeKeywords) ? $this->NegativeKeywords : null; } @@ -571,13 +588,14 @@ public function getNegativeKeywords() * @param \Api\ArrayType\ApiArrayOfString $negativeKeywords * @return \Api\StructType\ApiCampaignGetItem */ - public function setNegativeKeywords(\Api\ArrayType\ApiArrayOfString $negativeKeywords = null) + public function setNegativeKeywords(?\Api\ArrayType\ApiArrayOfString $negativeKeywords = null): self { if (is_null($negativeKeywords) || (is_array($negativeKeywords) && empty($negativeKeywords))) { unset($this->NegativeKeywords); } else { $this->NegativeKeywords = $negativeKeywords; } + return $this; } /** @@ -587,7 +605,7 @@ public function setNegativeKeywords(\Api\ArrayType\ApiArrayOfString $negativeKey * removable from the request (nillable=true+minOccurs=0) * @return \Api\ArrayType\ApiArrayOfString|null */ - public function getBlockedIps() + public function getBlockedIps(): ?\Api\ArrayType\ApiArrayOfString { return isset($this->BlockedIps) ? $this->BlockedIps : null; } @@ -598,13 +616,14 @@ public function getBlockedIps() * @param \Api\ArrayType\ApiArrayOfString $blockedIps * @return \Api\StructType\ApiCampaignGetItem */ - public function setBlockedIps(\Api\ArrayType\ApiArrayOfString $blockedIps = null) + public function setBlockedIps(?\Api\ArrayType\ApiArrayOfString $blockedIps = null): self { if (is_null($blockedIps) || (is_array($blockedIps) && empty($blockedIps))) { unset($this->BlockedIps); } else { $this->BlockedIps = $blockedIps; } + return $this; } /** @@ -614,7 +633,7 @@ public function setBlockedIps(\Api\ArrayType\ApiArrayOfString $blockedIps = null * removable from the request (nillable=true+minOccurs=0) * @return \Api\ArrayType\ApiArrayOfString|null */ - public function getExcludedSites() + public function getExcludedSites(): ?\Api\ArrayType\ApiArrayOfString { return isset($this->ExcludedSites) ? $this->ExcludedSites : null; } @@ -625,20 +644,21 @@ public function getExcludedSites() * @param \Api\ArrayType\ApiArrayOfString $excludedSites * @return \Api\StructType\ApiCampaignGetItem */ - public function setExcludedSites(\Api\ArrayType\ApiArrayOfString $excludedSites = null) + public function setExcludedSites(?\Api\ArrayType\ApiArrayOfString $excludedSites = null): self { if (is_null($excludedSites) || (is_array($excludedSites) && empty($excludedSites))) { unset($this->ExcludedSites); } else { $this->ExcludedSites = $excludedSites; } + return $this; } /** * Get TextCampaign value * @return \Api\StructType\ApiTextCampaignGetItem|null */ - public function getTextCampaign() + public function getTextCampaign(): ?\Api\StructType\ApiTextCampaignGetItem { return $this->TextCampaign; } @@ -647,16 +667,17 @@ public function getTextCampaign() * @param \Api\StructType\ApiTextCampaignGetItem $textCampaign * @return \Api\StructType\ApiCampaignGetItem */ - public function setTextCampaign(\Api\StructType\ApiTextCampaignGetItem $textCampaign = null) + public function setTextCampaign(?\Api\StructType\ApiTextCampaignGetItem $textCampaign = null): self { $this->TextCampaign = $textCampaign; + return $this; } /** * Get MobileAppCampaign value * @return \Api\StructType\ApiMobileAppCampaignGetItem|null */ - public function getMobileAppCampaign() + public function getMobileAppCampaign(): ?\Api\StructType\ApiMobileAppCampaignGetItem { return $this->MobileAppCampaign; } @@ -665,16 +686,17 @@ public function getMobileAppCampaign() * @param \Api\StructType\ApiMobileAppCampaignGetItem $mobileAppCampaign * @return \Api\StructType\ApiCampaignGetItem */ - public function setMobileAppCampaign(\Api\StructType\ApiMobileAppCampaignGetItem $mobileAppCampaign = null) + public function setMobileAppCampaign(?\Api\StructType\ApiMobileAppCampaignGetItem $mobileAppCampaign = null): self { $this->MobileAppCampaign = $mobileAppCampaign; + return $this; } /** * Get DynamicTextCampaign value * @return \Api\StructType\ApiDynamicTextCampaignGetItem|null */ - public function getDynamicTextCampaign() + public function getDynamicTextCampaign(): ?\Api\StructType\ApiDynamicTextCampaignGetItem { return $this->DynamicTextCampaign; } @@ -683,9 +705,10 @@ public function getDynamicTextCampaign() * @param \Api\StructType\ApiDynamicTextCampaignGetItem $dynamicTextCampaign * @return \Api\StructType\ApiCampaignGetItem */ - public function setDynamicTextCampaign(\Api\StructType\ApiDynamicTextCampaignGetItem $dynamicTextCampaign = null) + public function setDynamicTextCampaign(?\Api\StructType\ApiDynamicTextCampaignGetItem $dynamicTextCampaign = null): self { $this->DynamicTextCampaign = $dynamicTextCampaign; + return $this; } } diff --git a/tests/resources/generated/ValidDetails.php b/tests/resources/generated/ValidDetails.php index 4a99282f..2937cfd9 100644 --- a/tests/resources/generated/ValidDetails.php +++ b/tests/resources/generated/ValidDetails.php @@ -1,8 +1,11 @@ setMutualSettlementDetailCalcCostShipping($mutualSettlementDetailCalcCostShipping) @@ -295,7 +298,7 @@ public function __construct(\Api\StructType\ApiMutualSettlementDetailCalcCostShi * Get mutualSettlementDetailCalcCostShipping value * @return \Api\StructType\ApiMutualSettlementDetailCalcCostShipping|null */ - public function getMutualSettlementDetailCalcCostShipping() + public function getMutualSettlementDetailCalcCostShipping(): ?\Api\StructType\ApiMutualSettlementDetailCalcCostShipping { return isset($this->mutualSettlementDetailCalcCostShipping) ? $this->mutualSettlementDetailCalcCostShipping : null; } @@ -306,7 +309,7 @@ public function getMutualSettlementDetailCalcCostShipping() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailCalcCostShippingForChoiceConstraintsFromSetMutualSettlementDetailCalcCostShipping($value) + public function validateMutualSettlementDetailCalcCostShippingForChoiceConstraintsFromSetMutualSettlementDetailCalcCostShipping($value): string { $message = ''; if (is_null($value)) { @@ -333,12 +336,13 @@ public function validateMutualSettlementDetailCalcCostShippingForChoiceConstrain try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailCalcCostShipping can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailCalcCostShipping, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailCalcCostShipping can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailCalcCostShipping, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -346,28 +350,29 @@ public function validateMutualSettlementDetailCalcCostShippingForChoiceConstrain * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailCalcCostShipping $mutualSettlementDetailCalcCostShipping * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailCalcCostShipping(\Api\StructType\ApiMutualSettlementDetailCalcCostShipping $mutualSettlementDetailCalcCostShipping = null) + public function setMutualSettlementDetailCalcCostShipping(?\Api\StructType\ApiMutualSettlementDetailCalcCostShipping $mutualSettlementDetailCalcCostShipping = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailCalcCostShippingChoiceErrorMessage = self::validateMutualSettlementDetailCalcCostShippingForChoiceConstraintsFromSetMutualSettlementDetailCalcCostShipping($mutualSettlementDetailCalcCostShipping))) { - throw new \InvalidArgumentException($mutualSettlementDetailCalcCostShippingChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailCalcCostShippingChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailCalcCostShipping) || (is_array($mutualSettlementDetailCalcCostShipping) && empty($mutualSettlementDetailCalcCostShipping))) { unset($this->mutualSettlementDetailCalcCostShipping); } else { $this->mutualSettlementDetailCalcCostShipping = $mutualSettlementDetailCalcCostShipping; } + return $this; } /** * Get mutualSettlementDetailCashFlow value * @return \Api\StructType\ApiMutualSettlementDetailCashFlow|null */ - public function getMutualSettlementDetailCashFlow() + public function getMutualSettlementDetailCashFlow(): ?\Api\StructType\ApiMutualSettlementDetailCashFlow { return isset($this->mutualSettlementDetailCashFlow) ? $this->mutualSettlementDetailCashFlow : null; } @@ -378,7 +383,7 @@ public function getMutualSettlementDetailCashFlow() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailCashFlowForChoiceConstraintsFromSetMutualSettlementDetailCashFlow($value) + public function validateMutualSettlementDetailCashFlowForChoiceConstraintsFromSetMutualSettlementDetailCashFlow($value): string { $message = ''; if (is_null($value)) { @@ -405,12 +410,13 @@ public function validateMutualSettlementDetailCashFlowForChoiceConstraintsFromSe try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailCashFlow can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailCashFlow, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailCashFlow can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailCashFlow, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -418,28 +424,29 @@ public function validateMutualSettlementDetailCashFlowForChoiceConstraintsFromSe * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailCashFlow $mutualSettlementDetailCashFlow * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailCashFlow(\Api\StructType\ApiMutualSettlementDetailCashFlow $mutualSettlementDetailCashFlow = null) + public function setMutualSettlementDetailCashFlow(?\Api\StructType\ApiMutualSettlementDetailCashFlow $mutualSettlementDetailCashFlow = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailCashFlowChoiceErrorMessage = self::validateMutualSettlementDetailCashFlowForChoiceConstraintsFromSetMutualSettlementDetailCashFlow($mutualSettlementDetailCashFlow))) { - throw new \InvalidArgumentException($mutualSettlementDetailCashFlowChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailCashFlowChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailCashFlow) || (is_array($mutualSettlementDetailCashFlow) && empty($mutualSettlementDetailCashFlow))) { unset($this->mutualSettlementDetailCashFlow); } else { $this->mutualSettlementDetailCashFlow = $mutualSettlementDetailCashFlow; } + return $this; } /** * Get mutualSettlementDetailClientPayment value * @return \Api\StructType\ApiMutualSettlementDetailClientPayment|null */ - public function getMutualSettlementDetailClientPayment() + public function getMutualSettlementDetailClientPayment(): ?\Api\StructType\ApiMutualSettlementDetailClientPayment { return isset($this->mutualSettlementDetailClientPayment) ? $this->mutualSettlementDetailClientPayment : null; } @@ -450,7 +457,7 @@ public function getMutualSettlementDetailClientPayment() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailClientPaymentForChoiceConstraintsFromSetMutualSettlementDetailClientPayment($value) + public function validateMutualSettlementDetailClientPaymentForChoiceConstraintsFromSetMutualSettlementDetailClientPayment($value): string { $message = ''; if (is_null($value)) { @@ -477,12 +484,13 @@ public function validateMutualSettlementDetailClientPaymentForChoiceConstraintsF try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailClientPayment can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailClientPayment, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailClientPayment can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailClientPayment, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -490,28 +498,29 @@ public function validateMutualSettlementDetailClientPaymentForChoiceConstraintsF * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailClientPayment $mutualSettlementDetailClientPayment * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailClientPayment(\Api\StructType\ApiMutualSettlementDetailClientPayment $mutualSettlementDetailClientPayment = null) + public function setMutualSettlementDetailClientPayment(?\Api\StructType\ApiMutualSettlementDetailClientPayment $mutualSettlementDetailClientPayment = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailClientPaymentChoiceErrorMessage = self::validateMutualSettlementDetailClientPaymentForChoiceConstraintsFromSetMutualSettlementDetailClientPayment($mutualSettlementDetailClientPayment))) { - throw new \InvalidArgumentException($mutualSettlementDetailClientPaymentChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailClientPaymentChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailClientPayment) || (is_array($mutualSettlementDetailClientPayment) && empty($mutualSettlementDetailClientPayment))) { unset($this->mutualSettlementDetailClientPayment); } else { $this->mutualSettlementDetailClientPayment = $mutualSettlementDetailClientPayment; } + return $this; } /** * Get mutualSettlementDetailPostReturnRegistry value * @return \Api\StructType\ApiMutualSettlementDetailPostReturnRegistry|null */ - public function getMutualSettlementDetailPostReturnRegistry() + public function getMutualSettlementDetailPostReturnRegistry(): ?\Api\StructType\ApiMutualSettlementDetailPostReturnRegistry { return isset($this->mutualSettlementDetailPostReturnRegistry) ? $this->mutualSettlementDetailPostReturnRegistry : null; } @@ -522,7 +531,7 @@ public function getMutualSettlementDetailPostReturnRegistry() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailPostReturnRegistryForChoiceConstraintsFromSetMutualSettlementDetailPostReturnRegistry($value) + public function validateMutualSettlementDetailPostReturnRegistryForChoiceConstraintsFromSetMutualSettlementDetailPostReturnRegistry($value): string { $message = ''; if (is_null($value)) { @@ -549,12 +558,13 @@ public function validateMutualSettlementDetailPostReturnRegistryForChoiceConstra try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailPostReturnRegistry can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailPostReturnRegistry, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailPostReturnRegistry can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailPostReturnRegistry, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -562,28 +572,29 @@ public function validateMutualSettlementDetailPostReturnRegistryForChoiceConstra * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailPostReturnRegistry $mutualSettlementDetailPostReturnRegistry * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailPostReturnRegistry(\Api\StructType\ApiMutualSettlementDetailPostReturnRegistry $mutualSettlementDetailPostReturnRegistry = null) + public function setMutualSettlementDetailPostReturnRegistry(?\Api\StructType\ApiMutualSettlementDetailPostReturnRegistry $mutualSettlementDetailPostReturnRegistry = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailPostReturnRegistryChoiceErrorMessage = self::validateMutualSettlementDetailPostReturnRegistryForChoiceConstraintsFromSetMutualSettlementDetailPostReturnRegistry($mutualSettlementDetailPostReturnRegistry))) { - throw new \InvalidArgumentException($mutualSettlementDetailPostReturnRegistryChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailPostReturnRegistryChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailPostReturnRegistry) || (is_array($mutualSettlementDetailPostReturnRegistry) && empty($mutualSettlementDetailPostReturnRegistry))) { unset($this->mutualSettlementDetailPostReturnRegistry); } else { $this->mutualSettlementDetailPostReturnRegistry = $mutualSettlementDetailPostReturnRegistry; } + return $this; } /** * Get mutualSettlementDetailRouteList value * @return \Api\StructType\ApiMutualSettlementDetailRouteList|null */ - public function getMutualSettlementDetailRouteList() + public function getMutualSettlementDetailRouteList(): ?\Api\StructType\ApiMutualSettlementDetailRouteList { return isset($this->mutualSettlementDetailRouteList) ? $this->mutualSettlementDetailRouteList : null; } @@ -594,7 +605,7 @@ public function getMutualSettlementDetailRouteList() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailRouteListForChoiceConstraintsFromSetMutualSettlementDetailRouteList($value) + public function validateMutualSettlementDetailRouteListForChoiceConstraintsFromSetMutualSettlementDetailRouteList($value): string { $message = ''; if (is_null($value)) { @@ -621,12 +632,13 @@ public function validateMutualSettlementDetailRouteListForChoiceConstraintsFromS try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailRouteList can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailRouteList, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailRouteList can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailRouteList, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -634,28 +646,29 @@ public function validateMutualSettlementDetailRouteListForChoiceConstraintsFromS * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailRouteList $mutualSettlementDetailRouteList * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailRouteList(\Api\StructType\ApiMutualSettlementDetailRouteList $mutualSettlementDetailRouteList = null) + public function setMutualSettlementDetailRouteList(?\Api\StructType\ApiMutualSettlementDetailRouteList $mutualSettlementDetailRouteList = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailRouteListChoiceErrorMessage = self::validateMutualSettlementDetailRouteListForChoiceConstraintsFromSetMutualSettlementDetailRouteList($mutualSettlementDetailRouteList))) { - throw new \InvalidArgumentException($mutualSettlementDetailRouteListChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailRouteListChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailRouteList) || (is_array($mutualSettlementDetailRouteList) && empty($mutualSettlementDetailRouteList))) { unset($this->mutualSettlementDetailRouteList); } else { $this->mutualSettlementDetailRouteList = $mutualSettlementDetailRouteList; } + return $this; } /** * Get mutualSettlementDetailTrackNumberPayment value * @return \Api\StructType\ApiMutualSettlementDetailTrackNumberPayment|null */ - public function getMutualSettlementDetailTrackNumberPayment() + public function getMutualSettlementDetailTrackNumberPayment(): ?\Api\StructType\ApiMutualSettlementDetailTrackNumberPayment { return isset($this->mutualSettlementDetailTrackNumberPayment) ? $this->mutualSettlementDetailTrackNumberPayment : null; } @@ -666,7 +679,7 @@ public function getMutualSettlementDetailTrackNumberPayment() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailTrackNumberPaymentForChoiceConstraintsFromSetMutualSettlementDetailTrackNumberPayment($value) + public function validateMutualSettlementDetailTrackNumberPaymentForChoiceConstraintsFromSetMutualSettlementDetailTrackNumberPayment($value): string { $message = ''; if (is_null($value)) { @@ -693,12 +706,13 @@ public function validateMutualSettlementDetailTrackNumberPaymentForChoiceConstra try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailTrackNumberPayment can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailTrackNumberPayment, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailTrackNumberPayment can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailTrackNumberPayment, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -706,28 +720,29 @@ public function validateMutualSettlementDetailTrackNumberPaymentForChoiceConstra * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailTrackNumberPayment $mutualSettlementDetailTrackNumberPayment * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailTrackNumberPayment(\Api\StructType\ApiMutualSettlementDetailTrackNumberPayment $mutualSettlementDetailTrackNumberPayment = null) + public function setMutualSettlementDetailTrackNumberPayment(?\Api\StructType\ApiMutualSettlementDetailTrackNumberPayment $mutualSettlementDetailTrackNumberPayment = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailTrackNumberPaymentChoiceErrorMessage = self::validateMutualSettlementDetailTrackNumberPaymentForChoiceConstraintsFromSetMutualSettlementDetailTrackNumberPayment($mutualSettlementDetailTrackNumberPayment))) { - throw new \InvalidArgumentException($mutualSettlementDetailTrackNumberPaymentChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailTrackNumberPaymentChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailTrackNumberPayment) || (is_array($mutualSettlementDetailTrackNumberPayment) && empty($mutualSettlementDetailTrackNumberPayment))) { unset($this->mutualSettlementDetailTrackNumberPayment); } else { $this->mutualSettlementDetailTrackNumberPayment = $mutualSettlementDetailTrackNumberPayment; } + return $this; } /** * Get mutualSettlementDetailServiceRegistration value * @return \Api\StructType\ApiMutualSettlementDetailServiceRegistration|null */ - public function getMutualSettlementDetailServiceRegistration() + public function getMutualSettlementDetailServiceRegistration(): ?\Api\StructType\ApiMutualSettlementDetailServiceRegistration { return isset($this->mutualSettlementDetailServiceRegistration) ? $this->mutualSettlementDetailServiceRegistration : null; } @@ -738,7 +753,7 @@ public function getMutualSettlementDetailServiceRegistration() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailServiceRegistrationForChoiceConstraintsFromSetMutualSettlementDetailServiceRegistration($value) + public function validateMutualSettlementDetailServiceRegistrationForChoiceConstraintsFromSetMutualSettlementDetailServiceRegistration($value): string { $message = ''; if (is_null($value)) { @@ -765,12 +780,13 @@ public function validateMutualSettlementDetailServiceRegistrationForChoiceConstr try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailServiceRegistration can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailServiceRegistration, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailServiceRegistration can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailServiceRegistration, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -778,28 +794,29 @@ public function validateMutualSettlementDetailServiceRegistrationForChoiceConstr * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailServiceRegistration $mutualSettlementDetailServiceRegistration * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailServiceRegistration(\Api\StructType\ApiMutualSettlementDetailServiceRegistration $mutualSettlementDetailServiceRegistration = null) + public function setMutualSettlementDetailServiceRegistration(?\Api\StructType\ApiMutualSettlementDetailServiceRegistration $mutualSettlementDetailServiceRegistration = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailServiceRegistrationChoiceErrorMessage = self::validateMutualSettlementDetailServiceRegistrationForChoiceConstraintsFromSetMutualSettlementDetailServiceRegistration($mutualSettlementDetailServiceRegistration))) { - throw new \InvalidArgumentException($mutualSettlementDetailServiceRegistrationChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailServiceRegistrationChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailServiceRegistration) || (is_array($mutualSettlementDetailServiceRegistration) && empty($mutualSettlementDetailServiceRegistration))) { unset($this->mutualSettlementDetailServiceRegistration); } else { $this->mutualSettlementDetailServiceRegistration = $mutualSettlementDetailServiceRegistration; } + return $this; } /** * Get mutualSettlementDetailAcceptanceRegistry value * @return \Api\StructType\ApiMutualSettlementDetailAcceptanceRegistry|null */ - public function getMutualSettlementDetailAcceptanceRegistry() + public function getMutualSettlementDetailAcceptanceRegistry(): ?\Api\StructType\ApiMutualSettlementDetailAcceptanceRegistry { return isset($this->mutualSettlementDetailAcceptanceRegistry) ? $this->mutualSettlementDetailAcceptanceRegistry : null; } @@ -810,7 +827,7 @@ public function getMutualSettlementDetailAcceptanceRegistry() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailAcceptanceRegistryForChoiceConstraintsFromSetMutualSettlementDetailAcceptanceRegistry($value) + public function validateMutualSettlementDetailAcceptanceRegistryForChoiceConstraintsFromSetMutualSettlementDetailAcceptanceRegistry($value): string { $message = ''; if (is_null($value)) { @@ -837,12 +854,13 @@ public function validateMutualSettlementDetailAcceptanceRegistryForChoiceConstra try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailAcceptanceRegistry can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailAcceptanceRegistry, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailAcceptanceRegistry can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailAcceptanceRegistry, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -850,28 +868,29 @@ public function validateMutualSettlementDetailAcceptanceRegistryForChoiceConstra * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailAcceptanceRegistry $mutualSettlementDetailAcceptanceRegistry * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailAcceptanceRegistry(\Api\StructType\ApiMutualSettlementDetailAcceptanceRegistry $mutualSettlementDetailAcceptanceRegistry = null) + public function setMutualSettlementDetailAcceptanceRegistry(?\Api\StructType\ApiMutualSettlementDetailAcceptanceRegistry $mutualSettlementDetailAcceptanceRegistry = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailAcceptanceRegistryChoiceErrorMessage = self::validateMutualSettlementDetailAcceptanceRegistryForChoiceConstraintsFromSetMutualSettlementDetailAcceptanceRegistry($mutualSettlementDetailAcceptanceRegistry))) { - throw new \InvalidArgumentException($mutualSettlementDetailAcceptanceRegistryChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailAcceptanceRegistryChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailAcceptanceRegistry) || (is_array($mutualSettlementDetailAcceptanceRegistry) && empty($mutualSettlementDetailAcceptanceRegistry))) { unset($this->mutualSettlementDetailAcceptanceRegistry); } else { $this->mutualSettlementDetailAcceptanceRegistry = $mutualSettlementDetailAcceptanceRegistry; } + return $this; } /** * Get mutualSettlementDetailAdditionalChargeFare value * @return \Api\StructType\ApiMutualSettlementDetailAdditionalChargeFare|null */ - public function getMutualSettlementDetailAdditionalChargeFare() + public function getMutualSettlementDetailAdditionalChargeFare(): ?\Api\StructType\ApiMutualSettlementDetailAdditionalChargeFare { return isset($this->mutualSettlementDetailAdditionalChargeFare) ? $this->mutualSettlementDetailAdditionalChargeFare : null; } @@ -882,7 +901,7 @@ public function getMutualSettlementDetailAdditionalChargeFare() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailAdditionalChargeFareForChoiceConstraintsFromSetMutualSettlementDetailAdditionalChargeFare($value) + public function validateMutualSettlementDetailAdditionalChargeFareForChoiceConstraintsFromSetMutualSettlementDetailAdditionalChargeFare($value): string { $message = ''; if (is_null($value)) { @@ -909,12 +928,13 @@ public function validateMutualSettlementDetailAdditionalChargeFareForChoiceConst try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailAdditionalChargeFare can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailAdditionalChargeFare, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailAdditionalChargeFare can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailAdditionalChargeFare, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -922,28 +942,29 @@ public function validateMutualSettlementDetailAdditionalChargeFareForChoiceConst * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailAdditionalChargeFare $mutualSettlementDetailAdditionalChargeFare * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailAdditionalChargeFare(\Api\StructType\ApiMutualSettlementDetailAdditionalChargeFare $mutualSettlementDetailAdditionalChargeFare = null) + public function setMutualSettlementDetailAdditionalChargeFare(?\Api\StructType\ApiMutualSettlementDetailAdditionalChargeFare $mutualSettlementDetailAdditionalChargeFare = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailAdditionalChargeFareChoiceErrorMessage = self::validateMutualSettlementDetailAdditionalChargeFareForChoiceConstraintsFromSetMutualSettlementDetailAdditionalChargeFare($mutualSettlementDetailAdditionalChargeFare))) { - throw new \InvalidArgumentException($mutualSettlementDetailAdditionalChargeFareChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailAdditionalChargeFareChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailAdditionalChargeFare) || (is_array($mutualSettlementDetailAdditionalChargeFare) && empty($mutualSettlementDetailAdditionalChargeFare))) { unset($this->mutualSettlementDetailAdditionalChargeFare); } else { $this->mutualSettlementDetailAdditionalChargeFare = $mutualSettlementDetailAdditionalChargeFare; } + return $this; } /** * Get mutualSettlementDetailOutgoingRequestToCarrier value * @return \Api\StructType\ApiMutualSettlementDetailOutgoingRequestToCarrier|null */ - public function getMutualSettlementDetailOutgoingRequestToCarrier() + public function getMutualSettlementDetailOutgoingRequestToCarrier(): ?\Api\StructType\ApiMutualSettlementDetailOutgoingRequestToCarrier { return isset($this->mutualSettlementDetailOutgoingRequestToCarrier) ? $this->mutualSettlementDetailOutgoingRequestToCarrier : null; } @@ -954,7 +975,7 @@ public function getMutualSettlementDetailOutgoingRequestToCarrier() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailOutgoingRequestToCarrierForChoiceConstraintsFromSetMutualSettlementDetailOutgoingRequestToCarrier($value) + public function validateMutualSettlementDetailOutgoingRequestToCarrierForChoiceConstraintsFromSetMutualSettlementDetailOutgoingRequestToCarrier($value): string { $message = ''; if (is_null($value)) { @@ -981,12 +1002,13 @@ public function validateMutualSettlementDetailOutgoingRequestToCarrierForChoiceC try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailOutgoingRequestToCarrier can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailOutgoingRequestToCarrier, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailOutgoingRequestToCarrier can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailOutgoingRequestToCarrier, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -994,28 +1016,29 @@ public function validateMutualSettlementDetailOutgoingRequestToCarrierForChoiceC * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailOutgoingRequestToCarrier $mutualSettlementDetailOutgoingRequestToCarrier * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailOutgoingRequestToCarrier(\Api\StructType\ApiMutualSettlementDetailOutgoingRequestToCarrier $mutualSettlementDetailOutgoingRequestToCarrier = null) + public function setMutualSettlementDetailOutgoingRequestToCarrier(?\Api\StructType\ApiMutualSettlementDetailOutgoingRequestToCarrier $mutualSettlementDetailOutgoingRequestToCarrier = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailOutgoingRequestToCarrierChoiceErrorMessage = self::validateMutualSettlementDetailOutgoingRequestToCarrierForChoiceConstraintsFromSetMutualSettlementDetailOutgoingRequestToCarrier($mutualSettlementDetailOutgoingRequestToCarrier))) { - throw new \InvalidArgumentException($mutualSettlementDetailOutgoingRequestToCarrierChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailOutgoingRequestToCarrierChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailOutgoingRequestToCarrier) || (is_array($mutualSettlementDetailOutgoingRequestToCarrier) && empty($mutualSettlementDetailOutgoingRequestToCarrier))) { unset($this->mutualSettlementDetailOutgoingRequestToCarrier); } else { $this->mutualSettlementDetailOutgoingRequestToCarrier = $mutualSettlementDetailOutgoingRequestToCarrier; } + return $this; } /** * Get mutualSettlementDetailSMSInformation value * @return \Api\StructType\ApiMutualSettlementDetailSMSInformation|null */ - public function getMutualSettlementDetailSMSInformation() + public function getMutualSettlementDetailSMSInformation(): ?\Api\StructType\ApiMutualSettlementDetailSMSInformation { return isset($this->mutualSettlementDetailSMSInformation) ? $this->mutualSettlementDetailSMSInformation : null; } @@ -1026,7 +1049,7 @@ public function getMutualSettlementDetailSMSInformation() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailSMSInformationForChoiceConstraintsFromSetMutualSettlementDetailSMSInformation($value) + public function validateMutualSettlementDetailSMSInformationForChoiceConstraintsFromSetMutualSettlementDetailSMSInformation($value): string { $message = ''; if (is_null($value)) { @@ -1053,12 +1076,13 @@ public function validateMutualSettlementDetailSMSInformationForChoiceConstraints try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailSMSInformation can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailSMSInformation, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailSMSInformation can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailSMSInformation, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1066,28 +1090,29 @@ public function validateMutualSettlementDetailSMSInformationForChoiceConstraints * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailSMSInformation $mutualSettlementDetailSMSInformation * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailSMSInformation(\Api\StructType\ApiMutualSettlementDetailSMSInformation $mutualSettlementDetailSMSInformation = null) + public function setMutualSettlementDetailSMSInformation(?\Api\StructType\ApiMutualSettlementDetailSMSInformation $mutualSettlementDetailSMSInformation = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailSMSInformationChoiceErrorMessage = self::validateMutualSettlementDetailSMSInformationForChoiceConstraintsFromSetMutualSettlementDetailSMSInformation($mutualSettlementDetailSMSInformation))) { - throw new \InvalidArgumentException($mutualSettlementDetailSMSInformationChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailSMSInformationChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailSMSInformation) || (is_array($mutualSettlementDetailSMSInformation) && empty($mutualSettlementDetailSMSInformation))) { unset($this->mutualSettlementDetailSMSInformation); } else { $this->mutualSettlementDetailSMSInformation = $mutualSettlementDetailSMSInformation; } + return $this; } /** * Get mutualSettlementDetailBuyerGoodsReturn value * @return \Api\StructType\ApiMutualSettlementDetailBuyerGoodsReturn|null */ - public function getMutualSettlementDetailBuyerGoodsReturn() + public function getMutualSettlementDetailBuyerGoodsReturn(): ?\Api\StructType\ApiMutualSettlementDetailBuyerGoodsReturn { return isset($this->mutualSettlementDetailBuyerGoodsReturn) ? $this->mutualSettlementDetailBuyerGoodsReturn : null; } @@ -1098,7 +1123,7 @@ public function getMutualSettlementDetailBuyerGoodsReturn() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailBuyerGoodsReturnForChoiceConstraintsFromSetMutualSettlementDetailBuyerGoodsReturn($value) + public function validateMutualSettlementDetailBuyerGoodsReturnForChoiceConstraintsFromSetMutualSettlementDetailBuyerGoodsReturn($value): string { $message = ''; if (is_null($value)) { @@ -1125,12 +1150,13 @@ public function validateMutualSettlementDetailBuyerGoodsReturnForChoiceConstrain try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailBuyerGoodsReturn can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailBuyerGoodsReturn, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailBuyerGoodsReturn can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailBuyerGoodsReturn, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1138,28 +1164,29 @@ public function validateMutualSettlementDetailBuyerGoodsReturnForChoiceConstrain * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailBuyerGoodsReturn $mutualSettlementDetailBuyerGoodsReturn * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailBuyerGoodsReturn(\Api\StructType\ApiMutualSettlementDetailBuyerGoodsReturn $mutualSettlementDetailBuyerGoodsReturn = null) + public function setMutualSettlementDetailBuyerGoodsReturn(?\Api\StructType\ApiMutualSettlementDetailBuyerGoodsReturn $mutualSettlementDetailBuyerGoodsReturn = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailBuyerGoodsReturnChoiceErrorMessage = self::validateMutualSettlementDetailBuyerGoodsReturnForChoiceConstraintsFromSetMutualSettlementDetailBuyerGoodsReturn($mutualSettlementDetailBuyerGoodsReturn))) { - throw new \InvalidArgumentException($mutualSettlementDetailBuyerGoodsReturnChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailBuyerGoodsReturnChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailBuyerGoodsReturn) || (is_array($mutualSettlementDetailBuyerGoodsReturn) && empty($mutualSettlementDetailBuyerGoodsReturn))) { unset($this->mutualSettlementDetailBuyerGoodsReturn); } else { $this->mutualSettlementDetailBuyerGoodsReturn = $mutualSettlementDetailBuyerGoodsReturn; } + return $this; } /** * Get mutualSettlementDetailProductsPackaging value * @return \Api\StructType\ApiMutualSettlementDetailProductsPackaging|null */ - public function getMutualSettlementDetailProductsPackaging() + public function getMutualSettlementDetailProductsPackaging(): ?\Api\StructType\ApiMutualSettlementDetailProductsPackaging { return isset($this->mutualSettlementDetailProductsPackaging) ? $this->mutualSettlementDetailProductsPackaging : null; } @@ -1170,7 +1197,7 @@ public function getMutualSettlementDetailProductsPackaging() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailProductsPackagingForChoiceConstraintsFromSetMutualSettlementDetailProductsPackaging($value) + public function validateMutualSettlementDetailProductsPackagingForChoiceConstraintsFromSetMutualSettlementDetailProductsPackaging($value): string { $message = ''; if (is_null($value)) { @@ -1197,12 +1224,13 @@ public function validateMutualSettlementDetailProductsPackagingForChoiceConstrai try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailProductsPackaging can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailProductsPackaging, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailProductsPackaging can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailProductsPackaging, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1210,28 +1238,29 @@ public function validateMutualSettlementDetailProductsPackagingForChoiceConstrai * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailProductsPackaging $mutualSettlementDetailProductsPackaging * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailProductsPackaging(\Api\StructType\ApiMutualSettlementDetailProductsPackaging $mutualSettlementDetailProductsPackaging = null) + public function setMutualSettlementDetailProductsPackaging(?\Api\StructType\ApiMutualSettlementDetailProductsPackaging $mutualSettlementDetailProductsPackaging = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailProductsPackagingChoiceErrorMessage = self::validateMutualSettlementDetailProductsPackagingForChoiceConstraintsFromSetMutualSettlementDetailProductsPackaging($mutualSettlementDetailProductsPackaging))) { - throw new \InvalidArgumentException($mutualSettlementDetailProductsPackagingChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailProductsPackagingChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailProductsPackaging) || (is_array($mutualSettlementDetailProductsPackaging) && empty($mutualSettlementDetailProductsPackaging))) { unset($this->mutualSettlementDetailProductsPackaging); } else { $this->mutualSettlementDetailProductsPackaging = $mutualSettlementDetailProductsPackaging; } + return $this; } /** * Get mutualSettlementDetailAdjustmentWriteRegisters value * @return \Api\StructType\ApiMutualSettlementDetailAdjustmentWriteRegisters|null */ - public function getMutualSettlementDetailAdjustmentWriteRegisters() + public function getMutualSettlementDetailAdjustmentWriteRegisters(): ?\Api\StructType\ApiMutualSettlementDetailAdjustmentWriteRegisters { return isset($this->mutualSettlementDetailAdjustmentWriteRegisters) ? $this->mutualSettlementDetailAdjustmentWriteRegisters : null; } @@ -1242,7 +1271,7 @@ public function getMutualSettlementDetailAdjustmentWriteRegisters() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailAdjustmentWriteRegistersForChoiceConstraintsFromSetMutualSettlementDetailAdjustmentWriteRegisters($value) + public function validateMutualSettlementDetailAdjustmentWriteRegistersForChoiceConstraintsFromSetMutualSettlementDetailAdjustmentWriteRegisters($value): string { $message = ''; if (is_null($value)) { @@ -1269,12 +1298,13 @@ public function validateMutualSettlementDetailAdjustmentWriteRegistersForChoiceC try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailAdjustmentWriteRegisters can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailAdjustmentWriteRegisters, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailAdjustmentWriteRegisters can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailAdjustmentWriteRegisters, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1282,28 +1312,29 @@ public function validateMutualSettlementDetailAdjustmentWriteRegistersForChoiceC * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailAdjustmentWriteRegisters $mutualSettlementDetailAdjustmentWriteRegisters * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailAdjustmentWriteRegisters(\Api\StructType\ApiMutualSettlementDetailAdjustmentWriteRegisters $mutualSettlementDetailAdjustmentWriteRegisters = null) + public function setMutualSettlementDetailAdjustmentWriteRegisters(?\Api\StructType\ApiMutualSettlementDetailAdjustmentWriteRegisters $mutualSettlementDetailAdjustmentWriteRegisters = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailAdjustmentWriteRegistersChoiceErrorMessage = self::validateMutualSettlementDetailAdjustmentWriteRegistersForChoiceConstraintsFromSetMutualSettlementDetailAdjustmentWriteRegisters($mutualSettlementDetailAdjustmentWriteRegisters))) { - throw new \InvalidArgumentException($mutualSettlementDetailAdjustmentWriteRegistersChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailAdjustmentWriteRegistersChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailAdjustmentWriteRegisters) || (is_array($mutualSettlementDetailAdjustmentWriteRegisters) && empty($mutualSettlementDetailAdjustmentWriteRegisters))) { unset($this->mutualSettlementDetailAdjustmentWriteRegisters); } else { $this->mutualSettlementDetailAdjustmentWriteRegisters = $mutualSettlementDetailAdjustmentWriteRegisters; } + return $this; } /** * Get mutualSettlementDetailSafeCustody value * @return \Api\StructType\ApiMutualSettlementDetailSafeCustody|null */ - public function getMutualSettlementDetailSafeCustody() + public function getMutualSettlementDetailSafeCustody(): ?\Api\StructType\ApiMutualSettlementDetailSafeCustody { return isset($this->mutualSettlementDetailSafeCustody) ? $this->mutualSettlementDetailSafeCustody : null; } @@ -1314,7 +1345,7 @@ public function getMutualSettlementDetailSafeCustody() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailSafeCustodyForChoiceConstraintsFromSetMutualSettlementDetailSafeCustody($value) + public function validateMutualSettlementDetailSafeCustodyForChoiceConstraintsFromSetMutualSettlementDetailSafeCustody($value): string { $message = ''; if (is_null($value)) { @@ -1341,12 +1372,13 @@ public function validateMutualSettlementDetailSafeCustodyForChoiceConstraintsFro try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailSafeCustody can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailSafeCustody, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailSafeCustody can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailSafeCustody, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1354,28 +1386,29 @@ public function validateMutualSettlementDetailSafeCustodyForChoiceConstraintsFro * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailSafeCustody $mutualSettlementDetailSafeCustody * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailSafeCustody(\Api\StructType\ApiMutualSettlementDetailSafeCustody $mutualSettlementDetailSafeCustody = null) + public function setMutualSettlementDetailSafeCustody(?\Api\StructType\ApiMutualSettlementDetailSafeCustody $mutualSettlementDetailSafeCustody = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailSafeCustodyChoiceErrorMessage = self::validateMutualSettlementDetailSafeCustodyForChoiceConstraintsFromSetMutualSettlementDetailSafeCustody($mutualSettlementDetailSafeCustody))) { - throw new \InvalidArgumentException($mutualSettlementDetailSafeCustodyChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailSafeCustodyChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailSafeCustody) || (is_array($mutualSettlementDetailSafeCustody) && empty($mutualSettlementDetailSafeCustody))) { unset($this->mutualSettlementDetailSafeCustody); } else { $this->mutualSettlementDetailSafeCustody = $mutualSettlementDetailSafeCustody; } + return $this; } /** * Get mutualSettlementDetailSafeCustodyCalculation value * @return \Api\StructType\ApiMutualSettlementDetailSafeCustodyCalculation|null */ - public function getMutualSettlementDetailSafeCustodyCalculation() + public function getMutualSettlementDetailSafeCustodyCalculation(): ?\Api\StructType\ApiMutualSettlementDetailSafeCustodyCalculation { return isset($this->mutualSettlementDetailSafeCustodyCalculation) ? $this->mutualSettlementDetailSafeCustodyCalculation : null; } @@ -1386,7 +1419,7 @@ public function getMutualSettlementDetailSafeCustodyCalculation() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailSafeCustodyCalculationForChoiceConstraintsFromSetMutualSettlementDetailSafeCustodyCalculation($value) + public function validateMutualSettlementDetailSafeCustodyCalculationForChoiceConstraintsFromSetMutualSettlementDetailSafeCustodyCalculation($value): string { $message = ''; if (is_null($value)) { @@ -1413,12 +1446,13 @@ public function validateMutualSettlementDetailSafeCustodyCalculationForChoiceCon try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailSafeCustodyCalculation can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailSafeCustodyCalculation, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailSafeCustodyCalculation can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailSafeCustodyCalculation, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1426,28 +1460,29 @@ public function validateMutualSettlementDetailSafeCustodyCalculationForChoiceCon * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailSafeCustodyCalculation $mutualSettlementDetailSafeCustodyCalculation * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailSafeCustodyCalculation(\Api\StructType\ApiMutualSettlementDetailSafeCustodyCalculation $mutualSettlementDetailSafeCustodyCalculation = null) + public function setMutualSettlementDetailSafeCustodyCalculation(?\Api\StructType\ApiMutualSettlementDetailSafeCustodyCalculation $mutualSettlementDetailSafeCustodyCalculation = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailSafeCustodyCalculationChoiceErrorMessage = self::validateMutualSettlementDetailSafeCustodyCalculationForChoiceConstraintsFromSetMutualSettlementDetailSafeCustodyCalculation($mutualSettlementDetailSafeCustodyCalculation))) { - throw new \InvalidArgumentException($mutualSettlementDetailSafeCustodyCalculationChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailSafeCustodyCalculationChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailSafeCustodyCalculation) || (is_array($mutualSettlementDetailSafeCustodyCalculation) && empty($mutualSettlementDetailSafeCustodyCalculation))) { unset($this->mutualSettlementDetailSafeCustodyCalculation); } else { $this->mutualSettlementDetailSafeCustodyCalculation = $mutualSettlementDetailSafeCustodyCalculation; } + return $this; } /** * Get mutualSettlementDetailRegisterStorage value * @return \Api\StructType\ApiMutualSettlementDetailRegisterStorage|null */ - public function getMutualSettlementDetailRegisterStorage() + public function getMutualSettlementDetailRegisterStorage(): ?\Api\StructType\ApiMutualSettlementDetailRegisterStorage { return isset($this->mutualSettlementDetailRegisterStorage) ? $this->mutualSettlementDetailRegisterStorage : null; } @@ -1458,7 +1493,7 @@ public function getMutualSettlementDetailRegisterStorage() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateMutualSettlementDetailRegisterStorageForChoiceConstraintsFromSetMutualSettlementDetailRegisterStorage($value) + public function validateMutualSettlementDetailRegisterStorageForChoiceConstraintsFromSetMutualSettlementDetailRegisterStorage($value): string { $message = ''; if (is_null($value)) { @@ -1485,12 +1520,13 @@ public function validateMutualSettlementDetailRegisterStorageForChoiceConstraint try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property mutualSettlementDetailRegisterStorage can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailRegisterStorage, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property mutualSettlementDetailRegisterStorage can\'t be set as the property %s is already set. Only one property must be set among these properties: mutualSettlementDetailRegisterStorage, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -1498,21 +1534,22 @@ public function validateMutualSettlementDetailRegisterStorageForChoiceConstraint * 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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiMutualSettlementDetailRegisterStorage $mutualSettlementDetailRegisterStorage * @return \Api\StructType\ApiDetails */ - public function setMutualSettlementDetailRegisterStorage(\Api\StructType\ApiMutualSettlementDetailRegisterStorage $mutualSettlementDetailRegisterStorage = null) + public function setMutualSettlementDetailRegisterStorage(?\Api\StructType\ApiMutualSettlementDetailRegisterStorage $mutualSettlementDetailRegisterStorage = null): self { // validation for constraint: choice(mutualSettlementDetailCalcCostShipping, mutualSettlementDetailCashFlow, mutualSettlementDetailClientPayment, mutualSettlementDetailPostReturnRegistry, mutualSettlementDetailRouteList, mutualSettlementDetailTrackNumberPayment, mutualSettlementDetailServiceRegistration, mutualSettlementDetailAcceptanceRegistry, mutualSettlementDetailAdditionalChargeFare, mutualSettlementDetailOutgoingRequestToCarrier, mutualSettlementDetailSMSInformation, mutualSettlementDetailBuyerGoodsReturn, mutualSettlementDetailProductsPackaging, mutualSettlementDetailAdjustmentWriteRegisters, mutualSettlementDetailSafeCustody, mutualSettlementDetailSafeCustodyCalculation, mutualSettlementDetailRegisterStorage) if ('' !== ($mutualSettlementDetailRegisterStorageChoiceErrorMessage = self::validateMutualSettlementDetailRegisterStorageForChoiceConstraintsFromSetMutualSettlementDetailRegisterStorage($mutualSettlementDetailRegisterStorage))) { - throw new \InvalidArgumentException($mutualSettlementDetailRegisterStorageChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($mutualSettlementDetailRegisterStorageChoiceErrorMessage, __LINE__); } if (is_null($mutualSettlementDetailRegisterStorage) || (is_array($mutualSettlementDetailRegisterStorage) && empty($mutualSettlementDetailRegisterStorage))) { unset($this->mutualSettlementDetailRegisterStorage); } else { $this->mutualSettlementDetailRegisterStorage = $mutualSettlementDetailRegisterStorage; } + return $this; } } diff --git a/tests/resources/generated/ValidDoWithoutPrefix.php b/tests/resources/generated/ValidDoWithoutPrefix.php index 42a866ec..03bb3447 100755 --- a/tests/resources/generated/ValidDoWithoutPrefix.php +++ b/tests/resources/generated/ValidDoWithoutPrefix.php @@ -1,8 +1,11 @@ setSoapHeader($nameSpace, 'RequesterCredentials', $requesterCredentials, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'RequesterCredentials', $requesterCredentials, $mustUnderstand, $actor); } /** * Method to call the operation originally named DoMobileCheckoutPayment @@ -33,7 +36,6 @@ public function setSoapHeaderRequesterCredentials(\StructType\CustomSecurityHead * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest * @return \StructType\DoMobileCheckoutPaymentResponseType|bool @@ -41,12 +43,14 @@ public function setSoapHeaderRequesterCredentials(\StructType\CustomSecurityHead public function DoMobileCheckoutPayment(\StructType\DoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', array( + $this->setResult($resultDoMobileCheckoutPayment = $this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', [ $doMobileCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoMobileCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -59,7 +63,6 @@ public function DoMobileCheckoutPayment(\StructType\DoMobileCheckoutPaymentReq $ * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest * @return \StructType\DoExpressCheckoutPaymentResponseType|bool @@ -67,12 +70,14 @@ public function DoMobileCheckoutPayment(\StructType\DoMobileCheckoutPaymentReq $ public function DoExpressCheckoutPayment(\StructType\DoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', array( + $this->setResult($resultDoExpressCheckoutPayment = $this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', [ $doExpressCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoExpressCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -85,7 +90,6 @@ public function DoExpressCheckoutPayment(\StructType\DoExpressCheckoutPaymentReq * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest * @return \StructType\DoUATPExpressCheckoutPaymentResponseType|bool @@ -93,12 +97,14 @@ public function DoExpressCheckoutPayment(\StructType\DoExpressCheckoutPaymentReq public function DoUATPExpressCheckoutPayment(\StructType\DoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', array( + $this->setResult($resultDoUATPExpressCheckoutPayment = $this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', [ $doUATPExpressCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoUATPExpressCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -111,7 +117,6 @@ public function DoUATPExpressCheckoutPayment(\StructType\DoUATPExpressCheckoutPa * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoDirectPaymentReq $doDirectPaymentRequest * @return \StructType\DoDirectPaymentResponseType|bool @@ -119,12 +124,14 @@ public function DoUATPExpressCheckoutPayment(\StructType\DoUATPExpressCheckoutPa public function DoDirectPayment(\StructType\DoDirectPaymentReq $doDirectPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoDirectPayment', array( + $this->setResult($resultDoDirectPayment = $this->getSoapClient()->__soapCall('DoDirectPayment', [ $doDirectPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoDirectPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -137,7 +144,6 @@ public function DoDirectPayment(\StructType\DoDirectPaymentReq $doDirectPaymentR * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoCancelReq $doCancelRequest * @return \StructType\DoCancelResponseType|bool @@ -145,12 +151,14 @@ public function DoDirectPayment(\StructType\DoDirectPaymentReq $doDirectPaymentR public function DoCancel(\StructType\DoCancelReq $doCancelRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoCancel', array( + $this->setResult($resultDoCancel = $this->getSoapClient()->__soapCall('DoCancel', [ $doCancelRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoCancel; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -163,7 +171,6 @@ public function DoCancel(\StructType\DoCancelReq $doCancelRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoCaptureReq $doCaptureRequest * @return \StructType\DoCaptureResponseType|bool @@ -171,12 +178,14 @@ public function DoCancel(\StructType\DoCancelReq $doCancelRequest) public function DoCapture(\StructType\DoCaptureReq $doCaptureRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoCapture', array( + $this->setResult($resultDoCapture = $this->getSoapClient()->__soapCall('DoCapture', [ $doCaptureRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoCapture; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -189,7 +198,6 @@ public function DoCapture(\StructType\DoCaptureReq $doCaptureRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoReauthorizationReq $doReauthorizationRequest * @return \StructType\DoReauthorizationResponseType|bool @@ -197,12 +205,14 @@ public function DoCapture(\StructType\DoCaptureReq $doCaptureRequest) public function DoReauthorization(\StructType\DoReauthorizationReq $doReauthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoReauthorization', array( + $this->setResult($resultDoReauthorization = $this->getSoapClient()->__soapCall('DoReauthorization', [ $doReauthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoReauthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -215,7 +225,6 @@ public function DoReauthorization(\StructType\DoReauthorizationReq $doReauthoriz * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoVoidReq $doVoidRequest * @return \StructType\DoVoidResponseType|bool @@ -223,12 +232,14 @@ public function DoReauthorization(\StructType\DoReauthorizationReq $doReauthoriz public function DoVoid(\StructType\DoVoidReq $doVoidRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoVoid', array( + $this->setResult($resultDoVoid = $this->getSoapClient()->__soapCall('DoVoid', [ $doVoidRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoVoid; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -241,7 +252,6 @@ public function DoVoid(\StructType\DoVoidReq $doVoidRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoAuthorizationReq $doAuthorizationRequest * @return \StructType\DoAuthorizationResponseType|bool @@ -249,12 +259,14 @@ public function DoVoid(\StructType\DoVoidReq $doVoidRequest) public function DoAuthorization(\StructType\DoAuthorizationReq $doAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoAuthorization', array( + $this->setResult($resultDoAuthorization = $this->getSoapClient()->__soapCall('DoAuthorization', [ $doAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -267,7 +279,6 @@ public function DoAuthorization(\StructType\DoAuthorizationReq $doAuthorizationR * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoUATPAuthorizationReq $doUATPAuthorizationRequest * @return \StructType\DoUATPAuthorizationResponseType|bool @@ -275,12 +286,14 @@ public function DoAuthorization(\StructType\DoAuthorizationReq $doAuthorizationR public function DoUATPAuthorization(\StructType\DoUATPAuthorizationReq $doUATPAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoUATPAuthorization', array( + $this->setResult($resultDoUATPAuthorization = $this->getSoapClient()->__soapCall('DoUATPAuthorization', [ $doUATPAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoUATPAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -293,7 +306,6 @@ public function DoUATPAuthorization(\StructType\DoUATPAuthorizationReq $doUATPAu * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoReferenceTransactionReq $doReferenceTransactionRequest * @return \StructType\DoReferenceTransactionResponseType|bool @@ -301,12 +313,14 @@ public function DoUATPAuthorization(\StructType\DoUATPAuthorizationReq $doUATPAu public function DoReferenceTransaction(\StructType\DoReferenceTransactionReq $doReferenceTransactionRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoReferenceTransaction', array( + $this->setResult($resultDoReferenceTransaction = $this->getSoapClient()->__soapCall('DoReferenceTransaction', [ $doReferenceTransactionRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoReferenceTransaction; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -319,7 +333,6 @@ public function DoReferenceTransaction(\StructType\DoReferenceTransactionReq $do * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\DoNonReferencedCreditReq $doNonReferencedCreditRequest * @return \StructType\DoNonReferencedCreditResponseType|bool @@ -327,12 +340,14 @@ public function DoReferenceTransaction(\StructType\DoReferenceTransactionReq $do public function DoNonReferencedCredit(\StructType\DoNonReferencedCreditReq $doNonReferencedCreditRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoNonReferencedCredit', array( + $this->setResult($resultDoNonReferencedCredit = $this->getSoapClient()->__soapCall('DoNonReferencedCredit', [ $doNonReferencedCreditRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoNonReferencedCredit; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidExpiryDate.php b/tests/resources/generated/ValidExpiryDate.php index 877db8fd..5e883257 100644 --- a/tests/resources/generated/ValidExpiryDate.php +++ b/tests/resources/generated/ValidExpiryDate.php @@ -1,8 +1,11 @@ setMonth($month) @@ -47,7 +50,7 @@ public function __construct($month = null, $year = null) * Get month value * @return string */ - public function getMonth() + public function getMonth(): string { return $this->month; } @@ -56,24 +59,25 @@ public function getMonth() * @param string $month * @return \Api\StructType\ApiExpiryDate */ - public function setMonth($month = null) + public function setMonth(string $month): self { // validation for constraint: string if (!is_null($month) && !is_string($month)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($month, true), gettype($month)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($month, true), gettype($month)), __LINE__); } // validation for constraint: pattern((0[1-9]|1[012])) if (!is_null($month) && !preg_match('/(0[1-9]|1[012])/', $month)) { - 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[1-9]|1[012])/', var_export($month, true)), __LINE__); + 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[1-9]|1[012])/', var_export($month, true)), __LINE__); } $this->month = $month; + return $this; } /** * Get year value * @return string */ - public function getYear() + public function getYear(): string { return $this->year; } @@ -82,17 +86,18 @@ public function getYear() * @param string $year * @return \Api\StructType\ApiExpiryDate */ - public function setYear($year = null) + public function setYear(string $year): self { // validation for constraint: string if (!is_null($year) && !is_string($year)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($year, true), gettype($year)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($year, true), gettype($year)), __LINE__); } // validation for constraint: pattern([0-9][0-9]) if (!is_null($year) && !preg_match('/[0-9][0-9]/', $year)) { - 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]/', var_export($year, true)), __LINE__); + 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]/', var_export($year, true)), __LINE__); } $this->year = $year; + return $this; } } diff --git a/tests/resources/generated/ValidFieldString1000.php b/tests/resources/generated/ValidFieldString1000.php index 019e8885..84bc6be0 100644 --- a/tests/resources/generated/ValidFieldString1000.php +++ b/tests/resources/generated/ValidFieldString1000.php @@ -1,8 +1,11 @@ setRoomStays($roomStays) @@ -82,7 +85,7 @@ public function __construct(\Api\StructType\ApiRoomStaysType $roomStays = null, * Get RoomStays value * @return \Api\StructType\ApiRoomStaysType|null */ - public function getRoomStays() + public function getRoomStays(): ?\Api\StructType\ApiRoomStaysType { return $this->RoomStays; } @@ -91,16 +94,17 @@ public function getRoomStays() * @param \Api\StructType\ApiRoomStaysType $roomStays * @return \Api\StructType\ApiHotelReservationType */ - public function setRoomStays(\Api\StructType\ApiRoomStaysType $roomStays = null) + public function setRoomStays(?\Api\StructType\ApiRoomStaysType $roomStays = null): self { $this->RoomStays = $roomStays; + return $this; } /** * Get ResGuests value * @return \Api\StructType\ApiResGuestsType|null */ - public function getResGuests() + public function getResGuests(): ?\Api\StructType\ApiResGuestsType { return $this->ResGuests; } @@ -109,16 +113,17 @@ public function getResGuests() * @param \Api\StructType\ApiResGuestsType $resGuests * @return \Api\StructType\ApiHotelReservationType */ - public function setResGuests(\Api\StructType\ApiResGuestsType $resGuests = null) + public function setResGuests(?\Api\StructType\ApiResGuestsType $resGuests = null): self { $this->ResGuests = $resGuests; + return $this; } /** * Get ResGlobalInfo value * @return \Api\StructType\ApiResGlobalInfoType|null */ - public function getResGlobalInfo() + public function getResGlobalInfo(): ?\Api\StructType\ApiResGlobalInfoType { return $this->ResGlobalInfo; } @@ -127,16 +132,17 @@ public function getResGlobalInfo() * @param \Api\StructType\ApiResGlobalInfoType $resGlobalInfo * @return \Api\StructType\ApiHotelReservationType */ - public function setResGlobalInfo(\Api\StructType\ApiResGlobalInfoType $resGlobalInfo = null) + public function setResGlobalInfo(?\Api\StructType\ApiResGlobalInfoType $resGlobalInfo = null): self { $this->ResGlobalInfo = $resGlobalInfo; + return $this; } /** * Get RoomStayReservation value * @return bool|null */ - public function getRoomStayReservation() + public function getRoomStayReservation(): ?bool { return $this->RoomStayReservation; } @@ -145,20 +151,21 @@ public function getRoomStayReservation() * @param bool $roomStayReservation * @return \Api\StructType\ApiHotelReservationType */ - public function setRoomStayReservation($roomStayReservation = null) + public function setRoomStayReservation(?bool $roomStayReservation = null): self { // validation for constraint: boolean if (!is_null($roomStayReservation) && !is_bool($roomStayReservation)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($roomStayReservation, true), gettype($roomStayReservation)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($roomStayReservation, true), gettype($roomStayReservation)), __LINE__); } $this->RoomStayReservation = $roomStayReservation; + return $this; } /** * Get ResStatus value * @return string|null */ - public function getResStatus() + public function getResStatus(): ?string { return $this->ResStatus; } @@ -169,25 +176,26 @@ public function getResStatus() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public static function validateResStatusForUnionConstraintsFromSetResStatus($value) + public static function validateResStatusForUnionConstraintsFromSetResStatus($value): string { $message = ''; // validation for constraint: enumeration if (!\Api\EnumType\ApiPMS_ResStatusType::valueIsValid($value)) { - $exception0 = new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiPMS_ResStatusType', is_array($value) ? implode(', ', $value) : var_export($value, true), implode(', ', \Api\EnumType\ApiPMS_ResStatusType::getValidValues())), __LINE__); + $exception0 = new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiPMS_ResStatusType', is_array($value) ? implode(', ', $value) : var_export($value, true), implode(', ', \Api\EnumType\ApiPMS_ResStatusType::getValidValues())), __LINE__); } // validation for constraint: enumeration if (!\Api\EnumType\ApiTransactionActionType::valueIsValid($value)) { - $exception1 = new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiTransactionActionType', is_array($value) ? implode(', ', $value) : var_export($value, true), implode(', ', \Api\EnumType\ApiTransactionActionType::getValidValues())), __LINE__); + $exception1 = new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiTransactionActionType', is_array($value) ? implode(', ', $value) : var_export($value, true), implode(', ', \Api\EnumType\ApiTransactionActionType::getValidValues())), __LINE__); } // validation for constraint: pattern([A-Z]{1,2}) if (!is_null($value) && !preg_match('/[A-Z]{1,2}/', $value)) { - $exception2 = 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]{1,2}/', var_export($value, true)), __LINE__); + $exception2 = 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]{1,2}/', var_export($value, true)), __LINE__); } if (isset($exception0) && isset($exception1) && isset($exception2)) { - $message = sprintf("The value %s does not match any of the union rules: PMS_ResStatusType, TransactionActionType, UpperCaseAlphaLength1to2. See following errors:\n%s", var_export($value, true), implode("\n", array_map(function(\InvalidArgumentException $e) { return sprintf(' - %s', $e->getMessage()); }, [$exception0, $exception1, $exception2]))); + $message = sprintf("The value %s does not match any of the union rules: PMS_ResStatusType, TransactionActionType, UpperCaseAlphaLength1to2. See following errors:\n%s", var_export($value, true), implode("\n", array_map(function(InvalidArgumentException $e) { return sprintf(' - %s', $e->getMessage()); }, [$exception0, $exception1, $exception2]))); } unset($exception0, $exception1, $exception2); + return $message; } /** @@ -195,17 +203,18 @@ public static function validateResStatusForUnionConstraintsFromSetResStatus($val * @param string $resStatus * @return \Api\StructType\ApiHotelReservationType */ - public function setResStatus($resStatus = null) + public function setResStatus(?string $resStatus = null): self { // validation for constraint: string if (!is_null($resStatus) && !is_string($resStatus)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($resStatus, true), gettype($resStatus)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($resStatus, true), gettype($resStatus)), __LINE__); } // validation for constraint: union(PMS_ResStatusType, TransactionActionType, UpperCaseAlphaLength1to2) if ('' !== ($resStatusUnionErrorMessage = self::validateResStatusForUnionConstraintsFromSetResStatus($resStatus))) { - throw new \InvalidArgumentException($resStatusUnionErrorMessage, __LINE__); + throw new InvalidArgumentException($resStatusUnionErrorMessage, __LINE__); } $this->ResStatus = $resStatus; + return $this; } } diff --git a/tests/resources/generated/ValidHouseProfileData.php b/tests/resources/generated/ValidHouseProfileData.php index 8c6c3a3b..2827378a 100644 --- a/tests/resources/generated/ValidHouseProfileData.php +++ b/tests/resources/generated/ValidHouseProfileData.php @@ -1,8 +1,11 @@ setArea_total($area_total) @@ -597,7 +600,7 @@ public function __construct($area_total = null, $area_residential = null, $area_ * Get area_total value * @return float|null */ - public function getArea_total() + public function getArea_total(): ?float { return $this->area_total; } @@ -606,28 +609,29 @@ public function getArea_total() * @param float $area_total * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_total($area_total = null) + public function setArea_total(?float $area_total = null): self { // validation for constraint: float if (!is_null($area_total) && !(is_float($area_total) || is_numeric($area_total))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_total, true), gettype($area_total)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_total, true), gettype($area_total)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_total) && mb_strlen(mb_substr($area_total, false !== mb_strpos($area_total, '.') ? mb_strpos($area_total, '.') + 1 : mb_strlen($area_total))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_total, true), mb_strlen(mb_substr($area_total, mb_strpos($area_total, '.') + 1))), __LINE__); + if (!is_null($area_total) && mb_strlen(mb_substr((string) $area_total, false !== mb_strpos((string) $area_total, '.') ? mb_strpos((string) $area_total, '.') + 1 : mb_strlen((string) $area_total))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_total, true), mb_strlen(mb_substr((string) $area_total, mb_strpos((string) $area_total, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_total) && mb_strlen(preg_replace('/(\D)/', '', $area_total)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_total, true), mb_strlen(preg_replace('/(\D)/', '', $area_total))), __LINE__); + if (!is_null($area_total) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_total)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_total, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_total))), __LINE__); } $this->area_total = $area_total; + return $this; } /** * Get area_residential value * @return float|null */ - public function getArea_residential() + public function getArea_residential(): ?float { return $this->area_residential; } @@ -636,28 +640,29 @@ public function getArea_residential() * @param float $area_residential * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_residential($area_residential = null) + public function setArea_residential(?float $area_residential = null): self { // validation for constraint: float if (!is_null($area_residential) && !(is_float($area_residential) || is_numeric($area_residential))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_residential, true), gettype($area_residential)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_residential, true), gettype($area_residential)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_residential) && mb_strlen(mb_substr($area_residential, false !== mb_strpos($area_residential, '.') ? mb_strpos($area_residential, '.') + 1 : mb_strlen($area_residential))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_residential, true), mb_strlen(mb_substr($area_residential, mb_strpos($area_residential, '.') + 1))), __LINE__); + if (!is_null($area_residential) && mb_strlen(mb_substr((string) $area_residential, false !== mb_strpos((string) $area_residential, '.') ? mb_strpos((string) $area_residential, '.') + 1 : mb_strlen((string) $area_residential))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_residential, true), mb_strlen(mb_substr((string) $area_residential, mb_strpos((string) $area_residential, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_residential) && mb_strlen(preg_replace('/(\D)/', '', $area_residential)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_residential, true), mb_strlen(preg_replace('/(\D)/', '', $area_residential))), __LINE__); + if (!is_null($area_residential) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_residential)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_residential, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_residential))), __LINE__); } $this->area_residential = $area_residential; + return $this; } /** * Get area_non_residential value * @return float|null */ - public function getArea_non_residential() + public function getArea_non_residential(): ?float { return $this->area_non_residential; } @@ -666,28 +671,29 @@ public function getArea_non_residential() * @param float $area_non_residential * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_non_residential($area_non_residential = null) + public function setArea_non_residential(?float $area_non_residential = null): self { // validation for constraint: float if (!is_null($area_non_residential) && !(is_float($area_non_residential) || is_numeric($area_non_residential))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_non_residential, true), gettype($area_non_residential)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_non_residential, true), gettype($area_non_residential)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_non_residential) && mb_strlen(mb_substr($area_non_residential, false !== mb_strpos($area_non_residential, '.') ? mb_strpos($area_non_residential, '.') + 1 : mb_strlen($area_non_residential))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_non_residential, true), mb_strlen(mb_substr($area_non_residential, mb_strpos($area_non_residential, '.') + 1))), __LINE__); + if (!is_null($area_non_residential) && mb_strlen(mb_substr((string) $area_non_residential, false !== mb_strpos((string) $area_non_residential, '.') ? mb_strpos((string) $area_non_residential, '.') + 1 : mb_strlen((string) $area_non_residential))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_non_residential, true), mb_strlen(mb_substr((string) $area_non_residential, mb_strpos((string) $area_non_residential, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_non_residential) && mb_strlen(preg_replace('/(\D)/', '', $area_non_residential)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_non_residential, true), mb_strlen(preg_replace('/(\D)/', '', $area_non_residential))), __LINE__); + if (!is_null($area_non_residential) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_non_residential)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_non_residential, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_non_residential))), __LINE__); } $this->area_non_residential = $area_non_residential; + return $this; } /** * Get cadastral_number value * @return string|null */ - public function getCadastral_number() + public function getCadastral_number(): ?string { return $this->cadastral_number; } @@ -696,20 +702,21 @@ public function getCadastral_number() * @param string $cadastral_number * @return \Api\StructType\ApiHouseProfileData */ - public function setCadastral_number($cadastral_number = null) + public function setCadastral_number(?string $cadastral_number = null): self { // validation for constraint: string if (!is_null($cadastral_number) && !is_string($cadastral_number)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cadastral_number, true), gettype($cadastral_number)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cadastral_number, true), gettype($cadastral_number)), __LINE__); } $this->cadastral_number = $cadastral_number; + return $this; } /** * Get project_type value * @return string|null */ - public function getProject_type() + public function getProject_type(): ?string { return $this->project_type; } @@ -718,20 +725,21 @@ public function getProject_type() * @param string $project_type * @return \Api\StructType\ApiHouseProfileData */ - public function setProject_type($project_type = null) + public function setProject_type(?string $project_type = null): self { // validation for constraint: string if (!is_null($project_type) && !is_string($project_type)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($project_type, true), gettype($project_type)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($project_type, true), gettype($project_type)), __LINE__); } $this->project_type = $project_type; + return $this; } /** * Get location_description value * @return string|null */ - public function getLocation_description() + public function getLocation_description(): ?string { return $this->location_description; } @@ -740,20 +748,21 @@ public function getLocation_description() * @param string $location_description * @return \Api\StructType\ApiHouseProfileData */ - public function setLocation_description($location_description = null) + public function setLocation_description(?string $location_description = null): self { // validation for constraint: string if (!is_null($location_description) && !is_string($location_description)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($location_description, true), gettype($location_description)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($location_description, true), gettype($location_description)), __LINE__); } $this->location_description = $location_description; + return $this; } /** * Get individual_name value * @return string|null */ - public function getIndividual_name() + public function getIndividual_name(): ?string { return $this->individual_name; } @@ -762,20 +771,21 @@ public function getIndividual_name() * @param string $individual_name * @return \Api\StructType\ApiHouseProfileData */ - public function setIndividual_name($individual_name = null) + public function setIndividual_name(?string $individual_name = null): self { // validation for constraint: string if (!is_null($individual_name) && !is_string($individual_name)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($individual_name, true), gettype($individual_name)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($individual_name, true), gettype($individual_name)), __LINE__); } $this->individual_name = $individual_name; + return $this; } /** * Get house_type value * @return string|null */ - public function getHouse_type() + public function getHouse_type(): ?string { return $this->house_type; } @@ -783,24 +793,25 @@ public function getHouse_type() * Set house_type value * @uses \Api\EnumType\ApiHouseTypeEnum::valueIsValid() * @uses \Api\EnumType\ApiHouseTypeEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $house_type * @return \Api\StructType\ApiHouseProfileData */ - public function setHouse_type($house_type = null) + public function setHouse_type(?string $house_type = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiHouseTypeEnum::valueIsValid($house_type)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseTypeEnum', is_array($house_type) ? implode(', ', $house_type) : var_export($house_type, true), implode(', ', \Api\EnumType\ApiHouseTypeEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseTypeEnum', is_array($house_type) ? implode(', ', $house_type) : var_export($house_type, true), implode(', ', \Api\EnumType\ApiHouseTypeEnum::getValidValues())), __LINE__); } $this->house_type = $house_type; + return $this; } /** * Get exploitation_start_year value * @return string|null */ - public function getExploitation_start_year() + public function getExploitation_start_year(): ?string { return $this->exploitation_start_year; } @@ -809,20 +820,21 @@ public function getExploitation_start_year() * @param string $exploitation_start_year * @return \Api\StructType\ApiHouseProfileData */ - public function setExploitation_start_year($exploitation_start_year = null) + public function setExploitation_start_year(?string $exploitation_start_year = null): self { // validation for constraint: string if (!is_null($exploitation_start_year) && !is_string($exploitation_start_year)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($exploitation_start_year, true), gettype($exploitation_start_year)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($exploitation_start_year, true), gettype($exploitation_start_year)), __LINE__); } $this->exploitation_start_year = $exploitation_start_year; + return $this; } /** * Get wall_material value * @return string|null */ - public function getWall_material() + public function getWall_material(): ?string { return $this->wall_material; } @@ -830,24 +842,25 @@ public function getWall_material() * Set wall_material value * @uses \Api\EnumType\ApiHouseWallMaterialEnum::valueIsValid() * @uses \Api\EnumType\ApiHouseWallMaterialEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $wall_material * @return \Api\StructType\ApiHouseProfileData */ - public function setWall_material($wall_material = null) + public function setWall_material(?string $wall_material = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiHouseWallMaterialEnum::valueIsValid($wall_material)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseWallMaterialEnum', is_array($wall_material) ? implode(', ', $wall_material) : var_export($wall_material, true), implode(', ', \Api\EnumType\ApiHouseWallMaterialEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseWallMaterialEnum', is_array($wall_material) ? implode(', ', $wall_material) : var_export($wall_material, true), implode(', ', \Api\EnumType\ApiHouseWallMaterialEnum::getValidValues())), __LINE__); } $this->wall_material = $wall_material; + return $this; } /** * Get floor_type value * @return string|null */ - public function getFloor_type() + public function getFloor_type(): ?string { return $this->floor_type; } @@ -855,24 +868,25 @@ public function getFloor_type() * Set floor_type value * @uses \Api\EnumType\ApiHouseFloorTypeEnum::valueIsValid() * @uses \Api\EnumType\ApiHouseFloorTypeEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $floor_type * @return \Api\StructType\ApiHouseProfileData */ - public function setFloor_type($floor_type = null) + public function setFloor_type(?string $floor_type = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiHouseFloorTypeEnum::valueIsValid($floor_type)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseFloorTypeEnum', is_array($floor_type) ? implode(', ', $floor_type) : var_export($floor_type, true), implode(', ', \Api\EnumType\ApiHouseFloorTypeEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseFloorTypeEnum', is_array($floor_type) ? implode(', ', $floor_type) : var_export($floor_type, true), implode(', ', \Api\EnumType\ApiHouseFloorTypeEnum::getValidValues())), __LINE__); } $this->floor_type = $floor_type; + return $this; } /** * Get storeys_count value * @return int|null */ - public function getStoreys_count() + public function getStoreys_count(): ?int { return $this->storeys_count; } @@ -881,20 +895,21 @@ public function getStoreys_count() * @param int $storeys_count * @return \Api\StructType\ApiHouseProfileData */ - public function setStoreys_count($storeys_count = null) + public function setStoreys_count(?int $storeys_count = null): self { // validation for constraint: int if (!is_null($storeys_count) && !(is_int($storeys_count) || ctype_digit($storeys_count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($storeys_count, true), gettype($storeys_count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($storeys_count, true), gettype($storeys_count)), __LINE__); } $this->storeys_count = $storeys_count; + return $this; } /** * Get entrance_count value * @return int|null */ - public function getEntrance_count() + public function getEntrance_count(): ?int { return $this->entrance_count; } @@ -903,20 +918,21 @@ public function getEntrance_count() * @param int $entrance_count * @return \Api\StructType\ApiHouseProfileData */ - public function setEntrance_count($entrance_count = null) + public function setEntrance_count(?int $entrance_count = null): self { // validation for constraint: int if (!is_null($entrance_count) && !(is_int($entrance_count) || ctype_digit($entrance_count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($entrance_count, true), gettype($entrance_count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($entrance_count, true), gettype($entrance_count)), __LINE__); } $this->entrance_count = $entrance_count; + return $this; } /** * Get elevators_count value * @return int|null */ - public function getElevators_count() + public function getElevators_count(): ?int { return $this->elevators_count; } @@ -925,20 +941,21 @@ public function getElevators_count() * @param int $elevators_count * @return \Api\StructType\ApiHouseProfileData */ - public function setElevators_count($elevators_count = null) + public function setElevators_count(?int $elevators_count = null): self { // validation for constraint: int if (!is_null($elevators_count) && !(is_int($elevators_count) || ctype_digit($elevators_count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($elevators_count, true), gettype($elevators_count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($elevators_count, true), gettype($elevators_count)), __LINE__); } $this->elevators_count = $elevators_count; + return $this; } /** * Get area_private value * @return float|null */ - public function getArea_private() + public function getArea_private(): ?float { return $this->area_private; } @@ -947,28 +964,29 @@ public function getArea_private() * @param float $area_private * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_private($area_private = null) + public function setArea_private(?float $area_private = null): self { // validation for constraint: float if (!is_null($area_private) && !(is_float($area_private) || is_numeric($area_private))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_private, true), gettype($area_private)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_private, true), gettype($area_private)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_private) && mb_strlen(mb_substr($area_private, false !== mb_strpos($area_private, '.') ? mb_strpos($area_private, '.') + 1 : mb_strlen($area_private))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_private, true), mb_strlen(mb_substr($area_private, mb_strpos($area_private, '.') + 1))), __LINE__); + if (!is_null($area_private) && mb_strlen(mb_substr((string) $area_private, false !== mb_strpos((string) $area_private, '.') ? mb_strpos((string) $area_private, '.') + 1 : mb_strlen((string) $area_private))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_private, true), mb_strlen(mb_substr((string) $area_private, mb_strpos((string) $area_private, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_private) && mb_strlen(preg_replace('/(\D)/', '', $area_private)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_private, true), mb_strlen(preg_replace('/(\D)/', '', $area_private))), __LINE__); + if (!is_null($area_private) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_private)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_private, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_private))), __LINE__); } $this->area_private = $area_private; + return $this; } /** * Get area_municipal value * @return float|null */ - public function getArea_municipal() + public function getArea_municipal(): ?float { return $this->area_municipal; } @@ -977,28 +995,29 @@ public function getArea_municipal() * @param float $area_municipal * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_municipal($area_municipal = null) + public function setArea_municipal(?float $area_municipal = null): self { // validation for constraint: float if (!is_null($area_municipal) && !(is_float($area_municipal) || is_numeric($area_municipal))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_municipal, true), gettype($area_municipal)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_municipal, true), gettype($area_municipal)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_municipal) && mb_strlen(mb_substr($area_municipal, false !== mb_strpos($area_municipal, '.') ? mb_strpos($area_municipal, '.') + 1 : mb_strlen($area_municipal))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_municipal, true), mb_strlen(mb_substr($area_municipal, mb_strpos($area_municipal, '.') + 1))), __LINE__); + if (!is_null($area_municipal) && mb_strlen(mb_substr((string) $area_municipal, false !== mb_strpos((string) $area_municipal, '.') ? mb_strpos((string) $area_municipal, '.') + 1 : mb_strlen((string) $area_municipal))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_municipal, true), mb_strlen(mb_substr((string) $area_municipal, mb_strpos((string) $area_municipal, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_municipal) && mb_strlen(preg_replace('/(\D)/', '', $area_municipal)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_municipal, true), mb_strlen(preg_replace('/(\D)/', '', $area_municipal))), __LINE__); + if (!is_null($area_municipal) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_municipal)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_municipal, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_municipal))), __LINE__); } $this->area_municipal = $area_municipal; + return $this; } /** * Get area_national value * @return float|null */ - public function getArea_national() + public function getArea_national(): ?float { return $this->area_national; } @@ -1007,28 +1026,29 @@ public function getArea_national() * @param float $area_national * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_national($area_national = null) + public function setArea_national(?float $area_national = null): self { // validation for constraint: float if (!is_null($area_national) && !(is_float($area_national) || is_numeric($area_national))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_national, true), gettype($area_national)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_national, true), gettype($area_national)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_national) && mb_strlen(mb_substr($area_national, false !== mb_strpos($area_national, '.') ? mb_strpos($area_national, '.') + 1 : mb_strlen($area_national))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_national, true), mb_strlen(mb_substr($area_national, mb_strpos($area_national, '.') + 1))), __LINE__); + if (!is_null($area_national) && mb_strlen(mb_substr((string) $area_national, false !== mb_strpos((string) $area_national, '.') ? mb_strpos((string) $area_national, '.') + 1 : mb_strlen((string) $area_national))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_national, true), mb_strlen(mb_substr((string) $area_national, mb_strpos((string) $area_national, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_national) && mb_strlen(preg_replace('/(\D)/', '', $area_national)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_national, true), mb_strlen(preg_replace('/(\D)/', '', $area_national))), __LINE__); + if (!is_null($area_national) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_national)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_national, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_national))), __LINE__); } $this->area_national = $area_national; + return $this; } /** * Get area_land value * @return float|null */ - public function getArea_land() + public function getArea_land(): ?float { return $this->area_land; } @@ -1037,28 +1057,29 @@ public function getArea_land() * @param float $area_land * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_land($area_land = null) + public function setArea_land(?float $area_land = null): self { // validation for constraint: float if (!is_null($area_land) && !(is_float($area_land) || is_numeric($area_land))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_land, true), gettype($area_land)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_land, true), gettype($area_land)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_land) && mb_strlen(mb_substr($area_land, false !== mb_strpos($area_land, '.') ? mb_strpos($area_land, '.') + 1 : mb_strlen($area_land))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_land, true), mb_strlen(mb_substr($area_land, mb_strpos($area_land, '.') + 1))), __LINE__); + if (!is_null($area_land) && mb_strlen(mb_substr((string) $area_land, false !== mb_strpos((string) $area_land, '.') ? mb_strpos((string) $area_land, '.') + 1 : mb_strlen((string) $area_land))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_land, true), mb_strlen(mb_substr((string) $area_land, mb_strpos((string) $area_land, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_land) && mb_strlen(preg_replace('/(\D)/', '', $area_land)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_land, true), mb_strlen(preg_replace('/(\D)/', '', $area_land))), __LINE__); + if (!is_null($area_land) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_land)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_land, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_land))), __LINE__); } $this->area_land = $area_land; + return $this; } /** * Get area_territory value * @return float|null */ - public function getArea_territory() + public function getArea_territory(): ?float { return $this->area_territory; } @@ -1067,28 +1088,29 @@ public function getArea_territory() * @param float $area_territory * @return \Api\StructType\ApiHouseProfileData */ - public function setArea_territory($area_territory = null) + public function setArea_territory(?float $area_territory = null): self { // validation for constraint: float if (!is_null($area_territory) && !(is_float($area_territory) || is_numeric($area_territory))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_territory, true), gettype($area_territory)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($area_territory, true), gettype($area_territory)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($area_territory) && mb_strlen(mb_substr($area_territory, false !== mb_strpos($area_territory, '.') ? mb_strpos($area_territory, '.') + 1 : mb_strlen($area_territory))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_territory, true), mb_strlen(mb_substr($area_territory, mb_strpos($area_territory, '.') + 1))), __LINE__); + if (!is_null($area_territory) && mb_strlen(mb_substr((string) $area_territory, false !== mb_strpos((string) $area_territory, '.') ? mb_strpos((string) $area_territory, '.') + 1 : mb_strlen((string) $area_territory))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($area_territory, true), mb_strlen(mb_substr((string) $area_territory, mb_strpos((string) $area_territory, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($area_territory) && mb_strlen(preg_replace('/(\D)/', '', $area_territory)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_territory, true), mb_strlen(preg_replace('/(\D)/', '', $area_territory))), __LINE__); + if (!is_null($area_territory) && mb_strlen(preg_replace('/(\D)/', '', (string) $area_territory)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($area_territory, true), mb_strlen(preg_replace('/(\D)/', '', (string) $area_territory))), __LINE__); } $this->area_territory = $area_territory; + return $this; } /** * Get inventory_number value * @return string|null */ - public function getInventory_number() + public function getInventory_number(): ?string { return $this->inventory_number; } @@ -1097,20 +1119,21 @@ public function getInventory_number() * @param string $inventory_number * @return \Api\StructType\ApiHouseProfileData */ - public function setInventory_number($inventory_number = null) + public function setInventory_number(?string $inventory_number = null): self { // validation for constraint: string if (!is_null($inventory_number) && !is_string($inventory_number)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($inventory_number, true), gettype($inventory_number)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($inventory_number, true), gettype($inventory_number)), __LINE__); } $this->inventory_number = $inventory_number; + return $this; } /** * Get flats_count value * @return int|null */ - public function getFlats_count() + public function getFlats_count(): ?int { return $this->flats_count; } @@ -1119,20 +1142,21 @@ public function getFlats_count() * @param int $flats_count * @return \Api\StructType\ApiHouseProfileData */ - public function setFlats_count($flats_count = null) + public function setFlats_count(?int $flats_count = null): self { // validation for constraint: int if (!is_null($flats_count) && !(is_int($flats_count) || ctype_digit($flats_count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($flats_count, true), gettype($flats_count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($flats_count, true), gettype($flats_count)), __LINE__); } $this->flats_count = $flats_count; + return $this; } /** * Get residents_count value * @return int|null */ - public function getResidents_count() + public function getResidents_count(): ?int { return $this->residents_count; } @@ -1141,20 +1165,21 @@ public function getResidents_count() * @param int $residents_count * @return \Api\StructType\ApiHouseProfileData */ - public function setResidents_count($residents_count = null) + public function setResidents_count(?int $residents_count = null): self { // validation for constraint: int if (!is_null($residents_count) && !(is_int($residents_count) || ctype_digit($residents_count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($residents_count, true), gettype($residents_count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($residents_count, true), gettype($residents_count)), __LINE__); } $this->residents_count = $residents_count; + return $this; } /** * Get accounts_count value * @return int|null */ - public function getAccounts_count() + public function getAccounts_count(): ?int { return $this->accounts_count; } @@ -1163,20 +1188,21 @@ public function getAccounts_count() * @param int $accounts_count * @return \Api\StructType\ApiHouseProfileData */ - public function setAccounts_count($accounts_count = null) + public function setAccounts_count(?int $accounts_count = null): self { // validation for constraint: int if (!is_null($accounts_count) && !(is_int($accounts_count) || ctype_digit($accounts_count))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($accounts_count, true), gettype($accounts_count)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($accounts_count, true), gettype($accounts_count)), __LINE__); } $this->accounts_count = $accounts_count; + return $this; } /** * Get construction_features value * @return string|null */ - public function getConstruction_features() + public function getConstruction_features(): ?string { return $this->construction_features; } @@ -1185,20 +1211,21 @@ public function getConstruction_features() * @param string $construction_features * @return \Api\StructType\ApiHouseProfileData */ - public function setConstruction_features($construction_features = null) + public function setConstruction_features(?string $construction_features = null): self { // validation for constraint: string if (!is_null($construction_features) && !is_string($construction_features)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($construction_features, true), gettype($construction_features)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($construction_features, true), gettype($construction_features)), __LINE__); } $this->construction_features = $construction_features; + return $this; } /** * Get thermal_actual_expense value * @return float|null */ - public function getThermal_actual_expense() + public function getThermal_actual_expense(): ?float { return $this->thermal_actual_expense; } @@ -1207,28 +1234,29 @@ public function getThermal_actual_expense() * @param float $thermal_actual_expense * @return \Api\StructType\ApiHouseProfileData */ - public function setThermal_actual_expense($thermal_actual_expense = null) + public function setThermal_actual_expense(?float $thermal_actual_expense = null): self { // validation for constraint: float if (!is_null($thermal_actual_expense) && !(is_float($thermal_actual_expense) || is_numeric($thermal_actual_expense))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($thermal_actual_expense, true), gettype($thermal_actual_expense)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($thermal_actual_expense, true), gettype($thermal_actual_expense)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($thermal_actual_expense) && mb_strlen(mb_substr($thermal_actual_expense, false !== mb_strpos($thermal_actual_expense, '.') ? mb_strpos($thermal_actual_expense, '.') + 1 : mb_strlen($thermal_actual_expense))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($thermal_actual_expense, true), mb_strlen(mb_substr($thermal_actual_expense, mb_strpos($thermal_actual_expense, '.') + 1))), __LINE__); + if (!is_null($thermal_actual_expense) && mb_strlen(mb_substr((string) $thermal_actual_expense, false !== mb_strpos((string) $thermal_actual_expense, '.') ? mb_strpos((string) $thermal_actual_expense, '.') + 1 : mb_strlen((string) $thermal_actual_expense))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($thermal_actual_expense, true), mb_strlen(mb_substr((string) $thermal_actual_expense, mb_strpos((string) $thermal_actual_expense, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($thermal_actual_expense) && mb_strlen(preg_replace('/(\D)/', '', $thermal_actual_expense)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($thermal_actual_expense, true), mb_strlen(preg_replace('/(\D)/', '', $thermal_actual_expense))), __LINE__); + if (!is_null($thermal_actual_expense) && mb_strlen(preg_replace('/(\D)/', '', (string) $thermal_actual_expense)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($thermal_actual_expense, true), mb_strlen(preg_replace('/(\D)/', '', (string) $thermal_actual_expense))), __LINE__); } $this->thermal_actual_expense = $thermal_actual_expense; + return $this; } /** * Get thermal_normative_expense value * @return float|null */ - public function getThermal_normative_expense() + public function getThermal_normative_expense(): ?float { return $this->thermal_normative_expense; } @@ -1237,28 +1265,29 @@ public function getThermal_normative_expense() * @param float $thermal_normative_expense * @return \Api\StructType\ApiHouseProfileData */ - public function setThermal_normative_expense($thermal_normative_expense = null) + public function setThermal_normative_expense(?float $thermal_normative_expense = null): self { // validation for constraint: float if (!is_null($thermal_normative_expense) && !(is_float($thermal_normative_expense) || is_numeric($thermal_normative_expense))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($thermal_normative_expense, true), gettype($thermal_normative_expense)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($thermal_normative_expense, true), gettype($thermal_normative_expense)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($thermal_normative_expense) && mb_strlen(mb_substr($thermal_normative_expense, false !== mb_strpos($thermal_normative_expense, '.') ? mb_strpos($thermal_normative_expense, '.') + 1 : mb_strlen($thermal_normative_expense))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($thermal_normative_expense, true), mb_strlen(mb_substr($thermal_normative_expense, mb_strpos($thermal_normative_expense, '.') + 1))), __LINE__); + if (!is_null($thermal_normative_expense) && mb_strlen(mb_substr((string) $thermal_normative_expense, false !== mb_strpos((string) $thermal_normative_expense, '.') ? mb_strpos((string) $thermal_normative_expense, '.') + 1 : mb_strlen((string) $thermal_normative_expense))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($thermal_normative_expense, true), mb_strlen(mb_substr((string) $thermal_normative_expense, mb_strpos((string) $thermal_normative_expense, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($thermal_normative_expense) && mb_strlen(preg_replace('/(\D)/', '', $thermal_normative_expense)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($thermal_normative_expense, true), mb_strlen(preg_replace('/(\D)/', '', $thermal_normative_expense))), __LINE__); + if (!is_null($thermal_normative_expense) && mb_strlen(preg_replace('/(\D)/', '', (string) $thermal_normative_expense)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($thermal_normative_expense, true), mb_strlen(preg_replace('/(\D)/', '', (string) $thermal_normative_expense))), __LINE__); } $this->thermal_normative_expense = $thermal_normative_expense; + return $this; } /** * Get energy_efficiency value * @return string|null */ - public function getEnergy_efficiency() + public function getEnergy_efficiency(): ?string { return $this->energy_efficiency; } @@ -1266,24 +1295,25 @@ public function getEnergy_efficiency() * Set energy_efficiency value * @uses \Api\EnumType\ApiHouseEnergyEfficiencyClassEnum::valueIsValid() * @uses \Api\EnumType\ApiHouseEnergyEfficiencyClassEnum::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $energy_efficiency * @return \Api\StructType\ApiHouseProfileData */ - public function setEnergy_efficiency($energy_efficiency = null) + public function setEnergy_efficiency(?string $energy_efficiency = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiHouseEnergyEfficiencyClassEnum::valueIsValid($energy_efficiency)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseEnergyEfficiencyClassEnum', is_array($energy_efficiency) ? implode(', ', $energy_efficiency) : var_export($energy_efficiency, true), implode(', ', \Api\EnumType\ApiHouseEnergyEfficiencyClassEnum::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiHouseEnergyEfficiencyClassEnum', is_array($energy_efficiency) ? implode(', ', $energy_efficiency) : var_export($energy_efficiency, true), implode(', ', \Api\EnumType\ApiHouseEnergyEfficiencyClassEnum::getValidValues())), __LINE__); } $this->energy_efficiency = $energy_efficiency; + return $this; } /** * Get energy_audit_date value * @return string|null */ - public function getEnergy_audit_date() + public function getEnergy_audit_date(): ?string { return $this->energy_audit_date; } @@ -1292,20 +1322,21 @@ public function getEnergy_audit_date() * @param string $energy_audit_date * @return \Api\StructType\ApiHouseProfileData */ - public function setEnergy_audit_date($energy_audit_date = null) + public function setEnergy_audit_date(?string $energy_audit_date = null): self { // validation for constraint: string if (!is_null($energy_audit_date) && !is_string($energy_audit_date)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($energy_audit_date, true), gettype($energy_audit_date)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($energy_audit_date, true), gettype($energy_audit_date)), __LINE__); } $this->energy_audit_date = $energy_audit_date; + return $this; } /** * Get privatization_start_date value * @return string|null */ - public function getPrivatization_start_date() + public function getPrivatization_start_date(): ?string { return $this->privatization_start_date; } @@ -1314,20 +1345,21 @@ public function getPrivatization_start_date() * @param string $privatization_start_date * @return \Api\StructType\ApiHouseProfileData */ - public function setPrivatization_start_date($privatization_start_date = null) + public function setPrivatization_start_date(?string $privatization_start_date = null): self { // validation for constraint: string if (!is_null($privatization_start_date) && !is_string($privatization_start_date)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($privatization_start_date, true), gettype($privatization_start_date)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($privatization_start_date, true), gettype($privatization_start_date)), __LINE__); } $this->privatization_start_date = $privatization_start_date; + return $this; } /** * Get deterioration_total value * @return float|null */ - public function getDeterioration_total() + public function getDeterioration_total(): ?float { return $this->deterioration_total; } @@ -1336,28 +1368,29 @@ public function getDeterioration_total() * @param float $deterioration_total * @return \Api\StructType\ApiHouseProfileData */ - public function setDeterioration_total($deterioration_total = null) + public function setDeterioration_total(?float $deterioration_total = null): self { // validation for constraint: float if (!is_null($deterioration_total) && !(is_float($deterioration_total) || is_numeric($deterioration_total))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_total, true), gettype($deterioration_total)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_total, true), gettype($deterioration_total)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($deterioration_total) && mb_strlen(mb_substr($deterioration_total, false !== mb_strpos($deterioration_total, '.') ? mb_strpos($deterioration_total, '.') + 1 : mb_strlen($deterioration_total))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_total, true), mb_strlen(mb_substr($deterioration_total, mb_strpos($deterioration_total, '.') + 1))), __LINE__); + if (!is_null($deterioration_total) && mb_strlen(mb_substr((string) $deterioration_total, false !== mb_strpos((string) $deterioration_total, '.') ? mb_strpos((string) $deterioration_total, '.') + 1 : mb_strlen((string) $deterioration_total))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_total, true), mb_strlen(mb_substr((string) $deterioration_total, mb_strpos((string) $deterioration_total, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($deterioration_total) && mb_strlen(preg_replace('/(\D)/', '', $deterioration_total)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_total, true), mb_strlen(preg_replace('/(\D)/', '', $deterioration_total))), __LINE__); + if (!is_null($deterioration_total) && mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_total)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_total, true), mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_total))), __LINE__); } $this->deterioration_total = $deterioration_total; + return $this; } /** * Get deterioration_foundation value * @return float|null */ - public function getDeterioration_foundation() + public function getDeterioration_foundation(): ?float { return $this->deterioration_foundation; } @@ -1366,28 +1399,29 @@ public function getDeterioration_foundation() * @param float $deterioration_foundation * @return \Api\StructType\ApiHouseProfileData */ - public function setDeterioration_foundation($deterioration_foundation = null) + public function setDeterioration_foundation(?float $deterioration_foundation = null): self { // validation for constraint: float if (!is_null($deterioration_foundation) && !(is_float($deterioration_foundation) || is_numeric($deterioration_foundation))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_foundation, true), gettype($deterioration_foundation)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_foundation, true), gettype($deterioration_foundation)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($deterioration_foundation) && mb_strlen(mb_substr($deterioration_foundation, false !== mb_strpos($deterioration_foundation, '.') ? mb_strpos($deterioration_foundation, '.') + 1 : mb_strlen($deterioration_foundation))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_foundation, true), mb_strlen(mb_substr($deterioration_foundation, mb_strpos($deterioration_foundation, '.') + 1))), __LINE__); + if (!is_null($deterioration_foundation) && mb_strlen(mb_substr((string) $deterioration_foundation, false !== mb_strpos((string) $deterioration_foundation, '.') ? mb_strpos((string) $deterioration_foundation, '.') + 1 : mb_strlen((string) $deterioration_foundation))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_foundation, true), mb_strlen(mb_substr((string) $deterioration_foundation, mb_strpos((string) $deterioration_foundation, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($deterioration_foundation) && mb_strlen(preg_replace('/(\D)/', '', $deterioration_foundation)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_foundation, true), mb_strlen(preg_replace('/(\D)/', '', $deterioration_foundation))), __LINE__); + if (!is_null($deterioration_foundation) && mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_foundation)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_foundation, true), mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_foundation))), __LINE__); } $this->deterioration_foundation = $deterioration_foundation; + return $this; } /** * Get deterioration_bearing_walls value * @return float|null */ - public function getDeterioration_bearing_walls() + public function getDeterioration_bearing_walls(): ?float { return $this->deterioration_bearing_walls; } @@ -1396,28 +1430,29 @@ public function getDeterioration_bearing_walls() * @param float $deterioration_bearing_walls * @return \Api\StructType\ApiHouseProfileData */ - public function setDeterioration_bearing_walls($deterioration_bearing_walls = null) + public function setDeterioration_bearing_walls(?float $deterioration_bearing_walls = null): self { // validation for constraint: float if (!is_null($deterioration_bearing_walls) && !(is_float($deterioration_bearing_walls) || is_numeric($deterioration_bearing_walls))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_bearing_walls, true), gettype($deterioration_bearing_walls)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_bearing_walls, true), gettype($deterioration_bearing_walls)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($deterioration_bearing_walls) && mb_strlen(mb_substr($deterioration_bearing_walls, false !== mb_strpos($deterioration_bearing_walls, '.') ? mb_strpos($deterioration_bearing_walls, '.') + 1 : mb_strlen($deterioration_bearing_walls))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_bearing_walls, true), mb_strlen(mb_substr($deterioration_bearing_walls, mb_strpos($deterioration_bearing_walls, '.') + 1))), __LINE__); + if (!is_null($deterioration_bearing_walls) && mb_strlen(mb_substr((string) $deterioration_bearing_walls, false !== mb_strpos((string) $deterioration_bearing_walls, '.') ? mb_strpos((string) $deterioration_bearing_walls, '.') + 1 : mb_strlen((string) $deterioration_bearing_walls))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_bearing_walls, true), mb_strlen(mb_substr((string) $deterioration_bearing_walls, mb_strpos((string) $deterioration_bearing_walls, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($deterioration_bearing_walls) && mb_strlen(preg_replace('/(\D)/', '', $deterioration_bearing_walls)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_bearing_walls, true), mb_strlen(preg_replace('/(\D)/', '', $deterioration_bearing_walls))), __LINE__); + if (!is_null($deterioration_bearing_walls) && mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_bearing_walls)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_bearing_walls, true), mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_bearing_walls))), __LINE__); } $this->deterioration_bearing_walls = $deterioration_bearing_walls; + return $this; } /** * Get deterioration_floor value * @return float|null */ - public function getDeterioration_floor() + public function getDeterioration_floor(): ?float { return $this->deterioration_floor; } @@ -1426,28 +1461,29 @@ public function getDeterioration_floor() * @param float $deterioration_floor * @return \Api\StructType\ApiHouseProfileData */ - public function setDeterioration_floor($deterioration_floor = null) + public function setDeterioration_floor(?float $deterioration_floor = null): self { // validation for constraint: float if (!is_null($deterioration_floor) && !(is_float($deterioration_floor) || is_numeric($deterioration_floor))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_floor, true), gettype($deterioration_floor)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($deterioration_floor, true), gettype($deterioration_floor)), __LINE__); } // validation for constraint: fractionDigits(2) - if (!is_null($deterioration_floor) && mb_strlen(mb_substr($deterioration_floor, false !== mb_strpos($deterioration_floor, '.') ? mb_strpos($deterioration_floor, '.') + 1 : mb_strlen($deterioration_floor))) > 2) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_floor, true), mb_strlen(mb_substr($deterioration_floor, mb_strpos($deterioration_floor, '.') + 1))), __LINE__); + if (!is_null($deterioration_floor) && mb_strlen(mb_substr((string) $deterioration_floor, false !== mb_strpos((string) $deterioration_floor, '.') ? mb_strpos((string) $deterioration_floor, '.') + 1 : mb_strlen((string) $deterioration_floor))) > 2) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 2 fraction digits, %d given', var_export($deterioration_floor, true), mb_strlen(mb_substr((string) $deterioration_floor, mb_strpos((string) $deterioration_floor, '.') + 1))), __LINE__); } // validation for constraint: totalDigits(15) - if (!is_null($deterioration_floor) && mb_strlen(preg_replace('/(\D)/', '', $deterioration_floor)) > 15) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_floor, true), mb_strlen(preg_replace('/(\D)/', '', $deterioration_floor))), __LINE__); + if (!is_null($deterioration_floor) && mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_floor)) > 15) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must use at most 15 digits, "%d" given', var_export($deterioration_floor, true), mb_strlen(preg_replace('/(\D)/', '', (string) $deterioration_floor))), __LINE__); } $this->deterioration_floor = $deterioration_floor; + return $this; } /** * Get facade value * @return \Api\StructType\ApiFacade|null */ - public function getFacade() + public function getFacade(): ?\Api\StructType\ApiFacade { return $this->facade; } @@ -1456,16 +1492,17 @@ public function getFacade() * @param \Api\StructType\ApiFacade $facade * @return \Api\StructType\ApiHouseProfileData */ - public function setFacade(\Api\StructType\ApiFacade $facade = null) + public function setFacade(?\Api\StructType\ApiFacade $facade = null): self { $this->facade = $facade; + return $this; } /** * Get roof value * @return \Api\StructType\ApiRoof|null */ - public function getRoof() + public function getRoof(): ?\Api\StructType\ApiRoof { return $this->roof; } @@ -1474,16 +1511,17 @@ public function getRoof() * @param \Api\StructType\ApiRoof $roof * @return \Api\StructType\ApiHouseProfileData */ - public function setRoof(\Api\StructType\ApiRoof $roof = null) + public function setRoof(?\Api\StructType\ApiRoof $roof = null): self { $this->roof = $roof; + return $this; } /** * Get basement value * @return \Api\StructType\ApiBasement|null */ - public function getBasement() + public function getBasement(): ?\Api\StructType\ApiBasement { return $this->basement; } @@ -1492,16 +1530,17 @@ public function getBasement() * @param \Api\StructType\ApiBasement $basement * @return \Api\StructType\ApiHouseProfileData */ - public function setBasement(\Api\StructType\ApiBasement $basement = null) + public function setBasement(?\Api\StructType\ApiBasement $basement = null): self { $this->basement = $basement; + return $this; } /** * Get common_space value * @return \Api\StructType\ApiCommonSpace|null */ - public function getCommon_space() + public function getCommon_space(): ?\Api\StructType\ApiCommonSpace { return $this->common_space; } @@ -1510,16 +1549,17 @@ public function getCommon_space() * @param \Api\StructType\ApiCommonSpace $common_space * @return \Api\StructType\ApiHouseProfileData */ - public function setCommon_space(\Api\StructType\ApiCommonSpace $common_space = null) + public function setCommon_space(?\Api\StructType\ApiCommonSpace $common_space = null): self { $this->common_space = $common_space; + return $this; } /** * Get chute value * @return \Api\StructType\ApiChute|null */ - public function getChute() + public function getChute(): ?\Api\StructType\ApiChute { return $this->chute; } @@ -1528,16 +1568,17 @@ public function getChute() * @param \Api\StructType\ApiChute $chute * @return \Api\StructType\ApiHouseProfileData */ - public function setChute(\Api\StructType\ApiChute $chute = null) + public function setChute(?\Api\StructType\ApiChute $chute = null): self { $this->chute = $chute; + return $this; } /** * Get heating_system value * @return \Api\StructType\ApiHeatingSystem|null */ - public function getHeating_system() + public function getHeating_system(): ?\Api\StructType\ApiHeatingSystem { return $this->heating_system; } @@ -1546,16 +1587,17 @@ public function getHeating_system() * @param \Api\StructType\ApiHeatingSystem $heating_system * @return \Api\StructType\ApiHouseProfileData */ - public function setHeating_system(\Api\StructType\ApiHeatingSystem $heating_system = null) + public function setHeating_system(?\Api\StructType\ApiHeatingSystem $heating_system = null): self { $this->heating_system = $heating_system; + return $this; } /** * Get hot_water_system value * @return \Api\StructType\ApiHotWaterSystem|null */ - public function getHot_water_system() + public function getHot_water_system(): ?\Api\StructType\ApiHotWaterSystem { return $this->hot_water_system; } @@ -1564,16 +1606,17 @@ public function getHot_water_system() * @param \Api\StructType\ApiHotWaterSystem $hot_water_system * @return \Api\StructType\ApiHouseProfileData */ - public function setHot_water_system(\Api\StructType\ApiHotWaterSystem $hot_water_system = null) + public function setHot_water_system(?\Api\StructType\ApiHotWaterSystem $hot_water_system = null): self { $this->hot_water_system = $hot_water_system; + return $this; } /** * Get cold_water_system value * @return \Api\StructType\ApiColdWaterSystem|null */ - public function getCold_water_system() + public function getCold_water_system(): ?\Api\StructType\ApiColdWaterSystem { return $this->cold_water_system; } @@ -1582,16 +1625,17 @@ public function getCold_water_system() * @param \Api\StructType\ApiColdWaterSystem $cold_water_system * @return \Api\StructType\ApiHouseProfileData */ - public function setCold_water_system(\Api\StructType\ApiColdWaterSystem $cold_water_system = null) + public function setCold_water_system(?\Api\StructType\ApiColdWaterSystem $cold_water_system = null): self { $this->cold_water_system = $cold_water_system; + return $this; } /** * Get sewerage_system value * @return \Api\StructType\ApiSewerageSystem|null */ - public function getSewerage_system() + public function getSewerage_system(): ?\Api\StructType\ApiSewerageSystem { return $this->sewerage_system; } @@ -1600,16 +1644,17 @@ public function getSewerage_system() * @param \Api\StructType\ApiSewerageSystem $sewerage_system * @return \Api\StructType\ApiHouseProfileData */ - public function setSewerage_system(\Api\StructType\ApiSewerageSystem $sewerage_system = null) + public function setSewerage_system(?\Api\StructType\ApiSewerageSystem $sewerage_system = null): self { $this->sewerage_system = $sewerage_system; + return $this; } /** * Get electricity_system value * @return \Api\StructType\ApiElectricitySystem|null */ - public function getElectricity_system() + public function getElectricity_system(): ?\Api\StructType\ApiElectricitySystem { return $this->electricity_system; } @@ -1618,16 +1663,17 @@ public function getElectricity_system() * @param \Api\StructType\ApiElectricitySystem $electricity_system * @return \Api\StructType\ApiHouseProfileData */ - public function setElectricity_system(\Api\StructType\ApiElectricitySystem $electricity_system = null) + public function setElectricity_system(?\Api\StructType\ApiElectricitySystem $electricity_system = null): self { $this->electricity_system = $electricity_system; + return $this; } /** * Get gas_system value * @return \Api\StructType\ApiGasSystem|null */ - public function getGas_system() + public function getGas_system(): ?\Api\StructType\ApiGasSystem { return $this->gas_system; } @@ -1636,16 +1682,17 @@ public function getGas_system() * @param \Api\StructType\ApiGasSystem $gas_system * @return \Api\StructType\ApiHouseProfileData */ - public function setGas_system(\Api\StructType\ApiGasSystem $gas_system = null) + public function setGas_system(?\Api\StructType\ApiGasSystem $gas_system = null): self { $this->gas_system = $gas_system; + return $this; } /** * Get lifts value - * @return \Api\StructType\ApiLift[]|null + * @return \Api\StructType\ApiLift[] */ - public function getLifts() + public function getLifts(): array { return $this->lifts; } @@ -1655,7 +1702,7 @@ public function getLifts() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateLiftsForArrayConstraintsFromSetLifts(array $values = array()) + public static function validateLiftsForArrayConstraintsFromSetLifts(array $values = []): string { $message = ''; $invalidValues = []; @@ -1669,43 +1716,46 @@ public static function validateLiftsForArrayConstraintsFromSetLifts(array $value $message = sprintf('The lifts property can only contain items of type \Api\StructType\ApiLift, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set lifts value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiLift[] $lifts * @return \Api\StructType\ApiHouseProfileData */ - public function setLifts(array $lifts = array()) + public function setLifts(array $lifts = []): self { // validation for constraint: array if ('' !== ($liftsArrayErrorMessage = self::validateLiftsForArrayConstraintsFromSetLifts($lifts))) { - throw new \InvalidArgumentException($liftsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($liftsArrayErrorMessage, __LINE__); } $this->lifts = $lifts; + return $this; } /** * Add item to lifts value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiLift $item * @return \Api\StructType\ApiHouseProfileData */ - public function addToLifts(\Api\StructType\ApiLift $item) + public function addToLifts(\Api\StructType\ApiLift $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiLift) { - throw new \InvalidArgumentException(sprintf('The lifts property can only contain items of type \Api\StructType\ApiLift, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The lifts property can only contain items of type \Api\StructType\ApiLift, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->lifts[] = $item; + return $this; } /** * Get management_contract value * @return \Api\StructType\ApiManagementContract|null */ - public function getManagement_contract() + public function getManagement_contract(): ?\Api\StructType\ApiManagementContract { return $this->management_contract; } @@ -1714,16 +1764,17 @@ public function getManagement_contract() * @param \Api\StructType\ApiManagementContract $management_contract * @return \Api\StructType\ApiHouseProfileData */ - public function setManagement_contract(\Api\StructType\ApiManagementContract $management_contract = null) + public function setManagement_contract(?\Api\StructType\ApiManagementContract $management_contract = null): self { $this->management_contract = $management_contract; + return $this; } /** * Get heating_provider value * @return \Api\StructType\ApiProvider|null */ - public function getHeating_provider() + public function getHeating_provider(): ?\Api\StructType\ApiProvider { return $this->heating_provider; } @@ -1732,16 +1783,17 @@ public function getHeating_provider() * @param \Api\StructType\ApiProvider $heating_provider * @return \Api\StructType\ApiHouseProfileData */ - public function setHeating_provider(\Api\StructType\ApiProvider $heating_provider = null) + public function setHeating_provider(?\Api\StructType\ApiProvider $heating_provider = null): self { $this->heating_provider = $heating_provider; + return $this; } /** * Get electricity_provider value * @return \Api\StructType\ApiProvider|null */ - public function getElectricity_provider() + public function getElectricity_provider(): ?\Api\StructType\ApiProvider { return $this->electricity_provider; } @@ -1750,16 +1802,17 @@ public function getElectricity_provider() * @param \Api\StructType\ApiProvider $electricity_provider * @return \Api\StructType\ApiHouseProfileData */ - public function setElectricity_provider(\Api\StructType\ApiProvider $electricity_provider = null) + public function setElectricity_provider(?\Api\StructType\ApiProvider $electricity_provider = null): self { $this->electricity_provider = $electricity_provider; + return $this; } /** * Get gas_provider value * @return \Api\StructType\ApiProvider|null */ - public function getGas_provider() + public function getGas_provider(): ?\Api\StructType\ApiProvider { return $this->gas_provider; } @@ -1768,16 +1821,17 @@ public function getGas_provider() * @param \Api\StructType\ApiProvider $gas_provider * @return \Api\StructType\ApiHouseProfileData */ - public function setGas_provider(\Api\StructType\ApiProvider $gas_provider = null) + public function setGas_provider(?\Api\StructType\ApiProvider $gas_provider = null): self { $this->gas_provider = $gas_provider; + return $this; } /** * Get hot_water_provider value * @return \Api\StructType\ApiProvider|null */ - public function getHot_water_provider() + public function getHot_water_provider(): ?\Api\StructType\ApiProvider { return $this->hot_water_provider; } @@ -1786,16 +1840,17 @@ public function getHot_water_provider() * @param \Api\StructType\ApiProvider $hot_water_provider * @return \Api\StructType\ApiHouseProfileData */ - public function setHot_water_provider(\Api\StructType\ApiProvider $hot_water_provider = null) + public function setHot_water_provider(?\Api\StructType\ApiProvider $hot_water_provider = null): self { $this->hot_water_provider = $hot_water_provider; + return $this; } /** * Get cold_water_provider value * @return \Api\StructType\ApiProvider|null */ - public function getCold_water_provider() + public function getCold_water_provider(): ?\Api\StructType\ApiProvider { return $this->cold_water_provider; } @@ -1804,16 +1859,17 @@ public function getCold_water_provider() * @param \Api\StructType\ApiProvider $cold_water_provider * @return \Api\StructType\ApiHouseProfileData */ - public function setCold_water_provider(\Api\StructType\ApiProvider $cold_water_provider = null) + public function setCold_water_provider(?\Api\StructType\ApiProvider $cold_water_provider = null): self { $this->cold_water_provider = $cold_water_provider; + return $this; } /** * Get drainage_provider value * @return \Api\StructType\ApiProvider|null */ - public function getDrainage_provider() + public function getDrainage_provider(): ?\Api\StructType\ApiProvider { return $this->drainage_provider; } @@ -1822,16 +1878,17 @@ public function getDrainage_provider() * @param \Api\StructType\ApiProvider $drainage_provider * @return \Api\StructType\ApiHouseProfileData */ - public function setDrainage_provider(\Api\StructType\ApiProvider $drainage_provider = null) + public function setDrainage_provider(?\Api\StructType\ApiProvider $drainage_provider = null): self { $this->drainage_provider = $drainage_provider; + return $this; } /** * Get finance value * @return \Api\StructType\ApiFinance|null */ - public function getFinance() + public function getFinance(): ?\Api\StructType\ApiFinance { return $this->finance; } @@ -1840,9 +1897,10 @@ public function getFinance() * @param \Api\StructType\ApiFinance $finance * @return \Api\StructType\ApiHouseProfileData */ - public function setFinance(\Api\StructType\ApiFinance $finance = null) + public function setFinance(?\Api\StructType\ApiFinance $finance = null): self { $this->finance = $finance; + return $this; } } diff --git a/tests/resources/generated/ValidListWithoutPrefix.php b/tests/resources/generated/ValidListWithoutPrefix.php index 62b8353e..c74f520c 100644 --- a/tests/resources/generated/ValidListWithoutPrefix.php +++ b/tests/resources/generated/ValidListWithoutPrefix.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('listPaymentMethods', array( + $this->setResult($resultListPaymentMethods = $this->getSoapClient()->__soapCall('listPaymentMethods', [ $parameters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultListPaymentMethods; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidMyProjectApiSearchProject.php b/tests/resources/generated/ValidMyProjectApiSearchProject.php index c308dd6b..914073e5 100755 --- a/tests/resources/generated/ValidMyProjectApiSearchProject.php +++ b/tests/resources/generated/ValidMyProjectApiSearchProject.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('Search', array( + $this->setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ $parameters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidOmnitureApiService.php b/tests/resources/generated/ValidOmnitureApiService.php index bdf8154b..bdcd8bef 100755 --- a/tests/resources/generated/ValidOmnitureApiService.php +++ b/tests/resources/generated/ValidOmnitureApiService.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('CodeManager.DeleteCodeArchive', array( + $this->setResult($resultCodeManager_DeleteCodeArchive = $this->getSoapClient()->__soapCall('CodeManager.DeleteCodeArchive', [ $archive_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCodeManager_DeleteCodeArchive; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -41,7 +45,6 @@ public function CodeManager_DeleteCodeArchive($archive_id) * - documentation: Generates page code. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $char_set * @param string $code_type @@ -54,17 +57,19 @@ public function CodeManager_DeleteCodeArchive($archive_id) public function CodeManager_GenerateCode($char_set, $code_type, $cookie_domain_periods, $currency_code, $rsid, $secure) { try { - $this->setResult($this->getSoapClient()->__soapCall('CodeManager.GenerateCode', array( + $this->setResult($resultCodeManager_GenerateCode = $this->getSoapClient()->__soapCall('CodeManager.GenerateCode', [ $char_set, $code_type, $cookie_domain_periods, $currency_code, $rsid, $secure, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCodeManager_GenerateCode; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -74,7 +79,6 @@ public function CodeManager_GenerateCode($char_set, $code_type, $cookie_domain_p * - documentation: Returns a list of existing code archives. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $archive_id_list * @param string $binary_encoding @@ -84,14 +88,16 @@ public function CodeManager_GenerateCode($char_set, $code_type, $cookie_domain_p public function CodeManager_GetCodeArchives(array $archive_id_list, $binary_encoding, $populate_code_items) { try { - $this->setResult($this->getSoapClient()->__soapCall('CodeManager.GetCodeArchives', array( + $this->setResult($resultCodeManager_GetCodeArchives = $this->getSoapClient()->__soapCall('CodeManager.GetCodeArchives', [ $archive_id_list, $binary_encoding, $populate_code_items, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCodeManager_GetCodeArchives; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -101,7 +107,6 @@ public function CodeManager_GetCodeArchives(array $archive_id_list, $binary_enco * - documentation: Saves a page code archive. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $archive_description * @param string $archive_id @@ -112,15 +117,17 @@ public function CodeManager_GetCodeArchives(array $archive_id_list, $binary_enco public function CodeManager_SaveCodeArchive($archive_description, $archive_id, $archive_name, array $code) { try { - $this->setResult($this->getSoapClient()->__soapCall('CodeManager.SaveCodeArchive', array( + $this->setResult($resultCodeManager_SaveCodeArchive = $this->getSoapClient()->__soapCall('CodeManager.SaveCodeArchive', [ $archive_description, $archive_id, $archive_name, $code, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCodeManager_SaveCodeArchive; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -130,7 +137,6 @@ public function CodeManager_SaveCodeArchive($archive_description, $archive_id, $ * - documentation: Cancel a pending (queued) action that has yet to be approved. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $qid * @return int|bool @@ -138,12 +144,14 @@ public function CodeManager_SaveCodeArchive($archive_description, $archive_id, $ public function Company_CancelQueueItem($qid) { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.CancelQueueItem', array( + $this->setResult($resultCompany_CancelQueueItem = $this->getSoapClient()->__soapCall('Company.CancelQueueItem', [ $qid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompany_CancelQueueItem; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -153,7 +161,6 @@ public function Company_CancelQueueItem($qid) * - documentation: Downloads a product. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $productType * @return base64Binary|bool @@ -161,12 +168,14 @@ public function Company_CancelQueueItem($qid) public function Company_DownloadProduct($productType) { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.DownloadProduct', array( + $this->setResult($resultCompany_DownloadProduct = $this->getSoapClient()->__soapCall('Company.DownloadProduct', [ $productType, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompany_DownloadProduct; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -176,7 +185,6 @@ public function Company_DownloadProduct($productType) * - documentation: Returns the correct SOAP endpoint to be used for API calls * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $company * @return string|bool @@ -184,12 +192,14 @@ public function Company_DownloadProduct($productType) public function Company_GetEndpoint($company) { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetEndpoint', array( + $this->setResult($resultCompany_GetEndpoint = $this->getSoapClient()->__soapCall('Company.GetEndpoint', [ $company, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompany_GetEndpoint; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -199,17 +209,18 @@ public function Company_GetEndpoint($company) * - documentation: Returns queued items that are pending approval for the requesting company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiQueue_item[]|bool */ public function Company_GetQueue() { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetQueue', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultCompany_GetQueue = $this->getSoapClient()->__soapCall('Company.GetQueue', [], [], [], $this->outputHeaders)); + + return $resultCompany_GetQueue; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -219,7 +230,6 @@ public function Company_GetQueue() * - documentation: Retrieves all report suites associated with your company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rs_types * @param string $sp @@ -228,13 +238,15 @@ public function Company_GetQueue() public function Company_GetReportSuites(array $rs_types, $sp) { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetReportSuites', array( + $this->setResult($resultCompany_GetReportSuites = $this->getSoapClient()->__soapCall('Company.GetReportSuites', [ $rs_types, $sp, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompany_GetReportSuites; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -244,17 +256,18 @@ public function Company_GetReportSuites(array $rs_types, $sp) * - documentation: Returns remaining tokens for a given auth key (note that this call also consumes a token). * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return int|bool */ public function Company_GetTokenCount() { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetTokenCount', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultCompany_GetTokenCount = $this->getSoapClient()->__soapCall('Company.GetTokenCount', [], [], [], $this->outputHeaders)); + + return $resultCompany_GetTokenCount; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -264,17 +277,18 @@ public function Company_GetTokenCount() * - documentation: Returns token usage information (note that this call also consumes a token). * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiToken_usage_container|bool */ public function Company_GetTokenUsage() { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetTokenUsage', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultCompany_GetTokenUsage = $this->getSoapClient()->__soapCall('Company.GetTokenUsage', [], [], [], $this->outputHeaders)); + + return $resultCompany_GetTokenUsage; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -284,7 +298,6 @@ public function Company_GetTokenUsage() * - documentation: Returns the tracking server and namespace for the given report suite * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rsid * @return \Api\StructType\ApiTracking_server_data|bool @@ -292,12 +305,14 @@ public function Company_GetTokenUsage() public function Company_GetTrackingServer($rsid) { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetTrackingServer', array( + $this->setResult($resultCompany_GetTrackingServer = $this->getSoapClient()->__soapCall('Company.GetTrackingServer', [ $rsid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompany_GetTrackingServer; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -307,17 +322,18 @@ public function Company_GetTrackingServer($rsid) * - documentation: Retrieves version access for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return string[]|bool */ public function Company_GetVersionAccess() { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.GetVersionAccess', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultCompany_GetVersionAccess = $this->getSoapClient()->__soapCall('Company.GetVersionAccess', [], [], [], $this->outputHeaders)); + + return $resultCompany_GetVersionAccess; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -327,7 +343,6 @@ public function Company_GetVersionAccess() * - documentation: Resets the token count for the given auth key. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $auth_key * @return int|bool @@ -335,12 +350,14 @@ public function Company_GetVersionAccess() public function Company_ResetTokenCount($auth_key) { try { - $this->setResult($this->getSoapClient()->__soapCall('Company.ResetTokenCount', array( + $this->setResult($resultCompany_ResetTokenCount = $this->getSoapClient()->__soapCall('Company.ResetTokenCount', [ $auth_key, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompany_ResetTokenCount; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -350,7 +367,6 @@ public function Company_ResetTokenCount($auth_key) * - documentation: Retrieves a list of reportlets owned by the given dashboard. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dashboard_id * @param string $dashboard_type @@ -359,13 +375,15 @@ public function Company_ResetTokenCount($auth_key) public function Dashboards_GetDashboardAPI($dashboard_id, $dashboard_type) { try { - $this->setResult($this->getSoapClient()->__soapCall('Dashboards.GetDashboardAPI', array( + $this->setResult($resultDashboards_GetDashboardAPI = $this->getSoapClient()->__soapCall('Dashboards.GetDashboardAPI', [ $dashboard_id, $dashboard_type, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDashboards_GetDashboardAPI; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -375,7 +393,6 @@ public function Dashboards_GetDashboardAPI($dashboard_id, $dashboard_type) * - documentation: Retrieves data for a given reportlet. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $reportlet_id * @return \Api\StructType\ApiReportlet|bool @@ -383,12 +400,14 @@ public function Dashboards_GetDashboardAPI($dashboard_id, $dashboard_type) public function Dashboards_GetReportletDataAPI($reportlet_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Dashboards.GetReportletDataAPI', array( + $this->setResult($resultDashboards_GetReportletDataAPI = $this->getSoapClient()->__soapCall('Dashboards.GetReportletDataAPI', [ $reportlet_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDashboards_GetReportletDataAPI; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -398,7 +417,6 @@ public function Dashboards_GetReportletDataAPI($reportlet_id) * - documentation: Add rows of data to and optionally end a block of data begun by a BeginDataBlock call * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $blockID * @param string $dataSourceID @@ -410,16 +428,18 @@ public function Dashboards_GetReportletDataAPI($reportlet_id) public function DataSource_AppendDataBlock($blockID, $dataSourceID, $endOfBlock, $reportSuiteID, array $rows) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.AppendDataBlock', array( + $this->setResult($resultDataSource_AppendDataBlock = $this->getSoapClient()->__soapCall('DataSource.AppendDataBlock', [ $blockID, $dataSourceID, $endOfBlock, $reportSuiteID, $rows, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_AppendDataBlock; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -429,7 +449,6 @@ public function DataSource_AppendDataBlock($blockID, $dataSourceID, $endOfBlock, * - documentation: Begin and optionally end a block of data to be inserted into the Data Sources processing queue * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $blockName * @param string[] $columnNames @@ -442,17 +461,19 @@ public function DataSource_AppendDataBlock($blockID, $dataSourceID, $endOfBlock, public function DataSource_BeginDataBlock($blockName, array $columnNames, $dataSourceID, $endOfBlock, $reportSuiteID, array $rows) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.BeginDataBlock', array( + $this->setResult($resultDataSource_BeginDataBlock = $this->getSoapClient()->__soapCall('DataSource.BeginDataBlock', [ $blockName, $columnNames, $dataSourceID, $endOfBlock, $reportSuiteID, $rows, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_BeginDataBlock; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -462,7 +483,6 @@ public function DataSource_BeginDataBlock($blockName, array $columnNames, $dataS * - documentation: Deactivates a Data Source. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param string $reportSuiteID @@ -471,13 +491,15 @@ public function DataSource_BeginDataBlock($blockName, array $columnNames, $dataS public function DataSource_Deactivate($dataSourceID, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.Deactivate', array( + $this->setResult($resultDataSource_Deactivate = $this->getSoapClient()->__soapCall('DataSource.Deactivate', [ $dataSourceID, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_Deactivate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -487,7 +509,6 @@ public function DataSource_Deactivate($dataSourceID, $reportSuiteID) * - documentation: Returns array of file ids for a given data source id. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param string $filter @@ -497,14 +518,16 @@ public function DataSource_Deactivate($dataSourceID, $reportSuiteID) public function DataSource_GetFileIDs($dataSourceID, $filter, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.GetFileIDs', array( + $this->setResult($resultDataSource_GetFileIDs = $this->getSoapClient()->__soapCall('DataSource.GetFileIDs', [ $dataSourceID, $filter, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_GetFileIDs; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -514,7 +537,6 @@ public function DataSource_GetFileIDs($dataSourceID, $filter, $reportSuiteID) * - documentation: Returns dataSource file status information. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param string $filter @@ -524,14 +546,16 @@ public function DataSource_GetFileIDs($dataSourceID, $filter, $reportSuiteID) public function DataSource_GetFileInfo($dataSourceID, $filter, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.GetFileInfo', array( + $this->setResult($resultDataSource_GetFileInfo = $this->getSoapClient()->__soapCall('DataSource.GetFileInfo', [ $dataSourceID, $filter, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_GetFileInfo; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -541,7 +565,6 @@ public function DataSource_GetFileInfo($dataSourceID, $filter, $reportSuiteID) * - documentation: Returns dataSource file status information. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceFileID * @param string $reportSuiteID @@ -550,13 +573,15 @@ public function DataSource_GetFileInfo($dataSourceID, $filter, $reportSuiteID) public function DataSource_GetFileStatus($dataSourceFileID, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.GetFileStatus', array( + $this->setResult($resultDataSource_GetFileStatus = $this->getSoapClient()->__soapCall('DataSource.GetFileStatus', [ $dataSourceFileID, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_GetFileStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -566,7 +591,6 @@ public function DataSource_GetFileStatus($dataSourceFileID, $reportSuiteID) * - documentation: Returns a list of data sources that belong to the specified report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $reportSuiteID * @return \Api\StructType\ApiSimpleDataSource[]|bool @@ -574,12 +598,14 @@ public function DataSource_GetFileStatus($dataSourceFileID, $reportSuiteID) public function DataSource_GetIDs($reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.GetIDs', array( + $this->setResult($resultDataSource_GetIDs = $this->getSoapClient()->__soapCall('DataSource.GetIDs', [ $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_GetIDs; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -589,7 +615,6 @@ public function DataSource_GetIDs($reportSuiteID) * - documentation: Returns dataSource file status information. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $filter * @param string $reportSuiteID @@ -598,13 +623,15 @@ public function DataSource_GetIDs($reportSuiteID) public function DataSource_GetInfo($filter, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.GetInfo', array( + $this->setResult($resultDataSource_GetInfo = $this->getSoapClient()->__soapCall('DataSource.GetInfo', [ $filter, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_GetInfo; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -614,7 +641,6 @@ public function DataSource_GetInfo($filter, $reportSuiteID) * - documentation: Processes incomplete visits for a DataSource * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param string $reportSuiteID @@ -623,13 +649,15 @@ public function DataSource_GetInfo($filter, $reportSuiteID) public function DataSource_ProcessIncompleteVisits($dataSourceID, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.ProcessIncompleteVisits', array( + $this->setResult($resultDataSource_ProcessIncompleteVisits = $this->getSoapClient()->__soapCall('DataSource.ProcessIncompleteVisits', [ $dataSourceID, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_ProcessIncompleteVisits; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -639,7 +667,6 @@ public function DataSource_ProcessIncompleteVisits($dataSourceID, $reportSuiteID * - documentation: Sets DataSource file state to processing. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param string $reportSuiteID @@ -648,13 +675,15 @@ public function DataSource_ProcessIncompleteVisits($dataSourceID, $reportSuiteID public function DataSource_Restart($dataSourceID, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.Restart', array( + $this->setResult($resultDataSource_Restart = $this->getSoapClient()->__soapCall('DataSource.Restart', [ $dataSourceID, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_Restart; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -664,7 +693,6 @@ public function DataSource_Restart($dataSourceID, $reportSuiteID) * - documentation: Creates or modifies a Full Data Source. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param \Api\StructType\ApiDs_full_settings $dataSourceSettings @@ -674,14 +702,16 @@ public function DataSource_Restart($dataSourceID, $reportSuiteID) public function DataSource_SetupFull($dataSourceID, \Api\StructType\ApiDs_full_settings $dataSourceSettings, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.SetupFull', array( + $this->setResult($resultDataSource_SetupFull = $this->getSoapClient()->__soapCall('DataSource.SetupFull', [ $dataSourceID, $dataSourceSettings, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_SetupFull; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -691,7 +721,6 @@ public function DataSource_SetupFull($dataSourceID, \Api\StructType\ApiDs_full_s * - documentation: Creates or modifies a Generic Data Source. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param \Api\StructType\ApiDs_generic_settings $dataSourceSettings @@ -702,15 +731,17 @@ public function DataSource_SetupFull($dataSourceID, \Api\StructType\ApiDs_full_s public function DataSource_SetupGeneric($dataSourceID, \Api\StructType\ApiDs_generic_settings $dataSourceSettings, $dataSourceType, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.SetupGeneric', array( + $this->setResult($resultDataSource_SetupGeneric = $this->getSoapClient()->__soapCall('DataSource.SetupGeneric', [ $dataSourceID, $dataSourceSettings, $dataSourceType, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_SetupGeneric; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -720,7 +751,6 @@ public function DataSource_SetupGeneric($dataSourceID, \Api\StructType\ApiDs_gen * - documentation: Creates or modifies a Traffic Data Source. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param \Api\StructType\ApiDs_traffic_settings $dataSourceSettings @@ -730,14 +760,16 @@ public function DataSource_SetupGeneric($dataSourceID, \Api\StructType\ApiDs_gen public function DataSource_SetupTraffic($dataSourceID, \Api\StructType\ApiDs_traffic_settings $dataSourceSettings, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.SetupTraffic', array( + $this->setResult($resultDataSource_SetupTraffic = $this->getSoapClient()->__soapCall('DataSource.SetupTraffic', [ $dataSourceID, $dataSourceSettings, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_SetupTraffic; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -747,7 +779,6 @@ public function DataSource_SetupTraffic($dataSourceID, \Api\StructType\ApiDs_tra * - documentation: Creates or modifies a Webserver Log Data Source. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dataSourceID * @param \Api\StructType\ApiDs_weblog_settings $dataSourceSettings @@ -757,14 +788,16 @@ public function DataSource_SetupTraffic($dataSourceID, \Api\StructType\ApiDs_tra public function DataSource_SetupWebLog($dataSourceID, \Api\StructType\ApiDs_weblog_settings $dataSourceSettings, $reportSuiteID) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataSource.SetupWebLog', array( + $this->setResult($resultDataSource_SetupWebLog = $this->getSoapClient()->__soapCall('DataSource.SetupWebLog', [ $dataSourceID, $dataSourceSettings, $reportSuiteID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataSource_SetupWebLog; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -774,7 +807,6 @@ public function DataSource_SetupWebLog($dataSourceID, \Api\StructType\ApiDs_webl * - documentation: Cancels a Data Warehouse Request. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $request_Id * @return string|bool @@ -782,12 +814,14 @@ public function DataSource_SetupWebLog($dataSourceID, \Api\StructType\ApiDs_webl public function DataWarehouse_CancelRequest($request_Id) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.CancelRequest', array( + $this->setResult($resultDataWarehouse_CancelRequest = $this->getSoapClient()->__soapCall('DataWarehouse.CancelRequest', [ $request_Id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_CancelRequest; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -797,7 +831,6 @@ public function DataWarehouse_CancelRequest($request_Id) * - documentation: Checks the status of a Data Warehouse Request. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $request_Id * @return \Api\StructType\ApiData_warehouse_request|bool @@ -805,12 +838,14 @@ public function DataWarehouse_CancelRequest($request_Id) public function DataWarehouse_CheckRequest($request_Id) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.CheckRequest', array( + $this->setResult($resultDataWarehouse_CheckRequest = $this->getSoapClient()->__soapCall('DataWarehouse.CheckRequest', [ $request_Id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_CheckRequest; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -820,7 +855,6 @@ public function DataWarehouse_CheckRequest($request_Id) * - documentation: Create a new data warehouse segment * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $hidden * @param string $rsid @@ -830,14 +864,16 @@ public function DataWarehouse_CheckRequest($request_Id) public function DataWarehouse_CreateSegment($hidden, $rsid, \Api\StructType\ApiData_warehouse_segment $segment) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.CreateSegment', array( + $this->setResult($resultDataWarehouse_CreateSegment = $this->getSoapClient()->__soapCall('DataWarehouse.CreateSegment', [ $hidden, $rsid, $segment, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_CreateSegment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -847,7 +883,6 @@ public function DataWarehouse_CreateSegment($hidden, $rsid, \Api\StructType\ApiD * - documentation: Obtain content for the given request * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $request_Id * @param string $rsid @@ -857,14 +892,16 @@ public function DataWarehouse_CreateSegment($hidden, $rsid, \Api\StructType\ApiD public function DataWarehouse_GetReportData($request_Id, $rsid, $start_row) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.GetReportData', array( + $this->setResult($resultDataWarehouse_GetReportData = $this->getSoapClient()->__soapCall('DataWarehouse.GetReportData', [ $request_Id, $rsid, $start_row, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_GetReportData; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -874,7 +911,6 @@ public function DataWarehouse_GetReportData($request_Id, $rsid, $start_row) * - documentation: Obtain a description of an existing data warehouse segment * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rsid * @param string $segment @@ -883,13 +919,15 @@ public function DataWarehouse_GetReportData($request_Id, $rsid, $start_row) public function DataWarehouse_GetSegment($rsid, $segment) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.GetSegment', array( + $this->setResult($resultDataWarehouse_GetSegment = $this->getSoapClient()->__soapCall('DataWarehouse.GetSegment', [ $rsid, $segment, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_GetSegment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -899,7 +937,6 @@ public function DataWarehouse_GetSegment($rsid, $segment) * - documentation: Gets available segments. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rsid * @return \Api\StructType\ApiDwsegment[]|bool @@ -907,12 +944,14 @@ public function DataWarehouse_GetSegment($rsid, $segment) public function DataWarehouse_GetSegments($rsid) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.GetSegments', array( + $this->setResult($resultDataWarehouse_GetSegments = $this->getSoapClient()->__soapCall('DataWarehouse.GetSegments', [ $rsid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_GetSegments; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -922,7 +961,6 @@ public function DataWarehouse_GetSegments($rsid) * - documentation: Replace a data warehouse segment of the given id with the given segment. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $id * @param string $rsid @@ -932,14 +970,16 @@ public function DataWarehouse_GetSegments($rsid) public function DataWarehouse_ReplaceSegment($id, $rsid, \Api\StructType\ApiData_warehouse_segment $segment) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.ReplaceSegment', array( + $this->setResult($resultDataWarehouse_ReplaceSegment = $this->getSoapClient()->__soapCall('DataWarehouse.ReplaceSegment', [ $id, $rsid, $segment, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_ReplaceSegment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -949,7 +989,6 @@ public function DataWarehouse_ReplaceSegment($id, $rsid, \Api\StructType\ApiData * - documentation: Creates a Data Warehouse Request. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $breakdown_List * @param string $contact_Name @@ -977,7 +1016,7 @@ public function DataWarehouse_ReplaceSegment($id, $rsid, \Api\StructType\ApiData public function DataWarehouse_Request(array $breakdown_List, $contact_Name, $contact_Phone, $date_From, $date_Granularity, $date_Preset, $date_To, $date_Type, $email_Subject, $email_To, $fTP_Dir, $fTP_Host, $fTP_Password, $fTP_Port, $fTP_UserName, $file_Name, array $metric_List, $report_Description, $report_Name, $segment_Id, $rsid) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.Request', array( + $this->setResult($resultDataWarehouse_Request = $this->getSoapClient()->__soapCall('DataWarehouse.Request', [ $breakdown_List, $contact_Name, $contact_Phone, @@ -999,10 +1038,12 @@ public function DataWarehouse_Request(array $breakdown_List, $contact_Name, $con $report_Name, $segment_Id, $rsid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_Request; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1012,7 +1053,6 @@ public function DataWarehouse_Request(array $breakdown_List, $contact_Name, $con * - documentation: Verify the correctness of the given data warehouse segment * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiData_warehouse_segment $segment * @return boolean|bool @@ -1020,12 +1060,14 @@ public function DataWarehouse_Request(array $breakdown_List, $contact_Name, $con public function DataWarehouse_VerifySegment(\Api\StructType\ApiData_warehouse_segment $segment) { try { - $this->setResult($this->getSoapClient()->__soapCall('DataWarehouse.VerifySegment', array( + $this->setResult($resultDataWarehouse_VerifySegment = $this->getSoapClient()->__soapCall('DataWarehouse.VerifySegment', [ $segment, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDataWarehouse_VerifySegment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1035,7 +1077,6 @@ public function DataWarehouse_VerifySegment(\Api\StructType\ApiData_warehouse_se * - documentation: Delete a distribution list. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $dist_list_id * @return int|bool @@ -1043,12 +1084,14 @@ public function DataWarehouse_VerifySegment(\Api\StructType\ApiData_warehouse_se public function DeliveryList_Delete($dist_list_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('DeliveryList.Delete', array( + $this->setResult($resultDeliveryList_Delete = $this->getSoapClient()->__soapCall('DeliveryList.Delete', [ $dist_list_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDeliveryList_Delete; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1058,7 +1101,6 @@ public function DeliveryList_Delete($dist_list_id) * - documentation: Gets Publishing list. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $search_name * @return \Api\StructType\ApiPublishingList[]|bool @@ -1066,12 +1108,14 @@ public function DeliveryList_Delete($dist_list_id) public function DeliveryList_Get($search_name) { try { - $this->setResult($this->getSoapClient()->__soapCall('DeliveryList.Get', array( + $this->setResult($resultDeliveryList_Get = $this->getSoapClient()->__soapCall('DeliveryList.Get', [ $search_name, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDeliveryList_Get; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1081,7 +1125,6 @@ public function DeliveryList_Get($search_name) * - documentation: Save delivery list. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $delivery_list_name * @param string $dist_list_id @@ -1090,13 +1133,15 @@ public function DeliveryList_Get($search_name) public function DeliveryList_Save($delivery_list_name, $dist_list_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('DeliveryList.Save', array( + $this->setResult($resultDeliveryList_Save = $this->getSoapClient()->__soapCall('DeliveryList.Save', [ $delivery_list_name, $dist_list_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDeliveryList_Save; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1106,7 +1151,6 @@ public function DeliveryList_Save($delivery_list_name, $dist_list_id) * - documentation: Retrieve a list of Discover segments for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $end_date * @param string $rsid @@ -1116,14 +1160,16 @@ public function DeliveryList_Save($delivery_list_name, $dist_list_id) public function Discover_GetSegments($end_date, $rsid, $start_date) { try { - $this->setResult($this->getSoapClient()->__soapCall('Discover.GetSegments', array( + $this->setResult($resultDiscover_GetSegments = $this->getSoapClient()->__soapCall('Discover.GetSegments', [ $end_date, $rsid, $start_date, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDiscover_GetSegments; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1133,7 +1179,6 @@ public function Discover_GetSegments($end_date, $rsid, $start_date) * - documentation: Queue a Discover overtime report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -1141,12 +1186,14 @@ public function Discover_GetSegments($end_date, $rsid, $start_date) public function Discover_QueueDiscoverOvertime(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Discover.QueueDiscoverOvertime', array( + $this->setResult($resultDiscover_QueueDiscoverOvertime = $this->getSoapClient()->__soapCall('Discover.QueueDiscoverOvertime', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDiscover_QueueDiscoverOvertime; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1156,7 +1203,6 @@ public function Discover_QueueDiscoverOvertime(\Api\StructType\ApiReportDescript * - documentation: Queue a Discover ranked report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -1164,12 +1210,14 @@ public function Discover_QueueDiscoverOvertime(\Api\StructType\ApiReportDescript public function Discover_QueueDiscoverRanked(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Discover.QueueDiscoverRanked', array( + $this->setResult($resultDiscover_QueueDiscoverRanked = $this->getSoapClient()->__soapCall('Discover.QueueDiscoverRanked', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDiscover_QueueDiscoverRanked; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1179,7 +1227,6 @@ public function Discover_QueueDiscoverRanked(\Api\StructType\ApiReportDescriptio * - documentation: Queue a Discover trended report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -1187,12 +1234,14 @@ public function Discover_QueueDiscoverRanked(\Api\StructType\ApiReportDescriptio public function Discover_QueueDiscoverTrended(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Discover.QueueDiscoverTrended', array( + $this->setResult($resultDiscover_QueueDiscoverTrended = $this->getSoapClient()->__soapCall('Discover.QueueDiscoverTrended', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDiscover_QueueDiscoverTrended; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1202,7 +1251,6 @@ public function Discover_QueueDiscoverTrended(\Api\StructType\ApiReportDescripti * - documentation: Get console logs. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $company * @param string $end_date @@ -1215,17 +1263,19 @@ public function Discover_QueueDiscoverTrended(\Api\StructType\ApiReportDescripti public function Logs_GetAdminConsoleCompanyLog($company, $end_date, $filter_rule, array $filters, array $rsid_list, $start_date) { try { - $this->setResult($this->getSoapClient()->__soapCall('Logs.GetAdminConsoleCompanyLog', array( + $this->setResult($resultLogs_GetAdminConsoleCompanyLog = $this->getSoapClient()->__soapCall('Logs.GetAdminConsoleCompanyLog', [ $company, $end_date, $filter_rule, $filters, $rsid_list, $start_date, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultLogs_GetAdminConsoleCompanyLog; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1235,7 +1285,6 @@ public function Logs_GetAdminConsoleCompanyLog($company, $end_date, $filter_rule * - documentation: Get console logs. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $company * @param string $end_date @@ -1248,17 +1297,19 @@ public function Logs_GetAdminConsoleCompanyLog($company, $end_date, $filter_rule public function Logs_GetAdminConsoleLog($company, $end_date, $filter_rule, array $filters, array $rsid_list, $start_date) { try { - $this->setResult($this->getSoapClient()->__soapCall('Logs.GetAdminConsoleLog', array( + $this->setResult($resultLogs_GetAdminConsoleLog = $this->getSoapClient()->__soapCall('Logs.GetAdminConsoleLog', [ $company, $end_date, $filter_rule, $filters, $rsid_list, $start_date, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultLogs_GetAdminConsoleLog; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1268,7 +1319,6 @@ public function Logs_GetAdminConsoleLog($company, $end_date, $filter_rule, array * - documentation: Retrieve usage log information for the given company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $date_from * @param string $date_to @@ -1282,7 +1332,7 @@ public function Logs_GetAdminConsoleLog($company, $end_date, $filter_rule, array public function Logs_GetUsageLog($date_from, $date_to, $event_details, $event_type, $ip, $login, $report_suite) { try { - $this->setResult($this->getSoapClient()->__soapCall('Logs.GetUsageLog', array( + $this->setResult($resultLogs_GetUsageLog = $this->getSoapClient()->__soapCall('Logs.GetUsageLog', [ $date_from, $date_to, $event_details, @@ -1290,10 +1340,12 @@ public function Logs_GetUsageLog($date_from, $date_to, $event_details, $event_ty $ip, $login, $report_suite, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultLogs_GetUsageLog; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1303,7 +1355,6 @@ public function Logs_GetUsageLog($date_from, $date_to, $event_details, $event_ty * - documentation: Creates a new login for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $admin * @param string $change_password @@ -1325,7 +1376,7 @@ public function Logs_GetUsageLog($date_from, $date_to, $event_details, $event_ty public function Permissions_AddLogin($admin, $change_password, $create_dashboards, $dashboard_rsid, $email, $first_name, $last_name, $login, $password, $phone_number, array $selected_group_list, $temp_login, $temp_login_end, $temp_login_start, $title) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.AddLogin', array( + $this->setResult($resultPermissions_AddLogin = $this->getSoapClient()->__soapCall('Permissions.AddLogin', [ $admin, $change_password, $create_dashboards, @@ -1341,10 +1392,12 @@ public function Permissions_AddLogin($admin, $change_password, $create_dashboard $temp_login_end, $temp_login_start, $title, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_AddLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1354,7 +1407,6 @@ public function Permissions_AddLogin($admin, $change_password, $create_dashboard * - documentation: Indicates whether or not the login is valid for this company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $login * @param string $password @@ -1363,13 +1415,15 @@ public function Permissions_AddLogin($admin, $change_password, $create_dashboard public function Permissions_Authenticate($login, $password) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.Authenticate', array( + $this->setResult($resultPermissions_Authenticate = $this->getSoapClient()->__soapCall('Permissions.Authenticate', [ $login, $password, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_Authenticate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1379,7 +1433,6 @@ public function Permissions_Authenticate($login, $password) * - documentation: Removes the requested group from the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $groupid * @return int|bool @@ -1387,12 +1440,14 @@ public function Permissions_Authenticate($login, $password) public function Permissions_DeleteGroup($groupid) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.DeleteGroup', array( + $this->setResult($resultPermissions_DeleteGroup = $this->getSoapClient()->__soapCall('Permissions.DeleteGroup', [ $groupid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_DeleteGroup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1402,7 +1457,6 @@ public function Permissions_DeleteGroup($groupid) * - documentation: Removes a user login from the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $login * @return int|bool @@ -1410,12 +1464,14 @@ public function Permissions_DeleteGroup($groupid) public function Permissions_DeleteLogin($login) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.DeleteLogin', array( + $this->setResult($resultPermissions_DeleteLogin = $this->getSoapClient()->__soapCall('Permissions.DeleteLogin', [ $login, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_DeleteLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1425,7 +1481,6 @@ public function Permissions_DeleteLogin($login) * - documentation: Retrieves CRM login information for a specific user. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $company * @param string $login @@ -1434,13 +1489,15 @@ public function Permissions_DeleteLogin($login) public function Permissions_GetCRMInfo($company, $login) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetCRMInfo', array( + $this->setResult($resultPermissions_GetCRMInfo = $this->getSoapClient()->__soapCall('Permissions.GetCRMInfo', [ $company, $login, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetCRMInfo; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1450,7 +1507,6 @@ public function Permissions_GetCRMInfo($company, $login) * - documentation: Retrieves subgroups for a category. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $categoryid * @param string $groupid @@ -1459,13 +1515,15 @@ public function Permissions_GetCRMInfo($company, $login) public function Permissions_GetCategories($categoryid, $groupid) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetCategories', array( + $this->setResult($resultPermissions_GetCategories = $this->getSoapClient()->__soapCall('Permissions.GetCategories', [ $categoryid, $groupid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetCategories; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1475,7 +1533,6 @@ public function Permissions_GetCategories($categoryid, $groupid) * - documentation: Retrieves information about a particular group. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $group_type * @param string $groupid @@ -1484,13 +1541,15 @@ public function Permissions_GetCategories($categoryid, $groupid) public function Permissions_GetGroup($group_type, $groupid) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetGroup', array( + $this->setResult($resultPermissions_GetGroup = $this->getSoapClient()->__soapCall('Permissions.GetGroup', [ $group_type, $groupid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetGroup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1500,7 +1559,6 @@ public function Permissions_GetGroup($group_type, $groupid) * - documentation: Retrieves all available groups for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $field * @param string $search @@ -1509,13 +1567,15 @@ public function Permissions_GetGroup($group_type, $groupid) public function Permissions_GetGroups($field, $search) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetGroups', array( + $this->setResult($resultPermissions_GetGroups = $this->getSoapClient()->__soapCall('Permissions.GetGroups', [ $field, $search, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetGroups; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1525,7 +1585,6 @@ public function Permissions_GetGroups($field, $search) * - documentation: Retrieves a user login for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $login * @return \Api\StructType\ApiLogin|bool @@ -1533,12 +1592,14 @@ public function Permissions_GetGroups($field, $search) public function Permissions_GetLogin($login) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetLogin', array( + $this->setResult($resultPermissions_GetLogin = $this->getSoapClient()->__soapCall('Permissions.GetLogin', [ $login, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1548,7 +1609,6 @@ public function Permissions_GetLogin($login) * - documentation: Retrieves user logins for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $login_search_field * @param string $login_search_value @@ -1557,13 +1617,15 @@ public function Permissions_GetLogin($login) public function Permissions_GetLogins($login_search_field, $login_search_value) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetLogins', array( + $this->setResult($resultPermissions_GetLogins = $this->getSoapClient()->__soapCall('Permissions.GetLogins', [ $login_search_field, $login_search_value, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetLogins; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1573,7 +1635,6 @@ public function Permissions_GetLogins($login_search_field, $login_search_value) * - documentation: ReportBuilder login (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $locale * @return \Api\StructType\ApiReportBuilderLogin|bool @@ -1581,12 +1642,14 @@ public function Permissions_GetLogins($login_search_field, $login_search_value) public function Permissions_GetReportBuilderLogin($locale) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetReportBuilderLogin', array( + $this->setResult($resultPermissions_GetReportBuilderLogin = $this->getSoapClient()->__soapCall('Permissions.GetReportBuilderLogin', [ $locale, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetReportBuilderLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1597,7 +1660,6 @@ public function Permissions_GetReportBuilderLogin($locale) * - documentation: Retrieves all available accounts for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $search_field * @param string $search_val @@ -1606,13 +1668,15 @@ public function Permissions_GetReportBuilderLogin($locale) public function Permissions_GetReportSuiteGroupCount($search_field, $search_val) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetReportSuiteGroupCount', array( + $this->setResult($resultPermissions_GetReportSuiteGroupCount = $this->getSoapClient()->__soapCall('Permissions.GetReportSuiteGroupCount', [ $search_field, $search_val, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetReportSuiteGroupCount; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1622,7 +1686,6 @@ public function Permissions_GetReportSuiteGroupCount($search_field, $search_val) * - documentation: Returns the groups that this report suite is a part of. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rsid * @return \Api\StructType\ApiPermissions_account_groups|bool @@ -1630,12 +1693,14 @@ public function Permissions_GetReportSuiteGroupCount($search_field, $search_val) public function Permissions_GetReportSuiteGroups($rsid) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.GetReportSuiteGroups', array( + $this->setResult($resultPermissions_GetReportSuiteGroups = $this->getSoapClient()->__soapCall('Permissions.GetReportSuiteGroups', [ $rsid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_GetReportSuiteGroups; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1645,7 +1710,6 @@ public function Permissions_GetReportSuiteGroups($rsid) * - documentation: Determines if the current user has the given privilegeToken * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $privilegeToken * @return string|bool @@ -1653,12 +1717,14 @@ public function Permissions_GetReportSuiteGroups($rsid) public function Permissions_HasPrivilege($privilegeToken) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.HasPrivilege', array( + $this->setResult($resultPermissions_HasPrivilege = $this->getSoapClient()->__soapCall('Permissions.HasPrivilege', [ $privilegeToken, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_HasPrivilege; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1668,7 +1734,6 @@ public function Permissions_HasPrivilege($privilegeToken) * - documentation: Saves group setting - if the group does not exist it creates a new one. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $group_description * @param string $group_name @@ -1684,7 +1749,7 @@ public function Permissions_HasPrivilege($privilegeToken) public function Permissions_SaveGroup($group_description, $group_name, $group_type, $groupid, array $perm_info, \Api\StructType\ApiReport_categories $report_access_list, array $report_id_list, array $rsid_list, array $user_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.SaveGroup', array( + $this->setResult($resultPermissions_SaveGroup = $this->getSoapClient()->__soapCall('Permissions.SaveGroup', [ $group_description, $group_name, $group_type, @@ -1694,10 +1759,12 @@ public function Permissions_SaveGroup($group_description, $group_name, $group_ty $report_id_list, $rsid_list, $user_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_SaveGroup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1707,7 +1774,6 @@ public function Permissions_SaveGroup($group_description, $group_name, $group_ty * - documentation: Saves the login for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $admin * @param string $change_password @@ -1728,7 +1794,7 @@ public function Permissions_SaveGroup($group_description, $group_name, $group_ty public function Permissions_SaveLogin($admin, $change_password, $email, $first_name, $last_name, $login, $password, $phone_number, array $selected_group_list, $send_welcome_email, $temp_end_date, $temp_login, $temp_start_date, $title) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.SaveLogin', array( + $this->setResult($resultPermissions_SaveLogin = $this->getSoapClient()->__soapCall('Permissions.SaveLogin', [ $admin, $change_password, $email, @@ -1743,10 +1809,12 @@ public function Permissions_SaveLogin($admin, $change_password, $email, $first_n $temp_login, $temp_start_date, $title, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_SaveLogin; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1756,7 +1824,6 @@ public function Permissions_SaveLogin($admin, $change_password, $email, $first_n * - documentation: Assigns the provided groups to the indicated report suite ID. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rsid * @param int[] $selected_groups @@ -1765,13 +1832,15 @@ public function Permissions_SaveLogin($admin, $change_password, $email, $first_n public function Permissions_SaveReportSuiteGroups($rsid, array $selected_groups) { try { - $this->setResult($this->getSoapClient()->__soapCall('Permissions.SaveReportSuiteGroups', array( + $this->setResult($resultPermissions_SaveReportSuiteGroups = $this->getSoapClient()->__soapCall('Permissions.SaveReportSuiteGroups', [ $rsid, $selected_groups, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultPermissions_SaveReportSuiteGroups; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1781,7 +1850,6 @@ public function Permissions_SaveReportSuiteGroups($rsid, array $selected_groups) * - documentation: Cancel a report request. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $reportID * @return int|bool @@ -1789,12 +1857,14 @@ public function Permissions_SaveReportSuiteGroups($rsid, array $selected_groups) public function Report_CancelReport($reportID) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.CancelReport', array( + $this->setResult($resultReport_CancelReport = $this->getSoapClient()->__soapCall('Report.CancelReport', [ $reportID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_CancelReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1804,7 +1874,6 @@ public function Report_CancelReport($reportID) * - documentation: Retrieve element names * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReport_element_mapping[]|bool @@ -1812,12 +1881,14 @@ public function Report_CancelReport($reportID) public function Report_GetElementNames(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetElementNames', array( + $this->setResult($resultReport_GetElementNames = $this->getSoapClient()->__soapCall('Report.GetElementNames', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_GetElementNames; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1827,7 +1898,6 @@ public function Report_GetElementNames(\Api\StructType\ApiReportDescription $rep * - documentation: Runs an overtime report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportResponse|bool @@ -1835,12 +1905,14 @@ public function Report_GetElementNames(\Api\StructType\ApiReportDescription $rep public function Report_GetOvertimeReport(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetOvertimeReport', array( + $this->setResult($resultReport_GetOvertimeReport = $this->getSoapClient()->__soapCall('Report.GetOvertimeReport', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_GetOvertimeReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1850,7 +1922,6 @@ public function Report_GetOvertimeReport(\Api\StructType\ApiReportDescription $r * - documentation: Runs a ranked report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportResponse|bool @@ -1858,12 +1929,14 @@ public function Report_GetOvertimeReport(\Api\StructType\ApiReportDescription $r public function Report_GetRankedReport(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetRankedReport', array( + $this->setResult($resultReport_GetRankedReport = $this->getSoapClient()->__soapCall('Report.GetRankedReport', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_GetRankedReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1873,7 +1946,6 @@ public function Report_GetRankedReport(\Api\StructType\ApiReportDescription $rep * - documentation: Get status and data for a queued report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $reportID * @return \Api\StructType\ApiReportResponse|bool @@ -1881,12 +1953,14 @@ public function Report_GetRankedReport(\Api\StructType\ApiReportDescription $rep public function Report_GetReport($reportID) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetReport', array( + $this->setResult($resultReport_GetReport = $this->getSoapClient()->__soapCall('Report.GetReport', [ $reportID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_GetReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1896,17 +1970,18 @@ public function Report_GetReport($reportID) * - documentation: Retrieve the report queue for a given company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiReport_queue_item[]|bool */ public function Report_GetReportQueue() { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetReportQueue', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultReport_GetReportQueue = $this->getSoapClient()->__soapCall('Report.GetReportQueue', [], [], [], $this->outputHeaders)); + + return $resultReport_GetReportQueue; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1916,7 +1991,6 @@ public function Report_GetReportQueue() * - documentation: Get status for a queued report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $reportID * @return \Api\StructType\ApiReport_status|bool @@ -1924,12 +1998,14 @@ public function Report_GetReportQueue() public function Report_GetStatus($reportID) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetStatus', array( + $this->setResult($resultReport_GetStatus = $this->getSoapClient()->__soapCall('Report.GetStatus', [ $reportID, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_GetStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1939,7 +2015,6 @@ public function Report_GetStatus($reportID) * - documentation: Runs a trended report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportResponse|bool @@ -1947,12 +2022,14 @@ public function Report_GetStatus($reportID) public function Report_GetTrendedReport(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.GetTrendedReport', array( + $this->setResult($resultReport_GetTrendedReport = $this->getSoapClient()->__soapCall('Report.GetTrendedReport', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_GetTrendedReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1962,7 +2039,6 @@ public function Report_GetTrendedReport(\Api\StructType\ApiReportDescription $re * - documentation: Queue an overtime report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -1970,12 +2046,14 @@ public function Report_GetTrendedReport(\Api\StructType\ApiReportDescription $re public function Report_QueueOvertime(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.QueueOvertime', array( + $this->setResult($resultReport_QueueOvertime = $this->getSoapClient()->__soapCall('Report.QueueOvertime', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_QueueOvertime; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1985,7 +2063,6 @@ public function Report_QueueOvertime(\Api\StructType\ApiReportDescription $repor * - documentation: Queue an ranked report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -1993,12 +2070,14 @@ public function Report_QueueOvertime(\Api\StructType\ApiReportDescription $repor public function Report_QueueRanked(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.QueueRanked', array( + $this->setResult($resultReport_QueueRanked = $this->getSoapClient()->__soapCall('Report.QueueRanked', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_QueueRanked; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2008,7 +2087,6 @@ public function Report_QueueRanked(\Api\StructType\ApiReportDescription $reportD * - documentation: Queue a ranked report that is optimized for SearchCenter classifications. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSCM_reportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -2016,12 +2094,14 @@ public function Report_QueueRanked(\Api\StructType\ApiReportDescription $reportD public function Report_QueueSCMRanked(\Api\StructType\ApiSCM_reportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.QueueSCMRanked', array( + $this->setResult($resultReport_QueueSCMRanked = $this->getSoapClient()->__soapCall('Report.QueueSCMRanked', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_QueueSCMRanked; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2031,7 +2111,6 @@ public function Report_QueueSCMRanked(\Api\StructType\ApiSCM_reportDescription $ * - documentation: Queue an trended report. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReportDescription $reportDescription * @return \Api\StructType\ApiReportQueueResponse|bool @@ -2039,12 +2118,14 @@ public function Report_QueueSCMRanked(\Api\StructType\ApiSCM_reportDescription $ public function Report_QueueTrended(\Api\StructType\ApiReportDescription $reportDescription) { try { - $this->setResult($this->getSoapClient()->__soapCall('Report.QueueTrended', array( + $this->setResult($resultReport_QueueTrended = $this->getSoapClient()->__soapCall('Report.QueueTrended', [ $reportDescription, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReport_QueueTrended; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2054,7 +2135,6 @@ public function Report_QueueTrended(\Api\StructType\ApiReportDescription $report * - documentation: Saves the given correlation for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $rel_ids * @param string[] $rsid_list @@ -2064,14 +2144,16 @@ public function Report_QueueTrended(\Api\StructType\ApiReportDescription $report public function ReportSuite_AddCorrelations(array $rel_ids, array $rsid_list, $size) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.AddCorrelations', array( + $this->setResult($resultReportSuite_AddCorrelations = $this->getSoapClient()->__soapCall('ReportSuite.AddCorrelations', [ $rel_ids, $rsid_list, $size, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_AddCorrelations; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2081,7 +2163,6 @@ public function ReportSuite_AddCorrelations(array $rel_ids, array $rsid_list, $s * - documentation: Adds the internal URL filters for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $filters * @param string[] $rsid_list @@ -2090,13 +2171,15 @@ public function ReportSuite_AddCorrelations(array $rel_ids, array $rsid_list, $s public function ReportSuite_AddInternalURLFilters(array $filters, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.AddInternalURLFilters', array( + $this->setResult($resultReportSuite_AddInternalURLFilters = $this->getSoapClient()->__soapCall('ReportSuite.AddInternalURLFilters', [ $filters, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_AddInternalURLFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2106,7 +2189,6 @@ public function ReportSuite_AddInternalURLFilters(array $filters, array $rsid_li * - documentation: Adds a key visitors for the selected report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $key_visitors * @param string[] $rsid_list @@ -2115,13 +2197,15 @@ public function ReportSuite_AddInternalURLFilters(array $filters, array $rsid_li public function ReportSuite_AddKeyVisitors(array $key_visitors, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.AddKeyVisitors', array( + $this->setResult($resultReportSuite_AddKeyVisitors = $this->getSoapClient()->__soapCall('ReportSuite.AddKeyVisitors', [ $key_visitors, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_AddKeyVisitors; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2131,7 +2215,6 @@ public function ReportSuite_AddKeyVisitors(array $key_visitors, array $rsid_list * - documentation: Saves filter. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSaved_filter[] $savedFilters * @return \Api\StructType\ApiSaved_filter[]|bool @@ -2139,12 +2222,14 @@ public function ReportSuite_AddKeyVisitors(array $key_visitors, array $rsid_list public function ReportSuite_AddSavedFilters(array $savedFilters) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.AddSavedFilters', array( + $this->setResult($resultReportSuite_AddSavedFilters = $this->getSoapClient()->__soapCall('ReportSuite.AddSavedFilters', [ $savedFilters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_AddSavedFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2154,7 +2239,6 @@ public function ReportSuite_AddSavedFilters(array $savedFilters) * - documentation: Creates a new report suite with the values specified * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $base_currency * @param string $base_url @@ -2171,7 +2255,7 @@ public function ReportSuite_AddSavedFilters(array $savedFilters) public function ReportSuite_Create($base_currency, $base_url, $default_page, $duplicate_rsid, $go_live_date, $hits_per_day, $latin1, $rsid, $site_title, $time_zone) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.Create', array( + $this->setResult($resultReportSuite_Create = $this->getSoapClient()->__soapCall('ReportSuite.Create', [ $base_currency, $base_url, $default_page, @@ -2182,10 +2266,12 @@ public function ReportSuite_Create($base_currency, $base_url, $default_page, $du $rsid, $site_title, $time_zone, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_Create; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2195,7 +2281,6 @@ public function ReportSuite_Create($base_currency, $base_url, $default_page, $du * - documentation: Deletes the base URL for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return int|bool @@ -2203,12 +2288,14 @@ public function ReportSuite_Create($base_currency, $base_url, $default_page, $du public function ReportSuite_DeleteBaseURL(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteBaseURL', array( + $this->setResult($resultReportSuite_DeleteBaseURL = $this->getSoapClient()->__soapCall('ReportSuite.DeleteBaseURL', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteBaseURL; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2219,7 +2306,6 @@ public function ReportSuite_DeleteBaseURL(array $rsid_list) * - documentation: Deletes a calculated metric for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCalculated_metric[] $calculated_metrics * @param string[] $rsid_list @@ -2228,13 +2314,15 @@ public function ReportSuite_DeleteBaseURL(array $rsid_list) public function ReportSuite_DeleteCalculatedMetrics(array $calculated_metrics, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteCalculatedMetrics', array( + $this->setResult($resultReportSuite_DeleteCalculatedMetrics = $this->getSoapClient()->__soapCall('ReportSuite.DeleteCalculatedMetrics', [ $calculated_metrics, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteCalculatedMetrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2244,7 +2332,6 @@ public function ReportSuite_DeleteCalculatedMetrics(array $calculated_metrics, a * - documentation: Deletes a classification for one report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $c_view * @param string $div_num @@ -2255,15 +2342,17 @@ public function ReportSuite_DeleteCalculatedMetrics(array $calculated_metrics, a public function ReportSuite_DeleteClassifications($c_view, $div_num, $parent_div_num, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteClassifications', array( + $this->setResult($resultReportSuite_DeleteClassifications = $this->getSoapClient()->__soapCall('ReportSuite.DeleteClassifications', [ $c_view, $div_num, $parent_div_num, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteClassifications; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2273,7 +2362,6 @@ public function ReportSuite_DeleteClassifications($c_view, $div_num, $parent_div * - documentation: Deletes the specified data correlations * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $rel_ids * @param string[] $rsid_list @@ -2283,14 +2371,16 @@ public function ReportSuite_DeleteClassifications($c_view, $div_num, $parent_div public function ReportSuite_DeleteCorrelations(array $rel_ids, array $rsid_list, $size) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteCorrelations', array( + $this->setResult($resultReportSuite_DeleteCorrelations = $this->getSoapClient()->__soapCall('ReportSuite.DeleteCorrelations', [ $rel_ids, $rsid_list, $size, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteCorrelations; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2300,7 +2390,6 @@ public function ReportSuite_DeleteCorrelations(array $rel_ids, array $rsid_list, * - documentation: Deletes the default page for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return int|bool @@ -2308,12 +2397,14 @@ public function ReportSuite_DeleteCorrelations(array $rel_ids, array $rsid_list, public function ReportSuite_DeleteDefaultPage(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteDefaultPage', array( + $this->setResult($resultReportSuite_DeleteDefaultPage = $this->getSoapClient()->__soapCall('ReportSuite.DeleteDefaultPage', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteDefaultPage; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2324,7 +2415,6 @@ public function ReportSuite_DeleteDefaultPage(array $rsid_list) * - documentation: Delete an IP exclusion entry for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $ip_list * @param string[] $rsid_list @@ -2333,13 +2423,15 @@ public function ReportSuite_DeleteDefaultPage(array $rsid_list) public function ReportSuite_DeleteIPAddressExclusions(array $ip_list, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteIPAddressExclusions', array( + $this->setResult($resultReportSuite_DeleteIPAddressExclusions = $this->getSoapClient()->__soapCall('ReportSuite.DeleteIPAddressExclusions', [ $ip_list, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteIPAddressExclusions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2350,7 +2442,6 @@ public function ReportSuite_DeleteIPAddressExclusions(array $ip_list, array $rsi * - documentation: Deletes the specified internal URL filters * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $filters * @param string[] $rsid_list @@ -2359,13 +2450,15 @@ public function ReportSuite_DeleteIPAddressExclusions(array $ip_list, array $rsi public function ReportSuite_DeleteInternalURLFilters(array $filters, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteInternalURLFilters', array( + $this->setResult($resultReportSuite_DeleteInternalURLFilters = $this->getSoapClient()->__soapCall('ReportSuite.DeleteInternalURLFilters', [ $filters, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteInternalURLFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2375,7 +2468,6 @@ public function ReportSuite_DeleteInternalURLFilters(array $filters, array $rsid * - documentation: deletes a list of key visitors for the selected report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $key_visitors * @param string[] $rsid_list @@ -2384,13 +2476,15 @@ public function ReportSuite_DeleteInternalURLFilters(array $filters, array $rsid public function ReportSuite_DeleteKeyVisitors(array $key_visitors, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteKeyVisitors', array( + $this->setResult($resultReportSuite_DeleteKeyVisitors = $this->getSoapClient()->__soapCall('ReportSuite.DeleteKeyVisitors', [ $key_visitors, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteKeyVisitors; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2401,7 +2495,6 @@ public function ReportSuite_DeleteKeyVisitors(array $key_visitors, array $rsid_l * - documentation: Deletes a cost item for the selected report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $channel_type * @param string $cost_group @@ -2412,15 +2505,17 @@ public function ReportSuite_DeleteKeyVisitors(array $key_visitors, array $rsid_l public function ReportSuite_DeleteMarketingChannelCost($channel_type, $cost_group, $id, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteMarketingChannelCost', array( + $this->setResult($resultReportSuite_DeleteMarketingChannelCost = $this->getSoapClient()->__soapCall('ReportSuite.DeleteMarketingChannelCost', [ $channel_type, $cost_group, $id, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteMarketingChannelCost; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2431,7 +2526,6 @@ public function ReportSuite_DeleteMarketingChannelCost($channel_type, $cost_grou * - documentation: Delete marketing channels. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $channel_ids * @param string[] $rsid_list @@ -2440,13 +2534,15 @@ public function ReportSuite_DeleteMarketingChannelCost($channel_type, $cost_grou public function ReportSuite_DeleteMarketingChannels(array $channel_ids, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteMarketingChannels', array( + $this->setResult($resultReportSuite_DeleteMarketingChannels = $this->getSoapClient()->__soapCall('ReportSuite.DeleteMarketingChannels', [ $channel_ids, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteMarketingChannels; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2456,7 +2552,6 @@ public function ReportSuite_DeleteMarketingChannels(array $channel_ids, array $r * - documentation: Deletes the given pages from the requested report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $page_id_list * @param string[] $rsid_list @@ -2465,13 +2560,15 @@ public function ReportSuite_DeleteMarketingChannels(array $channel_ids, array $r public function ReportSuite_DeletePages(array $page_id_list, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeletePages', array( + $this->setResult($resultReportSuite_DeletePages = $this->getSoapClient()->__soapCall('ReportSuite.DeletePages', [ $page_id_list, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeletePages; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2481,7 +2578,6 @@ public function ReportSuite_DeletePages(array $page_id_list, array $rsid_list) * - documentation: Removes the specified paid search rule. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $filter * @param string[] $rsid_list @@ -2492,15 +2588,17 @@ public function ReportSuite_DeletePages(array $page_id_list, array $rsid_list) public function ReportSuite_DeletePaidSearch($filter, array $rsid_list, $rule, $search_engine) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeletePaidSearch', array( + $this->setResult($resultReportSuite_DeletePaidSearch = $this->getSoapClient()->__soapCall('ReportSuite.DeletePaidSearch', [ $filter, $rsid_list, $rule, $search_engine, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeletePaidSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2510,7 +2608,6 @@ public function ReportSuite_DeletePaidSearch($filter, array $rsid_list, $rule, $ * - documentation: Deletes a saved filter. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $savedFilterIds * @return boolean|bool @@ -2518,12 +2615,14 @@ public function ReportSuite_DeletePaidSearch($filter, array $rsid_list, $rule, $ public function ReportSuite_DeleteSavedFilter(array $savedFilterIds) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.DeleteSavedFilter', array( + $this->setResult($resultReportSuite_DeleteSavedFilter = $this->getSoapClient()->__soapCall('ReportSuite.DeleteSavedFilter', [ $savedFilterIds, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_DeleteSavedFilter; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2533,7 +2632,6 @@ public function ReportSuite_DeleteSavedFilter(array $savedFilterIds) * - documentation: Retrieves the activated status for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_activation[]|bool @@ -2541,12 +2639,14 @@ public function ReportSuite_DeleteSavedFilter(array $savedFilterIds) public function ReportSuite_GetActivation(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetActivation', array( + $this->setResult($resultReportSuite_GetActivation = $this->getSoapClient()->__soapCall('ReportSuite.GetActivation', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetActivation; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2556,7 +2656,6 @@ public function ReportSuite_GetActivation(array $rsid_list) * - documentation: Returns available elements for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $return_datawarehouse_elements * @param string[] $rsid_list @@ -2565,13 +2664,15 @@ public function ReportSuite_GetActivation(array $rsid_list) public function ReportSuite_GetAvailableElements($return_datawarehouse_elements, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetAvailableElements', array( + $this->setResult($resultReportSuite_GetAvailableElements = $this->getSoapClient()->__soapCall('ReportSuite.GetAvailableElements', [ $return_datawarehouse_elements, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetAvailableElements; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2581,7 +2682,6 @@ public function ReportSuite_GetAvailableElements($return_datawarehouse_elements, * - documentation: Returns available metrics for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $return_datawarehouse_metrics * @param string[] $rsid_list @@ -2590,13 +2690,15 @@ public function ReportSuite_GetAvailableElements($return_datawarehouse_elements, public function ReportSuite_GetAvailableMetrics($return_datawarehouse_metrics, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetAvailableMetrics', array( + $this->setResult($resultReportSuite_GetAvailableMetrics = $this->getSoapClient()->__soapCall('ReportSuite.GetAvailableMetrics', [ $return_datawarehouse_metrics, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetAvailableMetrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2606,7 +2708,6 @@ public function ReportSuite_GetAvailableMetrics($return_datawarehouse_metrics, a * - documentation: Retrieves the axle start date for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiRs_axle_start_date[]|bool @@ -2614,12 +2715,14 @@ public function ReportSuite_GetAvailableMetrics($return_datawarehouse_metrics, a public function ReportSuite_GetAxleStartDate(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetAxleStartDate', array( + $this->setResult($resultReportSuite_GetAxleStartDate = $this->getSoapClient()->__soapCall('ReportSuite.GetAxleStartDate', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetAxleStartDate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2629,7 +2732,6 @@ public function ReportSuite_GetAxleStartDate(array $rsid_list) * - documentation: Retrieves the base URL for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_base_currency[]|bool @@ -2637,12 +2739,14 @@ public function ReportSuite_GetAxleStartDate(array $rsid_list) public function ReportSuite_GetBaseCurrency(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetBaseCurrency', array( + $this->setResult($resultReportSuite_GetBaseCurrency = $this->getSoapClient()->__soapCall('ReportSuite.GetBaseCurrency', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetBaseCurrency; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2652,7 +2756,6 @@ public function ReportSuite_GetBaseCurrency(array $rsid_list) * - documentation: Retrieves the base URL for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_base_url[]|bool @@ -2660,12 +2763,14 @@ public function ReportSuite_GetBaseCurrency(array $rsid_list) public function ReportSuite_GetBaseURL(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetBaseURL', array( + $this->setResult($resultReportSuite_GetBaseURL = $this->getSoapClient()->__soapCall('ReportSuite.GetBaseURL', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetBaseURL; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2675,7 +2780,6 @@ public function ReportSuite_GetBaseURL(array $rsid_list) * - documentation: Retrieves the calculated metrics for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_calculated_metric[]|bool @@ -2683,12 +2787,14 @@ public function ReportSuite_GetBaseURL(array $rsid_list) public function ReportSuite_GetCalculatedMetrics(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetCalculatedMetrics', array( + $this->setResult($resultReportSuite_GetCalculatedMetrics = $this->getSoapClient()->__soapCall('ReportSuite.GetCalculatedMetrics', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetCalculatedMetrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2699,7 +2805,6 @@ public function ReportSuite_GetCalculatedMetrics(array $rsid_list) * - documentation: Retrieves the requested classifications from the requested report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $c_view * @param string[] $rel_id @@ -2709,14 +2814,16 @@ public function ReportSuite_GetCalculatedMetrics(array $rsid_list) public function ReportSuite_GetClassificationHierarchies($c_view, array $rel_id, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetClassificationHierarchies', array( + $this->setResult($resultReportSuite_GetClassificationHierarchies = $this->getSoapClient()->__soapCall('ReportSuite.GetClassificationHierarchies', [ $c_view, $rel_id, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetClassificationHierarchies; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2726,7 +2833,6 @@ public function ReportSuite_GetClassificationHierarchies($c_view, array $rel_id, * - documentation: Retrieves the requested classifications from the requested report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $c_view * @param string[] $rel_id @@ -2737,15 +2843,17 @@ public function ReportSuite_GetClassificationHierarchies($c_view, array $rel_id, public function ReportSuite_GetClassifications($c_view, array $rel_id, array $rsid_list, $type) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetClassifications', array( + $this->setResult($resultReportSuite_GetClassifications = $this->getSoapClient()->__soapCall('ReportSuite.GetClassifications', [ $c_view, $rel_id, $rsid_list, $type, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetClassifications; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2755,7 +2863,6 @@ public function ReportSuite_GetClassifications($c_view, array $rel_id, array $rs * - documentation: Retrieves the correlations for the specified report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_correlation[]|bool @@ -2763,12 +2870,14 @@ public function ReportSuite_GetClassifications($c_view, array $rel_id, array $rs public function ReportSuite_GetCorrelations(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetCorrelations', array( + $this->setResult($resultReportSuite_GetCorrelations = $this->getSoapClient()->__soapCall('ReportSuite.GetCorrelations', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetCorrelations; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2778,7 +2887,6 @@ public function ReportSuite_GetCorrelations(array $rsid_list) * - documentation: Retrieves the custom calendar for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_custom_calendar[]|bool @@ -2786,12 +2894,14 @@ public function ReportSuite_GetCorrelations(array $rsid_list) public function ReportSuite_GetCustomCalendar(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetCustomCalendar', array( + $this->setResult($resultReportSuite_GetCustomCalendar = $this->getSoapClient()->__soapCall('ReportSuite.GetCustomCalendar', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetCustomCalendar; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2801,7 +2911,6 @@ public function ReportSuite_GetCustomCalendar(array $rsid_list) * - documentation: Retrieves the default page for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_default_page[]|bool @@ -2809,12 +2918,14 @@ public function ReportSuite_GetCustomCalendar(array $rsid_list) public function ReportSuite_GetDefaultPage(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetDefaultPage', array( + $this->setResult($resultReportSuite_GetDefaultPage = $this->getSoapClient()->__soapCall('ReportSuite.GetDefaultPage', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetDefaultPage; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2824,7 +2935,6 @@ public function ReportSuite_GetDefaultPage(array $rsid_list) * - documentation: Retrieves the conversion variables for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_evar[]|bool @@ -2832,12 +2942,14 @@ public function ReportSuite_GetDefaultPage(array $rsid_list) public function ReportSuite_GetEVars(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetEVars', array( + $this->setResult($resultReportSuite_GetEVars = $this->getSoapClient()->__soapCall('ReportSuite.GetEVars', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetEVars; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2847,7 +2959,6 @@ public function ReportSuite_GetEVars(array $rsid_list) * - documentation: Retrieves the Conversion level for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_ecommerce[]|bool @@ -2855,12 +2966,14 @@ public function ReportSuite_GetEVars(array $rsid_list) public function ReportSuite_GetEcommerce(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetEcommerce', array( + $this->setResult($resultReportSuite_GetEcommerce = $this->getSoapClient()->__soapCall('ReportSuite.GetEcommerce', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetEcommerce; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2870,7 +2983,6 @@ public function ReportSuite_GetEcommerce(array $rsid_list) * - documentation: Retrieves the finding methods for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_finding_method[]|bool @@ -2878,12 +2990,14 @@ public function ReportSuite_GetEcommerce(array $rsid_list) public function ReportSuite_GetFindingMethods(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetFindingMethods', array( + $this->setResult($resultReportSuite_GetFindingMethods = $this->getSoapClient()->__soapCall('ReportSuite.GetFindingMethods', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetFindingMethods; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2893,7 +3007,6 @@ public function ReportSuite_GetFindingMethods(array $rsid_list) * - documentation: Returns the IP address exclusions for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_ip_exclusions[]|bool @@ -2901,12 +3014,14 @@ public function ReportSuite_GetFindingMethods(array $rsid_list) public function ReportSuite_GetIPAddressExclusions(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetIPAddressExclusions', array( + $this->setResult($resultReportSuite_GetIPAddressExclusions = $this->getSoapClient()->__soapCall('ReportSuite.GetIPAddressExclusions', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetIPAddressExclusions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2916,7 +3031,6 @@ public function ReportSuite_GetIPAddressExclusions(array $rsid_list) * - documentation: Retrieves the IP Address Obfuscation setting. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_ip_obfuscation[]|bool @@ -2924,12 +3038,14 @@ public function ReportSuite_GetIPAddressExclusions(array $rsid_list) public function ReportSuite_GetIPObfuscation(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetIPObfuscation', array( + $this->setResult($resultReportSuite_GetIPObfuscation = $this->getSoapClient()->__soapCall('ReportSuite.GetIPObfuscation', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetIPObfuscation; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2939,7 +3055,6 @@ public function ReportSuite_GetIPObfuscation(array $rsid_list) * - documentation: Retrieves the internal URL filters for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_internal_url_filter[]|bool @@ -2947,12 +3062,14 @@ public function ReportSuite_GetIPObfuscation(array $rsid_list) public function ReportSuite_GetInternalURLFilters(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetInternalURLFilters', array( + $this->setResult($resultReportSuite_GetInternalURLFilters = $this->getSoapClient()->__soapCall('ReportSuite.GetInternalURLFilters', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetInternalURLFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2962,7 +3079,6 @@ public function ReportSuite_GetInternalURLFilters(array $rsid_list) * - documentation: Retrieves a list of Key visitors for the specified report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_key_visitor[]|bool @@ -2970,12 +3086,14 @@ public function ReportSuite_GetInternalURLFilters(array $rsid_list) public function ReportSuite_GetKeyVisitors(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetKeyVisitors', array( + $this->setResult($resultReportSuite_GetKeyVisitors = $this->getSoapClient()->__soapCall('ReportSuite.GetKeyVisitors', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetKeyVisitors; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -2985,7 +3103,6 @@ public function ReportSuite_GetKeyVisitors(array $rsid_list) * - documentation: Retrieves the status of the multibyte character setting for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_localization[]|bool @@ -2993,12 +3110,14 @@ public function ReportSuite_GetKeyVisitors(array $rsid_list) public function ReportSuite_GetLocalization(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetLocalization', array( + $this->setResult($resultReportSuite_GetLocalization = $this->getSoapClient()->__soapCall('ReportSuite.GetLocalization', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetLocalization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3009,7 +3128,6 @@ public function ReportSuite_GetLocalization(array $rsid_list) * - documentation: Retrieves the marketing channel cost metrics for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_costs[]|bool @@ -3017,12 +3135,14 @@ public function ReportSuite_GetLocalization(array $rsid_list) public function ReportSuite_GetMarketingChannelCost(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelCost', array( + $this->setResult($resultReportSuite_GetMarketingChannelCost = $this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelCost', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetMarketingChannelCost; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3033,7 +3153,6 @@ public function ReportSuite_GetMarketingChannelCost(array $rsid_list) * - documentation: Retrieves the marketing channel engagement period expiration information for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiExpiration_event[]|bool @@ -3041,12 +3160,14 @@ public function ReportSuite_GetMarketingChannelCost(array $rsid_list) public function ReportSuite_GetMarketingChannelExpiration(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelExpiration', array( + $this->setResult($resultReportSuite_GetMarketingChannelExpiration = $this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelExpiration', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetMarketingChannelExpiration; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3057,7 +3178,6 @@ public function ReportSuite_GetMarketingChannelExpiration(array $rsid_list) * - documentation: Retrieves the marketing channel rules for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiRs_mchannel_rulesets[]|bool @@ -3065,12 +3185,14 @@ public function ReportSuite_GetMarketingChannelExpiration(array $rsid_list) public function ReportSuite_GetMarketingChannelRules(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelRules', array( + $this->setResult($resultReportSuite_GetMarketingChannelRules = $this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelRules', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetMarketingChannelRules; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3080,7 +3202,6 @@ public function ReportSuite_GetMarketingChannelRules(array $rsid_list) * - documentation: Retrieves the marketing channels for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiMchannels[]|bool @@ -3088,12 +3209,14 @@ public function ReportSuite_GetMarketingChannelRules(array $rsid_list) public function ReportSuite_GetMarketingChannels(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannels', array( + $this->setResult($resultReportSuite_GetMarketingChannels = $this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannels', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetMarketingChannels; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3104,7 +3227,6 @@ public function ReportSuite_GetMarketingChannels(array $rsid_list) * - documentation: Retrieves the available custom subrelations for the marketing channels in the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rel_id * @param string $rsid @@ -3113,13 +3235,15 @@ public function ReportSuite_GetMarketingChannels(array $rsid_list) public function ReportSuite_GetMarketingChannelsCustomSubRelations($rel_id, $rsid) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelsCustomSubRelations', array( + $this->setResult($resultReportSuite_GetMarketingChannelsCustomSubRelations = $this->getSoapClient()->__soapCall('ReportSuite.GetMarketingChannelsCustomSubRelations', [ $rel_id, $rsid, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetMarketingChannelsCustomSubRelations; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3129,7 +3253,6 @@ public function ReportSuite_GetMarketingChannelsCustomSubRelations($rel_id, $rsi * - documentation: Retrieves the Mobile Application Tracking settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return string|bool @@ -3137,12 +3260,14 @@ public function ReportSuite_GetMarketingChannelsCustomSubRelations($rel_id, $rsi public function ReportSuite_GetMobileAppReporting(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetMobileAppReporting', array( + $this->setResult($resultReportSuite_GetMobileAppReporting = $this->getSoapClient()->__soapCall('ReportSuite.GetMobileAppReporting', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetMobileAppReporting; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3152,7 +3277,6 @@ public function ReportSuite_GetMobileAppReporting(array $rsid_list) * - documentation: Retrieves a list of pages for the specified report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $limit * @param string $page_search @@ -3164,16 +3288,18 @@ public function ReportSuite_GetMobileAppReporting(array $rsid_list) public function ReportSuite_GetPages($limit, $page_search, array $rsid_list, $sc_period, $start_point) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetPages', array( + $this->setResult($resultReportSuite_GetPages = $this->getSoapClient()->__soapCall('ReportSuite.GetPages', [ $limit, $page_search, $rsid_list, $sc_period, $start_point, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetPages; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3183,7 +3309,6 @@ public function ReportSuite_GetPages($limit, $page_search, array $rsid_list, $sc * - documentation: Retrieves the paid search settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_paid_search[]|bool @@ -3191,12 +3316,14 @@ public function ReportSuite_GetPages($limit, $page_search, array $rsid_list, $sc public function ReportSuite_GetPaidSearch(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetPaidSearch', array( + $this->setResult($resultReportSuite_GetPaidSearch = $this->getSoapClient()->__soapCall('ReportSuite.GetPaidSearch', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetPaidSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3206,7 +3333,6 @@ public function ReportSuite_GetPaidSearch(array $rsid_list) * - documentation: Retrieves the permanent traffic settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiPermanent_traffic[]|bool @@ -3214,12 +3340,14 @@ public function ReportSuite_GetPaidSearch(array $rsid_list) public function ReportSuite_GetPermanentTraffic(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetPermanentTraffic', array( + $this->setResult($resultReportSuite_GetPermanentTraffic = $this->getSoapClient()->__soapCall('ReportSuite.GetPermanentTraffic', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetPermanentTraffic; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3229,7 +3357,6 @@ public function ReportSuite_GetPermanentTraffic(array $rsid_list) * - documentation: Returns processing status for the given report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_processing_status[]|bool @@ -3237,12 +3364,14 @@ public function ReportSuite_GetPermanentTraffic(array $rsid_list) public function ReportSuite_GetProcessingStatus(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetProcessingStatus', array( + $this->setResult($resultReportSuite_GetProcessingStatus = $this->getSoapClient()->__soapCall('ReportSuite.GetProcessingStatus', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetProcessingStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3252,7 +3381,6 @@ public function ReportSuite_GetProcessingStatus(array $rsid_list) * - documentation: Returns rollup dates for the given rollup report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_rollup_dates[]|bool @@ -3260,12 +3388,14 @@ public function ReportSuite_GetProcessingStatus(array $rsid_list) public function ReportSuite_GetRollupDates(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetRollupDates', array( + $this->setResult($resultReportSuite_GetRollupDates = $this->getSoapClient()->__soapCall('ReportSuite.GetRollupDates', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetRollupDates; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3275,17 +3405,18 @@ public function ReportSuite_GetRollupDates(array $rsid_list) * - documentation: Retrieves the rollups for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiRollup[]|bool */ public function ReportSuite_GetRollups() { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetRollups', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultReportSuite_GetRollups = $this->getSoapClient()->__soapCall('ReportSuite.GetRollups', [], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetRollups; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3295,17 +3426,18 @@ public function ReportSuite_GetRollups() * - documentation: Gets the saved filters for a report suite. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiSaved_filter[]|bool */ public function ReportSuite_GetSavedFilters() { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetSavedFilters', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultReportSuite_GetSavedFilters = $this->getSoapClient()->__soapCall('ReportSuite.GetSavedFilters', [], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetSavedFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3315,7 +3447,6 @@ public function ReportSuite_GetSavedFilters() * - documentation: Retrieves the scheduled traffic changes for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiSchedule_spike[]|bool @@ -3323,12 +3454,14 @@ public function ReportSuite_GetSavedFilters() public function ReportSuite_GetScheduledSpike(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetScheduledSpike', array( + $this->setResult($resultReportSuite_GetScheduledSpike = $this->getSoapClient()->__soapCall('ReportSuite.GetScheduledSpike', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetScheduledSpike; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3338,7 +3471,6 @@ public function ReportSuite_GetScheduledSpike(array $rsid_list) * - documentation: Retrieves the requested classifications from the requested report suites * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiRs_sc_segments[]|bool @@ -3346,12 +3478,14 @@ public function ReportSuite_GetScheduledSpike(array $rsid_list) public function ReportSuite_GetSegments(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetSegments', array( + $this->setResult($resultReportSuite_GetSegments = $this->getSoapClient()->__soapCall('ReportSuite.GetSegments', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetSegments; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3361,7 +3495,6 @@ public function ReportSuite_GetSegments(array $rsid_list) * - documentation: Returns report suite settings. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $locale * @param string[] $rsid_list @@ -3370,13 +3503,15 @@ public function ReportSuite_GetSegments(array $rsid_list) public function ReportSuite_GetSettings($locale, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetSettings', array( + $this->setResult($resultReportSuite_GetSettings = $this->getSoapClient()->__soapCall('ReportSuite.GetSettings', [ $locale, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetSettings; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3386,7 +3521,6 @@ public function ReportSuite_GetSettings($locale, array $rsid_list) * - documentation: Retrieves the Site Title for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_site_title[]|bool @@ -3394,12 +3528,14 @@ public function ReportSuite_GetSettings($locale, array $rsid_list) public function ReportSuite_GetSiteTitle(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetSiteTitle', array( + $this->setResult($resultReportSuite_GetSiteTitle = $this->getSoapClient()->__soapCall('ReportSuite.GetSiteTitle', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetSiteTitle; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3409,7 +3545,6 @@ public function ReportSuite_GetSiteTitle(array $rsid_list) * - documentation: Retrieves the success events for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_event[]|bool @@ -3417,12 +3552,14 @@ public function ReportSuite_GetSiteTitle(array $rsid_list) public function ReportSuite_GetSuccessEvents(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetSuccessEvents', array( + $this->setResult($resultReportSuite_GetSuccessEvents = $this->getSoapClient()->__soapCall('ReportSuite.GetSuccessEvents', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetSuccessEvents; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3432,7 +3569,6 @@ public function ReportSuite_GetSuccessEvents(array $rsid_list) * - documentation: Retrieves the templates for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_template[]|bool @@ -3440,12 +3576,14 @@ public function ReportSuite_GetSuccessEvents(array $rsid_list) public function ReportSuite_GetTemplate(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetTemplate', array( + $this->setResult($resultReportSuite_GetTemplate = $this->getSoapClient()->__soapCall('ReportSuite.GetTemplate', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetTemplate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3455,7 +3593,6 @@ public function ReportSuite_GetTemplate(array $rsid_list) * - documentation: Retrieves the Time Zone for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_time_zone[]|bool @@ -3463,12 +3600,14 @@ public function ReportSuite_GetTemplate(array $rsid_list) public function ReportSuite_GetTimeZone(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetTimeZone', array( + $this->setResult($resultReportSuite_GetTimeZone = $this->getSoapClient()->__soapCall('ReportSuite.GetTimeZone', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetTimeZone; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3478,7 +3617,6 @@ public function ReportSuite_GetTimeZone(array $rsid_list) * - documentation: Retrieves the Traffic Vars for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_traffic_var[]|bool @@ -3486,12 +3624,14 @@ public function ReportSuite_GetTimeZone(array $rsid_list) public function ReportSuite_GetTrafficVars(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetTrafficVars', array( + $this->setResult($resultReportSuite_GetTrafficVars = $this->getSoapClient()->__soapCall('ReportSuite.GetTrafficVars', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetTrafficVars; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3501,7 +3641,6 @@ public function ReportSuite_GetTrafficVars(array $rsid_list) * - documentation: Retrieves the visibility states for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_ui_element[]|bool @@ -3509,12 +3648,14 @@ public function ReportSuite_GetTrafficVars(array $rsid_list) public function ReportSuite_GetUIVisibility(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetUIVisibility', array( + $this->setResult($resultReportSuite_GetUIVisibility = $this->getSoapClient()->__soapCall('ReportSuite.GetUIVisibility', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetUIVisibility; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3525,7 +3666,6 @@ public function ReportSuite_GetUIVisibility(array $rsid_list) * - documentation: Retrieves a list of unique visitor variables * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_unique_visitor_variable[]|bool @@ -3533,12 +3673,14 @@ public function ReportSuite_GetUIVisibility(array $rsid_list) public function ReportSuite_GetUniqueVisitorVariable(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetUniqueVisitorVariable', array( + $this->setResult($resultReportSuite_GetUniqueVisitorVariable = $this->getSoapClient()->__soapCall('ReportSuite.GetUniqueVisitorVariable', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetUniqueVisitorVariable; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3548,7 +3690,6 @@ public function ReportSuite_GetUniqueVisitorVariable(array $rsid_list) * - documentation: Retrieves the Video Tracking settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return string|bool @@ -3556,12 +3697,14 @@ public function ReportSuite_GetUniqueVisitorVariable(array $rsid_list) public function ReportSuite_GetVideoReporting(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetVideoReporting', array( + $this->setResult($resultReportSuite_GetVideoReporting = $this->getSoapClient()->__soapCall('ReportSuite.GetVideoReporting', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetVideoReporting; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3571,7 +3714,6 @@ public function ReportSuite_GetVideoReporting(array $rsid_list) * - documentation: Retrieves the Video Tracking settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return \Api\StructType\ApiReport_suite_video_tracking[]|bool @@ -3579,12 +3721,14 @@ public function ReportSuite_GetVideoReporting(array $rsid_list) public function ReportSuite_GetVideoTracking(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.GetVideoTracking', array( + $this->setResult($resultReportSuite_GetVideoTracking = $this->getSoapClient()->__soapCall('ReportSuite.GetVideoTracking', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_GetVideoTracking; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3594,7 +3738,6 @@ public function ReportSuite_GetVideoTracking(array $rsid_list) * - documentation: Saves the Base Currency setting. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $base_currency * @param string[] $rsid_list @@ -3603,13 +3746,15 @@ public function ReportSuite_GetVideoTracking(array $rsid_list) public function ReportSuite_SaveBaseCurrency($base_currency, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveBaseCurrency', array( + $this->setResult($resultReportSuite_SaveBaseCurrency = $this->getSoapClient()->__soapCall('ReportSuite.SaveBaseCurrency', [ $base_currency, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveBaseCurrency; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3619,7 +3764,6 @@ public function ReportSuite_SaveBaseCurrency($base_currency, array $rsid_list) * - documentation: Saves the base URL for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $base_url * @param string[] $rsid_list @@ -3628,13 +3772,15 @@ public function ReportSuite_SaveBaseCurrency($base_currency, array $rsid_list) public function ReportSuite_SaveBaseURL($base_url, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveBaseURL', array( + $this->setResult($resultReportSuite_SaveBaseURL = $this->getSoapClient()->__soapCall('ReportSuite.SaveBaseURL', [ $base_url, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveBaseURL; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3644,7 +3790,6 @@ public function ReportSuite_SaveBaseURL($base_url, array $rsid_list) * - documentation: Saves a calculated metric for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCalculated_metric[] $calculated_metrics * @param string[] $rsid_list @@ -3653,13 +3798,15 @@ public function ReportSuite_SaveBaseURL($base_url, array $rsid_list) public function ReportSuite_SaveCalculatedMetrics(array $calculated_metrics, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveCalculatedMetrics', array( + $this->setResult($resultReportSuite_SaveCalculatedMetrics = $this->getSoapClient()->__soapCall('ReportSuite.SaveCalculatedMetrics', [ $calculated_metrics, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveCalculatedMetrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3670,7 +3817,6 @@ public function ReportSuite_SaveCalculatedMetrics(array $calculated_metrics, arr * - documentation: Modifies a classification hierarchy for one or more report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $c_options * @param string $c_view @@ -3686,7 +3832,7 @@ public function ReportSuite_SaveCalculatedMetrics(array $calculated_metrics, arr public function ReportSuite_SaveClassificationHierarchies(array $c_options, $c_view, $camp_view, $div_num, $name, $parent_div_num, array $rsid_list, $type, $update) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveClassificationHierarchies', array( + $this->setResult($resultReportSuite_SaveClassificationHierarchies = $this->getSoapClient()->__soapCall('ReportSuite.SaveClassificationHierarchies', [ $c_options, $c_view, $camp_view, @@ -3696,10 +3842,12 @@ public function ReportSuite_SaveClassificationHierarchies(array $c_options, $c_v $rsid_list, $type, $update, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveClassificationHierarchies; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3709,7 +3857,6 @@ public function ReportSuite_SaveClassificationHierarchies(array $c_options, $c_v * - documentation: Saves a classification for one or more report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $c_options * @param string $c_view @@ -3725,7 +3872,7 @@ public function ReportSuite_SaveClassificationHierarchies(array $c_options, $c_v public function ReportSuite_SaveClassifications(array $c_options, $c_view, $camp_view, $div_num, $name, $parent_div_num, array $rsid_list, $type, $update) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveClassifications', array( + $this->setResult($resultReportSuite_SaveClassifications = $this->getSoapClient()->__soapCall('ReportSuite.SaveClassifications', [ $c_options, $c_view, $camp_view, @@ -3735,10 +3882,12 @@ public function ReportSuite_SaveClassifications(array $c_options, $c_view, $camp $rsid_list, $type, $update, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveClassifications; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3748,7 +3897,6 @@ public function ReportSuite_SaveClassifications(array $c_options, $c_view, $camp * - documentation: Enables custom calendars for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $anchor_date * @param string $cal_type @@ -3758,14 +3906,16 @@ public function ReportSuite_SaveClassifications(array $c_options, $c_view, $camp public function ReportSuite_SaveCustomCalendar($anchor_date, $cal_type, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveCustomCalendar', array( + $this->setResult($resultReportSuite_SaveCustomCalendar = $this->getSoapClient()->__soapCall('ReportSuite.SaveCustomCalendar', [ $anchor_date, $cal_type, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveCustomCalendar; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3775,7 +3925,6 @@ public function ReportSuite_SaveCustomCalendar($anchor_date, $cal_type, array $r * - documentation: Saves the default page for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $default_page * @param string[] $rsid_list @@ -3784,13 +3933,15 @@ public function ReportSuite_SaveCustomCalendar($anchor_date, $cal_type, array $r public function ReportSuite_SaveDefaultPage($default_page, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveDefaultPage', array( + $this->setResult($resultReportSuite_SaveDefaultPage = $this->getSoapClient()->__soapCall('ReportSuite.SaveDefaultPage', [ $default_page, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveDefaultPage; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3800,7 +3951,6 @@ public function ReportSuite_SaveDefaultPage($default_page, array $rsid_list) * - documentation: Saves the conversion variables for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiEvar[] $evars * @param string[] $rsid_list @@ -3809,13 +3959,15 @@ public function ReportSuite_SaveDefaultPage($default_page, array $rsid_list) public function ReportSuite_SaveEVars(array $evars, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveEVars', array( + $this->setResult($resultReportSuite_SaveEVars = $this->getSoapClient()->__soapCall('ReportSuite.SaveEVars', [ $evars, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveEVars; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3825,7 +3977,6 @@ public function ReportSuite_SaveEVars(array $evars, array $rsid_list) * - documentation: Saves the conversion level for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $ecommerce * @param string[] $rsid_list @@ -3834,13 +3985,15 @@ public function ReportSuite_SaveEVars(array $evars, array $rsid_list) public function ReportSuite_SaveEcommerce($ecommerce, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveEcommerce', array( + $this->setResult($resultReportSuite_SaveEcommerce = $this->getSoapClient()->__soapCall('ReportSuite.SaveEcommerce', [ $ecommerce, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveEcommerce; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3850,7 +4003,6 @@ public function ReportSuite_SaveEcommerce($ecommerce, array $rsid_list) * - documentation: Saves finding method settings. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiFinding_method[] $reports * @param string[] $rsid_list @@ -3859,13 +4011,15 @@ public function ReportSuite_SaveEcommerce($ecommerce, array $rsid_list) public function ReportSuite_SaveFindingMethods(array $reports, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveFindingMethods', array( + $this->setResult($resultReportSuite_SaveFindingMethods = $this->getSoapClient()->__soapCall('ReportSuite.SaveFindingMethods', [ $reports, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveFindingMethods; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3876,7 +4030,6 @@ public function ReportSuite_SaveFindingMethods(array $reports, array $rsid_list) * - documentation: Add an IP exclusion entry for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSave_ip_exclusion[] $ip_list * @param string[] $rsid_list @@ -3885,13 +4038,15 @@ public function ReportSuite_SaveFindingMethods(array $reports, array $rsid_list) public function ReportSuite_SaveIPAddressExclusions(array $ip_list, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveIPAddressExclusions', array( + $this->setResult($resultReportSuite_SaveIPAddressExclusions = $this->getSoapClient()->__soapCall('ReportSuite.SaveIPAddressExclusions', [ $ip_list, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveIPAddressExclusions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3901,7 +4056,6 @@ public function ReportSuite_SaveIPAddressExclusions(array $ip_list, array $rsid_ * - documentation: Saves the IP Address Obfuscation setting. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $ip_obfuscation * @param string[] $rsid_list @@ -3910,13 +4064,15 @@ public function ReportSuite_SaveIPAddressExclusions(array $ip_list, array $rsid_ public function ReportSuite_SaveIPObfuscation($ip_obfuscation, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveIPObfuscation', array( + $this->setResult($resultReportSuite_SaveIPObfuscation = $this->getSoapClient()->__soapCall('ReportSuite.SaveIPObfuscation', [ $ip_obfuscation, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveIPObfuscation; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3927,7 +4083,6 @@ public function ReportSuite_SaveIPObfuscation($ip_obfuscation, array $rsid_list) * - documentation: Saves the marketing channel costs for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCost_item $cost_item * @param string[] $rsid_list @@ -3936,13 +4091,15 @@ public function ReportSuite_SaveIPObfuscation($ip_obfuscation, array $rsid_list) public function ReportSuite_SaveMarketingChannelCost(\Api\StructType\ApiCost_item $cost_item, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannelCost', array( + $this->setResult($resultReportSuite_SaveMarketingChannelCost = $this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannelCost', [ $cost_item, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveMarketingChannelCost; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3953,7 +4110,6 @@ public function ReportSuite_SaveMarketingChannelCost(\Api\StructType\ApiCost_ite * - documentation: Saves the visitor expiration period. Set the number of days required before the visit expires, or 0 for never expires * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $days * @param string[] $rsid_list @@ -3962,13 +4118,15 @@ public function ReportSuite_SaveMarketingChannelCost(\Api\StructType\ApiCost_ite public function ReportSuite_SaveMarketingChannelExpiration($days, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannelExpiration', array( + $this->setResult($resultReportSuite_SaveMarketingChannelExpiration = $this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannelExpiration', [ $days, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveMarketingChannelExpiration; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -3979,7 +4137,6 @@ public function ReportSuite_SaveMarketingChannelExpiration($days, array $rsid_li * - documentation: Saves the marketing channel rules for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiMchannel_ruleset[] $mchannel_rules * @param string[] $rsid_list @@ -3988,13 +4145,15 @@ public function ReportSuite_SaveMarketingChannelExpiration($days, array $rsid_li public function ReportSuite_SaveMarketingChannelRules(array $mchannel_rules, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannelRules', array( + $this->setResult($resultReportSuite_SaveMarketingChannelRules = $this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannelRules', [ $mchannel_rules, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveMarketingChannelRules; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4004,7 +4163,6 @@ public function ReportSuite_SaveMarketingChannelRules(array $mchannel_rules, arr * - documentation: Saves a set of marketing channels. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiMchannel[] $channels * @param string[] $rsid_list @@ -4013,13 +4171,15 @@ public function ReportSuite_SaveMarketingChannelRules(array $mchannel_rules, arr public function ReportSuite_SaveMarketingChannels(array $channels, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannels', array( + $this->setResult($resultReportSuite_SaveMarketingChannels = $this->getSoapClient()->__soapCall('ReportSuite.SaveMarketingChannels', [ $channels, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveMarketingChannels; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4027,7 +4187,6 @@ public function ReportSuite_SaveMarketingChannels(array $channels, array $rsid_l * Method to call the operation originally named ReportSuite.SaveMobileAppReporting * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return void|bool @@ -4035,12 +4194,14 @@ public function ReportSuite_SaveMarketingChannels(array $channels, array $rsid_l public function ReportSuite_SaveMobileAppReporting(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveMobileAppReporting', array( + $this->setResult($resultReportSuite_SaveMobileAppReporting = $this->getSoapClient()->__soapCall('ReportSuite.SaveMobileAppReporting', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveMobileAppReporting; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4050,7 +4211,6 @@ public function ReportSuite_SaveMobileAppReporting(array $rsid_list) * - documentation: Saves the paid search settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $filter * @param string[] $rsid_list @@ -4061,15 +4221,17 @@ public function ReportSuite_SaveMobileAppReporting(array $rsid_list) public function ReportSuite_SavePaidSearch($filter, array $rsid_list, $rule, $search_engine) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SavePaidSearch', array( + $this->setResult($resultReportSuite_SavePaidSearch = $this->getSoapClient()->__soapCall('ReportSuite.SavePaidSearch', [ $filter, $rsid_list, $rule, $search_engine, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SavePaidSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4079,7 +4241,6 @@ public function ReportSuite_SavePaidSearch($filter, array $rsid_list, $rule, $se * - documentation: Saves the permanent traffic settings for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $new_hits_per_day * @param string[] $rsid_list @@ -4089,14 +4250,16 @@ public function ReportSuite_SavePaidSearch($filter, array $rsid_list, $rule, $se public function ReportSuite_SavePermanentTraffic($new_hits_per_day, array $rsid_list, $start_date) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SavePermanentTraffic', array( + $this->setResult($resultReportSuite_SavePermanentTraffic = $this->getSoapClient()->__soapCall('ReportSuite.SavePermanentTraffic', [ $new_hits_per_day, $rsid_list, $start_date, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SavePermanentTraffic; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4106,7 +4269,6 @@ public function ReportSuite_SavePermanentTraffic($new_hits_per_day, array $rsid_ * - documentation: Saves a rollup for the company. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $go_live_date * @param string[] $rollup_rsids @@ -4117,15 +4279,17 @@ public function ReportSuite_SavePermanentTraffic($new_hits_per_day, array $rsid_ public function ReportSuite_SaveRollup($go_live_date, array $rollup_rsids, $rsid, $time_zone) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveRollup', array( + $this->setResult($resultReportSuite_SaveRollup = $this->getSoapClient()->__soapCall('ReportSuite.SaveRollup', [ $go_live_date, $rollup_rsids, $rsid, $time_zone, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveRollup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4135,7 +4299,6 @@ public function ReportSuite_SaveRollup($go_live_date, array $rollup_rsids, $rsid * - documentation: Saves filter. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSaved_filter[] $savedFilters * @return \Api\StructType\ApiSaved_filter[]|bool @@ -4143,12 +4306,14 @@ public function ReportSuite_SaveRollup($go_live_date, array $rollup_rsids, $rsid public function ReportSuite_SaveSavedFilters(array $savedFilters) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveSavedFilters', array( + $this->setResult($resultReportSuite_SaveSavedFilters = $this->getSoapClient()->__soapCall('ReportSuite.SaveSavedFilters', [ $savedFilters, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveSavedFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4158,7 +4323,6 @@ public function ReportSuite_SaveSavedFilters(array $savedFilters) * - documentation: Saves scheduled traffic spikes for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $end_date * @param string[] $rsid_list @@ -4169,15 +4333,17 @@ public function ReportSuite_SaveSavedFilters(array $savedFilters) public function ReportSuite_SaveScheduledSpike($end_date, array $rsid_list, $spike_hits_per_day, $start_date) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveScheduledSpike', array( + $this->setResult($resultReportSuite_SaveScheduledSpike = $this->getSoapClient()->__soapCall('ReportSuite.SaveScheduledSpike', [ $end_date, $rsid_list, $spike_hits_per_day, $start_date, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveScheduledSpike; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4187,7 +4353,6 @@ public function ReportSuite_SaveScheduledSpike($end_date, array $rsid_list, $spi * - documentation: Changes the Site Title of the report suites specified (it is not recommended to update multiple report suites with the same site title) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @param string $site_title @@ -4196,13 +4361,15 @@ public function ReportSuite_SaveScheduledSpike($end_date, array $rsid_list, $spi public function ReportSuite_SaveSiteTitle(array $rsid_list, $site_title) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveSiteTitle', array( + $this->setResult($resultReportSuite_SaveSiteTitle = $this->getSoapClient()->__soapCall('ReportSuite.SaveSiteTitle', [ $rsid_list, $site_title, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveSiteTitle; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4212,7 +4379,6 @@ public function ReportSuite_SaveSiteTitle(array $rsid_list, $site_title) * - documentation: Saves the success events to rsid_list * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiEvent[] $events * @param string[] $rsid_list @@ -4221,13 +4387,15 @@ public function ReportSuite_SaveSiteTitle(array $rsid_list, $site_title) public function ReportSuite_SaveSuccessEvents(array $events, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveSuccessEvents', array( + $this->setResult($resultReportSuite_SaveSuccessEvents = $this->getSoapClient()->__soapCall('ReportSuite.SaveSuccessEvents', [ $events, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveSuccessEvents; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4235,7 +4403,6 @@ public function ReportSuite_SaveSuccessEvents(array $events, array $rsid_list) * Method to call the operation originally named ReportSuite.SaveSurveySettings * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @param string $survey_display_event_num @@ -4246,15 +4413,17 @@ public function ReportSuite_SaveSuccessEvents(array $events, array $rsid_list) public function ReportSuite_SaveSurveySettings(array $rsid_list, $survey_display_event_num, $survey_evar_num, $survey_submit_event_num) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveSurveySettings', array( + $this->setResult($resultReportSuite_SaveSurveySettings = $this->getSoapClient()->__soapCall('ReportSuite.SaveSurveySettings', [ $rsid_list, $survey_display_event_num, $survey_evar_num, $survey_submit_event_num, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveSurveySettings; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4264,7 +4433,6 @@ public function ReportSuite_SaveSurveySettings(array $rsid_list, $survey_display * - documentation: Changes the timezone (lookup ID) of the report suites specified * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @param string $time_zone @@ -4273,13 +4441,15 @@ public function ReportSuite_SaveSurveySettings(array $rsid_list, $survey_display public function ReportSuite_SaveTimeZone(array $rsid_list, $time_zone) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveTimeZone', array( + $this->setResult($resultReportSuite_SaveTimeZone = $this->getSoapClient()->__soapCall('ReportSuite.SaveTimeZone', [ $rsid_list, $time_zone, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveTimeZone; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4289,7 +4459,6 @@ public function ReportSuite_SaveTimeZone(array $rsid_list, $time_zone) * - documentation: Saves the Traffic Vars for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiTraffic_var[] $property * @param string[] $rsid_list @@ -4298,13 +4467,15 @@ public function ReportSuite_SaveTimeZone(array $rsid_list, $time_zone) public function ReportSuite_SaveTrafficVars(array $property, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveTrafficVars', array( + $this->setResult($resultReportSuite_SaveTrafficVars = $this->getSoapClient()->__soapCall('ReportSuite.SaveTrafficVars', [ $property, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveTrafficVars; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4314,7 +4485,6 @@ public function ReportSuite_SaveTrafficVars(array $property, array $rsid_list) * - documentation: Changes the visibility state of the UI element given for the requested report suites. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @param string $state @@ -4324,14 +4494,16 @@ public function ReportSuite_SaveTrafficVars(array $property, array $rsid_list) public function ReportSuite_SaveUIVisibility(array $rsid_list, $state, $ui_element) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveUIVisibility', array( + $this->setResult($resultReportSuite_SaveUIVisibility = $this->getSoapClient()->__soapCall('ReportSuite.SaveUIVisibility', [ $rsid_list, $state, $ui_element, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveUIVisibility; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4342,7 +4514,6 @@ public function ReportSuite_SaveUIVisibility(array $rsid_list, $state, $ui_eleme * - documentation: Sets the unique visitor variable specified * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @param string $unique_visitor_variable @@ -4351,13 +4522,15 @@ public function ReportSuite_SaveUIVisibility(array $rsid_list, $state, $ui_eleme public function ReportSuite_SaveUniqueVisitorVariable(array $rsid_list, $unique_visitor_variable) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveUniqueVisitorVariable', array( + $this->setResult($resultReportSuite_SaveUniqueVisitorVariable = $this->getSoapClient()->__soapCall('ReportSuite.SaveUniqueVisitorVariable', [ $rsid_list, $unique_visitor_variable, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveUniqueVisitorVariable; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4365,7 +4538,6 @@ public function ReportSuite_SaveUniqueVisitorVariable(array $rsid_list, $unique_ * Method to call the operation originally named ReportSuite.SaveVideoReporting * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $rsid_list * @return void|bool @@ -4373,12 +4545,14 @@ public function ReportSuite_SaveUniqueVisitorVariable(array $rsid_list, $unique_ public function ReportSuite_SaveVideoReporting(array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReportSuite.SaveVideoReporting', array( + $this->setResult($resultReportSuite_SaveVideoReporting = $this->getSoapClient()->__soapCall('ReportSuite.SaveVideoReporting', [ $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReportSuite_SaveVideoReporting; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4388,7 +4562,6 @@ public function ReportSuite_SaveVideoReporting(array $rsid_list) * - documentation: Return the current status of a Saint API Job. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $job_id * @return \Api\StructType\ApiSaintresult[]|bool @@ -4396,12 +4569,14 @@ public function ReportSuite_SaveVideoReporting(array $rsid_list) public function Saint_CheckJobStatus($job_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.CheckJobStatus', array( + $this->setResult($resultSaint_CheckJobStatus = $this->getSoapClient()->__soapCall('Saint.CheckJobStatus', [ $job_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_CheckJobStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4411,7 +4586,6 @@ public function Saint_CheckJobStatus($job_id) * - documentation: Creates an ftp account for the given parameters and returns the ftp account info * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $description * @param string $email @@ -4424,17 +4598,19 @@ public function Saint_CheckJobStatus($job_id) public function Saint_CreateFTP($description, $email, $export, $overwrite, $relation_id, array $rsid_list) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.CreateFTP', array( + $this->setResult($resultSaint_CreateFTP = $this->getSoapClient()->__soapCall('Saint.CreateFTP', [ $description, $email, $export, $overwrite, $relation_id, $rsid_list, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_CreateFTP; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4444,7 +4620,6 @@ public function Saint_CreateFTP($description, $email, $export, $overwrite, $rela * - documentation: Creates Saint Export Job. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $campaign_filter_begin_range * @param string $campaign_filter_end_range @@ -4465,7 +4640,7 @@ public function Saint_CreateFTP($description, $email, $export, $overwrite, $rela public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_filter_end_range, $campaign_filter_option, $date_filter_row_end_date, $date_filter_row_start_date, $email_address, $encoding, $relation_id, array $report_suite_array, $row_match_filter_empty_column_name, $row_match_filter_match_column_name, $row_match_filter_match_column_value, $select_all_rows, $select_number_of_rows) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ExportCreateJob', array( + $this->setResult($resultSaint_ExportCreateJob = $this->getSoapClient()->__soapCall('Saint.ExportCreateJob', [ $campaign_filter_begin_range, $campaign_filter_end_range, $campaign_filter_option, @@ -4480,10 +4655,12 @@ public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_fi $row_match_filter_match_column_value, $select_all_rows, $select_number_of_rows, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ExportCreateJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4493,7 +4670,6 @@ public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_fi * - documentation: Returns the page details of a given file_id * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $file_id * @param string $segment_id @@ -4502,13 +4678,15 @@ public function Saint_ExportCreateJob($campaign_filter_begin_range, $campaign_fi public function Saint_ExportGetFileSegment($file_id, $segment_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ExportGetFileSegment', array( + $this->setResult($resultSaint_ExportGetFileSegment = $this->getSoapClient()->__soapCall('Saint.ExportGetFileSegment', [ $file_id, $segment_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ExportGetFileSegment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4518,7 +4696,6 @@ public function Saint_ExportGetFileSegment($file_id, $segment_id) * - documentation: Returns Array of compatability information for a report suite(s), * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $report_suite_array * @return \Api\StructType\ApiCompatability[]|bool @@ -4526,12 +4703,14 @@ public function Saint_ExportGetFileSegment($file_id, $segment_id) public function Saint_GetCompatabiltyMetrics(array $report_suite_array) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.GetCompatabiltyMetrics', array( + $this->setResult($resultSaint_GetCompatabiltyMetrics = $this->getSoapClient()->__soapCall('Saint.GetCompatabiltyMetrics', [ $report_suite_array, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_GetCompatabiltyMetrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4541,7 +4720,6 @@ public function Saint_GetCompatabiltyMetrics(array $report_suite_array) * - documentation: Get SAINT export filters. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $relation_id * @param string[] $report_suite_array @@ -4550,13 +4728,15 @@ public function Saint_GetCompatabiltyMetrics(array $report_suite_array) public function Saint_GetFilters($relation_id, array $report_suite_array) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.GetFilters', array( + $this->setResult($resultSaint_GetFilters = $this->getSoapClient()->__soapCall('Saint.GetFilters', [ $relation_id, $report_suite_array, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_GetFilters; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4566,7 +4746,6 @@ public function Saint_GetFilters($relation_id, array $report_suite_array) * - documentation: Returns the template to be used in the SAINT browser or FTP download * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $encoding * @param int[] $numeric_div_nums @@ -4578,16 +4757,18 @@ public function Saint_GetFilters($relation_id, array $report_suite_array) public function Saint_GetTemplate($encoding, array $numeric_div_nums, $relation_id, $report_suite, array $text_div_nums) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.GetTemplate', array( + $this->setResult($resultSaint_GetTemplate = $this->getSoapClient()->__soapCall('Saint.GetTemplate', [ $encoding, $numeric_div_nums, $relation_id, $report_suite, $text_div_nums, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_GetTemplate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4597,7 +4778,6 @@ public function Saint_GetTemplate($encoding, array $numeric_div_nums, $relation_ * - documentation: Commits a specified Saint Import job for processing. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $job_id * @return string|bool @@ -4605,12 +4785,14 @@ public function Saint_GetTemplate($encoding, array $numeric_div_nums, $relation_ public function Saint_ImportCommitJob($job_id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ImportCommitJob', array( + $this->setResult($resultSaint_ImportCommitJob = $this->getSoapClient()->__soapCall('Saint.ImportCommitJob', [ $job_id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ImportCommitJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4620,7 +4802,6 @@ public function Saint_ImportCommitJob($job_id) * - documentation: Creates a Saint Import Job * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $check_divisions * @param string $description @@ -4635,7 +4816,7 @@ public function Saint_ImportCommitJob($job_id) public function Saint_ImportCreateJob($check_divisions, $description, $email_address, $export_results, array $header, $overwrite_conflicts, $relation_id, array $report_suite_array) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ImportCreateJob', array( + $this->setResult($resultSaint_ImportCreateJob = $this->getSoapClient()->__soapCall('Saint.ImportCreateJob', [ $check_divisions, $description, $email_address, @@ -4644,10 +4825,12 @@ public function Saint_ImportCreateJob($check_divisions, $description, $email_add $overwrite_conflicts, $relation_id, $report_suite_array, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ImportCreateJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4657,7 +4840,6 @@ public function Saint_ImportCreateJob($check_divisions, $description, $email_add * - documentation: Attaches Import data to a given Saint Import job. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $job_id * @param string $page @@ -4667,14 +4849,16 @@ public function Saint_ImportCreateJob($check_divisions, $description, $email_add public function Saint_ImportPopulateJob($job_id, $page, array $rows) { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ImportPopulateJob', array( + $this->setResult($resultSaint_ImportPopulateJob = $this->getSoapClient()->__soapCall('Saint.ImportPopulateJob', [ $job_id, $page, $rows, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSaint_ImportPopulateJob; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4684,17 +4868,18 @@ public function Saint_ImportPopulateJob($job_id, $page, array $rows) * - documentation: Returns a list of the ftp accounts configured for this company * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiSaint_ftp[]|bool */ public function Saint_ListFTP() { try { - $this->setResult($this->getSoapClient()->__soapCall('Saint.ListFTP', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultSaint_ListFTP = $this->getSoapClient()->__soapCall('Saint.ListFTP', [], [], [], $this->outputHeaders)); + + return $resultSaint_ListFTP; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4704,7 +4889,6 @@ public function Saint_ListFTP() * - documentation: Creates a new published report. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $location * @param string $product @@ -4715,15 +4899,17 @@ public function Saint_ListFTP() public function Scheduling_CreatePublishedReport($location, $product, \Api\StructType\ApiScheduledReport $scheduledReport, $workbook) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.CreatePublishedReport', array( + $this->setResult($resultScheduling_CreatePublishedReport = $this->getSoapClient()->__soapCall('Scheduling.CreatePublishedReport', [ $location, $product, $scheduledReport, $workbook, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_CreatePublishedReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4733,7 +4919,6 @@ public function Scheduling_CreatePublishedReport($location, $product, \Api\Struc * - documentation: Deletes published reports. (Internal use only) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $product * @param int[] $scheduledReportIds @@ -4742,13 +4927,15 @@ public function Scheduling_CreatePublishedReport($location, $product, \Api\Struc public function Scheduling_DeletePublishedReport($product, array $scheduledReportIds) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.DeletePublishedReport', array( + $this->setResult($resultScheduling_DeletePublishedReport = $this->getSoapClient()->__soapCall('Scheduling.DeletePublishedReport', [ $product, $scheduledReportIds, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_DeletePublishedReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4758,7 +4945,6 @@ public function Scheduling_DeletePublishedReport($product, array $scheduledRepor * - documentation: Deletes workbooks from the library. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $location * @param string $product @@ -4769,15 +4955,17 @@ public function Scheduling_DeletePublishedReport($product, array $scheduledRepor public function Scheduling_DeleteWorkbook($location, $product, $username, array $workbookNames) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.DeleteWorkbook', array( + $this->setResult($resultScheduling_DeleteWorkbook = $this->getSoapClient()->__soapCall('Scheduling.DeleteWorkbook', [ $location, $product, $username, $workbookNames, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_DeleteWorkbook; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4787,7 +4975,6 @@ public function Scheduling_DeleteWorkbook($location, $product, $username, array * - documentation: Download a workbook. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $location * @param string $productType @@ -4798,15 +4985,17 @@ public function Scheduling_DeleteWorkbook($location, $product, $username, array public function Scheduling_DownloadWorkbook($location, $productType, $username, $workbookName) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.DownloadWorkbook', array( + $this->setResult($resultScheduling_DownloadWorkbook = $this->getSoapClient()->__soapCall('Scheduling.DownloadWorkbook', [ $location, $productType, $username, $workbookName, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_DownloadWorkbook; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4816,7 +5005,6 @@ public function Scheduling_DownloadWorkbook($location, $productType, $username, * - documentation: Get published reports for a user. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $product * @param string $username @@ -4825,13 +5013,15 @@ public function Scheduling_DownloadWorkbook($location, $productType, $username, public function Scheduling_GetPublishedReports($product, $username) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.GetPublishedReports', array( + $this->setResult($resultScheduling_GetPublishedReports = $this->getSoapClient()->__soapCall('Scheduling.GetPublishedReports', [ $product, $username, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_GetPublishedReports; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4841,7 +5031,6 @@ public function Scheduling_GetPublishedReports($product, $username) * - documentation: Gets a history of reports published by a user. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $limit * @param string $offset @@ -4852,15 +5041,17 @@ public function Scheduling_GetPublishedReports($product, $username) public function Scheduling_GetReportsRunHistory($limit, $offset, $product, $username) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.GetReportsRunHistory', array( + $this->setResult($resultScheduling_GetReportsRunHistory = $this->getSoapClient()->__soapCall('Scheduling.GetReportsRunHistory', [ $limit, $offset, $product, $username, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_GetReportsRunHistory; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4870,7 +5061,6 @@ public function Scheduling_GetReportsRunHistory($limit, $offset, $product, $user * - documentation: Gets a list of workbooks for a user. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $location * @param string $product @@ -4879,13 +5069,15 @@ public function Scheduling_GetReportsRunHistory($limit, $offset, $product, $user public function Scheduling_GetWorkbookList($location, $product) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.GetWorkbookList', array( + $this->setResult($resultScheduling_GetWorkbookList = $this->getSoapClient()->__soapCall('Scheduling.GetWorkbookList', [ $location, $product, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_GetWorkbookList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4895,7 +5087,6 @@ public function Scheduling_GetWorkbookList($location, $product) * - documentation: Re-enables a failed report. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $id * @return boolean|bool @@ -4903,12 +5094,14 @@ public function Scheduling_GetWorkbookList($location, $product) public function Scheduling_ReRunReport($id) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.ReRunReport', array( + $this->setResult($resultScheduling_ReRunReport = $this->getSoapClient()->__soapCall('Scheduling.ReRunReport', [ $id, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_ReRunReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4918,7 +5111,6 @@ public function Scheduling_ReRunReport($id) * - documentation: Edits a published report. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $product * @param \Api\StructType\ApiScheduledReport $scheduledReport @@ -4928,14 +5120,16 @@ public function Scheduling_ReRunReport($id) public function Scheduling_UpdatePublishedReport($product, \Api\StructType\ApiScheduledReport $scheduledReport, $workbook) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.UpdatePublishedReport', array( + $this->setResult($resultScheduling_UpdatePublishedReport = $this->getSoapClient()->__soapCall('Scheduling.UpdatePublishedReport', [ $product, $scheduledReport, $workbook, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_UpdatePublishedReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4945,7 +5139,6 @@ public function Scheduling_UpdatePublishedReport($product, \Api\StructType\ApiSc * - documentation: Uploads a Workbook. (Internal use only.) * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $description * @param string $filename @@ -4957,16 +5150,18 @@ public function Scheduling_UpdatePublishedReport($product, \Api\StructType\ApiSc public function Scheduling_UploadWorkbook($description, $filename, $location, $product, $workbook) { try { - $this->setResult($this->getSoapClient()->__soapCall('Scheduling.UploadWorkbook', array( + $this->setResult($resultScheduling_UploadWorkbook = $this->getSoapClient()->__soapCall('Scheduling.UploadWorkbook', [ $description, $filename, $location, $product, $workbook, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultScheduling_UploadWorkbook; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -4976,7 +5171,6 @@ public function Scheduling_UploadWorkbook($description, $filename, $location, $p * - documentation: Returns the list of current surveys created for a given report suite. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $rsid * @param string $status_filter @@ -4985,13 +5179,15 @@ public function Scheduling_UploadWorkbook($description, $filename, $location, $p public function Survey_GetSummaryList($rsid, $status_filter) { try { - $this->setResult($this->getSoapClient()->__soapCall('Survey.GetSummaryList', array( + $this->setResult($resultSurvey_GetSummaryList = $this->getSoapClient()->__soapCall('Survey.GetSummaryList', [ $rsid, $status_filter, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSurvey_GetSummaryList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -5001,7 +5197,6 @@ public function Survey_GetSummaryList($rsid, $status_filter) * - documentation: Retrieves the folders the user has on their menu. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $limit * @return \Api\StructType\ApiFormatted_folder[]|bool @@ -5009,12 +5204,14 @@ public function Survey_GetSummaryList($rsid, $status_filter) public function User_GetBookmarkFolders($limit) { try { - $this->setResult($this->getSoapClient()->__soapCall('User.GetBookmarkFolders', array( + $this->setResult($resultUser_GetBookmarkFolders = $this->getSoapClient()->__soapCall('User.GetBookmarkFolders', [ $limit, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUser_GetBookmarkFolders; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -5024,7 +5221,6 @@ public function User_GetBookmarkFolders($limit) * - documentation: Retrieves a list of dashboards accessible by the user. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $limit * @return \Api\StructType\ApiDashboard_element[]|bool @@ -5032,12 +5228,14 @@ public function User_GetBookmarkFolders($limit) public function User_GetDashboardsAPI($limit) { try { - $this->setResult($this->getSoapClient()->__soapCall('User.GetDashboardsAPI', array( + $this->setResult($resultUser_GetDashboardsAPI = $this->getSoapClient()->__soapCall('User.GetDashboardsAPI', [ $limit, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUser_GetDashboardsAPI; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -5047,17 +5245,18 @@ public function User_GetDashboardsAPI($limit) * - documentation: Retrieves the last used report suite by the user. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \Api\StructType\ApiReport_suite_id|bool */ public function User_GetLastUsedReportSuite() { try { - $this->setResult($this->getSoapClient()->__soapCall('User.GetLastUsedReportSuite', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultUser_GetLastUsedReportSuite = $this->getSoapClient()->__soapCall('User.GetLastUsedReportSuite', [], [], [], $this->outputHeaders)); + + return $resultUser_GetLastUsedReportSuite; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -5067,7 +5266,6 @@ public function User_GetLastUsedReportSuite() * - documentation: Determines if the supplied email address exists is tied to a Suite login. * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $emailAddress * @return boolean|bool @@ -5075,12 +5273,14 @@ public function User_GetLastUsedReportSuite() public function User_LoginEmailExists($emailAddress) { try { - $this->setResult($this->getSoapClient()->__soapCall('User.LoginEmailExists', array( + $this->setResult($resultUser_LoginEmailExists = $this->getSoapClient()->__soapCall('User.LoginEmailExists', [ $emailAddress, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUser_LoginEmailExists; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidOmnitureTutorial.php b/tests/resources/generated/ValidOmnitureTutorial.php index 3d97857e..6ca8f542 100755 --- a/tests/resources/generated/ValidOmnitureTutorial.php +++ b/tests/resources/generated/ValidOmnitureTutorial.php @@ -5,22 +5,22 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... */ require_once __DIR__ . '/vendor/autoload.php'; /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), +]; /** * Samples for Code ServiceType */ diff --git a/tests/resources/generated/ValidPayPalApiService.php b/tests/resources/generated/ValidPayPalApiService.php index 86fa78c9..478da48f 100755 --- a/tests/resources/generated/ValidPayPalApiService.php +++ b/tests/resources/generated/ValidPayPalApiService.php @@ -1,8 +1,11 @@ setSoapHeader($nameSpace, 'RequesterCredentials', $requesterCredentials, $mustUnderstand, $actor); + return $this->setSoapHeader($namespace, 'RequesterCredentials', $requesterCredentials, $mustUnderstand, $actor); } /** * Method to call the operation originally named RefundTransaction @@ -34,7 +37,6 @@ public function setSoapHeaderRequesterCredentials(\Api\StructType\ApiCustomSecur * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiRefundTransactionReq $refundTransactionRequest * @return \Api\StructType\ApiRefundTransactionResponseType|bool @@ -42,12 +44,14 @@ public function setSoapHeaderRequesterCredentials(\Api\StructType\ApiCustomSecur public function RefundTransaction(\Api\StructType\ApiRefundTransactionReq $refundTransactionRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('RefundTransaction', array( + $this->setResult($resultRefundTransaction = $this->getSoapClient()->__soapCall('RefundTransaction', [ $refundTransactionRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultRefundTransaction; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -60,7 +64,6 @@ public function RefundTransaction(\Api\StructType\ApiRefundTransactionReq $refun * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiInitiateRecoupReq $initiateRecoupRequest * @return \Api\StructType\ApiInitiateRecoupResponseType|bool @@ -68,12 +71,14 @@ public function RefundTransaction(\Api\StructType\ApiRefundTransactionReq $refun public function InitiateRecoup(\Api\StructType\ApiInitiateRecoupReq $initiateRecoupRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('InitiateRecoup', array( + $this->setResult($resultInitiateRecoup = $this->getSoapClient()->__soapCall('InitiateRecoup', [ $initiateRecoupRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultInitiateRecoup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -86,7 +91,6 @@ public function InitiateRecoup(\Api\StructType\ApiInitiateRecoupReq $initiateRec * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCompleteRecoupReq $completeRecoupRequest * @return \Api\StructType\ApiCompleteRecoupResponseType|bool @@ -94,12 +98,14 @@ public function InitiateRecoup(\Api\StructType\ApiInitiateRecoupReq $initiateRec public function CompleteRecoup(\Api\StructType\ApiCompleteRecoupReq $completeRecoupRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('CompleteRecoup', array( + $this->setResult($resultCompleteRecoup = $this->getSoapClient()->__soapCall('CompleteRecoup', [ $completeRecoupRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCompleteRecoup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -112,7 +118,6 @@ public function CompleteRecoup(\Api\StructType\ApiCompleteRecoupReq $completeRec * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCancelRecoupReq $cancelRecoupRequest * @return \Api\StructType\ApiCancelRecoupResponseType|bool @@ -120,12 +125,14 @@ public function CompleteRecoup(\Api\StructType\ApiCompleteRecoupReq $completeRec public function CancelRecoup(\Api\StructType\ApiCancelRecoupReq $cancelRecoupRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('CancelRecoup', array( + $this->setResult($resultCancelRecoup = $this->getSoapClient()->__soapCall('CancelRecoup', [ $cancelRecoupRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCancelRecoup; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -138,7 +145,6 @@ public function CancelRecoup(\Api\StructType\ApiCancelRecoupReq $cancelRecoupReq * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetTransactionDetailsReq $getTransactionDetailsRequest * @return \Api\StructType\ApiGetTransactionDetailsResponseType|bool @@ -146,12 +152,14 @@ public function CancelRecoup(\Api\StructType\ApiCancelRecoupReq $cancelRecoupReq public function GetTransactionDetails(\Api\StructType\ApiGetTransactionDetailsReq $getTransactionDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetTransactionDetails', array( + $this->setResult($resultGetTransactionDetails = $this->getSoapClient()->__soapCall('GetTransactionDetails', [ $getTransactionDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetTransactionDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -164,7 +172,6 @@ public function GetTransactionDetails(\Api\StructType\ApiGetTransactionDetailsRe * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMCreateButtonReq $bMCreateButtonRequest * @return \Api\StructType\ApiBMCreateButtonResponseType|bool @@ -172,12 +179,14 @@ public function GetTransactionDetails(\Api\StructType\ApiGetTransactionDetailsRe public function BMCreateButton(\Api\StructType\ApiBMCreateButtonReq $bMCreateButtonRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMCreateButton', array( + $this->setResult($resultBMCreateButton = $this->getSoapClient()->__soapCall('BMCreateButton', [ $bMCreateButtonRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMCreateButton; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -190,7 +199,6 @@ public function BMCreateButton(\Api\StructType\ApiBMCreateButtonReq $bMCreateBut * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMUpdateButtonReq $bMUpdateButtonRequest * @return \Api\StructType\ApiBMUpdateButtonResponseType|bool @@ -198,12 +206,14 @@ public function BMCreateButton(\Api\StructType\ApiBMCreateButtonReq $bMCreateBut public function BMUpdateButton(\Api\StructType\ApiBMUpdateButtonReq $bMUpdateButtonRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMUpdateButton', array( + $this->setResult($resultBMUpdateButton = $this->getSoapClient()->__soapCall('BMUpdateButton', [ $bMUpdateButtonRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMUpdateButton; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -216,7 +226,6 @@ public function BMUpdateButton(\Api\StructType\ApiBMUpdateButtonReq $bMUpdateBut * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMSetInventoryReq $bMSetInventoryRequest * @return \Api\StructType\ApiBMSetInventoryResponseType|bool @@ -224,12 +233,14 @@ public function BMUpdateButton(\Api\StructType\ApiBMUpdateButtonReq $bMUpdateBut public function BMSetInventory(\Api\StructType\ApiBMSetInventoryReq $bMSetInventoryRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMSetInventory', array( + $this->setResult($resultBMSetInventory = $this->getSoapClient()->__soapCall('BMSetInventory', [ $bMSetInventoryRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMSetInventory; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -242,7 +253,6 @@ public function BMSetInventory(\Api\StructType\ApiBMSetInventoryReq $bMSetInvent * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMGetButtonDetailsReq $bMGetButtonDetailsRequest * @return \Api\StructType\ApiBMGetButtonDetailsResponseType|bool @@ -250,12 +260,14 @@ public function BMSetInventory(\Api\StructType\ApiBMSetInventoryReq $bMSetInvent public function BMGetButtonDetails(\Api\StructType\ApiBMGetButtonDetailsReq $bMGetButtonDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMGetButtonDetails', array( + $this->setResult($resultBMGetButtonDetails = $this->getSoapClient()->__soapCall('BMGetButtonDetails', [ $bMGetButtonDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMGetButtonDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -268,7 +280,6 @@ public function BMGetButtonDetails(\Api\StructType\ApiBMGetButtonDetailsReq $bMG * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMGetInventoryReq $bMGetInventoryRequest * @return \Api\StructType\ApiBMGetInventoryResponseType|bool @@ -276,12 +287,14 @@ public function BMGetButtonDetails(\Api\StructType\ApiBMGetButtonDetailsReq $bMG public function BMGetInventory(\Api\StructType\ApiBMGetInventoryReq $bMGetInventoryRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMGetInventory', array( + $this->setResult($resultBMGetInventory = $this->getSoapClient()->__soapCall('BMGetInventory', [ $bMGetInventoryRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMGetInventory; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -294,7 +307,6 @@ public function BMGetInventory(\Api\StructType\ApiBMGetInventoryReq $bMGetInvent * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMManageButtonStatusReq $bMManageButtonStatusRequest * @return \Api\StructType\ApiBMManageButtonStatusResponseType|bool @@ -302,12 +314,14 @@ public function BMGetInventory(\Api\StructType\ApiBMGetInventoryReq $bMGetInvent public function BMManageButtonStatus(\Api\StructType\ApiBMManageButtonStatusReq $bMManageButtonStatusRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMManageButtonStatus', array( + $this->setResult($resultBMManageButtonStatus = $this->getSoapClient()->__soapCall('BMManageButtonStatus', [ $bMManageButtonStatusRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMManageButtonStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -320,7 +334,6 @@ public function BMManageButtonStatus(\Api\StructType\ApiBMManageButtonStatusReq * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBMButtonSearchReq $bMButtonSearchRequest * @return \Api\StructType\ApiBMButtonSearchResponseType|bool @@ -328,12 +341,14 @@ public function BMManageButtonStatus(\Api\StructType\ApiBMManageButtonStatusReq public function BMButtonSearch(\Api\StructType\ApiBMButtonSearchReq $bMButtonSearchRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BMButtonSearch', array( + $this->setResult($resultBMButtonSearch = $this->getSoapClient()->__soapCall('BMButtonSearch', [ $bMButtonSearchRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBMButtonSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -346,7 +361,6 @@ public function BMButtonSearch(\Api\StructType\ApiBMButtonSearchReq $bMButtonSea * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBillUserReq $billUserRequest * @return \Api\StructType\ApiBillUserResponseType|bool @@ -354,12 +368,14 @@ public function BMButtonSearch(\Api\StructType\ApiBMButtonSearchReq $bMButtonSea public function BillUser(\Api\StructType\ApiBillUserReq $billUserRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BillUser', array( + $this->setResult($resultBillUser = $this->getSoapClient()->__soapCall('BillUser', [ $billUserRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBillUser; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -372,7 +388,6 @@ public function BillUser(\Api\StructType\ApiBillUserReq $billUserRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiTransactionSearchReq $transactionSearchRequest * @return \Api\StructType\ApiTransactionSearchResponseType|bool @@ -380,12 +395,14 @@ public function BillUser(\Api\StructType\ApiBillUserReq $billUserRequest) public function TransactionSearch(\Api\StructType\ApiTransactionSearchReq $transactionSearchRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('TransactionSearch', array( + $this->setResult($resultTransactionSearch = $this->getSoapClient()->__soapCall('TransactionSearch', [ $transactionSearchRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultTransactionSearch; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -398,7 +415,6 @@ public function TransactionSearch(\Api\StructType\ApiTransactionSearchReq $trans * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiMassPayReq $massPayRequest * @return \Api\StructType\ApiMassPayResponseType|bool @@ -406,12 +422,14 @@ public function TransactionSearch(\Api\StructType\ApiTransactionSearchReq $trans public function MassPay(\Api\StructType\ApiMassPayReq $massPayRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('MassPay', array( + $this->setResult($resultMassPay = $this->getSoapClient()->__soapCall('MassPay', [ $massPayRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultMassPay; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -424,7 +442,6 @@ public function MassPay(\Api\StructType\ApiMassPayReq $massPayRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBillAgreementUpdateReq $billAgreementUpdateRequest * @return \Api\StructType\ApiBAUpdateResponseType|bool @@ -432,12 +449,14 @@ public function MassPay(\Api\StructType\ApiMassPayReq $massPayRequest) public function BillAgreementUpdate(\Api\StructType\ApiBillAgreementUpdateReq $billAgreementUpdateRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BillAgreementUpdate', array( + $this->setResult($resultBillAgreementUpdate = $this->getSoapClient()->__soapCall('BillAgreementUpdate', [ $billAgreementUpdateRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBillAgreementUpdate; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -450,7 +469,6 @@ public function BillAgreementUpdate(\Api\StructType\ApiBillAgreementUpdateReq $b * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiAddressVerifyReq $addressVerifyRequest * @return \Api\StructType\ApiAddressVerifyResponseType|bool @@ -458,12 +476,14 @@ public function BillAgreementUpdate(\Api\StructType\ApiBillAgreementUpdateReq $b public function AddressVerify(\Api\StructType\ApiAddressVerifyReq $addressVerifyRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('AddressVerify', array( + $this->setResult($resultAddressVerify = $this->getSoapClient()->__soapCall('AddressVerify', [ $addressVerifyRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultAddressVerify; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -476,7 +496,6 @@ public function AddressVerify(\Api\StructType\ApiAddressVerifyReq $addressVerify * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiEnterBoardingReq $enterBoardingRequest * @return \Api\StructType\ApiEnterBoardingResponseType|bool @@ -484,12 +503,14 @@ public function AddressVerify(\Api\StructType\ApiAddressVerifyReq $addressVerify public function EnterBoarding(\Api\StructType\ApiEnterBoardingReq $enterBoardingRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('EnterBoarding', array( + $this->setResult($resultEnterBoarding = $this->getSoapClient()->__soapCall('EnterBoarding', [ $enterBoardingRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultEnterBoarding; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -502,7 +523,6 @@ public function EnterBoarding(\Api\StructType\ApiEnterBoardingReq $enterBoarding * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetBoardingDetailsReq $getBoardingDetailsRequest * @return \Api\StructType\ApiGetBoardingDetailsResponseType|bool @@ -510,12 +530,14 @@ public function EnterBoarding(\Api\StructType\ApiEnterBoardingReq $enterBoarding public function GetBoardingDetails(\Api\StructType\ApiGetBoardingDetailsReq $getBoardingDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBoardingDetails', array( + $this->setResult($resultGetBoardingDetails = $this->getSoapClient()->__soapCall('GetBoardingDetails', [ $getBoardingDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBoardingDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -528,7 +550,6 @@ public function GetBoardingDetails(\Api\StructType\ApiGetBoardingDetailsReq $get * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCreateMobilePaymentReq $createMobilePaymentRequest * @return \Api\StructType\ApiCreateMobilePaymentResponseType|bool @@ -536,12 +557,14 @@ public function GetBoardingDetails(\Api\StructType\ApiGetBoardingDetailsReq $get public function CreateMobilePayment(\Api\StructType\ApiCreateMobilePaymentReq $createMobilePaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('CreateMobilePayment', array( + $this->setResult($resultCreateMobilePayment = $this->getSoapClient()->__soapCall('CreateMobilePayment', [ $createMobilePaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCreateMobilePayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -554,7 +577,6 @@ public function CreateMobilePayment(\Api\StructType\ApiCreateMobilePaymentReq $c * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetMobileStatusReq $getMobileStatusRequest * @return \Api\StructType\ApiGetMobileStatusResponseType|bool @@ -562,12 +584,14 @@ public function CreateMobilePayment(\Api\StructType\ApiCreateMobilePaymentReq $c public function GetMobileStatus(\Api\StructType\ApiGetMobileStatusReq $getMobileStatusRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetMobileStatus', array( + $this->setResult($resultGetMobileStatus = $this->getSoapClient()->__soapCall('GetMobileStatus', [ $getMobileStatusRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetMobileStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -580,7 +604,6 @@ public function GetMobileStatus(\Api\StructType\ApiGetMobileStatusReq $getMobile * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSetMobileCheckoutReq $setMobileCheckoutRequest * @return \Api\StructType\ApiSetMobileCheckoutResponseType|bool @@ -588,12 +611,14 @@ public function GetMobileStatus(\Api\StructType\ApiGetMobileStatusReq $getMobile public function SetMobileCheckout(\Api\StructType\ApiSetMobileCheckoutReq $setMobileCheckoutRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('SetMobileCheckout', array( + $this->setResult($resultSetMobileCheckout = $this->getSoapClient()->__soapCall('SetMobileCheckout', [ $setMobileCheckoutRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSetMobileCheckout; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -606,7 +631,6 @@ public function SetMobileCheckout(\Api\StructType\ApiSetMobileCheckoutReq $setMo * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest * @return \Api\StructType\ApiDoMobileCheckoutPaymentResponseType|bool @@ -614,12 +638,14 @@ public function SetMobileCheckout(\Api\StructType\ApiSetMobileCheckoutReq $setMo public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', array( + $this->setResult($resultDoMobileCheckoutPayment = $this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', [ $doMobileCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoMobileCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -632,7 +658,6 @@ public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPayme * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetBalanceReq $getBalanceRequest * @return \Api\StructType\ApiGetBalanceResponseType|bool @@ -640,12 +665,14 @@ public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPayme public function GetBalance(\Api\StructType\ApiGetBalanceReq $getBalanceRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBalance', array( + $this->setResult($resultGetBalance = $this->getSoapClient()->__soapCall('GetBalance', [ $getBalanceRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBalance; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -658,7 +685,6 @@ public function GetBalance(\Api\StructType\ApiGetBalanceReq $getBalanceRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetPalDetailsReq $getPalDetailsRequest * @return \Api\StructType\ApiGetPalDetailsResponseType|bool @@ -666,12 +692,14 @@ public function GetBalance(\Api\StructType\ApiGetBalanceReq $getBalanceRequest) public function GetPalDetails(\Api\StructType\ApiGetPalDetailsReq $getPalDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetPalDetails', array( + $this->setResult($resultGetPalDetails = $this->getSoapClient()->__soapCall('GetPalDetails', [ $getPalDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetPalDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -684,7 +712,6 @@ public function GetPalDetails(\Api\StructType\ApiGetPalDetailsReq $getPalDetails * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest * @return \Api\StructType\ApiDoExpressCheckoutPaymentResponseType|bool @@ -692,12 +719,14 @@ public function GetPalDetails(\Api\StructType\ApiGetPalDetailsReq $getPalDetails public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', array( + $this->setResult($resultDoExpressCheckoutPayment = $this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', [ $doExpressCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoExpressCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -710,7 +739,6 @@ public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPay * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest * @return \Api\StructType\ApiDoUATPExpressCheckoutPaymentResponseType|bool @@ -718,12 +746,14 @@ public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPay public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', array( + $this->setResult($resultDoUATPExpressCheckoutPayment = $this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', [ $doUATPExpressCheckoutPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoUATPExpressCheckoutPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -736,7 +766,6 @@ public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressChe * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSetAuthFlowParamReq $setAuthFlowParamRequest * @return \Api\StructType\ApiSetAuthFlowParamResponseType|bool @@ -744,12 +773,14 @@ public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressChe public function SetAuthFlowParam(\Api\StructType\ApiSetAuthFlowParamReq $setAuthFlowParamRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('SetAuthFlowParam', array( + $this->setResult($resultSetAuthFlowParam = $this->getSoapClient()->__soapCall('SetAuthFlowParam', [ $setAuthFlowParamRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSetAuthFlowParam; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -762,7 +793,6 @@ public function SetAuthFlowParam(\Api\StructType\ApiSetAuthFlowParamReq $setAuth * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetAuthDetailsReq $getAuthDetailsRequest * @return \Api\StructType\ApiGetAuthDetailsResponseType|bool @@ -770,12 +800,14 @@ public function SetAuthFlowParam(\Api\StructType\ApiSetAuthFlowParamReq $setAuth public function GetAuthDetails(\Api\StructType\ApiGetAuthDetailsReq $getAuthDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetAuthDetails', array( + $this->setResult($resultGetAuthDetails = $this->getSoapClient()->__soapCall('GetAuthDetails', [ $getAuthDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetAuthDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -788,7 +820,6 @@ public function GetAuthDetails(\Api\StructType\ApiGetAuthDetailsReq $getAuthDeta * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSetAccessPermissionsReq $setAccessPermissionsRequest * @return \Api\StructType\ApiSetAccessPermissionsResponseType|bool @@ -796,12 +827,14 @@ public function GetAuthDetails(\Api\StructType\ApiGetAuthDetailsReq $getAuthDeta public function SetAccessPermissions(\Api\StructType\ApiSetAccessPermissionsReq $setAccessPermissionsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('SetAccessPermissions', array( + $this->setResult($resultSetAccessPermissions = $this->getSoapClient()->__soapCall('SetAccessPermissions', [ $setAccessPermissionsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSetAccessPermissions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -814,7 +847,6 @@ public function SetAccessPermissions(\Api\StructType\ApiSetAccessPermissionsReq * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiUpdateAccessPermissionsReq $updateAccessPermissionsRequest * @return \Api\StructType\ApiUpdateAccessPermissionsResponseType|bool @@ -822,12 +854,14 @@ public function SetAccessPermissions(\Api\StructType\ApiSetAccessPermissionsReq public function UpdateAccessPermissions(\Api\StructType\ApiUpdateAccessPermissionsReq $updateAccessPermissionsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('UpdateAccessPermissions', array( + $this->setResult($resultUpdateAccessPermissions = $this->getSoapClient()->__soapCall('UpdateAccessPermissions', [ $updateAccessPermissionsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUpdateAccessPermissions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -840,7 +874,6 @@ public function UpdateAccessPermissions(\Api\StructType\ApiUpdateAccessPermissio * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetAccessPermissionDetailsReq $getAccessPermissionDetailsRequest * @return \Api\StructType\ApiGetAccessPermissionDetailsResponseType|bool @@ -848,12 +881,14 @@ public function UpdateAccessPermissions(\Api\StructType\ApiUpdateAccessPermissio public function GetAccessPermissionDetails(\Api\StructType\ApiGetAccessPermissionDetailsReq $getAccessPermissionDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetAccessPermissionDetails', array( + $this->setResult($resultGetAccessPermissionDetails = $this->getSoapClient()->__soapCall('GetAccessPermissionDetails', [ $getAccessPermissionDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetAccessPermissionDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -866,7 +901,6 @@ public function GetAccessPermissionDetails(\Api\StructType\ApiGetAccessPermissio * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetIncentiveEvaluationReq $getIncentiveEvaluationRequest * @return \Api\StructType\ApiGetIncentiveEvaluationResponseType|bool @@ -874,12 +908,14 @@ public function GetAccessPermissionDetails(\Api\StructType\ApiGetAccessPermissio public function GetIncentiveEvaluation(\Api\StructType\ApiGetIncentiveEvaluationReq $getIncentiveEvaluationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetIncentiveEvaluation', array( + $this->setResult($resultGetIncentiveEvaluation = $this->getSoapClient()->__soapCall('GetIncentiveEvaluation', [ $getIncentiveEvaluationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetIncentiveEvaluation; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -892,7 +928,6 @@ public function GetIncentiveEvaluation(\Api\StructType\ApiGetIncentiveEvaluation * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSetExpressCheckoutReq $setExpressCheckoutRequest * @return \Api\StructType\ApiSetExpressCheckoutResponseType|bool @@ -900,12 +935,14 @@ public function GetIncentiveEvaluation(\Api\StructType\ApiGetIncentiveEvaluation public function SetExpressCheckout(\Api\StructType\ApiSetExpressCheckoutReq $setExpressCheckoutRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('SetExpressCheckout', array( + $this->setResult($resultSetExpressCheckout = $this->getSoapClient()->__soapCall('SetExpressCheckout', [ $setExpressCheckoutRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSetExpressCheckout; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -918,7 +955,6 @@ public function SetExpressCheckout(\Api\StructType\ApiSetExpressCheckoutReq $set * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiExecuteCheckoutOperationsReq $executeCheckoutOperationsRequest * @return \Api\StructType\ApiExecuteCheckoutOperationsResponseType|bool @@ -926,12 +962,14 @@ public function SetExpressCheckout(\Api\StructType\ApiSetExpressCheckoutReq $set public function ExecuteCheckoutOperations(\Api\StructType\ApiExecuteCheckoutOperationsReq $executeCheckoutOperationsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('ExecuteCheckoutOperations', array( + $this->setResult($resultExecuteCheckoutOperations = $this->getSoapClient()->__soapCall('ExecuteCheckoutOperations', [ $executeCheckoutOperationsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultExecuteCheckoutOperations; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -944,7 +982,6 @@ public function ExecuteCheckoutOperations(\Api\StructType\ApiExecuteCheckoutOper * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetExpressCheckoutDetailsReq $getExpressCheckoutDetailsRequest * @return \Api\StructType\ApiGetExpressCheckoutDetailsResponseType|bool @@ -952,12 +989,14 @@ public function ExecuteCheckoutOperations(\Api\StructType\ApiExecuteCheckoutOper public function GetExpressCheckoutDetails(\Api\StructType\ApiGetExpressCheckoutDetailsReq $getExpressCheckoutDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetExpressCheckoutDetails', array( + $this->setResult($resultGetExpressCheckoutDetails = $this->getSoapClient()->__soapCall('GetExpressCheckoutDetails', [ $getExpressCheckoutDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetExpressCheckoutDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -970,7 +1009,6 @@ public function GetExpressCheckoutDetails(\Api\StructType\ApiGetExpressCheckoutD * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoDirectPaymentReq $doDirectPaymentRequest * @return \Api\StructType\ApiDoDirectPaymentResponseType|bool @@ -978,12 +1016,14 @@ public function GetExpressCheckoutDetails(\Api\StructType\ApiGetExpressCheckoutD public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectPaymentRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoDirectPayment', array( + $this->setResult($resultDoDirectPayment = $this->getSoapClient()->__soapCall('DoDirectPayment', [ $doDirectPaymentRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoDirectPayment; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -996,7 +1036,6 @@ public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectP * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiManagePendingTransactionStatusReq $managePendingTransactionStatusRequest * @return \Api\StructType\ApiManagePendingTransactionStatusResponseType|bool @@ -1004,12 +1043,14 @@ public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectP public function ManagePendingTransactionStatus(\Api\StructType\ApiManagePendingTransactionStatusReq $managePendingTransactionStatusRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('ManagePendingTransactionStatus', array( + $this->setResult($resultManagePendingTransactionStatus = $this->getSoapClient()->__soapCall('ManagePendingTransactionStatus', [ $managePendingTransactionStatusRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultManagePendingTransactionStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1022,7 +1063,6 @@ public function ManagePendingTransactionStatus(\Api\StructType\ApiManagePendingT * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoCancelReq $doCancelRequest * @return \Api\StructType\ApiDoCancelResponseType|bool @@ -1030,12 +1070,14 @@ public function ManagePendingTransactionStatus(\Api\StructType\ApiManagePendingT public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoCancel', array( + $this->setResult($resultDoCancel = $this->getSoapClient()->__soapCall('DoCancel', [ $doCancelRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoCancel; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1048,7 +1090,6 @@ public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoCaptureReq $doCaptureRequest * @return \Api\StructType\ApiDoCaptureResponseType|bool @@ -1056,12 +1097,14 @@ public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest) public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoCapture', array( + $this->setResult($resultDoCapture = $this->getSoapClient()->__soapCall('DoCapture', [ $doCaptureRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoCapture; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1074,7 +1117,6 @@ public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoReauthorizationReq $doReauthorizationRequest * @return \Api\StructType\ApiDoReauthorizationResponseType|bool @@ -1082,12 +1124,14 @@ public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest) public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doReauthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoReauthorization', array( + $this->setResult($resultDoReauthorization = $this->getSoapClient()->__soapCall('DoReauthorization', [ $doReauthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoReauthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1100,7 +1144,6 @@ public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doRea * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoVoidReq $doVoidRequest * @return \Api\StructType\ApiDoVoidResponseType|bool @@ -1108,12 +1151,14 @@ public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doRea public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoVoid', array( + $this->setResult($resultDoVoid = $this->getSoapClient()->__soapCall('DoVoid', [ $doVoidRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoVoid; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1126,7 +1171,6 @@ public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest) * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoAuthorizationReq $doAuthorizationRequest * @return \Api\StructType\ApiDoAuthorizationResponseType|bool @@ -1134,12 +1178,14 @@ public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest) public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoAuthorization', array( + $this->setResult($resultDoAuthorization = $this->getSoapClient()->__soapCall('DoAuthorization', [ $doAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1152,7 +1198,6 @@ public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthori * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiUpdateAuthorizationReq $updateAuthorizationRequest * @return \Api\StructType\ApiUpdateAuthorizationResponseType|bool @@ -1160,12 +1205,14 @@ public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthori public function UpdateAuthorization(\Api\StructType\ApiUpdateAuthorizationReq $updateAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('UpdateAuthorization', array( + $this->setResult($resultUpdateAuthorization = $this->getSoapClient()->__soapCall('UpdateAuthorization', [ $updateAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUpdateAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1178,7 +1225,6 @@ public function UpdateAuthorization(\Api\StructType\ApiUpdateAuthorizationReq $u * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoUATPAuthorizationReq $doUATPAuthorizationRequest * @return \Api\StructType\ApiDoUATPAuthorizationResponseType|bool @@ -1186,12 +1232,14 @@ public function UpdateAuthorization(\Api\StructType\ApiUpdateAuthorizationReq $u public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $doUATPAuthorizationRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoUATPAuthorization', array( + $this->setResult($resultDoUATPAuthorization = $this->getSoapClient()->__soapCall('DoUATPAuthorization', [ $doUATPAuthorizationRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoUATPAuthorization; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1204,7 +1252,6 @@ public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $d * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiSetCustomerBillingAgreementReq $setCustomerBillingAgreementRequest * @return \Api\StructType\ApiSetCustomerBillingAgreementResponseType|bool @@ -1212,12 +1259,14 @@ public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $d public function SetCustomerBillingAgreement(\Api\StructType\ApiSetCustomerBillingAgreementReq $setCustomerBillingAgreementRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('SetCustomerBillingAgreement', array( + $this->setResult($resultSetCustomerBillingAgreement = $this->getSoapClient()->__soapCall('SetCustomerBillingAgreement', [ $setCustomerBillingAgreementRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultSetCustomerBillingAgreement; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1230,7 +1279,6 @@ public function SetCustomerBillingAgreement(\Api\StructType\ApiSetCustomerBillin * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetBillingAgreementCustomerDetailsReq $getBillingAgreementCustomerDetailsRequest * @return \Api\StructType\ApiGetBillingAgreementCustomerDetailsResponseType|bool @@ -1238,12 +1286,14 @@ public function SetCustomerBillingAgreement(\Api\StructType\ApiSetCustomerBillin public function GetBillingAgreementCustomerDetails(\Api\StructType\ApiGetBillingAgreementCustomerDetailsReq $getBillingAgreementCustomerDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBillingAgreementCustomerDetails', array( + $this->setResult($resultGetBillingAgreementCustomerDetails = $this->getSoapClient()->__soapCall('GetBillingAgreementCustomerDetails', [ $getBillingAgreementCustomerDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBillingAgreementCustomerDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1256,7 +1306,6 @@ public function GetBillingAgreementCustomerDetails(\Api\StructType\ApiGetBilling * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCreateBillingAgreementReq $createBillingAgreementRequest * @return \Api\StructType\ApiCreateBillingAgreementResponseType|bool @@ -1264,12 +1313,14 @@ public function GetBillingAgreementCustomerDetails(\Api\StructType\ApiGetBilling public function CreateBillingAgreement(\Api\StructType\ApiCreateBillingAgreementReq $createBillingAgreementRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('CreateBillingAgreement', array( + $this->setResult($resultCreateBillingAgreement = $this->getSoapClient()->__soapCall('CreateBillingAgreement', [ $createBillingAgreementRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCreateBillingAgreement; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1282,7 +1333,6 @@ public function CreateBillingAgreement(\Api\StructType\ApiCreateBillingAgreement * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoReferenceTransactionReq $doReferenceTransactionRequest * @return \Api\StructType\ApiDoReferenceTransactionResponseType|bool @@ -1290,12 +1340,14 @@ public function CreateBillingAgreement(\Api\StructType\ApiCreateBillingAgreement public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransactionReq $doReferenceTransactionRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoReferenceTransaction', array( + $this->setResult($resultDoReferenceTransaction = $this->getSoapClient()->__soapCall('DoReferenceTransaction', [ $doReferenceTransactionRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoReferenceTransaction; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1308,7 +1360,6 @@ public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransaction * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiCreateRecurringPaymentsProfileReq $createRecurringPaymentsProfileRequest * @return \Api\StructType\ApiCreateRecurringPaymentsProfileResponseType|bool @@ -1316,12 +1367,14 @@ public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransaction public function CreateRecurringPaymentsProfile(\Api\StructType\ApiCreateRecurringPaymentsProfileReq $createRecurringPaymentsProfileRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('CreateRecurringPaymentsProfile', array( + $this->setResult($resultCreateRecurringPaymentsProfile = $this->getSoapClient()->__soapCall('CreateRecurringPaymentsProfile', [ $createRecurringPaymentsProfileRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultCreateRecurringPaymentsProfile; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1334,7 +1387,6 @@ public function CreateRecurringPaymentsProfile(\Api\StructType\ApiCreateRecurrin * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiGetRecurringPaymentsProfileDetailsReq $getRecurringPaymentsProfileDetailsRequest * @return \Api\StructType\ApiGetRecurringPaymentsProfileDetailsResponseType|bool @@ -1342,12 +1394,14 @@ public function CreateRecurringPaymentsProfile(\Api\StructType\ApiCreateRecurrin public function GetRecurringPaymentsProfileDetails(\Api\StructType\ApiGetRecurringPaymentsProfileDetailsReq $getRecurringPaymentsProfileDetailsRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetRecurringPaymentsProfileDetails', array( + $this->setResult($resultGetRecurringPaymentsProfileDetails = $this->getSoapClient()->__soapCall('GetRecurringPaymentsProfileDetails', [ $getRecurringPaymentsProfileDetailsRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetRecurringPaymentsProfileDetails; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1361,7 +1415,6 @@ public function GetRecurringPaymentsProfileDetails(\Api\StructType\ApiGetRecurri * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiManageRecurringPaymentsProfileStatusReq $manageRecurringPaymentsProfileStatusRequest * @return \Api\StructType\ApiManageRecurringPaymentsProfileStatusResponseType|bool @@ -1369,12 +1422,14 @@ public function GetRecurringPaymentsProfileDetails(\Api\StructType\ApiGetRecurri public function ManageRecurringPaymentsProfileStatus(\Api\StructType\ApiManageRecurringPaymentsProfileStatusReq $manageRecurringPaymentsProfileStatusRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('ManageRecurringPaymentsProfileStatus', array( + $this->setResult($resultManageRecurringPaymentsProfileStatus = $this->getSoapClient()->__soapCall('ManageRecurringPaymentsProfileStatus', [ $manageRecurringPaymentsProfileStatusRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultManageRecurringPaymentsProfileStatus; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1387,7 +1442,6 @@ public function ManageRecurringPaymentsProfileStatus(\Api\StructType\ApiManageRe * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiBillOutstandingAmountReq $billOutstandingAmountRequest * @return \Api\StructType\ApiBillOutstandingAmountResponseType|bool @@ -1395,12 +1449,14 @@ public function ManageRecurringPaymentsProfileStatus(\Api\StructType\ApiManageRe public function BillOutstandingAmount(\Api\StructType\ApiBillOutstandingAmountReq $billOutstandingAmountRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('BillOutstandingAmount', array( + $this->setResult($resultBillOutstandingAmount = $this->getSoapClient()->__soapCall('BillOutstandingAmount', [ $billOutstandingAmountRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultBillOutstandingAmount; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1413,7 +1469,6 @@ public function BillOutstandingAmount(\Api\StructType\ApiBillOutstandingAmountRe * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiUpdateRecurringPaymentsProfileReq $updateRecurringPaymentsProfileRequest * @return \Api\StructType\ApiUpdateRecurringPaymentsProfileResponseType|bool @@ -1421,12 +1476,14 @@ public function BillOutstandingAmount(\Api\StructType\ApiBillOutstandingAmountRe public function UpdateRecurringPaymentsProfile(\Api\StructType\ApiUpdateRecurringPaymentsProfileReq $updateRecurringPaymentsProfileRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('UpdateRecurringPaymentsProfile', array( + $this->setResult($resultUpdateRecurringPaymentsProfile = $this->getSoapClient()->__soapCall('UpdateRecurringPaymentsProfile', [ $updateRecurringPaymentsProfileRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultUpdateRecurringPaymentsProfile; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1439,7 +1496,6 @@ public function UpdateRecurringPaymentsProfile(\Api\StructType\ApiUpdateRecurrin * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiDoNonReferencedCreditReq $doNonReferencedCreditRequest * @return \Api\StructType\ApiDoNonReferencedCreditResponseType|bool @@ -1447,12 +1503,14 @@ public function UpdateRecurringPaymentsProfile(\Api\StructType\ApiUpdateRecurrin public function DoNonReferencedCredit(\Api\StructType\ApiDoNonReferencedCreditReq $doNonReferencedCreditRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('DoNonReferencedCredit', array( + $this->setResult($resultDoNonReferencedCredit = $this->getSoapClient()->__soapCall('DoNonReferencedCredit', [ $doNonReferencedCreditRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultDoNonReferencedCredit; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1465,7 +1523,6 @@ public function DoNonReferencedCredit(\Api\StructType\ApiDoNonReferencedCreditRe * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiReverseTransactionReq $reverseTransactionRequest * @return \Api\StructType\ApiReverseTransactionResponseType|bool @@ -1473,12 +1530,14 @@ public function DoNonReferencedCredit(\Api\StructType\ApiDoNonReferencedCreditRe public function ReverseTransaction(\Api\StructType\ApiReverseTransactionReq $reverseTransactionRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('ReverseTransaction', array( + $this->setResult($resultReverseTransaction = $this->getSoapClient()->__soapCall('ReverseTransaction', [ $reverseTransactionRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultReverseTransaction; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -1491,7 +1550,6 @@ public function ReverseTransaction(\Api\StructType\ApiReverseTransactionReq $rev * - SOAPHeaders: required * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \Api\StructType\ApiExternalRememberMeOptOutReq $externalRememberMeOptOutRequest * @return \Api\StructType\ApiExternalRememberMeOptOutResponseType|bool @@ -1499,12 +1557,14 @@ public function ReverseTransaction(\Api\StructType\ApiReverseTransactionReq $rev public function ExternalRememberMeOptOut(\Api\StructType\ApiExternalRememberMeOptOutReq $externalRememberMeOptOutRequest) { try { - $this->setResult($this->getSoapClient()->__soapCall('ExternalRememberMeOptOut', array( + $this->setResult($resultExternalRememberMeOptOut = $this->getSoapClient()->__soapCall('ExternalRememberMeOptOut', [ $externalRememberMeOptOutRequest, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultExternalRememberMeOptOut; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/ValidPaymentCardType.php b/tests/resources/generated/ValidPaymentCardType.php index 33eb1d6c..d05fd4d2 100644 --- a/tests/resources/generated/ValidPaymentCardType.php +++ b/tests/resources/generated/ValidPaymentCardType.php @@ -1,8 +1,11 @@ setCardHolderName($cardHolderName) @@ -244,7 +247,7 @@ public function __construct($cardHolderName = null, \Api\StructType\ApiCardIssue * Get CardHolderName value * @return string|null */ - public function getCardHolderName() + public function getCardHolderName(): ?string { return $this->CardHolderName; } @@ -253,28 +256,29 @@ public function getCardHolderName() * @param string $cardHolderName * @return \Api\StructType\ApiPaymentCardType */ - public function setCardHolderName($cardHolderName = null) + public function setCardHolderName(?string $cardHolderName = null): self { // validation for constraint: string if (!is_null($cardHolderName) && !is_string($cardHolderName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardHolderName, true), gettype($cardHolderName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardHolderName, true), gettype($cardHolderName)), __LINE__); } // validation for constraint: maxLength(64) - if (!is_null($cardHolderName) && mb_strlen($cardHolderName) > 64) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 64', mb_strlen($cardHolderName)), __LINE__); + if (!is_null($cardHolderName) && mb_strlen((string) $cardHolderName) > 64) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 64', mb_strlen((string) $cardHolderName)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($cardHolderName) && mb_strlen($cardHolderName) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($cardHolderName)), __LINE__); + if (!is_null($cardHolderName) && mb_strlen((string) $cardHolderName) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $cardHolderName)), __LINE__); } $this->CardHolderName = $cardHolderName; + return $this; } /** * Get CardIssuerName value * @return \Api\StructType\ApiCardIssuerName|null */ - public function getCardIssuerName() + public function getCardIssuerName(): ?\Api\StructType\ApiCardIssuerName { return $this->CardIssuerName; } @@ -283,16 +287,17 @@ public function getCardIssuerName() * @param \Api\StructType\ApiCardIssuerName $cardIssuerName * @return \Api\StructType\ApiPaymentCardType */ - public function setCardIssuerName(\Api\StructType\ApiCardIssuerName $cardIssuerName = null) + public function setCardIssuerName(?\Api\StructType\ApiCardIssuerName $cardIssuerName = null): self { $this->CardIssuerName = $cardIssuerName; + return $this; } /** * Get Address value * @return \Api\StructType\ApiAddressType|null */ - public function getAddress() + public function getAddress(): ?\Api\StructType\ApiAddressType { return $this->Address; } @@ -301,16 +306,17 @@ public function getAddress() * @param \Api\StructType\ApiAddressType $address * @return \Api\StructType\ApiPaymentCardType */ - public function setAddress(\Api\StructType\ApiAddressType $address = null) + public function setAddress(?\Api\StructType\ApiAddressType $address = null): self { $this->Address = $address; + return $this; } /** * Get Telephone value - * @return \Api\StructType\ApiTelephone[]|null + * @return \Api\StructType\ApiTelephone[] */ - public function getTelephone() + public function getTelephone(): array { return $this->Telephone; } @@ -320,7 +326,7 @@ public function getTelephone() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateTelephoneForArrayConstraintsFromSetTelephone(array $values = array()) + public static function validateTelephoneForArrayConstraintsFromSetTelephone(array $values = []): string { $message = ''; $invalidValues = []; @@ -334,51 +340,54 @@ public static function validateTelephoneForArrayConstraintsFromSetTelephone(arra $message = sprintf('The Telephone property can only contain items of type \Api\StructType\ApiTelephone, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Telephone value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiTelephone[] $telephone * @return \Api\StructType\ApiPaymentCardType */ - public function setTelephone(array $telephone = array()) + public function setTelephone(array $telephone = []): self { // validation for constraint: array if ('' !== ($telephoneArrayErrorMessage = self::validateTelephoneForArrayConstraintsFromSetTelephone($telephone))) { - throw new \InvalidArgumentException($telephoneArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($telephoneArrayErrorMessage, __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($telephone) && count($telephone) > 5) { - throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($telephone)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($telephone)), __LINE__); } $this->Telephone = $telephone; + return $this; } /** * Add item to Telephone value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiTelephone $item * @return \Api\StructType\ApiPaymentCardType */ - public function addToTelephone(\Api\StructType\ApiTelephone $item) + public function addToTelephone(\Api\StructType\ApiTelephone $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiTelephone) { - throw new \InvalidArgumentException(sprintf('The Telephone property can only contain items of type \Api\StructType\ApiTelephone, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Telephone property can only contain items of type \Api\StructType\ApiTelephone, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($this->Telephone) && count($this->Telephone) >= 5) { - throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->Telephone)), __LINE__); + throw new InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->Telephone)), __LINE__); } $this->Telephone[] = $item; + return $this; } /** * Get Email value - * @return \Api\StructType\ApiEmailType[]|null + * @return \Api\StructType\ApiEmailType[] */ - public function getEmail() + public function getEmail(): array { return $this->Email; } @@ -388,7 +397,7 @@ public function getEmail() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateEmailForArrayConstraintsFromSetEmail(array $values = array()) + public static function validateEmailForArrayConstraintsFromSetEmail(array $values = []): string { $message = ''; $invalidValues = []; @@ -402,51 +411,54 @@ public static function validateEmailForArrayConstraintsFromSetEmail(array $value $message = sprintf('The Email property can only contain items of type \Api\StructType\ApiEmailType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Email value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiEmailType[] $email * @return \Api\StructType\ApiPaymentCardType */ - public function setEmail(array $email = array()) + public function setEmail(array $email = []): self { // validation for constraint: array if ('' !== ($emailArrayErrorMessage = self::validateEmailForArrayConstraintsFromSetEmail($email))) { - throw new \InvalidArgumentException($emailArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($emailArrayErrorMessage, __LINE__); } // validation for constraint: maxOccurs(3) if (is_array($email) && count($email) > 3) { - throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 3', count($email)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 3', count($email)), __LINE__); } $this->Email = $email; + return $this; } /** * Add item to Email value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiEmailType $item * @return \Api\StructType\ApiPaymentCardType */ - public function addToEmail(\Api\StructType\ApiEmailType $item) + public function addToEmail(\Api\StructType\ApiEmailType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiEmailType) { - throw new \InvalidArgumentException(sprintf('The Email property can only contain items of type \Api\StructType\ApiEmailType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Email property can only contain items of type \Api\StructType\ApiEmailType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } // validation for constraint: maxOccurs(3) if (is_array($this->Email) && count($this->Email) >= 3) { - throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 3', count($this->Email)), __LINE__); + throw new InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 3', count($this->Email)), __LINE__); } $this->Email[] = $item; + return $this; } /** * Get CardType value * @return string|null */ - public function getCardType() + public function getCardType(): ?string { return $this->CardType; } @@ -455,24 +467,25 @@ public function getCardType() * @param string $cardType * @return \Api\StructType\ApiPaymentCardType */ - public function setCardType($cardType = null) + public function setCardType(?string $cardType = null): self { // validation for constraint: string if (!is_null($cardType) && !is_string($cardType)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardType, true), gettype($cardType)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardType, true), gettype($cardType)), __LINE__); } // validation for constraint: pattern([0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}, 0AA.BBBX, ) if (!is_null($cardType) && !preg_match('/[0-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', $cardType)) { - 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($cardType, true)), __LINE__); + 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($cardType, true)), __LINE__); } $this->CardType = $cardType; + return $this; } /** * Get CardCode value * @return string|null */ - public function getCardCode() + public function getCardCode(): ?string { return $this->CardCode; } @@ -480,24 +493,25 @@ public function getCardCode() * Set CardCode value * @uses \Api\EnumType\ApiPaymentCardCodeType::valueIsValid() * @uses \Api\EnumType\ApiPaymentCardCodeType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $cardCode * @return \Api\StructType\ApiPaymentCardType */ - public function setCardCode($cardCode = null) + public function setCardCode(?string $cardCode = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiPaymentCardCodeType::valueIsValid($cardCode)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiPaymentCardCodeType', is_array($cardCode) ? implode(', ', $cardCode) : var_export($cardCode, true), implode(', ', \Api\EnumType\ApiPaymentCardCodeType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiPaymentCardCodeType', is_array($cardCode) ? implode(', ', $cardCode) : var_export($cardCode, true), implode(', ', \Api\EnumType\ApiPaymentCardCodeType::getValidValues())), __LINE__); } $this->CardCode = $cardCode; + return $this; } /** * Get CardName value * @return string|null */ - public function getCardName() + public function getCardName(): ?string { return $this->CardName; } @@ -506,20 +520,21 @@ public function getCardName() * @param string $cardName * @return \Api\StructType\ApiPaymentCardType */ - public function setCardName($cardName = null) + public function setCardName(?string $cardName = null): self { // validation for constraint: string if (!is_null($cardName) && !is_string($cardName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardName, true), gettype($cardName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardName, true), gettype($cardName)), __LINE__); } $this->CardName = $cardName; + return $this; } /** * Get CardNumber value * @return string|null */ - public function getCardNumber() + public function getCardNumber(): ?string { return $this->CardNumber; } @@ -528,24 +543,25 @@ public function getCardNumber() * @param string $cardNumber * @return \Api\StructType\ApiPaymentCardType */ - public function setCardNumber($cardNumber = null) + public function setCardNumber(?string $cardNumber = null): self { // validation for constraint: string if (!is_null($cardNumber) && !is_string($cardNumber)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardNumber, true), gettype($cardNumber)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardNumber, true), gettype($cardNumber)), __LINE__); } // validation for constraint: pattern([0-9]{1,19}) if (!is_null($cardNumber) && !preg_match('/[0-9]{1,19}/', $cardNumber)) { - 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]{1,19}/', var_export($cardNumber, true)), __LINE__); + 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]{1,19}/', var_export($cardNumber, true)), __LINE__); } $this->CardNumber = $cardNumber; + return $this; } /** * Get SeriesCode value * @return string|null */ - public function getSeriesCode() + public function getSeriesCode(): ?string { return $this->SeriesCode; } @@ -554,24 +570,25 @@ public function getSeriesCode() * @param string $seriesCode * @return \Api\StructType\ApiPaymentCardType */ - public function setSeriesCode($seriesCode = null) + public function setSeriesCode(?string $seriesCode = null): self { // validation for constraint: string if (!is_null($seriesCode) && !is_string($seriesCode)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($seriesCode, true), gettype($seriesCode)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($seriesCode, true), gettype($seriesCode)), __LINE__); } // validation for constraint: pattern([0-9]{1,8}) if (!is_null($seriesCode) && !preg_match('/[0-9]{1,8}/', $seriesCode)) { - 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]{1,8}/', var_export($seriesCode, true)), __LINE__); + 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]{1,8}/', var_export($seriesCode, true)), __LINE__); } $this->SeriesCode = $seriesCode; + return $this; } /** * Get MaskedCardNumber value * @return string|null */ - public function getMaskedCardNumber() + public function getMaskedCardNumber(): ?string { return $this->MaskedCardNumber; } @@ -580,24 +597,25 @@ public function getMaskedCardNumber() * @param string $maskedCardNumber * @return \Api\StructType\ApiPaymentCardType */ - public function setMaskedCardNumber($maskedCardNumber = null) + public function setMaskedCardNumber(?string $maskedCardNumber = null): self { // validation for constraint: string if (!is_null($maskedCardNumber) && !is_string($maskedCardNumber)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($maskedCardNumber, true), gettype($maskedCardNumber)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($maskedCardNumber, true), gettype($maskedCardNumber)), __LINE__); } // validation for constraint: pattern([0-9a-zA-Z]{1,19}) if (!is_null($maskedCardNumber) && !preg_match('/[0-9a-zA-Z]{1,19}/', $maskedCardNumber)) { - 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-9a-zA-Z]{1,19}/', var_export($maskedCardNumber, true)), __LINE__); + 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-9a-zA-Z]{1,19}/', var_export($maskedCardNumber, true)), __LINE__); } $this->MaskedCardNumber = $maskedCardNumber; + return $this; } /** * Get CardHolderRPH value * @return string|null */ - public function getCardHolderRPH() + public function getCardHolderRPH(): ?string { return $this->CardHolderRPH; } @@ -606,24 +624,25 @@ public function getCardHolderRPH() * @param string $cardHolderRPH * @return \Api\StructType\ApiPaymentCardType */ - public function setCardHolderRPH($cardHolderRPH = null) + public function setCardHolderRPH(?string $cardHolderRPH = null): self { // validation for constraint: string if (!is_null($cardHolderRPH) && !is_string($cardHolderRPH)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardHolderRPH, true), gettype($cardHolderRPH)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cardHolderRPH, true), gettype($cardHolderRPH)), __LINE__); } // validation for constraint: pattern([0-9]{1,8}) if (!is_null($cardHolderRPH) && !preg_match('/[0-9]{1,8}/', $cardHolderRPH)) { - 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]{1,8}/', var_export($cardHolderRPH, true)), __LINE__); + 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]{1,8}/', var_export($cardHolderRPH, true)), __LINE__); } $this->CardHolderRPH = $cardHolderRPH; + return $this; } /** * Get CountryOfIssue value * @return string|null */ - public function getCountryOfIssue() + public function getCountryOfIssue(): ?string { return $this->CountryOfIssue; } @@ -632,24 +651,25 @@ public function getCountryOfIssue() * @param string $countryOfIssue * @return \Api\StructType\ApiPaymentCardType */ - public function setCountryOfIssue($countryOfIssue = null) + public function setCountryOfIssue(?string $countryOfIssue = null): self { // validation for constraint: string if (!is_null($countryOfIssue) && !is_string($countryOfIssue)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($countryOfIssue, true), gettype($countryOfIssue)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($countryOfIssue, true), gettype($countryOfIssue)), __LINE__); } // validation for constraint: pattern([a-zA-Z]{2}) if (!is_null($countryOfIssue) && !preg_match('/[a-zA-Z]{2}/', $countryOfIssue)) { - 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-zA-Z]{2}/', var_export($countryOfIssue, true)), __LINE__); + 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-zA-Z]{2}/', var_export($countryOfIssue, true)), __LINE__); } $this->CountryOfIssue = $countryOfIssue; + return $this; } /** * Get Remark value * @return string|null */ - public function getRemark() + public function getRemark(): ?string { return $this->Remark; } @@ -658,28 +678,29 @@ public function getRemark() * @param string $remark * @return \Api\StructType\ApiPaymentCardType */ - public function setRemark($remark = null) + public function setRemark(?string $remark = null): self { // validation for constraint: string if (!is_null($remark) && !is_string($remark)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($remark, true), gettype($remark)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($remark, true), gettype($remark)), __LINE__); } // validation for constraint: maxLength(128) - if (!is_null($remark) && mb_strlen($remark) > 128) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 128', mb_strlen($remark)), __LINE__); + if (!is_null($remark) && mb_strlen((string) $remark) > 128) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 128', mb_strlen((string) $remark)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($remark) && mb_strlen($remark) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($remark)), __LINE__); + if (!is_null($remark) && mb_strlen((string) $remark) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $remark)), __LINE__); } $this->Remark = $remark; + return $this; } /** * Get ShareSynchInd value * @return string|null */ - public function getShareSynchInd() + public function getShareSynchInd(): ?string { return $this->ShareSynchInd; } @@ -688,20 +709,21 @@ public function getShareSynchInd() * @param string $shareSynchInd * @return \Api\StructType\ApiPaymentCardType */ - public function setShareSynchInd($shareSynchInd = null) + public function setShareSynchInd(?string $shareSynchInd = null): self { // validation for constraint: string if (!is_null($shareSynchInd) && !is_string($shareSynchInd)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareSynchInd, true), gettype($shareSynchInd)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareSynchInd, true), gettype($shareSynchInd)), __LINE__); } $this->ShareSynchInd = $shareSynchInd; + return $this; } /** * Get ShareMarketInd value * @return string|null */ - public function getShareMarketInd() + public function getShareMarketInd(): ?string { return $this->ShareMarketInd; } @@ -710,20 +732,21 @@ public function getShareMarketInd() * @param string $shareMarketInd * @return \Api\StructType\ApiPaymentCardType */ - public function setShareMarketInd($shareMarketInd = null) + public function setShareMarketInd(?string $shareMarketInd = null): self { // validation for constraint: string if (!is_null($shareMarketInd) && !is_string($shareMarketInd)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareMarketInd, true), gettype($shareMarketInd)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($shareMarketInd, true), gettype($shareMarketInd)), __LINE__); } $this->ShareMarketInd = $shareMarketInd; + return $this; } /** * Get EffectiveDate value * @return string|null */ - public function getEffectiveDate() + public function getEffectiveDate(): ?string { return $this->EffectiveDate; } @@ -732,24 +755,25 @@ public function getEffectiveDate() * @param string $effectiveDate * @return \Api\StructType\ApiPaymentCardType */ - public function setEffectiveDate($effectiveDate = null) + public function setEffectiveDate(?string $effectiveDate = null): self { // validation for constraint: string if (!is_null($effectiveDate) && !is_string($effectiveDate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($effectiveDate, true), gettype($effectiveDate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($effectiveDate, true), gettype($effectiveDate)), __LINE__); } // validation for constraint: pattern((0[1-9]|1[0-2])[0-9][0-9]) if (!is_null($effectiveDate) && !preg_match('/(0[1-9]|1[0-2])[0-9][0-9]/', $effectiveDate)) { - 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[1-9]|1[0-2])[0-9][0-9]/', var_export($effectiveDate, true)), __LINE__); + 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[1-9]|1[0-2])[0-9][0-9]/', var_export($effectiveDate, true)), __LINE__); } $this->EffectiveDate = $effectiveDate; + return $this; } /** * Get ExpireDate value * @return string|null */ - public function getExpireDate() + public function getExpireDate(): ?string { return $this->ExpireDate; } @@ -758,17 +782,18 @@ public function getExpireDate() * @param string $expireDate * @return \Api\StructType\ApiPaymentCardType */ - public function setExpireDate($expireDate = null) + public function setExpireDate(?string $expireDate = null): self { // validation for constraint: string if (!is_null($expireDate) && !is_string($expireDate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($expireDate, true), gettype($expireDate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($expireDate, true), gettype($expireDate)), __LINE__); } // validation for constraint: pattern((0[1-9]|1[0-2])[0-9][0-9]) if (!is_null($expireDate) && !preg_match('/(0[1-9]|1[0-2])[0-9][0-9]/', $expireDate)) { - 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[1-9]|1[0-2])[0-9][0-9]/', var_export($expireDate, true)), __LINE__); + 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[1-9]|1[0-2])[0-9][0-9]/', var_export($expireDate, true)), __LINE__); } $this->ExpireDate = $expireDate; + return $this; } } diff --git a/tests/resources/generated/ValidProposeNewTimeType.php b/tests/resources/generated/ValidProposeNewTimeType.php index 7929bfb8..67639b30 100644 --- a/tests/resources/generated/ValidProposeNewTimeType.php +++ b/tests/resources/generated/ValidProposeNewTimeType.php @@ -1,8 +1,11 @@ '\\Api\\StructType\\ApiRequestState', 'SetRequestForSubmitInnStatus' => '\\Api\\StructType\\ApiSetRequestForSubmitInnStatus', 'FiasAddress' => '\\Api\\StructType\\ApiFiasAddress', @@ -103,6 +105,6 @@ final public static function get() 'ReportingPeriod' => '\\Api\\StructType\\ApiReportingPeriod', 'FileObject' => '\\Api\\StructType\\ApiFileObject', 'ErrorDetails' => '\\Api\\StructType\\ApiErrorDetails', - ); + ]; } } diff --git a/tests/resources/generated/ValidReformaTutorial.php b/tests/resources/generated/ValidReformaTutorial.php index 144fad6c..7bc436e2 100755 --- a/tests/resources/generated/ValidReformaTutorial.php +++ b/tests/resources/generated/ValidReformaTutorial.php @@ -5,22 +5,22 @@ * You have to use an associative array such as: * - the key must be a constant beginning with WSDL_ from AbstractSoapClientBase class (each generated ServiceType class extends this class) * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option) - * $options = array( - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', - * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', - * ); + * $options = [ + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', + * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', + * ]; * etc... */ require_once __DIR__ . '/vendor/autoload.php'; /** * Minimal options */ -$options = array( - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', - \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), -); +$options = [ + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', + WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Api\ApiClassMap::get(), +]; /** * Samples for Login ServiceType */ diff --git a/tests/resources/generated/ValidSetExpressCheckoutRequestDetailsType.php b/tests/resources/generated/ValidSetExpressCheckoutRequestDetailsType.php index 81693fff..1e90b959 100644 --- a/tests/resources/generated/ValidSetExpressCheckoutRequestDetailsType.php +++ b/tests/resources/generated/ValidSetExpressCheckoutRequestDetailsType.php @@ -1,8 +1,11 @@ setOrderTotal($orderTotal) @@ -807,7 +810,7 @@ public function __construct(\Api\StructType\ApiBasicAmountType $orderTotal = nul * Get OrderTotal value * @return \Api\StructType\ApiBasicAmountType|null */ - public function getOrderTotal() + public function getOrderTotal(): ?\Api\StructType\ApiBasicAmountType { return $this->OrderTotal; } @@ -816,16 +819,17 @@ public function getOrderTotal() * @param \Api\StructType\ApiBasicAmountType $orderTotal * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setOrderTotal(\Api\StructType\ApiBasicAmountType $orderTotal = null) + public function setOrderTotal(?\Api\StructType\ApiBasicAmountType $orderTotal = null): self { $this->OrderTotal = $orderTotal; + return $this; } /** * Get ReturnURL value * @return string|null */ - public function getReturnURL() + public function getReturnURL(): ?string { return $this->ReturnURL; } @@ -834,20 +838,21 @@ public function getReturnURL() * @param string $returnURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setReturnURL($returnURL = null) + public function setReturnURL(?string $returnURL = null): self { // validation for constraint: string if (!is_null($returnURL) && !is_string($returnURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($returnURL, true), gettype($returnURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($returnURL, true), gettype($returnURL)), __LINE__); } $this->ReturnURL = $returnURL; + return $this; } /** * Get CancelURL value * @return string|null */ - public function getCancelURL() + public function getCancelURL(): ?string { return $this->CancelURL; } @@ -856,20 +861,21 @@ public function getCancelURL() * @param string $cancelURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCancelURL($cancelURL = null) + public function setCancelURL(?string $cancelURL = null): self { // validation for constraint: string if (!is_null($cancelURL) && !is_string($cancelURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cancelURL, true), gettype($cancelURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cancelURL, true), gettype($cancelURL)), __LINE__); } $this->CancelURL = $cancelURL; + return $this; } /** * Get TrackingImageURL value * @return string|null */ - public function getTrackingImageURL() + public function getTrackingImageURL(): ?string { return $this->TrackingImageURL; } @@ -878,20 +884,21 @@ public function getTrackingImageURL() * @param string $trackingImageURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setTrackingImageURL($trackingImageURL = null) + public function setTrackingImageURL(?string $trackingImageURL = null): self { // validation for constraint: string if (!is_null($trackingImageURL) && !is_string($trackingImageURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($trackingImageURL, true), gettype($trackingImageURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($trackingImageURL, true), gettype($trackingImageURL)), __LINE__); } $this->TrackingImageURL = $trackingImageURL; + return $this; } /** * Get giropaySuccessURL value * @return string|null */ - public function getGiropaySuccessURL() + public function getGiropaySuccessURL(): ?string { return $this->giropaySuccessURL; } @@ -900,20 +907,21 @@ public function getGiropaySuccessURL() * @param string $giropaySuccessURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiropaySuccessURL($giropaySuccessURL = null) + public function setGiropaySuccessURL(?string $giropaySuccessURL = null): self { // validation for constraint: string if (!is_null($giropaySuccessURL) && !is_string($giropaySuccessURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giropaySuccessURL, true), gettype($giropaySuccessURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giropaySuccessURL, true), gettype($giropaySuccessURL)), __LINE__); } $this->giropaySuccessURL = $giropaySuccessURL; + return $this; } /** * Get giropayCancelURL value * @return string|null */ - public function getGiropayCancelURL() + public function getGiropayCancelURL(): ?string { return $this->giropayCancelURL; } @@ -922,20 +930,21 @@ public function getGiropayCancelURL() * @param string $giropayCancelURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiropayCancelURL($giropayCancelURL = null) + public function setGiropayCancelURL(?string $giropayCancelURL = null): self { // validation for constraint: string if (!is_null($giropayCancelURL) && !is_string($giropayCancelURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giropayCancelURL, true), gettype($giropayCancelURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giropayCancelURL, true), gettype($giropayCancelURL)), __LINE__); } $this->giropayCancelURL = $giropayCancelURL; + return $this; } /** * Get BanktxnPendingURL value * @return string|null */ - public function getBanktxnPendingURL() + public function getBanktxnPendingURL(): ?string { return $this->BanktxnPendingURL; } @@ -944,20 +953,21 @@ public function getBanktxnPendingURL() * @param string $banktxnPendingURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBanktxnPendingURL($banktxnPendingURL = null) + public function setBanktxnPendingURL(?string $banktxnPendingURL = null): self { // validation for constraint: string if (!is_null($banktxnPendingURL) && !is_string($banktxnPendingURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($banktxnPendingURL, true), gettype($banktxnPendingURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($banktxnPendingURL, true), gettype($banktxnPendingURL)), __LINE__); } $this->BanktxnPendingURL = $banktxnPendingURL; + return $this; } /** * Get Token value * @return string|null */ - public function getToken() + public function getToken(): ?string { return $this->Token; } @@ -966,20 +976,21 @@ public function getToken() * @param string $token * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setToken($token = null) + public function setToken(?string $token = null): self { // validation for constraint: string if (!is_null($token) && !is_string($token)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($token, true), gettype($token)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($token, true), gettype($token)), __LINE__); } $this->Token = $token; + return $this; } /** * Get MaxAmount value * @return \Api\StructType\ApiBasicAmountType|null */ - public function getMaxAmount() + public function getMaxAmount(): ?\Api\StructType\ApiBasicAmountType { return $this->MaxAmount; } @@ -988,16 +999,17 @@ public function getMaxAmount() * @param \Api\StructType\ApiBasicAmountType $maxAmount * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setMaxAmount(\Api\StructType\ApiBasicAmountType $maxAmount = null) + public function setMaxAmount(?\Api\StructType\ApiBasicAmountType $maxAmount = null): self { $this->MaxAmount = $maxAmount; + return $this; } /** * Get OrderDescription value * @return string|null */ - public function getOrderDescription() + public function getOrderDescription(): ?string { return $this->OrderDescription; } @@ -1006,20 +1018,21 @@ public function getOrderDescription() * @param string $orderDescription * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setOrderDescription($orderDescription = null) + public function setOrderDescription(?string $orderDescription = null): self { // validation for constraint: string if (!is_null($orderDescription) && !is_string($orderDescription)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($orderDescription, true), gettype($orderDescription)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($orderDescription, true), gettype($orderDescription)), __LINE__); } $this->OrderDescription = $orderDescription; + return $this; } /** * Get Custom value * @return string|null */ - public function getCustom() + public function getCustom(): ?string { return $this->Custom; } @@ -1028,20 +1041,21 @@ public function getCustom() * @param string $custom * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCustom($custom = null) + public function setCustom(?string $custom = null): self { // validation for constraint: string if (!is_null($custom) && !is_string($custom)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($custom, true), gettype($custom)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($custom, true), gettype($custom)), __LINE__); } $this->Custom = $custom; + return $this; } /** * Get InvoiceID value * @return string|null */ - public function getInvoiceID() + public function getInvoiceID(): ?string { return $this->InvoiceID; } @@ -1050,20 +1064,21 @@ public function getInvoiceID() * @param string $invoiceID * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setInvoiceID($invoiceID = null) + public function setInvoiceID(?string $invoiceID = null): self { // validation for constraint: string if (!is_null($invoiceID) && !is_string($invoiceID)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($invoiceID, true), gettype($invoiceID)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($invoiceID, true), gettype($invoiceID)), __LINE__); } $this->InvoiceID = $invoiceID; + return $this; } /** * Get ReqConfirmShipping value * @return string|null */ - public function getReqConfirmShipping() + public function getReqConfirmShipping(): ?string { return $this->ReqConfirmShipping; } @@ -1072,20 +1087,21 @@ public function getReqConfirmShipping() * @param string $reqConfirmShipping * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setReqConfirmShipping($reqConfirmShipping = null) + public function setReqConfirmShipping(?string $reqConfirmShipping = null): self { // validation for constraint: string if (!is_null($reqConfirmShipping) && !is_string($reqConfirmShipping)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reqConfirmShipping, true), gettype($reqConfirmShipping)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reqConfirmShipping, true), gettype($reqConfirmShipping)), __LINE__); } $this->ReqConfirmShipping = $reqConfirmShipping; + return $this; } /** * Get ReqBillingAddress value * @return string|null */ - public function getReqBillingAddress() + public function getReqBillingAddress(): ?string { return $this->ReqBillingAddress; } @@ -1094,20 +1110,21 @@ public function getReqBillingAddress() * @param string $reqBillingAddress * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setReqBillingAddress($reqBillingAddress = null) + public function setReqBillingAddress(?string $reqBillingAddress = null): self { // validation for constraint: string if (!is_null($reqBillingAddress) && !is_string($reqBillingAddress)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reqBillingAddress, true), gettype($reqBillingAddress)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reqBillingAddress, true), gettype($reqBillingAddress)), __LINE__); } $this->ReqBillingAddress = $reqBillingAddress; + return $this; } /** * Get BillingAddress value * @return \Api\StructType\ApiAddressType|null */ - public function getBillingAddress() + public function getBillingAddress(): ?\Api\StructType\ApiAddressType { return $this->BillingAddress; } @@ -1116,16 +1133,17 @@ public function getBillingAddress() * @param \Api\StructType\ApiAddressType $billingAddress * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBillingAddress(\Api\StructType\ApiAddressType $billingAddress = null) + public function setBillingAddress(?\Api\StructType\ApiAddressType $billingAddress = null): self { $this->BillingAddress = $billingAddress; + return $this; } /** * Get NoShipping value * @return string|null */ - public function getNoShipping() + public function getNoShipping(): ?string { return $this->NoShipping; } @@ -1134,20 +1152,21 @@ public function getNoShipping() * @param string $noShipping * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setNoShipping($noShipping = null) + public function setNoShipping(?string $noShipping = null): self { // validation for constraint: string if (!is_null($noShipping) && !is_string($noShipping)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($noShipping, true), gettype($noShipping)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($noShipping, true), gettype($noShipping)), __LINE__); } $this->NoShipping = $noShipping; + return $this; } /** * Get AddressOverride value * @return string|null */ - public function getAddressOverride() + public function getAddressOverride(): ?string { return $this->AddressOverride; } @@ -1156,20 +1175,21 @@ public function getAddressOverride() * @param string $addressOverride * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setAddressOverride($addressOverride = null) + public function setAddressOverride(?string $addressOverride = null): self { // validation for constraint: string if (!is_null($addressOverride) && !is_string($addressOverride)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($addressOverride, true), gettype($addressOverride)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($addressOverride, true), gettype($addressOverride)), __LINE__); } $this->AddressOverride = $addressOverride; + return $this; } /** * Get LocaleCode value * @return string|null */ - public function getLocaleCode() + public function getLocaleCode(): ?string { return $this->LocaleCode; } @@ -1178,20 +1198,21 @@ public function getLocaleCode() * @param string $localeCode * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setLocaleCode($localeCode = null) + public function setLocaleCode(?string $localeCode = null): self { // validation for constraint: string if (!is_null($localeCode) && !is_string($localeCode)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($localeCode, true), gettype($localeCode)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($localeCode, true), gettype($localeCode)), __LINE__); } $this->LocaleCode = $localeCode; + return $this; } /** * Get PageStyle value * @return string|null */ - public function getPageStyle() + public function getPageStyle(): ?string { return $this->PageStyle; } @@ -1200,20 +1221,21 @@ public function getPageStyle() * @param string $pageStyle * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setPageStyle($pageStyle = null) + public function setPageStyle(?string $pageStyle = null): self { // validation for constraint: string if (!is_null($pageStyle) && !is_string($pageStyle)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($pageStyle, true), gettype($pageStyle)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($pageStyle, true), gettype($pageStyle)), __LINE__); } $this->PageStyle = $pageStyle; + return $this; } /** * Get cpp_header_image value * @return string|null */ - public function getCpp_header_image() + public function getCpp_header_image(): ?string { return $this->{'cpp-header-image'}; } @@ -1222,20 +1244,21 @@ public function getCpp_header_image() * @param string $cpp_header_image * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCpp_header_image($cpp_header_image = null) + public function setCpp_header_image(?string $cpp_header_image = null): self { // validation for constraint: string if (!is_null($cpp_header_image) && !is_string($cpp_header_image)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_header_image, true), gettype($cpp_header_image)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_header_image, true), gettype($cpp_header_image)), __LINE__); } $this->cpp_header_image = $this->{'cpp-header-image'} = $cpp_header_image; + return $this; } /** * Get cpp_header_border_color value * @return string|null */ - public function getCpp_header_border_color() + public function getCpp_header_border_color(): ?string { return $this->{'cpp-header-border-color'}; } @@ -1244,20 +1267,21 @@ public function getCpp_header_border_color() * @param string $cpp_header_border_color * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCpp_header_border_color($cpp_header_border_color = null) + public function setCpp_header_border_color(?string $cpp_header_border_color = null): self { // validation for constraint: string if (!is_null($cpp_header_border_color) && !is_string($cpp_header_border_color)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_header_border_color, true), gettype($cpp_header_border_color)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_header_border_color, true), gettype($cpp_header_border_color)), __LINE__); } $this->cpp_header_border_color = $this->{'cpp-header-border-color'} = $cpp_header_border_color; + return $this; } /** * Get cpp_header_back_color value * @return string|null */ - public function getCpp_header_back_color() + public function getCpp_header_back_color(): ?string { return $this->{'cpp-header-back-color'}; } @@ -1266,20 +1290,21 @@ public function getCpp_header_back_color() * @param string $cpp_header_back_color * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCpp_header_back_color($cpp_header_back_color = null) + public function setCpp_header_back_color(?string $cpp_header_back_color = null): self { // validation for constraint: string if (!is_null($cpp_header_back_color) && !is_string($cpp_header_back_color)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_header_back_color, true), gettype($cpp_header_back_color)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_header_back_color, true), gettype($cpp_header_back_color)), __LINE__); } $this->cpp_header_back_color = $this->{'cpp-header-back-color'} = $cpp_header_back_color; + return $this; } /** * Get cpp_payflow_color value * @return string|null */ - public function getCpp_payflow_color() + public function getCpp_payflow_color(): ?string { return $this->{'cpp-payflow-color'}; } @@ -1288,20 +1313,21 @@ public function getCpp_payflow_color() * @param string $cpp_payflow_color * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCpp_payflow_color($cpp_payflow_color = null) + public function setCpp_payflow_color(?string $cpp_payflow_color = null): self { // validation for constraint: string if (!is_null($cpp_payflow_color) && !is_string($cpp_payflow_color)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_payflow_color, true), gettype($cpp_payflow_color)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_payflow_color, true), gettype($cpp_payflow_color)), __LINE__); } $this->cpp_payflow_color = $this->{'cpp-payflow-color'} = $cpp_payflow_color; + return $this; } /** * Get cpp_cart_border_color value * @return string|null */ - public function getCpp_cart_border_color() + public function getCpp_cart_border_color(): ?string { return $this->{'cpp-cart-border-color'}; } @@ -1310,20 +1336,21 @@ public function getCpp_cart_border_color() * @param string $cpp_cart_border_color * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCpp_cart_border_color($cpp_cart_border_color = null) + public function setCpp_cart_border_color(?string $cpp_cart_border_color = null): self { // validation for constraint: string if (!is_null($cpp_cart_border_color) && !is_string($cpp_cart_border_color)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_cart_border_color, true), gettype($cpp_cart_border_color)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_cart_border_color, true), gettype($cpp_cart_border_color)), __LINE__); } $this->cpp_cart_border_color = $this->{'cpp-cart-border-color'} = $cpp_cart_border_color; + return $this; } /** * Get cpp_logo_image value * @return string|null */ - public function getCpp_logo_image() + public function getCpp_logo_image(): ?string { return $this->{'cpp-logo-image'}; } @@ -1332,20 +1359,21 @@ public function getCpp_logo_image() * @param string $cpp_logo_image * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCpp_logo_image($cpp_logo_image = null) + public function setCpp_logo_image(?string $cpp_logo_image = null): self { // validation for constraint: string if (!is_null($cpp_logo_image) && !is_string($cpp_logo_image)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_logo_image, true), gettype($cpp_logo_image)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($cpp_logo_image, true), gettype($cpp_logo_image)), __LINE__); } $this->cpp_logo_image = $this->{'cpp-logo-image'} = $cpp_logo_image; + return $this; } /** * Get Address value * @return \Api\StructType\ApiAddressType|null */ - public function getAddress() + public function getAddress(): ?\Api\StructType\ApiAddressType { return $this->Address; } @@ -1354,16 +1382,17 @@ public function getAddress() * @param \Api\StructType\ApiAddressType $address * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setAddress(\Api\StructType\ApiAddressType $address = null) + public function setAddress(?\Api\StructType\ApiAddressType $address = null): self { $this->Address = $address; + return $this; } /** * Get PaymentAction value * @return string|null */ - public function getPaymentAction() + public function getPaymentAction(): ?string { return $this->PaymentAction; } @@ -1371,24 +1400,25 @@ public function getPaymentAction() * Set PaymentAction value * @uses \Api\EnumType\ApiPaymentActionCodeType::valueIsValid() * @uses \Api\EnumType\ApiPaymentActionCodeType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $paymentAction * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setPaymentAction($paymentAction = null) + public function setPaymentAction(?string $paymentAction = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiPaymentActionCodeType::valueIsValid($paymentAction)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiPaymentActionCodeType', is_array($paymentAction) ? implode(', ', $paymentAction) : var_export($paymentAction, true), implode(', ', \Api\EnumType\ApiPaymentActionCodeType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiPaymentActionCodeType', is_array($paymentAction) ? implode(', ', $paymentAction) : var_export($paymentAction, true), implode(', ', \Api\EnumType\ApiPaymentActionCodeType::getValidValues())), __LINE__); } $this->PaymentAction = $paymentAction; + return $this; } /** * Get SolutionType value * @return string|null */ - public function getSolutionType() + public function getSolutionType(): ?string { return $this->SolutionType; } @@ -1396,24 +1426,25 @@ public function getSolutionType() * Set SolutionType value * @uses \Api\EnumType\ApiSolutionTypeType::valueIsValid() * @uses \Api\EnumType\ApiSolutionTypeType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $solutionType * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setSolutionType($solutionType = null) + public function setSolutionType(?string $solutionType = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiSolutionTypeType::valueIsValid($solutionType)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiSolutionTypeType', is_array($solutionType) ? implode(', ', $solutionType) : var_export($solutionType, true), implode(', ', \Api\EnumType\ApiSolutionTypeType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiSolutionTypeType', is_array($solutionType) ? implode(', ', $solutionType) : var_export($solutionType, true), implode(', ', \Api\EnumType\ApiSolutionTypeType::getValidValues())), __LINE__); } $this->SolutionType = $solutionType; + return $this; } /** * Get LandingPage value * @return string|null */ - public function getLandingPage() + public function getLandingPage(): ?string { return $this->LandingPage; } @@ -1421,24 +1452,25 @@ public function getLandingPage() * Set LandingPage value * @uses \Api\EnumType\ApiLandingPageType::valueIsValid() * @uses \Api\EnumType\ApiLandingPageType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $landingPage * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setLandingPage($landingPage = null) + public function setLandingPage(?string $landingPage = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiLandingPageType::valueIsValid($landingPage)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiLandingPageType', is_array($landingPage) ? implode(', ', $landingPage) : var_export($landingPage, true), implode(', ', \Api\EnumType\ApiLandingPageType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiLandingPageType', is_array($landingPage) ? implode(', ', $landingPage) : var_export($landingPage, true), implode(', ', \Api\EnumType\ApiLandingPageType::getValidValues())), __LINE__); } $this->LandingPage = $landingPage; + return $this; } /** * Get BuyerEmail value * @return string|null */ - public function getBuyerEmail() + public function getBuyerEmail(): ?string { return $this->BuyerEmail; } @@ -1447,20 +1479,21 @@ public function getBuyerEmail() * @param string $buyerEmail * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBuyerEmail($buyerEmail = null) + public function setBuyerEmail(?string $buyerEmail = null): self { // validation for constraint: string if (!is_null($buyerEmail) && !is_string($buyerEmail)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buyerEmail, true), gettype($buyerEmail)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buyerEmail, true), gettype($buyerEmail)), __LINE__); } $this->BuyerEmail = $buyerEmail; + return $this; } /** * Get ChannelType value * @return string|null */ - public function getChannelType() + public function getChannelType(): ?string { return $this->ChannelType; } @@ -1468,24 +1501,25 @@ public function getChannelType() * Set ChannelType value * @uses \Api\EnumType\ApiChannelType::valueIsValid() * @uses \Api\EnumType\ApiChannelType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $channelType * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setChannelType($channelType = null) + public function setChannelType(?string $channelType = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiChannelType::valueIsValid($channelType)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiChannelType', is_array($channelType) ? implode(', ', $channelType) : var_export($channelType, true), implode(', ', \Api\EnumType\ApiChannelType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiChannelType', is_array($channelType) ? implode(', ', $channelType) : var_export($channelType, true), implode(', ', \Api\EnumType\ApiChannelType::getValidValues())), __LINE__); } $this->ChannelType = $channelType; + return $this; } /** * Get BillingAgreementDetails value - * @return \Api\StructType\ApiBillingAgreementDetailsType[]|null + * @return \Api\StructType\ApiBillingAgreementDetailsType[] */ - public function getBillingAgreementDetails() + public function getBillingAgreementDetails(): array { return $this->BillingAgreementDetails; } @@ -1495,7 +1529,7 @@ public function getBillingAgreementDetails() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateBillingAgreementDetailsForArrayConstraintsFromSetBillingAgreementDetails(array $values = array()) + public static function validateBillingAgreementDetailsForArrayConstraintsFromSetBillingAgreementDetails(array $values = []): string { $message = ''; $invalidValues = []; @@ -1509,43 +1543,46 @@ public static function validateBillingAgreementDetailsForArrayConstraintsFromSet $message = sprintf('The BillingAgreementDetails property can only contain items of type \Api\StructType\ApiBillingAgreementDetailsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set BillingAgreementDetails value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiBillingAgreementDetailsType[] $billingAgreementDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBillingAgreementDetails(array $billingAgreementDetails = array()) + public function setBillingAgreementDetails(array $billingAgreementDetails = []): self { // validation for constraint: array if ('' !== ($billingAgreementDetailsArrayErrorMessage = self::validateBillingAgreementDetailsForArrayConstraintsFromSetBillingAgreementDetails($billingAgreementDetails))) { - throw new \InvalidArgumentException($billingAgreementDetailsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($billingAgreementDetailsArrayErrorMessage, __LINE__); } $this->BillingAgreementDetails = $billingAgreementDetails; + return $this; } /** * Add item to BillingAgreementDetails value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiBillingAgreementDetailsType $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToBillingAgreementDetails(\Api\StructType\ApiBillingAgreementDetailsType $item) + public function addToBillingAgreementDetails(\Api\StructType\ApiBillingAgreementDetailsType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiBillingAgreementDetailsType) { - throw new \InvalidArgumentException(sprintf('The BillingAgreementDetails property can only contain items of type \Api\StructType\ApiBillingAgreementDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The BillingAgreementDetails property can only contain items of type \Api\StructType\ApiBillingAgreementDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->BillingAgreementDetails[] = $item; + return $this; } /** * Get PromoCodes value - * @return string[]|null + * @return string[] */ - public function getPromoCodes() + public function getPromoCodes(): array { return $this->PromoCodes; } @@ -1555,7 +1592,7 @@ public function getPromoCodes() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validatePromoCodesForArrayConstraintsFromSetPromoCodes(array $values = array()) + public static function validatePromoCodesForArrayConstraintsFromSetPromoCodes(array $values = []): string { $message = ''; $invalidValues = []; @@ -1569,43 +1606,46 @@ public static function validatePromoCodesForArrayConstraintsFromSetPromoCodes(ar $message = sprintf('The PromoCodes property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set PromoCodes value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $promoCodes * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setPromoCodes(array $promoCodes = array()) + public function setPromoCodes(array $promoCodes = []): self { // validation for constraint: array if ('' !== ($promoCodesArrayErrorMessage = self::validatePromoCodesForArrayConstraintsFromSetPromoCodes($promoCodes))) { - throw new \InvalidArgumentException($promoCodesArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($promoCodesArrayErrorMessage, __LINE__); } $this->PromoCodes = $promoCodes; + return $this; } /** * Add item to PromoCodes value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToPromoCodes($item) + public function addToPromoCodes(string $item): self { // validation for constraint: itemType if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The PromoCodes property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The PromoCodes property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->PromoCodes[] = $item; + return $this; } /** * Get PayPalCheckOutBtnType value * @return string|null */ - public function getPayPalCheckOutBtnType() + public function getPayPalCheckOutBtnType(): ?string { return $this->PayPalCheckOutBtnType; } @@ -1614,20 +1654,21 @@ public function getPayPalCheckOutBtnType() * @param string $payPalCheckOutBtnType * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setPayPalCheckOutBtnType($payPalCheckOutBtnType = null) + public function setPayPalCheckOutBtnType(?string $payPalCheckOutBtnType = null): self { // validation for constraint: string if (!is_null($payPalCheckOutBtnType) && !is_string($payPalCheckOutBtnType)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($payPalCheckOutBtnType, true), gettype($payPalCheckOutBtnType)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($payPalCheckOutBtnType, true), gettype($payPalCheckOutBtnType)), __LINE__); } $this->PayPalCheckOutBtnType = $payPalCheckOutBtnType; + return $this; } /** * Get ProductCategory value * @return string|null */ - public function getProductCategory() + public function getProductCategory(): ?string { return $this->ProductCategory; } @@ -1635,24 +1676,25 @@ public function getProductCategory() * Set ProductCategory value * @uses \Api\EnumType\ApiProductCategoryType::valueIsValid() * @uses \Api\EnumType\ApiProductCategoryType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $productCategory * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setProductCategory($productCategory = null) + public function setProductCategory(?string $productCategory = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiProductCategoryType::valueIsValid($productCategory)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiProductCategoryType', is_array($productCategory) ? implode(', ', $productCategory) : var_export($productCategory, true), implode(', ', \Api\EnumType\ApiProductCategoryType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiProductCategoryType', is_array($productCategory) ? implode(', ', $productCategory) : var_export($productCategory, true), implode(', ', \Api\EnumType\ApiProductCategoryType::getValidValues())), __LINE__); } $this->ProductCategory = $productCategory; + return $this; } /** * Get ShippingMethod value * @return string|null */ - public function getShippingMethod() + public function getShippingMethod(): ?string { return $this->ShippingMethod; } @@ -1660,24 +1702,25 @@ public function getShippingMethod() * Set ShippingMethod value * @uses \Api\EnumType\ApiShippingServiceCodeType::valueIsValid() * @uses \Api\EnumType\ApiShippingServiceCodeType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $shippingMethod * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setShippingMethod($shippingMethod = null) + public function setShippingMethod(?string $shippingMethod = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiShippingServiceCodeType::valueIsValid($shippingMethod)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiShippingServiceCodeType', is_array($shippingMethod) ? implode(', ', $shippingMethod) : var_export($shippingMethod, true), implode(', ', \Api\EnumType\ApiShippingServiceCodeType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiShippingServiceCodeType', is_array($shippingMethod) ? implode(', ', $shippingMethod) : var_export($shippingMethod, true), implode(', ', \Api\EnumType\ApiShippingServiceCodeType::getValidValues())), __LINE__); } $this->ShippingMethod = $shippingMethod; + return $this; } /** * Get ProfileAddressChangeDate value * @return string|null */ - public function getProfileAddressChangeDate() + public function getProfileAddressChangeDate(): ?string { return $this->ProfileAddressChangeDate; } @@ -1686,20 +1729,21 @@ public function getProfileAddressChangeDate() * @param string $profileAddressChangeDate * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setProfileAddressChangeDate($profileAddressChangeDate = null) + public function setProfileAddressChangeDate(?string $profileAddressChangeDate = null): self { // validation for constraint: string if (!is_null($profileAddressChangeDate) && !is_string($profileAddressChangeDate)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($profileAddressChangeDate, true), gettype($profileAddressChangeDate)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($profileAddressChangeDate, true), gettype($profileAddressChangeDate)), __LINE__); } $this->ProfileAddressChangeDate = $profileAddressChangeDate; + return $this; } /** * Get AllowNote value * @return string|null */ - public function getAllowNote() + public function getAllowNote(): ?string { return $this->AllowNote; } @@ -1708,20 +1752,21 @@ public function getAllowNote() * @param string $allowNote * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setAllowNote($allowNote = null) + public function setAllowNote(?string $allowNote = null): self { // validation for constraint: string if (!is_null($allowNote) && !is_string($allowNote)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($allowNote, true), gettype($allowNote)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($allowNote, true), gettype($allowNote)), __LINE__); } $this->AllowNote = $allowNote; + return $this; } /** * Get FundingSourceDetails value * @return \Api\StructType\ApiFundingSourceDetailsType|null */ - public function getFundingSourceDetails() + public function getFundingSourceDetails(): ?\Api\StructType\ApiFundingSourceDetailsType { return $this->FundingSourceDetails; } @@ -1730,16 +1775,17 @@ public function getFundingSourceDetails() * @param \Api\StructType\ApiFundingSourceDetailsType $fundingSourceDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setFundingSourceDetails(\Api\StructType\ApiFundingSourceDetailsType $fundingSourceDetails = null) + public function setFundingSourceDetails(?\Api\StructType\ApiFundingSourceDetailsType $fundingSourceDetails = null): self { $this->FundingSourceDetails = $fundingSourceDetails; + return $this; } /** * Get BrandName value * @return string|null */ - public function getBrandName() + public function getBrandName(): ?string { return $this->BrandName; } @@ -1748,20 +1794,21 @@ public function getBrandName() * @param string $brandName * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBrandName($brandName = null) + public function setBrandName(?string $brandName = null): self { // validation for constraint: string if (!is_null($brandName) && !is_string($brandName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brandName, true), gettype($brandName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brandName, true), gettype($brandName)), __LINE__); } $this->BrandName = $brandName; + return $this; } /** * Get CallbackURL value * @return string|null */ - public function getCallbackURL() + public function getCallbackURL(): ?string { return $this->CallbackURL; } @@ -1770,20 +1817,21 @@ public function getCallbackURL() * @param string $callbackURL * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCallbackURL($callbackURL = null) + public function setCallbackURL(?string $callbackURL = null): self { // validation for constraint: string if (!is_null($callbackURL) && !is_string($callbackURL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callbackURL, true), gettype($callbackURL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callbackURL, true), gettype($callbackURL)), __LINE__); } $this->CallbackURL = $callbackURL; + return $this; } /** * Get EnhancedCheckoutData value * @return \Api\StructType\ApiEnhancedCheckoutDataType|null */ - public function getEnhancedCheckoutData() + public function getEnhancedCheckoutData(): ?\Api\StructType\ApiEnhancedCheckoutDataType { return $this->EnhancedCheckoutData; } @@ -1792,16 +1840,17 @@ public function getEnhancedCheckoutData() * @param \Api\StructType\ApiEnhancedCheckoutDataType $enhancedCheckoutData * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setEnhancedCheckoutData(\Api\StructType\ApiEnhancedCheckoutDataType $enhancedCheckoutData = null) + public function setEnhancedCheckoutData(?\Api\StructType\ApiEnhancedCheckoutDataType $enhancedCheckoutData = null): self { $this->EnhancedCheckoutData = $enhancedCheckoutData; + return $this; } /** * Get OtherPaymentMethods value - * @return \Api\StructType\ApiOtherPaymentMethodDetailsType[]|null + * @return \Api\StructType\ApiOtherPaymentMethodDetailsType[] */ - public function getOtherPaymentMethods() + public function getOtherPaymentMethods(): array { return $this->OtherPaymentMethods; } @@ -1811,7 +1860,7 @@ public function getOtherPaymentMethods() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateOtherPaymentMethodsForArrayConstraintsFromSetOtherPaymentMethods(array $values = array()) + public static function validateOtherPaymentMethodsForArrayConstraintsFromSetOtherPaymentMethods(array $values = []): string { $message = ''; $invalidValues = []; @@ -1825,43 +1874,46 @@ public static function validateOtherPaymentMethodsForArrayConstraintsFromSetOthe $message = sprintf('The OtherPaymentMethods property can only contain items of type \Api\StructType\ApiOtherPaymentMethodDetailsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set OtherPaymentMethods value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiOtherPaymentMethodDetailsType[] $otherPaymentMethods * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setOtherPaymentMethods(array $otherPaymentMethods = array()) + public function setOtherPaymentMethods(array $otherPaymentMethods = []): self { // validation for constraint: array if ('' !== ($otherPaymentMethodsArrayErrorMessage = self::validateOtherPaymentMethodsForArrayConstraintsFromSetOtherPaymentMethods($otherPaymentMethods))) { - throw new \InvalidArgumentException($otherPaymentMethodsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($otherPaymentMethodsArrayErrorMessage, __LINE__); } $this->OtherPaymentMethods = $otherPaymentMethods; + return $this; } /** * Add item to OtherPaymentMethods value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiOtherPaymentMethodDetailsType $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToOtherPaymentMethods(\Api\StructType\ApiOtherPaymentMethodDetailsType $item) + public function addToOtherPaymentMethods(\Api\StructType\ApiOtherPaymentMethodDetailsType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiOtherPaymentMethodDetailsType) { - throw new \InvalidArgumentException(sprintf('The OtherPaymentMethods property can only contain items of type \Api\StructType\ApiOtherPaymentMethodDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The OtherPaymentMethods property can only contain items of type \Api\StructType\ApiOtherPaymentMethodDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->OtherPaymentMethods[] = $item; + return $this; } /** * Get BuyerDetails value * @return \Api\StructType\ApiBuyerDetailsType|null */ - public function getBuyerDetails() + public function getBuyerDetails(): ?\Api\StructType\ApiBuyerDetailsType { return $this->BuyerDetails; } @@ -1870,16 +1922,17 @@ public function getBuyerDetails() * @param \Api\StructType\ApiBuyerDetailsType $buyerDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBuyerDetails(\Api\StructType\ApiBuyerDetailsType $buyerDetails = null) + public function setBuyerDetails(?\Api\StructType\ApiBuyerDetailsType $buyerDetails = null): self { $this->BuyerDetails = $buyerDetails; + return $this; } /** * Get PaymentDetails value - * @return \Api\StructType\ApiPaymentDetailsType[]|null + * @return \Api\StructType\ApiPaymentDetailsType[] */ - public function getPaymentDetails() + public function getPaymentDetails(): array { return $this->PaymentDetails; } @@ -1889,7 +1942,7 @@ public function getPaymentDetails() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validatePaymentDetailsForArrayConstraintsFromSetPaymentDetails(array $values = array()) + public static function validatePaymentDetailsForArrayConstraintsFromSetPaymentDetails(array $values = []): string { $message = ''; $invalidValues = []; @@ -1903,51 +1956,54 @@ public static function validatePaymentDetailsForArrayConstraintsFromSetPaymentDe $message = sprintf('The PaymentDetails property can only contain items of type \Api\StructType\ApiPaymentDetailsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set PaymentDetails value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiPaymentDetailsType[] $paymentDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setPaymentDetails(array $paymentDetails = array()) + public function setPaymentDetails(array $paymentDetails = []): self { // validation for constraint: array if ('' !== ($paymentDetailsArrayErrorMessage = self::validatePaymentDetailsForArrayConstraintsFromSetPaymentDetails($paymentDetails))) { - throw new \InvalidArgumentException($paymentDetailsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($paymentDetailsArrayErrorMessage, __LINE__); } // validation for constraint: maxOccurs(10) if (is_array($paymentDetails) && count($paymentDetails) > 10) { - throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 10', count($paymentDetails)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 10', count($paymentDetails)), __LINE__); } $this->PaymentDetails = $paymentDetails; + return $this; } /** * Add item to PaymentDetails value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiPaymentDetailsType $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToPaymentDetails(\Api\StructType\ApiPaymentDetailsType $item) + public function addToPaymentDetails(\Api\StructType\ApiPaymentDetailsType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiPaymentDetailsType) { - throw new \InvalidArgumentException(sprintf('The PaymentDetails property can only contain items of type \Api\StructType\ApiPaymentDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The PaymentDetails property can only contain items of type \Api\StructType\ApiPaymentDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } // validation for constraint: maxOccurs(10) if (is_array($this->PaymentDetails) && count($this->PaymentDetails) >= 10) { - throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 10', count($this->PaymentDetails)), __LINE__); + throw new InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 10', count($this->PaymentDetails)), __LINE__); } $this->PaymentDetails[] = $item; + return $this; } /** * Get FlatRateShippingOptions value - * @return \Api\StructType\ApiShippingOptionType[]|null + * @return \Api\StructType\ApiShippingOptionType[] */ - public function getFlatRateShippingOptions() + public function getFlatRateShippingOptions(): array { return $this->FlatRateShippingOptions; } @@ -1957,7 +2013,7 @@ public function getFlatRateShippingOptions() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateFlatRateShippingOptionsForArrayConstraintsFromSetFlatRateShippingOptions(array $values = array()) + public static function validateFlatRateShippingOptionsForArrayConstraintsFromSetFlatRateShippingOptions(array $values = []): string { $message = ''; $invalidValues = []; @@ -1971,43 +2027,46 @@ public static function validateFlatRateShippingOptionsForArrayConstraintsFromSet $message = sprintf('The FlatRateShippingOptions property can only contain items of type \Api\StructType\ApiShippingOptionType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set FlatRateShippingOptions value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiShippingOptionType[] $flatRateShippingOptions * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setFlatRateShippingOptions(array $flatRateShippingOptions = array()) + public function setFlatRateShippingOptions(array $flatRateShippingOptions = []): self { // validation for constraint: array if ('' !== ($flatRateShippingOptionsArrayErrorMessage = self::validateFlatRateShippingOptionsForArrayConstraintsFromSetFlatRateShippingOptions($flatRateShippingOptions))) { - throw new \InvalidArgumentException($flatRateShippingOptionsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($flatRateShippingOptionsArrayErrorMessage, __LINE__); } $this->FlatRateShippingOptions = $flatRateShippingOptions; + return $this; } /** * Add item to FlatRateShippingOptions value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiShippingOptionType $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToFlatRateShippingOptions(\Api\StructType\ApiShippingOptionType $item) + public function addToFlatRateShippingOptions(\Api\StructType\ApiShippingOptionType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiShippingOptionType) { - throw new \InvalidArgumentException(sprintf('The FlatRateShippingOptions property can only contain items of type \Api\StructType\ApiShippingOptionType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The FlatRateShippingOptions property can only contain items of type \Api\StructType\ApiShippingOptionType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->FlatRateShippingOptions[] = $item; + return $this; } /** * Get CallbackTimeout value * @return string|null */ - public function getCallbackTimeout() + public function getCallbackTimeout(): ?string { return $this->CallbackTimeout; } @@ -2016,20 +2075,21 @@ public function getCallbackTimeout() * @param string $callbackTimeout * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCallbackTimeout($callbackTimeout = null) + public function setCallbackTimeout(?string $callbackTimeout = null): self { // validation for constraint: string if (!is_null($callbackTimeout) && !is_string($callbackTimeout)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callbackTimeout, true), gettype($callbackTimeout)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callbackTimeout, true), gettype($callbackTimeout)), __LINE__); } $this->CallbackTimeout = $callbackTimeout; + return $this; } /** * Get CallbackVersion value * @return string|null */ - public function getCallbackVersion() + public function getCallbackVersion(): ?string { return $this->CallbackVersion; } @@ -2038,20 +2098,21 @@ public function getCallbackVersion() * @param string $callbackVersion * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCallbackVersion($callbackVersion = null) + public function setCallbackVersion(?string $callbackVersion = null): self { // validation for constraint: string if (!is_null($callbackVersion) && !is_string($callbackVersion)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callbackVersion, true), gettype($callbackVersion)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($callbackVersion, true), gettype($callbackVersion)), __LINE__); } $this->CallbackVersion = $callbackVersion; + return $this; } /** * Get CustomerServiceNumber value * @return string|null */ - public function getCustomerServiceNumber() + public function getCustomerServiceNumber(): ?string { return $this->CustomerServiceNumber; } @@ -2060,20 +2121,21 @@ public function getCustomerServiceNumber() * @param string $customerServiceNumber * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCustomerServiceNumber($customerServiceNumber = null) + public function setCustomerServiceNumber(?string $customerServiceNumber = null): self { // validation for constraint: string if (!is_null($customerServiceNumber) && !is_string($customerServiceNumber)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($customerServiceNumber, true), gettype($customerServiceNumber)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($customerServiceNumber, true), gettype($customerServiceNumber)), __LINE__); } $this->CustomerServiceNumber = $customerServiceNumber; + return $this; } /** * Get GiftMessageEnable value * @return string|null */ - public function getGiftMessageEnable() + public function getGiftMessageEnable(): ?string { return $this->GiftMessageEnable; } @@ -2082,20 +2144,21 @@ public function getGiftMessageEnable() * @param string $giftMessageEnable * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiftMessageEnable($giftMessageEnable = null) + public function setGiftMessageEnable(?string $giftMessageEnable = null): self { // validation for constraint: string if (!is_null($giftMessageEnable) && !is_string($giftMessageEnable)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftMessageEnable, true), gettype($giftMessageEnable)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftMessageEnable, true), gettype($giftMessageEnable)), __LINE__); } $this->GiftMessageEnable = $giftMessageEnable; + return $this; } /** * Get GiftReceiptEnable value * @return string|null */ - public function getGiftReceiptEnable() + public function getGiftReceiptEnable(): ?string { return $this->GiftReceiptEnable; } @@ -2104,20 +2167,21 @@ public function getGiftReceiptEnable() * @param string $giftReceiptEnable * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiftReceiptEnable($giftReceiptEnable = null) + public function setGiftReceiptEnable(?string $giftReceiptEnable = null): self { // validation for constraint: string if (!is_null($giftReceiptEnable) && !is_string($giftReceiptEnable)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftReceiptEnable, true), gettype($giftReceiptEnable)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftReceiptEnable, true), gettype($giftReceiptEnable)), __LINE__); } $this->GiftReceiptEnable = $giftReceiptEnable; + return $this; } /** * Get GiftWrapEnable value * @return string|null */ - public function getGiftWrapEnable() + public function getGiftWrapEnable(): ?string { return $this->GiftWrapEnable; } @@ -2126,20 +2190,21 @@ public function getGiftWrapEnable() * @param string $giftWrapEnable * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiftWrapEnable($giftWrapEnable = null) + public function setGiftWrapEnable(?string $giftWrapEnable = null): self { // validation for constraint: string if (!is_null($giftWrapEnable) && !is_string($giftWrapEnable)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftWrapEnable, true), gettype($giftWrapEnable)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftWrapEnable, true), gettype($giftWrapEnable)), __LINE__); } $this->GiftWrapEnable = $giftWrapEnable; + return $this; } /** * Get GiftWrapName value * @return string|null */ - public function getGiftWrapName() + public function getGiftWrapName(): ?string { return $this->GiftWrapName; } @@ -2148,20 +2213,21 @@ public function getGiftWrapName() * @param string $giftWrapName * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiftWrapName($giftWrapName = null) + public function setGiftWrapName(?string $giftWrapName = null): self { // validation for constraint: string if (!is_null($giftWrapName) && !is_string($giftWrapName)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftWrapName, true), gettype($giftWrapName)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftWrapName, true), gettype($giftWrapName)), __LINE__); } $this->GiftWrapName = $giftWrapName; + return $this; } /** * Get GiftWrapAmount value * @return \Api\StructType\ApiBasicAmountType|null */ - public function getGiftWrapAmount() + public function getGiftWrapAmount(): ?\Api\StructType\ApiBasicAmountType { return $this->GiftWrapAmount; } @@ -2170,16 +2236,17 @@ public function getGiftWrapAmount() * @param \Api\StructType\ApiBasicAmountType $giftWrapAmount * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setGiftWrapAmount(\Api\StructType\ApiBasicAmountType $giftWrapAmount = null) + public function setGiftWrapAmount(?\Api\StructType\ApiBasicAmountType $giftWrapAmount = null): self { $this->GiftWrapAmount = $giftWrapAmount; + return $this; } /** * Get BuyerEmailOptInEnable value * @return string|null */ - public function getBuyerEmailOptInEnable() + public function getBuyerEmailOptInEnable(): ?string { return $this->BuyerEmailOptInEnable; } @@ -2188,20 +2255,21 @@ public function getBuyerEmailOptInEnable() * @param string $buyerEmailOptInEnable * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setBuyerEmailOptInEnable($buyerEmailOptInEnable = null) + public function setBuyerEmailOptInEnable(?string $buyerEmailOptInEnable = null): self { // validation for constraint: string if (!is_null($buyerEmailOptInEnable) && !is_string($buyerEmailOptInEnable)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buyerEmailOptInEnable, true), gettype($buyerEmailOptInEnable)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buyerEmailOptInEnable, true), gettype($buyerEmailOptInEnable)), __LINE__); } $this->BuyerEmailOptInEnable = $buyerEmailOptInEnable; + return $this; } /** * Get SurveyEnable value * @return string|null */ - public function getSurveyEnable() + public function getSurveyEnable(): ?string { return $this->SurveyEnable; } @@ -2210,20 +2278,21 @@ public function getSurveyEnable() * @param string $surveyEnable * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setSurveyEnable($surveyEnable = null) + public function setSurveyEnable(?string $surveyEnable = null): self { // validation for constraint: string if (!is_null($surveyEnable) && !is_string($surveyEnable)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($surveyEnable, true), gettype($surveyEnable)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($surveyEnable, true), gettype($surveyEnable)), __LINE__); } $this->SurveyEnable = $surveyEnable; + return $this; } /** * Get SurveyQuestion value * @return string|null */ - public function getSurveyQuestion() + public function getSurveyQuestion(): ?string { return $this->SurveyQuestion; } @@ -2232,20 +2301,21 @@ public function getSurveyQuestion() * @param string $surveyQuestion * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setSurveyQuestion($surveyQuestion = null) + public function setSurveyQuestion(?string $surveyQuestion = null): self { // validation for constraint: string if (!is_null($surveyQuestion) && !is_string($surveyQuestion)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($surveyQuestion, true), gettype($surveyQuestion)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($surveyQuestion, true), gettype($surveyQuestion)), __LINE__); } $this->SurveyQuestion = $surveyQuestion; + return $this; } /** * Get SurveyChoice value - * @return string[]|null + * @return string[] */ - public function getSurveyChoice() + public function getSurveyChoice(): array { return $this->SurveyChoice; } @@ -2255,7 +2325,7 @@ public function getSurveyChoice() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateSurveyChoiceForArrayConstraintsFromSetSurveyChoice(array $values = array()) + public static function validateSurveyChoiceForArrayConstraintsFromSetSurveyChoice(array $values = []): string { $message = ''; $invalidValues = []; @@ -2269,43 +2339,46 @@ public static function validateSurveyChoiceForArrayConstraintsFromSetSurveyChoic $message = sprintf('The SurveyChoice property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set SurveyChoice value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string[] $surveyChoice * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setSurveyChoice(array $surveyChoice = array()) + public function setSurveyChoice(array $surveyChoice = []): self { // validation for constraint: array if ('' !== ($surveyChoiceArrayErrorMessage = self::validateSurveyChoiceForArrayConstraintsFromSetSurveyChoice($surveyChoice))) { - throw new \InvalidArgumentException($surveyChoiceArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($surveyChoiceArrayErrorMessage, __LINE__); } $this->SurveyChoice = $surveyChoice; + return $this; } /** * Add item to SurveyChoice value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToSurveyChoice($item) + public function addToSurveyChoice(string $item): self { // validation for constraint: itemType if (!is_string($item)) { - throw new \InvalidArgumentException(sprintf('The SurveyChoice property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The SurveyChoice property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->SurveyChoice[] = $item; + return $this; } /** * Get TotalType value * @return string|null */ - public function getTotalType() + public function getTotalType(): ?string { return $this->TotalType; } @@ -2313,24 +2386,25 @@ public function getTotalType() * Set TotalType value * @uses \Api\EnumType\ApiTotalType::valueIsValid() * @uses \Api\EnumType\ApiTotalType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $totalType * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setTotalType($totalType = null) + public function setTotalType(?string $totalType = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiTotalType::valueIsValid($totalType)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiTotalType', is_array($totalType) ? implode(', ', $totalType) : var_export($totalType, true), implode(', ', \Api\EnumType\ApiTotalType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiTotalType', is_array($totalType) ? implode(', ', $totalType) : var_export($totalType, true), implode(', ', \Api\EnumType\ApiTotalType::getValidValues())), __LINE__); } $this->TotalType = $totalType; + return $this; } /** * Get NoteToBuyer value * @return string|null */ - public function getNoteToBuyer() + public function getNoteToBuyer(): ?string { return $this->NoteToBuyer; } @@ -2339,20 +2413,21 @@ public function getNoteToBuyer() * @param string $noteToBuyer * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setNoteToBuyer($noteToBuyer = null) + public function setNoteToBuyer(?string $noteToBuyer = null): self { // validation for constraint: string if (!is_null($noteToBuyer) && !is_string($noteToBuyer)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($noteToBuyer, true), gettype($noteToBuyer)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($noteToBuyer, true), gettype($noteToBuyer)), __LINE__); } $this->NoteToBuyer = $noteToBuyer; + return $this; } /** * Get Incentives value - * @return \Api\StructType\ApiIncentiveInfoType[]|null + * @return \Api\StructType\ApiIncentiveInfoType[] */ - public function getIncentives() + public function getIncentives(): array { return $this->Incentives; } @@ -2362,7 +2437,7 @@ public function getIncentives() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateIncentivesForArrayConstraintsFromSetIncentives(array $values = array()) + public static function validateIncentivesForArrayConstraintsFromSetIncentives(array $values = []): string { $message = ''; $invalidValues = []; @@ -2376,43 +2451,46 @@ public static function validateIncentivesForArrayConstraintsFromSetIncentives(ar $message = sprintf('The Incentives property can only contain items of type \Api\StructType\ApiIncentiveInfoType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set Incentives value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiIncentiveInfoType[] $incentives * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setIncentives(array $incentives = array()) + public function setIncentives(array $incentives = []): self { // validation for constraint: array if ('' !== ($incentivesArrayErrorMessage = self::validateIncentivesForArrayConstraintsFromSetIncentives($incentives))) { - throw new \InvalidArgumentException($incentivesArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($incentivesArrayErrorMessage, __LINE__); } $this->Incentives = $incentives; + return $this; } /** * Add item to Incentives value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiIncentiveInfoType $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToIncentives(\Api\StructType\ApiIncentiveInfoType $item) + public function addToIncentives(\Api\StructType\ApiIncentiveInfoType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiIncentiveInfoType) { - throw new \InvalidArgumentException(sprintf('The Incentives property can only contain items of type \Api\StructType\ApiIncentiveInfoType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The Incentives property can only contain items of type \Api\StructType\ApiIncentiveInfoType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } $this->Incentives[] = $item; + return $this; } /** * Get ReqInstrumentDetails value * @return string|null */ - public function getReqInstrumentDetails() + public function getReqInstrumentDetails(): ?string { return $this->ReqInstrumentDetails; } @@ -2421,20 +2499,21 @@ public function getReqInstrumentDetails() * @param string $reqInstrumentDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setReqInstrumentDetails($reqInstrumentDetails = null) + public function setReqInstrumentDetails(?string $reqInstrumentDetails = null): self { // validation for constraint: string if (!is_null($reqInstrumentDetails) && !is_string($reqInstrumentDetails)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reqInstrumentDetails, true), gettype($reqInstrumentDetails)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reqInstrumentDetails, true), gettype($reqInstrumentDetails)), __LINE__); } $this->ReqInstrumentDetails = $reqInstrumentDetails; + return $this; } /** * Get ExternalRememberMeOptInDetails value * @return \Api\StructType\ApiExternalRememberMeOptInDetailsType|null */ - public function getExternalRememberMeOptInDetails() + public function getExternalRememberMeOptInDetails(): ?\Api\StructType\ApiExternalRememberMeOptInDetailsType { return $this->ExternalRememberMeOptInDetails; } @@ -2443,16 +2522,17 @@ public function getExternalRememberMeOptInDetails() * @param \Api\StructType\ApiExternalRememberMeOptInDetailsType $externalRememberMeOptInDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setExternalRememberMeOptInDetails(\Api\StructType\ApiExternalRememberMeOptInDetailsType $externalRememberMeOptInDetails = null) + public function setExternalRememberMeOptInDetails(?\Api\StructType\ApiExternalRememberMeOptInDetailsType $externalRememberMeOptInDetails = null): self { $this->ExternalRememberMeOptInDetails = $externalRememberMeOptInDetails; + return $this; } /** * Get FlowControlDetails value * @return \Api\StructType\ApiFlowControlDetailsType|null */ - public function getFlowControlDetails() + public function getFlowControlDetails(): ?\Api\StructType\ApiFlowControlDetailsType { return $this->FlowControlDetails; } @@ -2461,16 +2541,17 @@ public function getFlowControlDetails() * @param \Api\StructType\ApiFlowControlDetailsType $flowControlDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setFlowControlDetails(\Api\StructType\ApiFlowControlDetailsType $flowControlDetails = null) + public function setFlowControlDetails(?\Api\StructType\ApiFlowControlDetailsType $flowControlDetails = null): self { $this->FlowControlDetails = $flowControlDetails; + return $this; } /** * Get DisplayControlDetails value * @return \Api\StructType\ApiDisplayControlDetailsType|null */ - public function getDisplayControlDetails() + public function getDisplayControlDetails(): ?\Api\StructType\ApiDisplayControlDetailsType { return $this->DisplayControlDetails; } @@ -2479,16 +2560,17 @@ public function getDisplayControlDetails() * @param \Api\StructType\ApiDisplayControlDetailsType $displayControlDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setDisplayControlDetails(\Api\StructType\ApiDisplayControlDetailsType $displayControlDetails = null) + public function setDisplayControlDetails(?\Api\StructType\ApiDisplayControlDetailsType $displayControlDetails = null): self { $this->DisplayControlDetails = $displayControlDetails; + return $this; } /** * Get ExternalPartnerTrackingDetails value * @return \Api\StructType\ApiExternalPartnerTrackingDetailsType|null */ - public function getExternalPartnerTrackingDetails() + public function getExternalPartnerTrackingDetails(): ?\Api\StructType\ApiExternalPartnerTrackingDetailsType { return $this->ExternalPartnerTrackingDetails; } @@ -2497,16 +2579,17 @@ public function getExternalPartnerTrackingDetails() * @param \Api\StructType\ApiExternalPartnerTrackingDetailsType $externalPartnerTrackingDetails * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setExternalPartnerTrackingDetails(\Api\StructType\ApiExternalPartnerTrackingDetailsType $externalPartnerTrackingDetails = null) + public function setExternalPartnerTrackingDetails(?\Api\StructType\ApiExternalPartnerTrackingDetailsType $externalPartnerTrackingDetails = null): self { $this->ExternalPartnerTrackingDetails = $externalPartnerTrackingDetails; + return $this; } /** * Get CoupledBuckets value - * @return \Api\StructType\ApiCoupledBucketsType[]|null + * @return \Api\StructType\ApiCoupledBucketsType[] */ - public function getCoupledBuckets() + public function getCoupledBuckets(): array { return $this->CoupledBuckets; } @@ -2516,7 +2599,7 @@ public function getCoupledBuckets() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateCoupledBucketsForArrayConstraintsFromSetCoupledBuckets(array $values = array()) + public static function validateCoupledBucketsForArrayConstraintsFromSetCoupledBuckets(array $values = []): string { $message = ''; $invalidValues = []; @@ -2530,44 +2613,47 @@ public static function validateCoupledBucketsForArrayConstraintsFromSetCoupledBu $message = sprintf('The CoupledBuckets property can only contain items of type \Api\StructType\ApiCoupledBucketsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set CoupledBuckets value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiCoupledBucketsType[] $coupledBuckets * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function setCoupledBuckets(array $coupledBuckets = array()) + public function setCoupledBuckets(array $coupledBuckets = []): self { // validation for constraint: array if ('' !== ($coupledBucketsArrayErrorMessage = self::validateCoupledBucketsForArrayConstraintsFromSetCoupledBuckets($coupledBuckets))) { - throw new \InvalidArgumentException($coupledBucketsArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($coupledBucketsArrayErrorMessage, __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($coupledBuckets) && count($coupledBuckets) > 5) { - throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($coupledBuckets)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($coupledBuckets)), __LINE__); } $this->CoupledBuckets = $coupledBuckets; + return $this; } /** * Add item to CoupledBuckets value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiCoupledBucketsType $item * @return \Api\StructType\ApiSetExpressCheckoutRequestDetailsType */ - public function addToCoupledBuckets(\Api\StructType\ApiCoupledBucketsType $item) + public function addToCoupledBuckets(\Api\StructType\ApiCoupledBucketsType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiCoupledBucketsType) { - throw new \InvalidArgumentException(sprintf('The CoupledBuckets property can only contain items of type \Api\StructType\ApiCoupledBucketsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The CoupledBuckets property can only contain items of type \Api\StructType\ApiCoupledBucketsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($this->CoupledBuckets) && count($this->CoupledBuckets) >= 5) { - throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->CoupledBuckets)), __LINE__); + throw new InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->CoupledBuckets)), __LINE__); } $this->CoupledBuckets[] = $item; + return $this; } } diff --git a/tests/resources/generated/ValidShopper.php b/tests/resources/generated/ValidShopper.php index 0c71de52..fa6082a0 100644 --- a/tests/resources/generated/ValidShopper.php +++ b/tests/resources/generated/ValidShopper.php @@ -1,8 +1,11 @@ setName($name) @@ -148,7 +151,7 @@ public function __construct(\Api\StructType\ApiName $name = null, $email = null, * Get name value * @return \Api\StructType\ApiName */ - public function getName() + public function getName(): \Api\StructType\ApiName { return $this->name; } @@ -157,16 +160,17 @@ public function getName() * @param \Api\StructType\ApiName $name * @return \Api\StructType\ApiShopper */ - public function setName(\Api\StructType\ApiName $name = null) + public function setName(\Api\StructType\ApiName $name): self { $this->name = $name; + return $this; } /** * Get email value * @return string */ - public function getEmail() + public function getEmail(): string { return $this->email; } @@ -175,32 +179,33 @@ public function getEmail() * @param string $email * @return \Api\StructType\ApiShopper */ - public function setEmail($email = null) + public function setEmail(string $email): self { // validation for constraint: string if (!is_null($email) && !is_string($email)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($email, true), gettype($email)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($email, true), gettype($email)), __LINE__); } // validation for constraint: maxLength(100) - if (!is_null($email) && mb_strlen($email) > 100) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 100', mb_strlen($email)), __LINE__); + if (!is_null($email) && mb_strlen((string) $email) > 100) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 100', mb_strlen((string) $email)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($email) && mb_strlen($email) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($email)), __LINE__); + if (!is_null($email) && mb_strlen((string) $email) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $email)), __LINE__); } // validation for constraint: pattern([_a-zA-Z0-9\-\+\.]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]+)) if (!is_null($email) && !preg_match('/[_a-zA-Z0-9\\-\\+\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\.[a-zA-Z]+)/', $email)) { - 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-zA-Z0-9\\-\\+\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\.[a-zA-Z]+)/', var_export($email, true)), __LINE__); + 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-zA-Z0-9\\-\\+\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\.[a-zA-Z]+)/', var_export($email, true)), __LINE__); } $this->email = $email; + return $this; } /** * Get language value * @return \Api\StructType\ApiLanguage */ - public function getLanguage() + public function getLanguage(): \Api\StructType\ApiLanguage { return $this->language; } @@ -209,16 +214,17 @@ public function getLanguage() * @param \Api\StructType\ApiLanguage $language * @return \Api\StructType\ApiShopper */ - public function setLanguage(\Api\StructType\ApiLanguage $language = null) + public function setLanguage(\Api\StructType\ApiLanguage $language): self { $this->language = $language; + return $this; } /** * Get gender value * @return string */ - public function getGender() + public function getGender(): string { return $this->gender; } @@ -226,24 +232,25 @@ public function getGender() * Set gender value * @uses \Api\EnumType\ApiGender::valueIsValid() * @uses \Api\EnumType\ApiGender::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $gender * @return \Api\StructType\ApiShopper */ - public function setGender($gender = null) + public function setGender(string $gender): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiGender::valueIsValid($gender)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiGender', is_array($gender) ? implode(', ', $gender) : var_export($gender, true), implode(', ', \Api\EnumType\ApiGender::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiGender', is_array($gender) ? implode(', ', $gender) : var_export($gender, true), implode(', ', \Api\EnumType\ApiGender::getValidValues())), __LINE__); } $this->gender = $gender; + return $this; } /** * Get id value * @return string */ - public function getId() + public function getId(): string { return $this->id; } @@ -252,28 +259,29 @@ public function getId() * @param string $id * @return \Api\StructType\ApiShopper */ - public function setId($id = null) + 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__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($id, true), gettype($id)), __LINE__); } // validation for constraint: maxLength(35) - if (!is_null($id) && mb_strlen($id) > 35) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 35', mb_strlen($id)), __LINE__); + if (!is_null($id) && mb_strlen((string) $id) > 35) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 35', mb_strlen((string) $id)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($id) && mb_strlen($id) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($id)), __LINE__); + if (!is_null($id) && mb_strlen((string) $id) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $id)), __LINE__); } $this->id = $id; + return $this; } /** * Get dateOfBirth value * @return string|null */ - public function getDateOfBirth() + public function getDateOfBirth(): ?string { return $this->dateOfBirth; } @@ -282,28 +290,29 @@ public function getDateOfBirth() * @param string $dateOfBirth * @return \Api\StructType\ApiShopper */ - public function setDateOfBirth($dateOfBirth = null) + public function setDateOfBirth(?string $dateOfBirth = null): self { // validation for constraint: string if (!is_null($dateOfBirth) && !is_string($dateOfBirth)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($dateOfBirth, true), gettype($dateOfBirth)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($dateOfBirth, true), gettype($dateOfBirth)), __LINE__); } // validation for constraint: maxLength(10) - if (!is_null($dateOfBirth) && mb_strlen($dateOfBirth) > 10) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 10', mb_strlen($dateOfBirth)), __LINE__); + if (!is_null($dateOfBirth) && mb_strlen((string) $dateOfBirth) > 10) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 10', mb_strlen((string) $dateOfBirth)), __LINE__); } // validation for constraint: minLength(10) - if (!is_null($dateOfBirth) && mb_strlen($dateOfBirth) < 10) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 10', mb_strlen($dateOfBirth)), __LINE__); + if (!is_null($dateOfBirth) && mb_strlen((string) $dateOfBirth) < 10) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 10', mb_strlen((string) $dateOfBirth)), __LINE__); } $this->dateOfBirth = $dateOfBirth; + return $this; } /** * Get phoneNumber value * @return string|null */ - public function getPhoneNumber() + public function getPhoneNumber(): ?string { return $this->phoneNumber; } @@ -312,28 +321,29 @@ public function getPhoneNumber() * @param string $phoneNumber * @return \Api\StructType\ApiShopper */ - public function setPhoneNumber($phoneNumber = null) + public function setPhoneNumber(?string $phoneNumber = null): self { // validation for constraint: string if (!is_null($phoneNumber) && !is_string($phoneNumber)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($phoneNumber, true), gettype($phoneNumber)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($phoneNumber, true), gettype($phoneNumber)), __LINE__); } // validation for constraint: maxLength(50) - if (!is_null($phoneNumber) && mb_strlen($phoneNumber) > 50) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 50', mb_strlen($phoneNumber)), __LINE__); + if (!is_null($phoneNumber) && mb_strlen((string) $phoneNumber) > 50) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 50', mb_strlen((string) $phoneNumber)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($phoneNumber) && mb_strlen($phoneNumber) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($phoneNumber)), __LINE__); + if (!is_null($phoneNumber) && mb_strlen((string) $phoneNumber) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $phoneNumber)), __LINE__); } $this->phoneNumber = $phoneNumber; + return $this; } /** * Get mobilePhoneNumber value * @return string|null */ - public function getMobilePhoneNumber() + public function getMobilePhoneNumber(): ?string { return $this->mobilePhoneNumber; } @@ -342,28 +352,29 @@ public function getMobilePhoneNumber() * @param string $mobilePhoneNumber * @return \Api\StructType\ApiShopper */ - public function setMobilePhoneNumber($mobilePhoneNumber = null) + public function setMobilePhoneNumber(?string $mobilePhoneNumber = null): self { // validation for constraint: string if (!is_null($mobilePhoneNumber) && !is_string($mobilePhoneNumber)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($mobilePhoneNumber, true), gettype($mobilePhoneNumber)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($mobilePhoneNumber, true), gettype($mobilePhoneNumber)), __LINE__); } // validation for constraint: maxLength(50) - if (!is_null($mobilePhoneNumber) && mb_strlen($mobilePhoneNumber) > 50) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 50', mb_strlen($mobilePhoneNumber)), __LINE__); + if (!is_null($mobilePhoneNumber) && mb_strlen((string) $mobilePhoneNumber) > 50) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 50', mb_strlen((string) $mobilePhoneNumber)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($mobilePhoneNumber) && mb_strlen($mobilePhoneNumber) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($mobilePhoneNumber)), __LINE__); + if (!is_null($mobilePhoneNumber) && mb_strlen((string) $mobilePhoneNumber) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $mobilePhoneNumber)), __LINE__); } $this->mobilePhoneNumber = $mobilePhoneNumber; + return $this; } /** * Get ipAddress value * @return string|null */ - public function getIpAddress() + public function getIpAddress(): ?string { return $this->ipAddress; } @@ -372,21 +383,22 @@ public function getIpAddress() * @param string $ipAddress * @return \Api\StructType\ApiShopper */ - public function setIpAddress($ipAddress = null) + public function setIpAddress(?string $ipAddress = null): self { // validation for constraint: string if (!is_null($ipAddress) && !is_string($ipAddress)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($ipAddress, true), gettype($ipAddress)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($ipAddress, true), gettype($ipAddress)), __LINE__); } // validation for constraint: maxLength(35) - if (!is_null($ipAddress) && mb_strlen($ipAddress) > 35) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 35', mb_strlen($ipAddress)), __LINE__); + if (!is_null($ipAddress) && mb_strlen((string) $ipAddress) > 35) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 35', mb_strlen((string) $ipAddress)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($ipAddress) && mb_strlen($ipAddress) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($ipAddress)), __LINE__); + if (!is_null($ipAddress) && mb_strlen((string) $ipAddress) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $ipAddress)), __LINE__); } $this->ipAddress = $ipAddress; + return $this; } } diff --git a/tests/resources/generated/ValidTaxType.php b/tests/resources/generated/ValidTaxType.php index ac76b0ee..64d5fe2f 100644 --- a/tests/resources/generated/ValidTaxType.php +++ b/tests/resources/generated/ValidTaxType.php @@ -1,8 +1,11 @@ setTaxDescription($taxDescription) @@ -117,9 +120,9 @@ public function __construct(array $taxDescription = array(), $type = null, $code } /** * Get TaxDescription value - * @return \Api\StructType\ApiParagraphType[]|null + * @return \Api\StructType\ApiParagraphType[] */ - public function getTaxDescription() + public function getTaxDescription(): array { return $this->TaxDescription; } @@ -129,7 +132,7 @@ public function getTaxDescription() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateTaxDescriptionForArrayConstraintsFromSetTaxDescription(array $values = array()) + public static function validateTaxDescriptionForArrayConstraintsFromSetTaxDescription(array $values = []): string { $message = ''; $invalidValues = []; @@ -143,51 +146,54 @@ public static function validateTaxDescriptionForArrayConstraintsFromSetTaxDescri $message = sprintf('The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); } unset($invalidValues); + return $message; } /** * Set TaxDescription value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiParagraphType[] $taxDescription * @return \Api\StructType\ApiTaxType */ - public function setTaxDescription(array $taxDescription = array()) + public function setTaxDescription(array $taxDescription = []): self { // validation for constraint: array if ('' !== ($taxDescriptionArrayErrorMessage = self::validateTaxDescriptionForArrayConstraintsFromSetTaxDescription($taxDescription))) { - throw new \InvalidArgumentException($taxDescriptionArrayErrorMessage, __LINE__); + throw new InvalidArgumentException($taxDescriptionArrayErrorMessage, __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($taxDescription) && count($taxDescription) > 5) { - throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($taxDescription)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($taxDescription)), __LINE__); } $this->TaxDescription = $taxDescription; + return $this; } /** * Add item to TaxDescription value - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param \Api\StructType\ApiParagraphType $item * @return \Api\StructType\ApiTaxType */ - public function addToTaxDescription(\Api\StructType\ApiParagraphType $item) + public function addToTaxDescription(\Api\StructType\ApiParagraphType $item): self { // validation for constraint: itemType if (!$item instanceof \Api\StructType\ApiParagraphType) { - throw new \InvalidArgumentException(sprintf('The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + throw new InvalidArgumentException(sprintf('The TaxDescription property can only contain items of type \Api\StructType\ApiParagraphType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); } // validation for constraint: maxOccurs(5) if (is_array($this->TaxDescription) && count($this->TaxDescription) >= 5) { - throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->TaxDescription)), __LINE__); + throw new InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->TaxDescription)), __LINE__); } $this->TaxDescription[] = $item; + return $this; } /** * Get Type value * @return string|null */ - public function getType() + public function getType(): ?string { return $this->Type; } @@ -195,24 +201,25 @@ public function getType() * Set Type value * @uses \Api\EnumType\ApiAmountDeterminationType::valueIsValid() * @uses \Api\EnumType\ApiAmountDeterminationType::getValidValues() - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @param string $type * @return \Api\StructType\ApiTaxType */ - public function setType($type = null) + public function setType(?string $type = null): self { // validation for constraint: enumeration if (!\Api\EnumType\ApiAmountDeterminationType::valueIsValid($type)) { - throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAmountDeterminationType', is_array($type) ? implode(', ', $type) : var_export($type, true), implode(', ', \Api\EnumType\ApiAmountDeterminationType::getValidValues())), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiAmountDeterminationType', is_array($type) ? implode(', ', $type) : var_export($type, true), implode(', ', \Api\EnumType\ApiAmountDeterminationType::getValidValues())), __LINE__); } $this->Type = $type; + return $this; } /** * Get Code value * @return string|null */ - public function getCode() + public function getCode(): ?string { return $this->Code; } @@ -221,24 +228,25 @@ public function getCode() * @param string $code * @return \Api\StructType\ApiTaxType */ - public function setCode($code = null) + public function setCode(?string $code = null): self { // validation for constraint: string if (!is_null($code) && !is_string($code)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($code, true), gettype($code)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($code, true), gettype($code)), __LINE__); } // validation for constraint: pattern([0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}, 0AA.BBBX, ) if (!is_null($code) && !preg_match('/[0-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', $code)) { - 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($code, true)), __LINE__); + 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($code, true)), __LINE__); } $this->Code = $code; + return $this; } /** * Get Percent value * @return float|null */ - public function getPercent() + public function getPercent(): ?float { return $this->Percent; } @@ -247,28 +255,29 @@ public function getPercent() * @param float $percent * @return \Api\StructType\ApiTaxType */ - public function setPercent($percent = null) + public function setPercent(?float $percent = null): self { // validation for constraint: float if (!is_null($percent) && !(is_float($percent) || is_numeric($percent))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($percent, true), gettype($percent)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($percent, true), gettype($percent)), __LINE__); } // validation for constraint: maxInclusive(100.00) if (!is_null($percent) && $percent > 100.00) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must be numerically less than or equal to 100.00', var_export($percent, true)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must be numerically less than or equal to 100.00', var_export($percent, true)), __LINE__); } // validation for constraint: minInclusive(0.00) if (!is_null($percent) && $percent < 0.00) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must be numerically greater than or equal to 0.00', var_export($percent, true)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must be numerically greater than or equal to 0.00', var_export($percent, true)), __LINE__); } $this->Percent = $percent; + return $this; } /** * Get Amount value * @return float|null */ - public function getAmount() + public function getAmount(): ?float { return $this->Amount; } @@ -277,24 +286,25 @@ public function getAmount() * @param float $amount * @return \Api\StructType\ApiTaxType */ - public function setAmount($amount = null) + public function setAmount(?float $amount = null): self { // validation for constraint: float if (!is_null($amount) && !(is_float($amount) || is_numeric($amount))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($amount, true), gettype($amount)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($amount, true), gettype($amount)), __LINE__); } // validation for constraint: fractionDigits(3) - if (!is_null($amount) && mb_strlen(mb_substr($amount, false !== mb_strpos($amount, '.') ? mb_strpos($amount, '.') + 1 : mb_strlen($amount))) > 3) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 3 fraction digits, %d given', var_export($amount, true), mb_strlen(mb_substr($amount, mb_strpos($amount, '.') + 1))), __LINE__); + if (!is_null($amount) && mb_strlen(mb_substr((string) $amount, false !== mb_strpos((string) $amount, '.') ? mb_strpos((string) $amount, '.') + 1 : mb_strlen((string) $amount))) > 3) { + throw new InvalidArgumentException(sprintf('Invalid value %s, the value must at most contain 3 fraction digits, %d given', var_export($amount, true), mb_strlen(mb_substr((string) $amount, mb_strpos((string) $amount, '.') + 1))), __LINE__); } $this->Amount = $amount; + return $this; } /** * Get CurrencyCode value * @return string|null */ - public function getCurrencyCode() + public function getCurrencyCode(): ?string { return $this->CurrencyCode; } @@ -303,24 +313,25 @@ public function getCurrencyCode() * @param string $currencyCode * @return \Api\StructType\ApiTaxType */ - public function setCurrencyCode($currencyCode = null) + public function setCurrencyCode(?string $currencyCode = null): self { // validation for constraint: string if (!is_null($currencyCode) && !is_string($currencyCode)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($currencyCode, true), gettype($currencyCode)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($currencyCode, true), gettype($currencyCode)), __LINE__); } // validation for constraint: pattern([a-zA-Z]{3}) if (!is_null($currencyCode) && !preg_match('/[a-zA-Z]{3}/', $currencyCode)) { - 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-zA-Z]{3}/', var_export($currencyCode, true)), __LINE__); + 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-zA-Z]{3}/', var_export($currencyCode, true)), __LINE__); } $this->CurrencyCode = $currencyCode; + return $this; } /** * Get DecimalPlaces value * @return int|null */ - public function getDecimalPlaces() + public function getDecimalPlaces(): ?int { return $this->DecimalPlaces; } @@ -329,13 +340,14 @@ public function getDecimalPlaces() * @param int $decimalPlaces * @return \Api\StructType\ApiTaxType */ - public function setDecimalPlaces($decimalPlaces = null) + public function setDecimalPlaces(?int $decimalPlaces = null): self { // validation for constraint: int if (!is_null($decimalPlaces) && !(is_int($decimalPlaces) || ctype_digit($decimalPlaces))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($decimalPlaces, true), gettype($decimalPlaces)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($decimalPlaces, true), gettype($decimalPlaces)), __LINE__); } $this->DecimalPlaces = $decimalPlaces; + return $this; } } diff --git a/tests/resources/generated/ValidUniqueID_Type.php b/tests/resources/generated/ValidUniqueID_Type.php index 8b06dc6b..09ce3668 100644 --- a/tests/resources/generated/ValidUniqueID_Type.php +++ b/tests/resources/generated/ValidUniqueID_Type.php @@ -1,8 +1,11 @@ setType($type) @@ -92,7 +95,7 @@ public function __construct($type = null, $iD = null, \Api\StructType\ApiCompany * Get Type value * @return string */ - public function getType() + public function getType(): string { return $this->Type; } @@ -101,24 +104,25 @@ public function getType() * @param string $type * @return \Api\StructType\ApiUniqueID_Type */ - public function setType($type = null) + public function setType(string $type): self { // validation for constraint: string if (!is_null($type) && !is_string($type)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); } // validation for constraint: pattern([0-9A-Z]{1,3}(\.[A-Z]{3}(\.X){0,1}){0,1}, 0AA.BBBX, ) if (!is_null($type) && !preg_match('/[0-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', $type)) { - 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($type, true)), __LINE__); + 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-9A-Z]{1,3}(\\.[A-Z]{3}(\\.X){0,1}){0,1}|0AA.BBBX|^$/', var_export($type, true)), __LINE__); } $this->Type = $type; + return $this; } /** * Get ID value * @return string */ - public function getID() + public function getID(): string { return $this->ID; } @@ -127,28 +131,29 @@ public function getID() * @param string $iD * @return \Api\StructType\ApiUniqueID_Type */ - public function setID($iD = null) + 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__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($iD, true), gettype($iD)), __LINE__); } // validation for constraint: maxLength(32) - if (!is_null($iD) && mb_strlen($iD) > 32) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 32', mb_strlen($iD)), __LINE__); + if (!is_null($iD) && mb_strlen((string) $iD) > 32) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 32', mb_strlen((string) $iD)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($iD) && mb_strlen($iD) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($iD)), __LINE__); + if (!is_null($iD) && mb_strlen((string) $iD) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $iD)), __LINE__); } $this->ID = $iD; + return $this; } /** * Get CompanyName value * @return \Api\StructType\ApiCompanyNameType|null */ - public function getCompanyName() + public function getCompanyName(): ?\Api\StructType\ApiCompanyNameType { return $this->CompanyName; } @@ -157,16 +162,17 @@ public function getCompanyName() * @param \Api\StructType\ApiCompanyNameType $companyName * @return \Api\StructType\ApiUniqueID_Type */ - public function setCompanyName(\Api\StructType\ApiCompanyNameType $companyName = null) + public function setCompanyName(?\Api\StructType\ApiCompanyNameType $companyName = null): self { $this->CompanyName = $companyName; + return $this; } /** * Get URL value * @return string|null */ - public function getURL() + public function getURL(): ?string { return $this->URL; } @@ -175,20 +181,21 @@ public function getURL() * @param string $uRL * @return \Api\StructType\ApiUniqueID_Type */ - public function setURL($uRL = null) + public function setURL(?string $uRL = null): self { // validation for constraint: string if (!is_null($uRL) && !is_string($uRL)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uRL, true), gettype($uRL)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uRL, true), gettype($uRL)), __LINE__); } $this->URL = $uRL; + return $this; } /** * Get ID_Context value * @return string|null */ - public function getID_Context() + public function getID_Context(): ?string { return $this->ID_Context; } @@ -197,21 +204,22 @@ public function getID_Context() * @param string $iD_Context * @return \Api\StructType\ApiUniqueID_Type */ - public function setID_Context($iD_Context = null) + public function setID_Context(?string $iD_Context = null): self { // validation for constraint: string if (!is_null($iD_Context) && !is_string($iD_Context)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($iD_Context, true), gettype($iD_Context)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($iD_Context, true), gettype($iD_Context)), __LINE__); } // validation for constraint: maxLength(32) - if (!is_null($iD_Context) && mb_strlen($iD_Context) > 32) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 32', mb_strlen($iD_Context)), __LINE__); + if (!is_null($iD_Context) && mb_strlen((string) $iD_Context) > 32) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 32', mb_strlen((string) $iD_Context)), __LINE__); } // validation for constraint: minLength(1) - if (!is_null($iD_Context) && mb_strlen($iD_Context) < 1) { - throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen($iD_Context)), __LINE__); + if (!is_null($iD_Context) && mb_strlen((string) $iD_Context) < 1) { + throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $iD_Context)), __LINE__); } $this->ID_Context = $iD_Context; + return $this; } } diff --git a/tests/resources/generated/ValidUnitTestsStructResult.php b/tests/resources/generated/ValidUnitTestsStructResult.php index ec38aab0..84410e52 100644 --- a/tests/resources/generated/ValidUnitTestsStructResult.php +++ b/tests/resources/generated/ValidUnitTestsStructResult.php @@ -1,8 +1,11 @@ setSuccess($success) @@ -64,7 +67,7 @@ public function __construct($success = false, \Api\StructType\ApiErrors $errors * Get Success value * @return bool|null */ - public function getSuccess() + public function getSuccess(): ?bool { return isset($this->Success) ? $this->Success : null; } @@ -75,7 +78,7 @@ public function getSuccess() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateSuccessForChoiceConstraintsFromSetSuccess($value) + public function validateSuccessForChoiceConstraintsFromSetSuccess($value): string { $message = ''; if (is_null($value)) { @@ -87,12 +90,13 @@ public function validateSuccessForChoiceConstraintsFromSetSuccess($value) try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property Success can\'t be set as the property %s is already set. Only one property must be set among these properties: Success, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property Success can\'t be set as the property %s is already set. Only one property must be set among these properties: Success, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -100,32 +104,33 @@ public function validateSuccessForChoiceConstraintsFromSetSuccess($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 + * @throws InvalidArgumentException * @param bool $success * @return \Api\StructType\ApiResult */ - public function setSuccess($success = false) + public function setSuccess(?bool $success = false): self { // validation for constraint: boolean if (!is_null($success) && !is_bool($success)) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($success, true), gettype($success)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($success, true), gettype($success)), __LINE__); } // validation for constraint: choice(Success, Errors) if ('' !== ($successChoiceErrorMessage = self::validateSuccessForChoiceConstraintsFromSetSuccess($success))) { - throw new \InvalidArgumentException($successChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($successChoiceErrorMessage, __LINE__); } if (is_null($success) || (is_array($success) && empty($success))) { unset($this->Success); } else { $this->Success = $success; } + return $this; } /** * Get Errors value * @return \Api\StructType\ApiErrors|null */ - public function getErrors() + public function getErrors(): ?\Api\StructType\ApiErrors { return isset($this->Errors) ? $this->Errors : null; } @@ -136,7 +141,7 @@ public function getErrors() * @param mixed $value * @return string A non-empty message if the values does not match the validation rules */ - public function validateErrorsForChoiceConstraintsFromSetErrors($value) + public function validateErrorsForChoiceConstraintsFromSetErrors($value): string { $message = ''; if (is_null($value)) { @@ -148,12 +153,13 @@ public function validateErrorsForChoiceConstraintsFromSetErrors($value) try { foreach ($properties as $property) { if (isset($this->{$property})) { - throw new \InvalidArgumentException(sprintf('The property Errors can\'t be set as the property %s is already set. Only one property must be set among these properties: Errors, %s.', $property, implode(', ', $properties)), __LINE__); + throw new InvalidArgumentException(sprintf('The property Errors can\'t be set as the property %s is already set. Only one property must be set among these properties: Errors, %s.', $property, implode(', ', $properties)), __LINE__); } } - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $message = $e->getMessage(); } + return $message; } /** @@ -161,28 +167,29 @@ public function validateErrorsForChoiceConstraintsFromSetErrors($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 + * @throws InvalidArgumentException * @param \Api\StructType\ApiErrors $errors * @return \Api\StructType\ApiResult */ - public function setErrors(\Api\StructType\ApiErrors $errors = null) + public function setErrors(?\Api\StructType\ApiErrors $errors = null): self { // validation for constraint: choice(Success, Errors) if ('' !== ($errorsChoiceErrorMessage = self::validateErrorsForChoiceConstraintsFromSetErrors($errors))) { - throw new \InvalidArgumentException($errorsChoiceErrorMessage, __LINE__); + throw new InvalidArgumentException($errorsChoiceErrorMessage, __LINE__); } if (is_null($errors) || (is_array($errors) && empty($errors))) { unset($this->Errors); } else { $this->Errors = $errors; } + return $this; } /** * Get Warnings value * @return \Api\StructType\ApiWarnings|null */ - public function getWarnings() + public function getWarnings(): ?\Api\StructType\ApiWarnings { return $this->Warnings; } @@ -191,9 +198,10 @@ public function getWarnings() * @param \Api\StructType\ApiWarnings $warnings * @return \Api\StructType\ApiResult */ - public function setWarnings(\Api\StructType\ApiWarnings $warnings = null) + public function setWarnings(?\Api\StructType\ApiWarnings $warnings = null): self { $this->Warnings = $warnings; + return $this; } } diff --git a/tests/resources/generated/ValidWorkingPeriod.php b/tests/resources/generated/ValidWorkingPeriod.php index 8e17c2fc..6d70e702 100644 --- a/tests/resources/generated/ValidWorkingPeriod.php +++ b/tests/resources/generated/ValidWorkingPeriod.php @@ -1,8 +1,11 @@ setDayOfWeek($dayOfWeek) @@ -54,9 +57,9 @@ public function __construct(array $dayOfWeek = array(), $startTimeInMinutes = nu } /** * Get DayOfWeek value - * @return string[] + * @return string */ - public function getDayOfWeek() + public function getDayOfWeek(): string { return $this->DayOfWeek; } @@ -66,7 +69,7 @@ public function getDayOfWeek() * @param array $values * @return string A non-empty message if the values does not match the validation rules */ - public static function validateDayOfWeekForArrayConstraintsFromSetDayOfWeek(array $values = array()) + public static function validateDayOfWeekForArrayConstraintsFromSetDayOfWeek(array $values = []): string { $message = ''; $invalidValues = []; @@ -80,30 +83,32 @@ public static function validateDayOfWeekForArrayConstraintsFromSetDayOfWeek(arra $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \Api\EnumType\ApiDayOfWeekType', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \Api\EnumType\ApiDayOfWeekType::getValidValues())); } unset($invalidValues); + return $message; } /** * Set DayOfWeek value * @uses \Api\EnumType\ApiDayOfWeekType::valueIsValid() * @uses \Api\EnumType\ApiDayOfWeekType::getValidValues() - * @throws \InvalidArgumentException - * @param string[] $dayOfWeek + * @throws InvalidArgumentException + * @param array|string $dayOfWeek * @return \Api\StructType\ApiWorkingPeriod */ - public function setDayOfWeek(array $dayOfWeek = array()) + public function setDayOfWeek($dayOfWeek): self { // validation for constraint: list - if ('' !== ($dayOfWeekArrayErrorMessage = self::validateDayOfWeekForArrayConstraintsFromSetDayOfWeek($dayOfWeek))) { - throw new \InvalidArgumentException($dayOfWeekArrayErrorMessage, __LINE__); + if ('' !== ($dayOfWeekArrayErrorMessage = self::validateDayOfWeekForArrayConstraintsFromSetDayOfWeek(is_string($dayOfWeek) ? explode(' ', $dayOfWeek) : $dayOfWeek))) { + throw new InvalidArgumentException($dayOfWeekArrayErrorMessage, __LINE__); } - $this->DayOfWeek = is_array($dayOfWeek) ? implode(' ', $dayOfWeek) : null; + $this->DayOfWeek = is_array($dayOfWeek) ? implode(' ', $dayOfWeek) : $dayOfWeek; + return $this; } /** * Get StartTimeInMinutes value * @return int */ - public function getStartTimeInMinutes() + public function getStartTimeInMinutes(): int { return $this->StartTimeInMinutes; } @@ -112,20 +117,21 @@ public function getStartTimeInMinutes() * @param int $startTimeInMinutes * @return \Api\StructType\ApiWorkingPeriod */ - public function setStartTimeInMinutes($startTimeInMinutes = null) + public function setStartTimeInMinutes(int $startTimeInMinutes): self { // validation for constraint: int if (!is_null($startTimeInMinutes) && !(is_int($startTimeInMinutes) || ctype_digit($startTimeInMinutes))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($startTimeInMinutes, true), gettype($startTimeInMinutes)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($startTimeInMinutes, true), gettype($startTimeInMinutes)), __LINE__); } $this->StartTimeInMinutes = $startTimeInMinutes; + return $this; } /** * Get EndTimeInMinutes value * @return int */ - public function getEndTimeInMinutes() + public function getEndTimeInMinutes(): int { return $this->EndTimeInMinutes; } @@ -134,13 +140,14 @@ public function getEndTimeInMinutes() * @param int $endTimeInMinutes * @return \Api\StructType\ApiWorkingPeriod */ - public function setEndTimeInMinutes($endTimeInMinutes = null) + public function setEndTimeInMinutes(int $endTimeInMinutes): self { // validation for constraint: int if (!is_null($endTimeInMinutes) && !(is_int($endTimeInMinutes) || ctype_digit($endTimeInMinutes))) { - throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($endTimeInMinutes, true), gettype($endTimeInMinutes)), __LINE__); + throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($endTimeInMinutes, true), gettype($endTimeInMinutes)), __LINE__); } $this->EndTimeInMinutes = $endTimeInMinutes; + return $this; } } diff --git a/tests/resources/generated/ValidYandexDirectApiLiveGet.php b/tests/resources/generated/ValidYandexDirectApiLiveGet.php index f7c3e4fa..3807aabe 100644 --- a/tests/resources/generated/ValidYandexDirectApiLiveGet.php +++ b/tests/resources/generated/ValidYandexDirectApiLiveGet.php @@ -1,8 +1,11 @@ setResult($this->getSoapClient()->__soapCall('GetVersion', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetVersion = $this->getSoapClient()->__soapCall('GetVersion', [], [], [], $this->outputHeaders)); + + return $resultGetVersion; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -33,7 +37,6 @@ public function GetVersion() * Method to call the operation originally named GetClientsList * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\ClientInfoRequest $params * @return \StructType\ClientInfo[]|bool @@ -41,12 +44,14 @@ public function GetVersion() public function GetClientsList(\StructType\ClientInfoRequest $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetClientsList', array( + $this->setResult($resultGetClientsList = $this->getSoapClient()->__soapCall('GetClientsList', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetClientsList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -54,7 +59,6 @@ public function GetClientsList(\StructType\ClientInfoRequest $params) * Method to call the operation originally named GetSubClients * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetSubClientsRequest $params * @return \StructType\ShortClientInfo[]|bool @@ -62,12 +66,14 @@ public function GetClientsList(\StructType\ClientInfoRequest $params) public function GetSubClients(\StructType\GetSubClientsRequest $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetSubClients', array( + $this->setResult($resultGetSubClients = $this->getSoapClient()->__soapCall('GetSubClients', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetSubClients; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -75,7 +81,6 @@ public function GetSubClients(\StructType\GetSubClientsRequest $params) * Method to call the operation originally named GetSummaryStat * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetSummaryStatRequest $params * @return \StructType\StatItem[]|bool @@ -83,12 +88,14 @@ public function GetSubClients(\StructType\GetSubClientsRequest $params) public function GetSummaryStat(\StructType\GetSummaryStatRequest $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetSummaryStat', array( + $this->setResult($resultGetSummaryStat = $this->getSoapClient()->__soapCall('GetSummaryStat', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetSummaryStat; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -96,7 +103,6 @@ public function GetSummaryStat(\StructType\GetSummaryStatRequest $params) * Method to call the operation originally named GetCampaignParams * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\CampaignIDInfo $params * @return \StructType\CampaignInfo|bool @@ -104,12 +110,14 @@ public function GetSummaryStat(\StructType\GetSummaryStatRequest $params) public function GetCampaignParams(\StructType\CampaignIDInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetCampaignParams', array( + $this->setResult($resultGetCampaignParams = $this->getSoapClient()->__soapCall('GetCampaignParams', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetCampaignParams; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -117,7 +125,6 @@ public function GetCampaignParams(\StructType\CampaignIDInfo $params) * Method to call the operation originally named GetCampaignsParams * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\CampaignIDSInfo $params * @return \StructType\CampaignInfo[]|bool @@ -125,12 +132,14 @@ public function GetCampaignParams(\StructType\CampaignIDInfo $params) public function GetCampaignsParams(\StructType\CampaignIDSInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetCampaignsParams', array( + $this->setResult($resultGetCampaignsParams = $this->getSoapClient()->__soapCall('GetCampaignsParams', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetCampaignsParams; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -138,17 +147,18 @@ public function GetCampaignsParams(\StructType\CampaignIDSInfo $params) * Method to call the operation originally named GetReportList * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\ReportInfo[]|bool */ public function GetReportList() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetReportList', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetReportList = $this->getSoapClient()->__soapCall('GetReportList', [], [], [], $this->outputHeaders)); + + return $resultGetReportList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -156,7 +166,6 @@ public function GetReportList() * Method to call the operation originally named GetClientsUnits * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $params * @return \StructType\ClientsUnitInfo[]|bool @@ -164,12 +173,14 @@ public function GetReportList() public function GetClientsUnits(array $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetClientsUnits', array( + $this->setResult($resultGetClientsUnits = $this->getSoapClient()->__soapCall('GetClientsUnits', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetClientsUnits; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -177,7 +188,6 @@ public function GetClientsUnits(array $params) * Method to call the operation originally named GetClientInfo * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $params * @return \StructType\ClientInfo[]|bool @@ -185,12 +195,14 @@ public function GetClientsUnits(array $params) public function GetClientInfo(array $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetClientInfo', array( + $this->setResult($resultGetClientInfo = $this->getSoapClient()->__soapCall('GetClientInfo', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetClientInfo; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -198,7 +210,6 @@ public function GetClientInfo(array $params) * Method to call the operation originally named GetBanners * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetBannersInfo $params * @return \StructType\BannerInfo[]|bool @@ -206,12 +217,14 @@ public function GetClientInfo(array $params) public function GetBanners(\StructType\GetBannersInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBanners', array( + $this->setResult($resultGetBanners = $this->getSoapClient()->__soapCall('GetBanners', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBanners; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -219,7 +232,6 @@ public function GetBanners(\StructType\GetBannersInfo $params) * Method to call the operation originally named GetCampaignsList * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string[] $params * @return \StructType\ShortCampaignInfo[]|bool @@ -227,12 +239,14 @@ public function GetBanners(\StructType\GetBannersInfo $params) public function GetCampaignsList(array $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetCampaignsList', array( + $this->setResult($resultGetCampaignsList = $this->getSoapClient()->__soapCall('GetCampaignsList', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetCampaignsList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -240,7 +254,6 @@ public function GetCampaignsList(array $params) * Method to call the operation originally named GetCampaignsListFilter * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetCampaignsInfo $params * @return \StructType\ShortCampaignInfo[]|bool @@ -248,12 +261,14 @@ public function GetCampaignsList(array $params) public function GetCampaignsListFilter(\StructType\GetCampaignsInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetCampaignsListFilter', array( + $this->setResult($resultGetCampaignsListFilter = $this->getSoapClient()->__soapCall('GetCampaignsListFilter', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetCampaignsListFilter; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -261,7 +276,6 @@ public function GetCampaignsListFilter(\StructType\GetCampaignsInfo $params) * Method to call the operation originally named GetBalance * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $params * @return \StructType\CampaignBalanceInfo[]|bool @@ -269,12 +283,14 @@ public function GetCampaignsListFilter(\StructType\GetCampaignsInfo $params) public function GetBalance(array $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBalance', array( + $this->setResult($resultGetBalance = $this->getSoapClient()->__soapCall('GetBalance', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBalance; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -282,7 +298,6 @@ public function GetBalance(array $params) * Method to call the operation originally named GetBannerPhrases * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param int[] $params * @return \StructType\BannerPhraseInfo[]|bool @@ -290,12 +305,14 @@ public function GetBalance(array $params) public function GetBannerPhrases(array $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBannerPhrases', array( + $this->setResult($resultGetBannerPhrases = $this->getSoapClient()->__soapCall('GetBannerPhrases', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBannerPhrases; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -303,7 +320,6 @@ public function GetBannerPhrases(array $params) * Method to call the operation originally named GetBannerPhrasesFilter * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\BannerPhrasesFilterRequestInfo $params * @return \StructType\BannerPhraseInfo[]|bool @@ -311,12 +327,14 @@ public function GetBannerPhrases(array $params) public function GetBannerPhrasesFilter(\StructType\BannerPhrasesFilterRequestInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBannerPhrasesFilter', array( + $this->setResult($resultGetBannerPhrasesFilter = $this->getSoapClient()->__soapCall('GetBannerPhrasesFilter', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBannerPhrasesFilter; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -324,17 +342,18 @@ public function GetBannerPhrasesFilter(\StructType\BannerPhrasesFilterRequestInf * Method to call the operation originally named GetRegions * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\RegionInfo[]|bool */ public function GetRegions() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetRegions', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetRegions = $this->getSoapClient()->__soapCall('GetRegions', [], [], [], $this->outputHeaders)); + + return $resultGetRegions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -342,7 +361,6 @@ public function GetRegions() * Method to call the operation originally named GetBannersStat * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\NewReportInfo $params * @return \StructType\GetBannersStatResponse|bool @@ -350,12 +368,14 @@ public function GetRegions() public function GetBannersStat(\StructType\NewReportInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBannersStat', array( + $this->setResult($resultGetBannersStat = $this->getSoapClient()->__soapCall('GetBannersStat', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBannersStat; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -363,7 +383,6 @@ public function GetBannersStat(\StructType\NewReportInfo $params) * Method to call the operation originally named GetForecast * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $params * @return \StructType\GetForecastInfo|bool @@ -371,12 +390,14 @@ public function GetBannersStat(\StructType\NewReportInfo $params) public function GetForecast($params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetForecast', array( + $this->setResult($resultGetForecast = $this->getSoapClient()->__soapCall('GetForecast', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetForecast; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -384,17 +405,18 @@ public function GetForecast($params) * Method to call the operation originally named GetRubrics * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\RubricInfo[]|bool */ public function GetRubrics() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetRubrics', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetRubrics = $this->getSoapClient()->__soapCall('GetRubrics', [], [], [], $this->outputHeaders)); + + return $resultGetRubrics; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -402,17 +424,18 @@ public function GetRubrics() * Method to call the operation originally named GetTimeZones * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\TimeZoneInfo[]|bool */ public function GetTimeZones() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetTimeZones', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetTimeZones = $this->getSoapClient()->__soapCall('GetTimeZones', [], [], [], $this->outputHeaders)); + + return $resultGetTimeZones; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -420,17 +443,18 @@ public function GetTimeZones() * Method to call the operation originally named GetForecastList * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\ForecastStatusInfo[]|bool */ public function GetForecastList() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetForecastList', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetForecastList = $this->getSoapClient()->__soapCall('GetForecastList', [], [], [], $this->outputHeaders)); + + return $resultGetForecastList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -438,17 +462,18 @@ public function GetForecastList() * Method to call the operation originally named GetAvailableVersions * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\VersionDesc[]|bool */ public function GetAvailableVersions() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetAvailableVersions', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetAvailableVersions = $this->getSoapClient()->__soapCall('GetAvailableVersions', [], [], [], $this->outputHeaders)); + + return $resultGetAvailableVersions; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -456,7 +481,6 @@ public function GetAvailableVersions() * Method to call the operation originally named GetKeywordsSuggestion * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\KeywordsSuggestionInfo $params * @return string[]|bool @@ -464,12 +488,14 @@ public function GetAvailableVersions() public function GetKeywordsSuggestion(\StructType\KeywordsSuggestionInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetKeywordsSuggestion', array( + $this->setResult($resultGetKeywordsSuggestion = $this->getSoapClient()->__soapCall('GetKeywordsSuggestion', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetKeywordsSuggestion; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -477,17 +503,18 @@ public function GetKeywordsSuggestion(\StructType\KeywordsSuggestionInfo $params * Method to call the operation originally named GetWordstatReportList * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\WordstatReportStatusInfo[]|bool */ public function GetWordstatReportList() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetWordstatReportList', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetWordstatReportList = $this->getSoapClient()->__soapCall('GetWordstatReportList', [], [], [], $this->outputHeaders)); + + return $resultGetWordstatReportList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -495,7 +522,6 @@ public function GetWordstatReportList() * Method to call the operation originally named GetWordstatReport * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param string $params * @return \StructType\WordstatReportInfo[]|bool @@ -503,12 +529,14 @@ public function GetWordstatReportList() public function GetWordstatReport($params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetWordstatReport', array( + $this->setResult($resultGetWordstatReport = $this->getSoapClient()->__soapCall('GetWordstatReport', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetWordstatReport; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -516,7 +544,6 @@ public function GetWordstatReport($params) * Method to call the operation originally named GetStatGoals * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\StatGoalsCampaignIDInfo $params * @return \StructType\StatGoalInfo[]|bool @@ -524,12 +551,14 @@ public function GetWordstatReport($params) public function GetStatGoals(\StructType\StatGoalsCampaignIDInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetStatGoals', array( + $this->setResult($resultGetStatGoals = $this->getSoapClient()->__soapCall('GetStatGoals', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetStatGoals; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -537,7 +566,6 @@ public function GetStatGoals(\StructType\StatGoalsCampaignIDInfo $params) * Method to call the operation originally named GetChanges * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetChangesRequest $params * @return \StructType\GetChangesResponse|bool @@ -545,12 +573,14 @@ public function GetStatGoals(\StructType\StatGoalsCampaignIDInfo $params) public function GetChanges(\StructType\GetChangesRequest $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetChanges', array( + $this->setResult($resultGetChanges = $this->getSoapClient()->__soapCall('GetChanges', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetChanges; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -558,7 +588,6 @@ public function GetChanges(\StructType\GetChangesRequest $params) * Method to call the operation originally named GetEventsLog * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetEventsLogRequest $params * @return \StructType\EventsLogItem[]|bool @@ -566,12 +595,14 @@ public function GetChanges(\StructType\GetChangesRequest $params) public function GetEventsLog(\StructType\GetEventsLogRequest $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetEventsLog', array( + $this->setResult($resultGetEventsLog = $this->getSoapClient()->__soapCall('GetEventsLog', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetEventsLog; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -579,7 +610,6 @@ public function GetEventsLog(\StructType\GetEventsLogRequest $params) * Method to call the operation originally named GetCampaignsTags * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\CampaignIDSInfo $params * @return \StructType\CampaignTagsInfo[]|bool @@ -587,12 +617,14 @@ public function GetEventsLog(\StructType\GetEventsLogRequest $params) public function GetCampaignsTags(\StructType\CampaignIDSInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetCampaignsTags', array( + $this->setResult($resultGetCampaignsTags = $this->getSoapClient()->__soapCall('GetCampaignsTags', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetCampaignsTags; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -600,7 +632,6 @@ public function GetCampaignsTags(\StructType\CampaignIDSInfo $params) * Method to call the operation originally named GetBannersTags * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\BannersRequestInfo $params * @return \StructType\BannerTagsInfo[]|bool @@ -608,12 +639,14 @@ public function GetCampaignsTags(\StructType\CampaignIDSInfo $params) public function GetBannersTags(\StructType\BannersRequestInfo $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetBannersTags', array( + $this->setResult($resultGetBannersTags = $this->getSoapClient()->__soapCall('GetBannersTags', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetBannersTags; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -621,17 +654,18 @@ public function GetBannersTags(\StructType\BannersRequestInfo $params) * Method to call the operation originally named GetCreditLimits * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\CreditLimitsInfo|bool */ public function GetCreditLimits() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetCreditLimits', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetCreditLimits = $this->getSoapClient()->__soapCall('GetCreditLimits', [], [], [], $this->outputHeaders)); + + return $resultGetCreditLimits; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -639,7 +673,6 @@ public function GetCreditLimits() * Method to call the operation originally named GetRetargetingGoals * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @param \StructType\GetRetargetingGoalsRequest $params * @return \StructType\RetargetingGoal[]|bool @@ -647,12 +680,14 @@ public function GetCreditLimits() public function GetRetargetingGoals(\StructType\GetRetargetingGoalsRequest $params) { try { - $this->setResult($this->getSoapClient()->__soapCall('GetRetargetingGoals', array( + $this->setResult($resultGetRetargetingGoals = $this->getSoapClient()->__soapCall('GetRetargetingGoals', [ $params, - ), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + ], [], [], $this->outputHeaders)); + + return $resultGetRetargetingGoals; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } @@ -660,17 +695,18 @@ public function GetRetargetingGoals(\StructType\GetRetargetingGoalsRequest $para * Method to call the operation originally named GetOfflineReportList * @uses AbstractSoapClientBase::getSoapClient() * @uses AbstractSoapClientBase::setResult() - * @uses AbstractSoapClientBase::getResult() * @uses AbstractSoapClientBase::saveLastError() * @return \StructType\OfflineReportInfo[]|bool */ public function GetOfflineReportList() { try { - $this->setResult($this->getSoapClient()->__soapCall('GetOfflineReportList', array(), array(), array(), $this->outputHeaders)); - return $this->getResult(); - } catch (\SoapFault $soapFault) { + $this->setResult($resultGetOfflineReportList = $this->getSoapClient()->__soapCall('GetOfflineReportList', [], [], [], $this->outputHeaders)); + + return $resultGetOfflineReportList; + } catch (SoapFault $soapFault) { $this->saveLastError(__METHOD__, $soapFault); + return false; } } diff --git a/tests/resources/generated/json_serialized.json b/tests/resources/generated/json_serialized.json index 650c367b..267db6ca 100755 --- a/tests/resources/generated/json_serialized.json +++ b/tests/resources/generated/json_serialized.json @@ -3349,10 +3349,10 @@ "namespace_prefix": "", "standalone": false, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_actonservice2_none.json b/tests/resources/generated/parsed_actonservice2_none.json index c9db5dc1..c016248b 100644 --- a/tests/resources/generated/parsed_actonservice2_none.json +++ b/tests/resources/generated/parsed_actonservice2_none.json @@ -1162,7 +1162,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -3750,10 +3750,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_actonservice2_start.json b/tests/resources/generated/parsed_actonservice2_start.json index 00b8c5cf..d4a63fdd 100644 --- a/tests/resources/generated/parsed_actonservice2_start.json +++ b/tests/resources/generated/parsed_actonservice2_start.json @@ -1162,7 +1162,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -3750,10 +3750,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_bingsearch_none.json b/tests/resources/generated/parsed_bingsearch_none.json index 92bb82b1..85a632b4 100644 --- a/tests/resources/generated/parsed_bingsearch_none.json +++ b/tests/resources/generated/parsed_bingsearch_none.json @@ -3351,10 +3351,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_bingsearch_start.json b/tests/resources/generated/parsed_bingsearch_start.json index 9b511cd8..eeb50980 100644 --- a/tests/resources/generated/parsed_bingsearch_start.json +++ b/tests/resources/generated/parsed_bingsearch_start.json @@ -3351,10 +3351,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_deliveryservice_none.json b/tests/resources/generated/parsed_deliveryservice_none.json index 4c158724..c5e9f54e 100644 --- a/tests/resources/generated/parsed_deliveryservice_none.json +++ b/tests/resources/generated/parsed_deliveryservice_none.json @@ -12358,10 +12358,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_deliveryservice_start.json b/tests/resources/generated/parsed_deliveryservice_start.json index aebf4a67..d24630f5 100644 --- a/tests/resources/generated/parsed_deliveryservice_start.json +++ b/tests/resources/generated/parsed_deliveryservice_start.json @@ -12115,10 +12115,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_docdatapayments_none.json b/tests/resources/generated/parsed_docdatapayments_none.json index 023e5c41..e8bd4b82 100644 --- a/tests/resources/generated/parsed_docdatapayments_none.json +++ b/tests/resources/generated/parsed_docdatapayments_none.json @@ -1162,7 +1162,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2126,7 +2126,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2619,7 +2619,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2673,7 +2673,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2740,7 +2740,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -4035,7 +4035,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -4187,7 +4187,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -4296,7 +4296,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5020,7 +5020,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5062,7 +5062,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5203,7 +5203,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5296,7 +5296,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5389,7 +5389,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5469,7 +5469,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5549,7 +5549,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5616,7 +5616,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5670,7 +5670,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5872,7 +5872,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5926,7 +5926,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6006,7 +6006,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6073,7 +6073,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6114,7 +6114,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6168,7 +6168,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6377,7 +6377,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6431,7 +6431,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6563,7 +6563,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6639,7 +6639,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6715,7 +6715,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6804,7 +6804,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6854,7 +6854,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7336,7 +7336,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7373,7 +7373,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7690,7 +7690,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7727,7 +7727,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7940,7 +7940,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7977,7 +7977,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8321,7 +8321,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8384,7 +8384,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8625,7 +8625,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8675,7 +8675,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8984,7 +8984,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9021,7 +9021,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9366,7 +9366,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9416,7 +9416,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9456,7 +9456,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9565,7 +9565,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9602,7 +9602,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9761,7 +9761,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9811,7 +9811,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -10023,7 +10023,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -10116,10 +10116,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_docdatapayments_start.json b/tests/resources/generated/parsed_docdatapayments_start.json index fcf26b97..dd485ea7 100644 --- a/tests/resources/generated/parsed_docdatapayments_start.json +++ b/tests/resources/generated/parsed_docdatapayments_start.json @@ -1153,7 +1153,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2117,7 +2117,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2610,7 +2610,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2664,7 +2664,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2731,7 +2731,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -4026,7 +4026,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -4178,7 +4178,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -4287,7 +4287,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5011,7 +5011,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5053,7 +5053,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5194,7 +5194,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5287,7 +5287,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5380,7 +5380,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5460,7 +5460,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5540,7 +5540,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5607,7 +5607,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5661,7 +5661,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5863,7 +5863,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5917,7 +5917,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5997,7 +5997,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6064,7 +6064,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6105,7 +6105,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6159,7 +6159,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6368,7 +6368,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6422,7 +6422,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6554,7 +6554,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6630,7 +6630,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6706,7 +6706,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6795,7 +6795,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -6845,7 +6845,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7327,7 +7327,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7364,7 +7364,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7681,7 +7681,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7718,7 +7718,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7931,7 +7931,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -7968,7 +7968,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8312,7 +8312,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8375,7 +8375,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8616,7 +8616,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8666,7 +8666,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -8975,7 +8975,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9012,7 +9012,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9357,7 +9357,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9407,7 +9407,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9447,7 +9447,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9556,7 +9556,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9593,7 +9593,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9752,7 +9752,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -9802,7 +9802,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -10014,7 +10014,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -10107,10 +10107,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_ews_none.json b/tests/resources/generated/parsed_ews_none.json index e6b8a696..e2b563a6 100644 --- a/tests/resources/generated/parsed_ews_none.json +++ b/tests/resources/generated/parsed_ews_none.json @@ -46244,7 +46244,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -46362,7 +46362,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -47793,7 +47793,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -59473,7 +59473,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -68238,7 +68238,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -92581,10 +92581,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_ews_start.json b/tests/resources/generated/parsed_ews_start.json index b25a3660..900af8ba 100644 --- a/tests/resources/generated/parsed_ews_start.json +++ b/tests/resources/generated/parsed_ews_start.json @@ -45614,7 +45614,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -45732,7 +45732,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -47163,7 +47163,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -58843,7 +58843,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -67608,7 +67608,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -91951,10 +91951,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_myboard_none.json b/tests/resources/generated/parsed_myboard_none.json index cfaabe79..04fcb2ce 100644 --- a/tests/resources/generated/parsed_myboard_none.json +++ b/tests/resources/generated/parsed_myboard_none.json @@ -11536,10 +11536,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_myboard_start.json b/tests/resources/generated/parsed_myboard_start.json index 8c90a2f7..faef14cf 100644 --- a/tests/resources/generated/parsed_myboard_start.json +++ b/tests/resources/generated/parsed_myboard_start.json @@ -10654,10 +10654,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_odigeo_none.json b/tests/resources/generated/parsed_odigeo_none.json index edf1cede..82f76bba 100644 --- a/tests/resources/generated/parsed_odigeo_none.json +++ b/tests/resources/generated/parsed_odigeo_none.json @@ -1457,10 +1457,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_odigeo_start.json b/tests/resources/generated/parsed_odigeo_start.json index 84915364..9fb08ed9 100644 --- a/tests/resources/generated/parsed_odigeo_start.json +++ b/tests/resources/generated/parsed_odigeo_start.json @@ -1457,10 +1457,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_omnitureadminservices_none.json b/tests/resources/generated/parsed_omnitureadminservices_none.json index 97f1f25e..ebe4ad39 100644 --- a/tests/resources/generated/parsed_omnitureadminservices_none.json +++ b/tests/resources/generated/parsed_omnitureadminservices_none.json @@ -26759,10 +26759,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_omnitureadminservices_start.json b/tests/resources/generated/parsed_omnitureadminservices_start.json index 9f6fcffa..c9363c98 100644 --- a/tests/resources/generated/parsed_omnitureadminservices_start.json +++ b/tests/resources/generated/parsed_omnitureadminservices_start.json @@ -25103,10 +25103,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_ordercontract_none.json b/tests/resources/generated/parsed_ordercontract_none.json index 17c82eca..bc5fdeba 100644 --- a/tests/resources/generated/parsed_ordercontract_none.json +++ b/tests/resources/generated/parsed_ordercontract_none.json @@ -248,7 +248,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -274,7 +274,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -300,7 +300,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5723,10 +5723,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_ordercontract_start.json b/tests/resources/generated/parsed_ordercontract_start.json index a1ca25a7..ac91f2bd 100644 --- a/tests/resources/generated/parsed_ordercontract_start.json +++ b/tests/resources/generated/parsed_ordercontract_start.json @@ -230,7 +230,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -256,7 +256,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -282,7 +282,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -5705,10 +5705,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_paypal_none.json b/tests/resources/generated/parsed_paypal_none.json index 8c7608c7..c20943d8 100644 --- a/tests/resources/generated/parsed_paypal_none.json +++ b/tests/resources/generated/parsed_paypal_none.json @@ -11423,7 +11423,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -11536,7 +11536,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -46081,10 +46081,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_paypal_start.json b/tests/resources/generated/parsed_paypal_start.json index d797f44a..9cc2cc55 100644 --- a/tests/resources/generated/parsed_paypal_start.json +++ b/tests/resources/generated/parsed_paypal_start.json @@ -11126,7 +11126,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -11239,7 +11239,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -45784,10 +45784,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_portaplusapi_none.json b/tests/resources/generated/parsed_portaplusapi_none.json index 032302ed..0db3cf5b 100644 --- a/tests/resources/generated/parsed_portaplusapi_none.json +++ b/tests/resources/generated/parsed_portaplusapi_none.json @@ -1351,10 +1351,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_portaplusapi_start.json b/tests/resources/generated/parsed_portaplusapi_start.json index 4c756337..4b71a881 100644 --- a/tests/resources/generated/parsed_portaplusapi_start.json +++ b/tests/resources/generated/parsed_portaplusapi_start.json @@ -1090,10 +1090,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_queueservice_none.json b/tests/resources/generated/parsed_queueservice_none.json index 4da1e5b3..7b297301 100644 --- a/tests/resources/generated/parsed_queueservice_none.json +++ b/tests/resources/generated/parsed_queueservice_none.json @@ -2552,7 +2552,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2584,10 +2584,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_queueservice_start.json b/tests/resources/generated/parsed_queueservice_start.json index 277a63c3..a67ee7d2 100644 --- a/tests/resources/generated/parsed_queueservice_start.json +++ b/tests/resources/generated/parsed_queueservice_start.json @@ -2498,7 +2498,7 @@ { "containsElements": false, "removableFromRequest": false, - "type": "\\DOMDocument", + "type": "DOMDocument", "inheritance": "", "abstract": false, "meta": [], @@ -2530,10 +2530,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_reformagkh_none.json b/tests/resources/generated/parsed_reformagkh_none.json index c7c9e64a..add583da 100644 --- a/tests/resources/generated/parsed_reformagkh_none.json +++ b/tests/resources/generated/parsed_reformagkh_none.json @@ -16449,10 +16449,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_reformagkh_start.json b/tests/resources/generated/parsed_reformagkh_start.json index 6f7d2350..fe411884 100644 --- a/tests/resources/generated/parsed_reformagkh_start.json +++ b/tests/resources/generated/parsed_reformagkh_start.json @@ -16314,10 +16314,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_unit_tests_none.json b/tests/resources/generated/parsed_unit_tests_none.json index f21a1d4d..3001fb47 100644 --- a/tests/resources/generated/parsed_unit_tests_none.json +++ b/tests/resources/generated/parsed_unit_tests_none.json @@ -174,10 +174,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_unit_tests_start.json b/tests/resources/generated/parsed_unit_tests_start.json index cf5b22d0..28b1ceab 100644 --- a/tests/resources/generated/parsed_unit_tests_start.json +++ b/tests/resources/generated/parsed_unit_tests_start.json @@ -174,10 +174,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_vehicleselection_none.json b/tests/resources/generated/parsed_vehicleselection_none.json index 4aecf560..ee148d66 100644 --- a/tests/resources/generated/parsed_vehicleselection_none.json +++ b/tests/resources/generated/parsed_vehicleselection_none.json @@ -38132,10 +38132,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_vehicleselection_start.json b/tests/resources/generated/parsed_vehicleselection_start.json index c5532554..dc5b1a46 100644 --- a/tests/resources/generated/parsed_vehicleselection_start.json +++ b/tests/resources/generated/parsed_vehicleselection_start.json @@ -37853,10 +37853,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_wcf_none.json b/tests/resources/generated/parsed_wcf_none.json index 40262eac..006fa172 100644 --- a/tests/resources/generated/parsed_wcf_none.json +++ b/tests/resources/generated/parsed_wcf_none.json @@ -253,10 +253,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_wcf_start.json b/tests/resources/generated/parsed_wcf_start.json index 2cf218e9..c49cfdbe 100644 --- a/tests/resources/generated/parsed_wcf_start.json +++ b/tests/resources/generated/parsed_wcf_start.json @@ -253,10 +253,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_whl_none.json b/tests/resources/generated/parsed_whl_none.json index 2fe8614b..66d4bb4e 100644 --- a/tests/resources/generated/parsed_whl_none.json +++ b/tests/resources/generated/parsed_whl_none.json @@ -16910,10 +16910,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_whl_start.json b/tests/resources/generated/parsed_whl_start.json index dd3ad6bb..6ea2744f 100644 --- a/tests/resources/generated/parsed_whl_start.json +++ b/tests/resources/generated/parsed_whl_start.json @@ -16874,10 +16874,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_yandex_campaigns_none.json b/tests/resources/generated/parsed_yandex_campaigns_none.json index 7d124fc0..5f5ea543 100644 --- a/tests/resources/generated/parsed_yandex_campaigns_none.json +++ b/tests/resources/generated/parsed_yandex_campaigns_none.json @@ -7706,10 +7706,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_yandex_campaigns_start.json b/tests/resources/generated/parsed_yandex_campaigns_start.json index 52b79fcb..a79d0049 100644 --- a/tests/resources/generated/parsed_yandex_campaigns_start.json +++ b/tests/resources/generated/parsed_yandex_campaigns_start.json @@ -7706,10 +7706,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_yandex_groups_none.json b/tests/resources/generated/parsed_yandex_groups_none.json index f7a8bb28..993dc6a5 100644 --- a/tests/resources/generated/parsed_yandex_groups_none.json +++ b/tests/resources/generated/parsed_yandex_groups_none.json @@ -2604,10 +2604,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_yandex_groups_start.json b/tests/resources/generated/parsed_yandex_groups_start.json index 1a0299d2..5deba1e7 100644 --- a/tests/resources/generated/parsed_yandex_groups_start.json +++ b/tests/resources/generated/parsed_yandex_groups_start.json @@ -2604,10 +2604,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_yandex_live_none.json b/tests/resources/generated/parsed_yandex_live_none.json index 7741f6a9..644723e2 100644 --- a/tests/resources/generated/parsed_yandex_live_none.json +++ b/tests/resources/generated/parsed_yandex_live_none.json @@ -13946,10 +13946,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generated/parsed_yandex_live_start.json b/tests/resources/generated/parsed_yandex_live_start.json index 0f326e99..d4eaaa7a 100644 --- a/tests/resources/generated/parsed_yandex_live_start.json +++ b/tests/resources/generated/parsed_yandex_live_start.json @@ -13451,10 +13451,10 @@ "namespace_prefix": "", "standalone": true, "validation": true, - "struct_class": "\\WsdlToPhp\\PackageBase\\AbstractStructBase", - "struct_array_class": "\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase", - "struct_enum_class": "\\WsdlToPhp\\PackageBase\\AbstractStructEnumBase", - "soap_client_class": "\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase", + "struct_class": "WsdlToPhp\\PackageBase\\AbstractStructBase", + "struct_array_class": "WsdlToPhp\\PackageBase\\AbstractStructArrayBase", + "struct_enum_class": "WsdlToPhp\\PackageBase\\AbstractStructEnumBase", + "soap_client_class": "WsdlToPhp\\PackageBase\\AbstractSoapClientBase", "origin": "__ORIGIN__", "destination": "__DESTINATION__", "src_dirname": "src", diff --git a/tests/resources/generator_options.yml b/tests/resources/generator_options.yml index 2511cde3..e92a0918 100755 --- a/tests/resources/generator_options.yml +++ b/tests/resources/generator_options.yml @@ -26,16 +26,16 @@ validation: default: true values: [ true, false ] struct_class: - default: '\WsdlToPhp\PackageBase\AbstractStructBase' + default: 'WsdlToPhp\PackageBase\AbstractStructBase' values: '' struct_array_class: - default: '\WsdlToPhp\PackageBase\AbstractStructArrayBase' + default: 'WsdlToPhp\PackageBase\AbstractStructArrayBase' values: '' struct_enum_class: - default: '\WsdlToPhp\PackageBase\AbstractStructEnumBase' + default: 'WsdlToPhp\PackageBase\AbstractStructEnumBase' values: '' soap_client_class: - default: '\WsdlToPhp\PackageBase\AbstractSoapClientBase' + default: 'WsdlToPhp\PackageBase\AbstractSoapClientBase' values: '' origin: default: '' diff --git a/tests/resources/php_reserved_keywords.yml b/tests/resources/php_reserved_keywords.yml index ea75edb0..6dab32c4 100755 --- a/tests/resources/php_reserved_keywords.yml +++ b/tests/resources/php_reserved_keywords.yml @@ -109,6 +109,7 @@ reserved_keywords: - "interface" - "isset" - "list" + - "match" - "namespace" - "new" - "or" @@ -160,4 +161,4 @@ reserved_keywords: - "object" - "resource" - "mixed" - - "numeric" \ No newline at end of file + - "numeric" diff --git a/tests/resources/service_reserved_keywords.yml b/tests/resources/service_reserved_keywords.yml index 8556f979..5bb6d415 100644 --- a/tests/resources/service_reserved_keywords.yml +++ b/tests/resources/service_reserved_keywords.yml @@ -20,7 +20,7 @@ reserved_keywords: - "getLastRequestHeaders" - "getLastResponseHeaders" - "getLastHeaders" - - "getFormatedXml" + - "getFormattedXml" - "convertStringHeadersToArray" - "setSoapHeader" - "setHttpHeader" @@ -29,4 +29,4 @@ reserved_keywords: - "saveLastError" - "getLastErrorForMethod" - "getResult" - - "setResult" \ No newline at end of file + - "setResult" diff --git a/tests/resources/struct_array_reserved_keywords.yml b/tests/resources/struct_array_reserved_keywords.yml index 956a130e..85447334 100644 --- a/tests/resources/struct_array_reserved_keywords.yml +++ b/tests/resources/struct_array_reserved_keywords.yml @@ -7,6 +7,8 @@ reserved_keywords: - case_insensitive: # methods from AbstractStructArrayBase + - "_get" + - "_set" - "getAttributeName" - "length" - "count" diff --git a/tests/resources/xsd_types.yml b/tests/resources/xsd_types.yml index 7d560f1b..8124618b 100755 --- a/tests/resources/xsd_types.yml +++ b/tests/resources/xsd_types.yml @@ -13,7 +13,6 @@ xsd_types: decimal: "float" double: "float" duration: "string" - DayOfWeekType: "string" float: "float" gMonth: "string" gMonthDay: "int" @@ -48,4 +47,4 @@ xsd_types: unsignedLong: "int" unsignedShort: "int" UID: "string" - UNKNOWN: "string" \ No newline at end of file + UNKNOWN: "string" diff --git a/wsdltophp.yml.dist b/wsdltophp.yml.dist index 83b42026..62edfa71 100644 --- a/wsdltophp.yml.dist +++ b/wsdltophp.yml.dist @@ -30,16 +30,16 @@ validation: default: true values: [ true, false ] struct_class: - default: '\WsdlToPhp\PackageBase\AbstractStructBase' + default: 'WsdlToPhp\PackageBase\AbstractStructBase' values: '' struct_array_class: - default: '\WsdlToPhp\PackageBase\AbstractStructArrayBase' + default: 'WsdlToPhp\PackageBase\AbstractStructArrayBase' values: '' struct_enum_class: - default: '\WsdlToPhp\PackageBase\AbstractStructEnumBase' + default: 'WsdlToPhp\PackageBase\AbstractStructEnumBase' values: '' soap_client_class: - default: '\WsdlToPhp\PackageBase\AbstractSoapClientBase' + default: 'WsdlToPhp\PackageBase\AbstractSoapClientBase' values: '' origin: default: ''