├── .docker └── Dockerfile ├── .editorconfig ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── docker-entrypoint.sh ├── php.ini └── workflows │ ├── release.yml │ ├── sonars.yml │ └── static_coverage.yml ├── .gitignore ├── .php-cs-fixer.php ├── CASES.md ├── CHANGELOG.md ├── LICENSE ├── MANIFEST.md ├── README.md ├── UPGRADE-3.0.md ├── UPGRADE-4.0.md ├── box.json ├── composer.json ├── console ├── docker-compose.yml ├── phpunit.xml.dist ├── rector.php ├── sonar-project.properties ├── src ├── Command │ ├── AbstractCommand.php │ └── GeneratePackageCommand.php ├── ConfigurationReader │ ├── AbstractReservedWord.php │ ├── AbstractYamlReader.php │ ├── GeneratorOptions.php │ ├── PhpReservedKeyword.php │ ├── ServiceReservedMethod.php │ ├── StructArrayReservedMethod.php │ ├── StructReservedMethod.php │ └── XsdTypes.php ├── Container │ ├── AbstractObjectContainer.php │ ├── Model │ │ ├── AbstractModel.php │ │ ├── EmptyModel.php │ │ ├── Method.php │ │ ├── Schema.php │ │ ├── Service.php │ │ ├── Struct.php │ │ ├── StructAttribute.php │ │ └── StructValue.php │ ├── Parser.php │ └── PhpElement │ │ ├── AbstractPhpElement.php │ │ ├── Constant.php │ │ ├── Method.php │ │ └── Property.php ├── File │ ├── AbstractFile.php │ ├── AbstractModelFile.php │ ├── AbstractOperation.php │ ├── ClassMap.php │ ├── Composer.php │ ├── Element │ │ └── PhpFunctionParameter.php │ ├── FileInterface.php │ ├── Operation.php │ ├── OperationAnnotationBlock.php │ ├── Service.php │ ├── Struct.php │ ├── StructArray.php │ ├── StructEnum.php │ ├── Tutorial.php │ ├── Utils.php │ └── Validation │ │ ├── AbstractBoundRule.php │ │ ├── AbstractLengthRule.php │ │ ├── AbstractMinMaxRule.php │ │ ├── AbstractRule.php │ │ ├── AbstractSetOfValuesRule.php │ │ ├── ArrayRule.php │ │ ├── BoolRule.php │ │ ├── BooleanRule.php │ │ ├── ChoiceMaxOccursRule.php │ │ ├── ChoiceMinOccursRule.php │ │ ├── ChoiceRule.php │ │ ├── EnumerationRule.php │ │ ├── FloatRule.php │ │ ├── FractionDigitsRule.php │ │ ├── IntRule.php │ │ ├── ItemTypeRule.php │ │ ├── LengthRule.php │ │ ├── ListRule.php │ │ ├── MaxExclusiveRule.php │ │ ├── MaxInclusiveRule.php │ │ ├── MaxLengthRule.php │ │ ├── MaxOccursRule.php │ │ ├── MinExclusiveRule.php │ │ ├── MinInclusiveRule.php │ │ ├── MinLengthRule.php │ │ ├── MinOccursRule.php │ │ ├── PatternRule.php │ │ ├── Rules.php │ │ ├── StringRule.php │ │ ├── TotalDigitsRule.php │ │ ├── UnionRule.php │ │ └── XmlRule.php ├── Generator │ ├── AbstractGeneratorAware.php │ ├── Generator.php │ ├── GeneratorContainers.php │ ├── GeneratorFiles.php │ ├── GeneratorParsers.php │ ├── GeneratorSoapClient.php │ ├── SoapClient.php │ └── Utils.php ├── Model │ ├── AbstractDocument.php │ ├── AbstractModel.php │ ├── EmptyModel.php │ ├── Method.php │ ├── Schema.php │ ├── Service.php │ ├── Struct.php │ ├── StructAttribute.php │ ├── StructValue.php │ └── Wsdl.php ├── Parser │ ├── AbstractParser.php │ ├── ParserInterface.php │ ├── SoapClient │ │ ├── AbstractParser.php │ │ ├── Functions.php │ │ └── Structs.php │ └── Wsdl │ │ ├── AbstractAttributesParser.php │ │ ├── AbstractParser.php │ │ ├── AbstractTagImportParser.php │ │ ├── AbstractTagInputOutputParser.php │ │ ├── AbstractTagParser.php │ │ ├── README.md │ │ ├── TagAttribute.php │ │ ├── TagChoice.php │ │ ├── TagComplexType.php │ │ ├── TagDocumentation.php │ │ ├── TagElement.php │ │ ├── TagEnumeration.php │ │ ├── TagExtension.php │ │ ├── TagHeader.php │ │ ├── TagImport.php │ │ ├── TagInclude.php │ │ ├── TagInput.php │ │ ├── TagList.php │ │ ├── TagOutput.php │ │ ├── TagRestriction.php │ │ └── TagUnion.php └── resources │ └── config │ ├── generator_options.yml │ ├── php_reserved_keywords.yml │ ├── service_reserved_keywords.yml │ ├── struct_array_reserved_keywords.yml │ ├── struct_reserved_keywords.yml │ └── xsd_types.yml ├── tests ├── AbstractTestCase.php ├── Command │ └── GeneratePackageCommandTest.php ├── ConfigurationReader │ ├── GeneratorOptionsTest.php │ ├── PhpReservedKeywordTest.php │ ├── ServiceReservedMethodTest.php │ ├── StructArrayReservedMethodTest.php │ ├── StructReservedMethodTest.php │ └── XsdTypesTest.php ├── Container │ ├── ContainerTest.php │ ├── FalseObjectContainerTest.php │ ├── FalseObjectTest.php │ ├── Model │ │ ├── MethodContainerTest.php │ │ ├── ModelContainerTest.php │ │ ├── SchemaContainerTest.php │ │ ├── ServiceContainerTest.php │ │ ├── StructAttributeContainerTest.php │ │ ├── StructContainerTest.php │ │ └── StructValueContainerTest.php │ ├── ObjectContainerTest.php │ ├── ObjectTest.php │ ├── ParserTest.php │ └── PhpElement │ │ ├── ConstantTest.php │ │ ├── MethodTest.php │ │ └── PropertyTest.php ├── File │ ├── AbstractFile.php │ ├── ClassMapTest.php │ ├── ComposerTest.php │ ├── ServiceTest.php │ ├── StructArrayTest.php │ ├── StructEnumTest.php │ ├── StructTest.php │ ├── TutorialTest.php │ └── Validation │ │ ├── AbstractRule.php │ │ ├── ArrayRuleTest.php │ │ ├── BooleanRuleTest.php │ │ ├── ChoiceRuleTest.php │ │ ├── EnumerationRuleTest.php │ │ ├── FloatRuleTest.php │ │ ├── FractionDigitsRuleTest.php │ │ ├── IntRuleTest.php │ │ ├── InvalidRuleClass.php │ │ ├── InvalidRuleTest.php │ │ ├── ItemTypeRuleTest.php │ │ ├── LengthRuleTest.php │ │ ├── ListRuleTest.php │ │ ├── MaxExclusiveRuleTest.php │ │ ├── MaxInclusiveRuleTest.php │ │ ├── MaxLengthRuleTest.php │ │ ├── MaxOccursRuleTest.php │ │ ├── MinExclusiveRuleTest.php │ │ ├── MinInclusiveRuleTest.php │ │ ├── MinLengthRuleTest.php │ │ ├── PatternRuleTest.php │ │ ├── StringRuleTest.php │ │ ├── TotalDigitsRuleTest.php │ │ ├── UnionRuleTest.php │ │ └── XmlRuleTest.php ├── Generator │ ├── GeneratorContainerTest.php │ ├── GeneratorSoapClientTest.php │ ├── GeneratorTest.php │ └── UtilsTest.php ├── Model │ ├── MethodTest.php │ ├── ModelTest.php │ ├── ServiceTest.php │ ├── StructAttributeTest.php │ ├── StructTest.php │ ├── StructValueTest.php │ └── WsdlTest.php ├── Parser │ ├── SoapClient │ │ ├── FunctionsTest.php │ │ ├── SoapClientParser.php │ │ └── StructsTest.php │ └── Wsdl │ │ ├── TagAttributeTest.php │ │ ├── TagChoiceTest.php │ │ ├── TagComplexTypeTest.php │ │ ├── TagDocumentationTest.php │ │ ├── TagElementTest.php │ │ ├── TagEnumerationTest.php │ │ ├── TagExtensionTest.php │ │ ├── TagHeaderTest.php │ │ ├── TagImportTest.php │ │ ├── TagIncludeTest.php │ │ ├── TagInputTest.php │ │ ├── TagListTest.php │ │ ├── TagOutputTest.php │ │ ├── TagRestrictionTest.php │ │ ├── TagUnionTest.php │ │ └── WsdlParser.php ├── generate_serialized_jsons.php └── resources │ ├── ActonService2.local.wsdl │ ├── ActonService2.wsdl │ ├── DeliveryService.wsdl │ ├── MyBoardPack.wsdl │ ├── OmnitureAdminServices.wsdl │ ├── OrderContract.wsdl │ ├── QueueService.wsdl │ ├── VehicleSelectionService │ ├── VehicleSelectionService.wsdl │ ├── VehicleSelectionService_schema1.xsd │ └── VehicleSelectionService_schema2.xsd │ ├── aukro.wsdl │ ├── bad_generator_options.yml │ ├── bad_php_reserved_keywords.yml │ ├── bad_xsd_types.yml │ ├── bingsearch.wsdl │ ├── bullhornstaffing.local.wsdl │ ├── directapi │ ├── adgroups.wsdl │ ├── campaigns.wsdl │ ├── general.xsd │ └── live.wsdl │ ├── docdatapayments │ ├── 1_3.1.xsd │ ├── 1_3.2.xsd │ └── 1_3.wsdl │ ├── ebaySvc.wsdl │ ├── empty.wsdl │ ├── ews │ ├── messages.xsd │ ├── services.wsdl │ └── types.xsd │ ├── existing_config │ └── wsdltophp.yml │ ├── generated │ ├── ValidActonApiService.php │ ├── ValidActonClassMap.php │ ├── ValidActonClassMapWihoutNamespace.php │ ├── ValidActonClassMapWihoutNamespaceAndCategory.php │ ├── ValidActonNoneTutorial.php │ ├── ValidActonTutorial.php │ ├── ValidAdGroupsSelectionCriteria.php │ ├── ValidAddRequest.php │ ├── ValidAddRequestRepeatedMaxOccurs.php │ ├── ValidAddress.php │ ├── ValidAddressDelivery_Type.php │ ├── ValidAddressType.php │ ├── ValidApiAdultOption.php │ ├── ValidApiArrayOfError.php │ ├── ValidApiArrayOfErrorProject.php │ ├── ValidApiArrayOfGuid.php │ ├── ValidApiArrayOfNewsRelatedSearch.php │ ├── ValidApiArrayOfString.php │ ├── ValidApiArrayOfWebSearchOption.php │ ├── ValidApiAuthenticate.php │ ├── ValidApiControlsType.php │ ├── ValidApiCreate.php │ ├── ValidApiDelete.php │ ├── ValidApiDo.php │ ├── ValidApiDs_weblog_formats.php │ ├── ValidApiFareItinerary.php │ ├── ValidApiFind.php │ ├── ValidApiHouseStageEnum.php │ ├── ValidApiItem.php │ ├── ValidApiLogin.php │ ├── ValidApiNewsArticle.php │ ├── ValidApiOffer.php │ ├── ValidApiPhoneNumberKeyType.php │ ├── ValidApiPhonebookSortOption.php │ ├── ValidApiPhonebookSortOptionApi.php │ ├── ValidApiQuery.php │ ├── ValidApiQueryWithIdenticalPropertiesDifferentByCase.php │ ├── ValidApiSaint.php │ ├── ValidApiSearch.php │ ├── ValidApiSearchBingApi.php │ ├── ValidApiSearchRequest.php │ ├── ValidApiSourceType.php │ ├── ValidApiTransactionActionType.php │ ├── ValidApiVideoRequest.php │ ├── ValidApiWebSearchOption.php │ ├── ValidBannerInfo.php │ ├── ValidBingApiService.php │ ├── ValidBingClassMap.php │ ├── ValidBingComposer.json │ ├── ValidBingComposerEmptySrcDirname.json │ ├── ValidBingComposerSettings.json │ ├── ValidBingComposerSlashSrcDirname.json │ ├── ValidBingEmptyComposerNameComposer.json │ ├── ValidBingTutorial.php │ ├── ValidBingTutorialNoPrefix.php │ ├── ValidBingTutorialNotStandalone.php │ ├── ValidCampaignGetItem.php │ ├── ValidDetails.php │ ├── ValidDoWithoutPrefix.php │ ├── ValidExpiryDate.php │ ├── ValidFieldString1000.php │ ├── ValidHotelReservationType.php │ ├── ValidHouseProfileData.php │ ├── ValidListWithoutPrefix.php │ ├── ValidMyProjectApiSearchProject.php │ ├── ValidOmnitureApiService.php │ ├── ValidOmnitureTutorial.php │ ├── ValidPayPalApiService.php │ ├── ValidPaymentCardType.php │ ├── ValidProposeNewTimeType.php │ ├── ValidReformaClassMap.php │ ├── ValidReformaTutorial.php │ ├── ValidSetExpressCheckoutRequestDetailsType.php │ ├── ValidShopper.php │ ├── ValidTaxType.php │ ├── ValidUniqueID_Type.php │ ├── ValidUnitTestsStructResult.php │ ├── ValidUnitTestsValueListType.php │ ├── ValidWorkingPeriod.php │ ├── ValidYandexDirectApiLiveGet.php │ ├── json_serialized.json │ ├── parsed_actonservice2_none.json │ ├── parsed_actonservice2_start.json │ ├── parsed_bingsearch_none.json │ ├── parsed_bingsearch_start.json │ ├── parsed_deliveryservice_none.json │ ├── parsed_deliveryservice_start.json │ ├── parsed_docdatapayments_none.json │ ├── parsed_docdatapayments_start.json │ ├── parsed_ews.json │ ├── parsed_ews_none.json │ ├── parsed_ews_start.json │ ├── parsed_myboard_none.json │ ├── parsed_myboard_start.json │ ├── parsed_odigeo_none.json │ ├── parsed_odigeo_start.json │ ├── parsed_omnitureadminservices_none.json │ ├── parsed_omnitureadminservices_start.json │ ├── parsed_ordercontract_none.json │ ├── parsed_ordercontract_start.json │ ├── parsed_paypal_none.json │ ├── parsed_paypal_start.json │ ├── parsed_portaplusapi_none.json │ ├── parsed_portaplusapi_start.json │ ├── parsed_queueservice_none.json │ ├── parsed_queueservice_start.json │ ├── parsed_reformagkh_none.json │ ├── parsed_reformagkh_start.json │ ├── parsed_unit_tests_none.json │ ├── parsed_unit_tests_start.json │ ├── parsed_vehicleselection_none.json │ ├── parsed_vehicleselection_start.json │ ├── parsed_wcf_none.json │ ├── parsed_wcf_start.json │ ├── parsed_whl_none.json │ ├── parsed_whl_start.json │ ├── parsed_yandex_campaigns_none.json │ ├── parsed_yandex_campaigns_start.json │ ├── parsed_yandex_groups_none.json │ ├── parsed_yandex_groups_start.json │ ├── parsed_yandex_live_none.json │ └── parsed_yandex_live_start.json │ ├── generator_options.yml │ ├── image │ ├── ImageViewService.local.wsdl │ ├── ImageViewService.wsdl │ ├── availableImagesRequest.xsd │ ├── availableImagesResponse.xsd │ ├── imageViewCommon.xsd │ ├── imagesRequest.xsd │ └── imagesResponse.xsd │ ├── lnp │ ├── CommonIdsModel.xsd │ ├── NumberManagement.wsdl │ └── NumberManagementModel.xsd │ ├── numeric_enumeration.xml │ ├── odigeo.wsdl │ ├── partner │ ├── PartnerService.0.xsd │ ├── PartnerService.1.xsd │ ├── PartnerService.10.xsd │ ├── PartnerService.11.xsd │ ├── PartnerService.12.xsd │ ├── PartnerService.13.xsd │ ├── PartnerService.14.xsd │ ├── PartnerService.15.xsd │ ├── PartnerService.16.xsd │ ├── PartnerService.17.xsd │ ├── PartnerService.18.xsd │ ├── PartnerService.2.xsd │ ├── PartnerService.3.xsd │ ├── PartnerService.4.xsd │ ├── PartnerService.5.xsd │ ├── PartnerService.6.xsd │ ├── PartnerService.7.xsd │ ├── PartnerService.8.xsd │ ├── PartnerService.9.xsd │ ├── PartnerService.local.scd.wsdl │ ├── PartnerService.local.third.wsdl │ ├── PartnerService.local.wsdl │ └── PartnerService.wsdl │ ├── paypal │ ├── CoreComponentTypes.xsd │ ├── EnhancedDataTypes.xsd │ ├── PayPalSvc.wsdl │ └── eBLBaseComponents.xsd │ ├── php_reserved_keywords.yml │ ├── portaplusapi.wsdl │ ├── reformagkh.wsdl │ ├── service_reserved_keywords.yml │ ├── struct_array_reserved_keywords.yml │ ├── struct_reserved_keywords.yml │ ├── unit_tests.wsdl │ ├── wcf │ ├── Service1.wsdl │ ├── Service1.xsd │ ├── Service10.wsdl │ ├── Service10.xsd │ └── Service11.xsd │ ├── whl.wsdl │ ├── xmlmime.xml │ └── xsd_types.yml └── wsdltophp.yml.dist /.docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM splitbrain/phpfarm:jessie 2 | 3 | RUN apt-get update && apt-get install -y git zip 4 | 5 | COPY --from=composer:latest /usr/bin/composer /usr/bin/composer 6 | COPY . /var/www/ 7 | 8 | WORKDIR /var/www/ 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # For more information about the properties used in 2 | # this file, please see the EditorConfig documentation: 3 | # http://editorconfig.org/ 4 | 5 | root = true 6 | 7 | [*] 8 | end_of_line = lf 9 | 10 | [*.php] 11 | indent_style = space 12 | indent_size = 4 -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | We accept contributions via pull requests on [Github]. 6 | Please make all pull requests to the `develop` branch, not the `master` branch. 7 | 8 | ## Before posting an issue 9 | 10 | - If a command is failing, post the full output you get when running the command, with the `--verbose` argument 11 | - If everything looks normal in said log, provide a log without the `--force` argument 12 | 13 | ## Pull Requests 14 | 15 | - **Create an issue** - Explain as detailed as possible the issue you encountered so we can understand the context of your pull request 16 | - **[Symfony Coding Standard]** - The easiest way to apply the conventions is to run `composer lint` 17 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 18 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 19 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 20 | - **Create feature branches** - Don't ask us to pull from your master branch. 21 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 22 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. 23 | 24 | ## Building the PHAR 25 | 26 | Once you cloned the repository in local, in order to test your changes, one solution : 27 | 28 | - You can compile the PHAR by doing `composer build` which will output to `bin/wsdltophp.phar`. In order to compile it you'll need to have the `phar.readonly` set to **Off** in your `php.ini`. 29 | 30 | ## Running Tests 31 | 32 | ``` bash 33 | $ composer test 34 | ``` 35 | 36 | **Happy coding**! 37 | 38 | [Github]: https://github.com/wsdltophp/packagegenerator 39 | [Symfony Coding Standard]: http://symfony.com/doc/current/contributing/code/standards.html 40 | -------------------------------------------------------------------------------- /.github/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PHP=7.4.10 2 | ARG WSDLTOPHP=3.2.7 3 | ARG PHAR 4 | 5 | FROM php:$PHP-cli 6 | 7 | ARG PHAR 8 | ARG WSDLTOPHP 9 | 10 | LABEL maintainer="https://github.com/mikaelcom" \ 11 | version=$WSDLTOPHP \ 12 | description="This image allows to use the wsdltophp command line tool in order to generate a PHP SDK from any WSDL" 13 | 14 | RUN apt-get update \ 15 | && apt-get install -y libxml2-dev tini zip \ 16 | && NPROC="$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)" \ 17 | && docker-php-ext-install soap 18 | 19 | COPY .github/php.ini /usr/local/etc/php/ 20 | 21 | COPY $PHAR wsdltophp.phar 22 | 23 | COPY $PHAR /usr/bin/wsdltophp 24 | COPY .github/docker-entrypoint.sh / 25 | ENTRYPOINT ["sh", "/docker-entrypoint.sh"] 26 | CMD ["wsdltophp"] 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: mikaelcom 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | 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. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | - During the package generation? 16 | - During the usage of the generated package? 17 | 18 | **Expected behavior** 19 | A clear and concise description of what you expected to happen. 20 | 21 | **Additional context** 22 | Add any other context about the problem here. 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: mikaelcom 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | isCommand() { 4 | # Retain backwards compatibility with common CI providers, 5 | if [ "$1" = "sh" ]; then 6 | return 1 7 | fi 8 | 9 | wsdltophp help "$1" > /dev/null 2>&1 10 | } 11 | 12 | # check if the first argument passed in looks like a flag 13 | if [ "${1#-}" != "$1" ]; then 14 | set -- /usr/bin/tini -- wsdltophp "$@" 15 | # check if the first argument passed in is wsdltophp 16 | elif [ "$1" = 'wsdltophp' ]; then 17 | set -- /usr/bin/tini -- "$@" 18 | # check if the first argument passed in matches a known command 19 | elif isCommand "$1"; then 20 | set -- /usr/bin/tini -- wsdltophp "$@" 21 | fi 22 | 23 | exec "$@" 24 | -------------------------------------------------------------------------------- /.github/php.ini: -------------------------------------------------------------------------------- 1 | memory_limit = -1 2 | -------------------------------------------------------------------------------- /.github/workflows/sonars.yml: -------------------------------------------------------------------------------- 1 | name: Sonars 2 | on: 3 | push: 4 | branches: 5 | - develop 6 | - feature/* 7 | - feat/* 8 | - release/* 9 | pull_request: 10 | types: [ opened, synchronize, reopened ] 11 | jobs: 12 | sonarcloud: 13 | name: Sonars 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | pull-requests: write 18 | statuses: write 19 | steps: 20 | - name: Checkout code 21 | uses: actions/checkout@v3 22 | with: 23 | fetch-depth: 0 24 | 25 | - name: Setup PHP with Xdebug 26 | uses: shivammathur/setup-php@v2 27 | with: 28 | php-version: 7.4 29 | coverage: xdebug 30 | 31 | - name: Install dependencies with composer 32 | run: composer update --no-ansi --no-interaction --no-progress 33 | 34 | - name: Generate coverage report with phpunit 35 | run: vendor/bin/phpunit --coverage-clover coverage.xml --log-junit report.xml 36 | 37 | - name: Monitor coverage 38 | uses: slavcodev/coverage-monitor-action@v1 39 | with: 40 | github_token: ${{ secrets.GITHUB_TOKEN }} 41 | coverage_path: coverage.xml 42 | threshold_alert: 95 43 | threshold_warning: 90 44 | 45 | - name: Fix phpunit files paths 46 | run: sed -i 's@'$GITHUB_WORKSPACE/'@''@g' coverage.xml report.xml 47 | 48 | - name: SonarCloud Scan 49 | uses: SonarSource/sonarcloud-github-action@master 50 | env: 51 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 52 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 53 | -------------------------------------------------------------------------------- /.github/workflows/static_coverage.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Deploy code coverage content to Pages 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["develop"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 19 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 20 | concurrency: 21 | group: "pages" 22 | cancel-in-progress: false 23 | 24 | jobs: 25 | # Single deploy job since we're just deploying 26 | deploy: 27 | environment: 28 | name: github-pages 29 | url: ${{ steps.deployment.outputs.page_url }} 30 | runs-on: ubuntu-latest 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@v3 34 | with: 35 | fetch-depth: 0 36 | 37 | - name: Setup PHP with Xdebug 38 | uses: shivammathur/setup-php@v2 39 | with: 40 | php-version: 7.4 41 | coverage: xdebug 42 | 43 | - name: Install dependencies with composer 44 | run: composer update --no-ansi --no-interaction --no-progress 45 | 46 | - name: Generate coverage report with phpunit 47 | run: vendor/bin/phpunit --coverage-html=coverage 48 | 49 | - name: Setup Pages 50 | uses: actions/configure-pages@v3 51 | 52 | - name: Upload artifact 53 | uses: actions/upload-pages-artifact@v1 54 | with: 55 | # Upload entire repository 56 | path: 'coverage' 57 | 58 | - name: Deploy to GitHub Pages 59 | id: deployment 60 | uses: actions/deploy-pages@v2 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock 3 | composer.phar 4 | phpunit.xml 5 | wsdltophp.yml 6 | bin 7 | tests/resources/generated 8 | coverage 9 | .phpunit.result.cache 10 | -------------------------------------------------------------------------------- /.php-cs-fixer.php: -------------------------------------------------------------------------------- 1 | exclude('vendor') 5 | ->exclude('tests/resources/generated') 6 | ->in(__DIR__); 7 | 8 | return (new PhpCsFixer\Config()) 9 | ->setUsingCache(false) 10 | ->setRules(array( 11 | '@PhpCsFixer' => true, 12 | 'phpdoc_separation' => false, 13 | )) 14 | ->setFinder($finder); 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Mikaël DELSOL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is furnished 10 | to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /UPGRADE-3.0.md: -------------------------------------------------------------------------------- 1 | # UPGRADE FROM 2.* to 3.* 2 | 3 | The main change is that the property `$soapClient` in the abstract class `AbstractSoapClientBase` is no more static. 4 | 5 | **Previously**: 6 | ```php 7 | class MyService extends AbstractSoapClientBase 8 | { 9 | public function CreateQueue(\Api\StructType\ApiCreateQueue $body) 10 | { 11 | try { 12 | $this->setResult(self::getSoapClient()->CreateQueue($body)); 13 | return $this->getResult(); 14 | } catch (\SoapFault $soapFault) { 15 | $this->saveLastError(__METHOD__, $soapFault); 16 | return false; 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | `self::getSoapClient()` was used to access the SoapClient instance. 23 | 24 | **Now**: 25 | ```php 26 | class MyService extends AbstractSoapClientBase 27 | { 28 | public function CreateQueue(\Api\StructType\ApiCreateQueue $body) 29 | { 30 | try { 31 | $this->setResult($this->getSoapClient()->CreateQueue($body)); 32 | return $this->getResult(); 33 | } catch (\SoapFault $soapFault) { 34 | $this->saveLastError(__METHOD__, $soapFault); 35 | return false; 36 | } 37 | } 38 | } 39 | ``` 40 | 41 | `$this->getSoapClient()` is now used to access the SoapClient instance. 42 | 43 | The [PackageBase](https://github.com/WsdlToPhp/PackageBase) version is now >= 2.0. 44 | -------------------------------------------------------------------------------- /box.json: -------------------------------------------------------------------------------- 1 | { 2 | "alias": "wsdltophp.phar", 3 | "chmod": "0755", 4 | "directories": [ 5 | "src" 6 | ], 7 | "finder": [ 8 | { 9 | "name": "*.php", 10 | "exclude": [ 11 | "phpunit", 12 | "Tests", 13 | "tests" 14 | ], 15 | "in": "vendor" 16 | }, 17 | { 18 | "name": "*.json", 19 | "exclude": [ 20 | "phpunit", 21 | "Tests", 22 | "tests" 23 | ], 24 | "in": "vendor/composer/composer" 25 | }, 26 | { 27 | "name": "LICENSE", 28 | "exclude": [ 29 | "phpunit", 30 | "Tests", 31 | "tests" 32 | ], 33 | "in": "vendor/composer/composer" 34 | } 35 | ], 36 | "files": [ 37 | "LICENSE", 38 | "CHANGELOG.md", 39 | "README.md" 40 | ], 41 | "git-version": "git-version", 42 | "main": "console", 43 | "output": "bin/wsdltophp.phar", 44 | "stub": true 45 | } -------------------------------------------------------------------------------- /console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | add(new GeneratePackageCommand()); 13 | 14 | $console->run(); -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | php: 5 | build: 6 | context: . 7 | dockerfile: .docker/Dockerfile 8 | volumes: 9 | - .:/var/www:rw 10 | container_name: package_generator 11 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | src 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ./tests/Command/ 14 | ./tests/ConfigurationReader/ 15 | ./tests/Generator 16 | ./tests/File 17 | ./tests/Model/ 18 | ./tests/Container/ 19 | ./tests/Parser/ 20 | 21 | 22 | ./tests/Command/ 23 | 24 | 25 | ./tests/ConfigurationReader/ 26 | 27 | 28 | ./tests/Generator/UtilsTest.php 29 | 30 | 31 | ./tests/Generator/GeneratorTest.php 32 | 33 | 34 | ./tests/File/ 35 | 36 | 37 | ./tests/Model/ 38 | 39 | 40 | ./tests/Container/ 41 | 42 | 43 | ./tests/Parser/ 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /rector.php: -------------------------------------------------------------------------------- 1 | paths([ 14 | __DIR__.'/src', 15 | __DIR__.'/tests', 16 | ]); 17 | $rectorConfig->skip([ 18 | __DIR__.'/tests/resources', 19 | ]); 20 | // define sets of rules 21 | $rectorConfig->sets([ 22 | LevelSetList::UP_TO_PHP_74, 23 | ]); 24 | 25 | // replace fully qualified class name by use statements 26 | $rectorConfig->importShortClasses(false); 27 | // keep native PHP class short name import 28 | $rectorConfig->importNames(); 29 | 30 | // register a single rule 31 | $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); 32 | $rectorConfig->rule(ReturnTypeFromStrictNativeCallRector::class); 33 | $rectorConfig->rule(ReturnTypeFromStrictScalarReturnExprRector::class); 34 | $rectorConfig->rule(ReturnTypeFromStrictTypedPropertyRector::class); 35 | }; 36 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=WsdlToPhp_PackageGenerator 2 | sonar.organization=wsdltophp 3 | sonar.php.coverage.reportPaths=coverage.xml 4 | sonar.php.tests.reportPath=report.xml 5 | 6 | sonar.sources=src/ 7 | sonar.tests=tests/ 8 | -------------------------------------------------------------------------------- /src/Command/AbstractCommand.php: -------------------------------------------------------------------------------- 1 | addOption( 23 | 'force', 24 | null, 25 | InputOption::VALUE_NONE, 26 | 'If true, then package is really generated otherwise debug information are displayed' 27 | ); 28 | } 29 | 30 | protected function execute(InputInterface $input, OutputInterface $output): int 31 | { 32 | $this->input = $input; 33 | $this->output = $output; 34 | 35 | return self::EXIT_OK; 36 | } 37 | 38 | protected function canExecute(): bool 39 | { 40 | return true === (bool) $this->getOptionValue('force'); 41 | } 42 | 43 | protected function writeLn($messages, int $type = OutputInterface::OUTPUT_NORMAL): void 44 | { 45 | $this->output->writeln($messages, $type); 46 | } 47 | 48 | protected function getOptionValue(string $name) 49 | { 50 | return $this->input->getOption($name); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/ConfigurationReader/AbstractReservedWord.php: -------------------------------------------------------------------------------- 1 | parseReservedKeywords($filename); 18 | } 19 | 20 | public function is(string $keyword): bool 21 | { 22 | return in_array($keyword, $this->keywords[self::CASE_SENSITIVE_KEY], true) || in_array(mb_strtolower($keyword), $this->keywords[self::CASE_INSENSITIVE_KEY], true); 23 | } 24 | 25 | protected function parseReservedKeywords(string $filename): AbstractReservedWord 26 | { 27 | $allKeywords = $this->parseSimpleArray($filename, self::MAIN_KEY); 28 | $caseSensitiveKeywords = $allKeywords[self::CASE_SENSITIVE_KEY]; 29 | $caseInsensitiveKeywords = array_map('strtolower', $allKeywords[self::CASE_INSENSITIVE_KEY]); 30 | $this->keywords = array_merge_recursive($this->keywords, [ 31 | self::CASE_SENSITIVE_KEY => $caseSensitiveKeywords, 32 | self::CASE_INSENSITIVE_KEY => $caseInsensitiveKeywords, 33 | ]); 34 | 35 | return $this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/ConfigurationReader/AbstractYamlReader.php: -------------------------------------------------------------------------------- 1 | parse(file_get_contents($filename)); 47 | } 48 | 49 | protected function parseSimpleArray(string $filename, string $mainKey): array 50 | { 51 | $values = $this->loadYaml($filename); 52 | if (!array_key_exists($mainKey, $values)) { 53 | throw new \InvalidArgumentException(sprintf('Unable to find section "%s" in "%s"', $mainKey, $filename), __LINE__); 54 | } 55 | 56 | return $values[$mainKey]; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/ConfigurationReader/PhpReservedKeyword.php: -------------------------------------------------------------------------------- 1 | parseXsdTypes($filename); 23 | } 24 | 25 | public static function instance(?string $filename = null): self 26 | { 27 | return parent::instance($filename); 28 | } 29 | 30 | public static function getDefaultConfigurationPath(): string 31 | { 32 | return __DIR__.'/../resources/config/xsd_types.yml'; 33 | } 34 | 35 | public function isXsd(string $xsdType): bool 36 | { 37 | return array_key_exists($xsdType, $this->types) || self::isAnonymous($xsdType); 38 | } 39 | 40 | public static function isAnonymous(string $xsdType): bool 41 | { 42 | return (bool) preg_match(self::ANONYMOUS_TYPE, $xsdType); 43 | } 44 | 45 | public function phpType(string $xsdType): string 46 | { 47 | return self::isAnonymous($xsdType) ? $this->types[self::ANONYMOUS_KEY] : ($this->isXsd($xsdType) ? $this->types[$xsdType] : ''); 48 | } 49 | 50 | protected function parseXsdTypes(string $filename): self 51 | { 52 | $this->types = $this->parseSimpleArray($filename, self::MAIN_KEY); 53 | 54 | return $this; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Container/Model/AbstractModel.php: -------------------------------------------------------------------------------- 1 | get($name); 16 | } 17 | 18 | public function get($value): ?Model 19 | { 20 | foreach ($this->objects as $object) { 21 | if ($object instanceof Model && $value === $object->getName()) { 22 | return $object; 23 | } 24 | } 25 | 26 | return null; 27 | } 28 | 29 | protected function objectClass(): string 30 | { 31 | return Model::class; 32 | } 33 | 34 | protected function objectProperty(): string 35 | { 36 | return 'methodName'; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Container/Model/Schema.php: -------------------------------------------------------------------------------- 1 | get($name); 14 | } 15 | 16 | protected function objectClass(): string 17 | { 18 | return Model::class; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Container/Model/Service.php: -------------------------------------------------------------------------------- 1 | get($serviceName) instanceof Model) { 15 | $this->add(new Model($this->generator, $serviceName)); 16 | } 17 | $serviceMethod = $this->get($serviceName)->getMethod($methodName); 18 | 19 | // Service method does not already exist, register it 20 | if (!$serviceMethod instanceof MethodModel) { 21 | $this->get($serviceName)->addMethod($methodName, $methodParameter, $methodReturn); 22 | } 23 | // Service method exists with a different signature, register it too by identifying the service functions as non unique functions 24 | elseif ($methodParameter !== $serviceMethod->getParameterType()) { 25 | $serviceMethod->setUnique(false); 26 | $this->get($serviceName)->addMethod($methodName, $methodParameter, $methodReturn, false); 27 | } 28 | 29 | return $this; 30 | } 31 | 32 | public function getServiceByName(string $name): ?Model 33 | { 34 | return $this->get($name); 35 | } 36 | 37 | public function getMethods(): Method 38 | { 39 | $methods = new Method($this->generator); 40 | 41 | /** @var Model $service */ 42 | foreach ($this->objects as $service) { 43 | foreach ($service->getMethods() as $method) { 44 | $methods->add($method); 45 | } 46 | } 47 | 48 | return $methods; 49 | } 50 | 51 | protected function objectClass(): string 52 | { 53 | return Model::class; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Container/Model/StructAttribute.php: -------------------------------------------------------------------------------- 1 | get($name); 14 | } 15 | 16 | public function getStructAttributeByCleanName(string $cleanedName): ?Model 17 | { 18 | return $this->getByCleanName($cleanedName); 19 | } 20 | 21 | public function getByCleanName(string $cleanedName): ?Model 22 | { 23 | $attribute = null; 24 | foreach ($this->objects as $object) { 25 | if ($object instanceof Model && $cleanedName === $object->getCleanName()) { 26 | $attribute = $object; 27 | 28 | break; 29 | } 30 | } 31 | 32 | return $attribute; 33 | } 34 | 35 | protected function objectClass(): string 36 | { 37 | return Model::class; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Container/Model/StructValue.php: -------------------------------------------------------------------------------- 1 | get($name); 14 | } 15 | 16 | protected function objectClass(): string 17 | { 18 | return Model::class; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Container/Parser.php: -------------------------------------------------------------------------------- 1 | get($name); 14 | } 15 | 16 | protected function objectClass(): string 17 | { 18 | return AbstractParser::class; 19 | } 20 | 21 | protected function objectProperty(): string 22 | { 23 | return self::PROPERTY_NAME; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Container/PhpElement/AbstractPhpElement.php: -------------------------------------------------------------------------------- 1 | setFile(new PhpFile($name)) 22 | ->setGenerator($generator) 23 | ; 24 | } 25 | 26 | public function setGenerator(Generator $generator): self 27 | { 28 | $this->generator = $generator; 29 | 30 | return $this; 31 | } 32 | 33 | public function getGenerator(): Generator 34 | { 35 | return $this->generator; 36 | } 37 | 38 | public function write(): void 39 | { 40 | $this->writeFile(); 41 | } 42 | 43 | public function getFileName(): string 44 | { 45 | return sprintf('%s%s.%s', $this->getFileDestination(), $this->getFile()->getMainElement()->getName(), $this->getFileExtension()); 46 | } 47 | 48 | public function getFileExtension(): string 49 | { 50 | return self::PHP_FILE_EXTENSION; 51 | } 52 | 53 | public function getFile(): PhpFile 54 | { 55 | return $this->file; 56 | } 57 | 58 | protected function writeFile(): void 59 | { 60 | file_put_contents($this->getFileName(), $this->getFile()->toString(), LOCK_EX); 61 | } 62 | 63 | protected function getFileDestination(): string 64 | { 65 | return $this->getGenerator()->getOptionDestination(); 66 | } 67 | 68 | protected function setFile(PhpFile $file): self 69 | { 70 | $this->file = $file; 71 | 72 | return $this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/File/Element/PhpFunctionParameter.php: -------------------------------------------------------------------------------- 1 | model = $model; 18 | } 19 | 20 | public function setModel(AbstractModel $model): self 21 | { 22 | $this->model = $model; 23 | 24 | return $this; 25 | } 26 | 27 | public function getModel(): ?AbstractModel 28 | { 29 | return $this->model; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/File/FileInterface.php: -------------------------------------------------------------------------------- 1 | getChildren())) { 20 | $block->addChild('Meta information extracted from the WSDL'); 21 | } 22 | 23 | foreach ($validMeta as $meta) { 24 | $block->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, $meta, AbstractModelFile::ANNOTATION_META_LENGTH)); 25 | } 26 | } 27 | } 28 | 29 | public static function getValidMetaValues(AbstractModel $model, array $ignoreMeta = []): array 30 | { 31 | $meta = $model->getMeta(); 32 | $validMeta = []; 33 | foreach ($meta as $metaName => $metaValue) { 34 | if (in_array($metaName, $ignoreMeta, true)) { 35 | continue; 36 | } 37 | 38 | $finalMeta = self::getMetaValueAnnotation($metaName, $metaValue); 39 | if (is_scalar($finalMeta)) { 40 | $validMeta[] = $finalMeta; 41 | } 42 | } 43 | 44 | return $validMeta; 45 | } 46 | 47 | public static function getMetaValueAnnotation(string $metaName, $metaValue): ?string 48 | { 49 | $meta = null; 50 | if (is_array($metaValue)) { 51 | $metaValue = implode(' | ', array_unique($metaValue)); 52 | } 53 | 54 | $metaValue = GeneratorUtils::cleanComment($metaValue, ', ', false === mb_stripos($metaName, 'SOAPHeader')); 55 | if (is_scalar($metaValue)) { 56 | $meta = sprintf("\t- %s: %s", $metaName, $metaValue); 57 | } 58 | 59 | return $meta; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/File/Validation/AbstractBoundRule.php: -------------------------------------------------------------------------------- 1 | symbol()) { 27 | case self::SYMBOL_MAX_EXCLUSIVE: 28 | case self::SYMBOL_MAX_INCLUSIVE: 29 | $checkValueDomain = '==='; 30 | 31 | break; 32 | 33 | default: 34 | $checkValueDomain = '!=='; 35 | 36 | break; 37 | } 38 | $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\')))'; 39 | } 40 | 41 | return sprintf(($itemType ? '' : '!is_null($%1$s) && ').$test, $parameterName, $value, $this->symbol(), $method, $checkValueDomain); 42 | } 43 | 44 | final public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 45 | { 46 | 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); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/File/Validation/AbstractLengthRule.php: -------------------------------------------------------------------------------- 1 | getAttribute()->isArray()) { 15 | $test = sprintf( 16 | ($itemType ? '' : '!is_null($%1$s) && ').'mb_strlen((string) $%1$s) %3$s %2$d', 17 | $parameterName, 18 | $value, 19 | $this->symbol() 20 | ); 21 | } else { 22 | $this->addArrayValidationMethod($parameterName, $value); 23 | $test = sprintf( 24 | '\'\' !== (%s = self::%s($%s))', 25 | $this->getArrayErrorMessageVariableName($parameterName), 26 | $this->getValidationMethodName($parameterName), 27 | $parameterName 28 | ); 29 | } 30 | 31 | return $test; 32 | } 33 | 34 | final public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 35 | { 36 | if ($itemType || !$this->getAttribute()->isArray()) { 37 | $message = sprintf( 38 | 'sprintf(\'Invalid length of %%s, the number of characters/octets contained by the literal must be %s %s\', mb_strlen((string) $%s))', 39 | $this->comparisonString(), 40 | is_array($value) ? implode(',', array_unique($value)) : $value, 41 | $parameterName 42 | ); 43 | } else { 44 | $message = $this->getArrayErrorMessageVariableName($parameterName); 45 | } 46 | 47 | return $message; 48 | } 49 | 50 | final protected function getArrayExceptionMessageOnTestFailure($value): string 51 | { 52 | return sprintf( 53 | 'Invalid length for value(s) %%s, the number of characters/octets contained by the literal must be %s %s', 54 | $this->comparisonString(), 55 | $value 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/File/Validation/AbstractMinMaxRule.php: -------------------------------------------------------------------------------- 1 | '; 10 | public const SYMBOL_MAX_EXCLUSIVE = '>='; 11 | public const SYMBOL_MIN_INCLUSIVE = '<'; 12 | public const SYMBOL_MIN_EXCLUSIVE = '<='; 13 | public const SYMBOL_STRICT = '!=='; 14 | 15 | /** 16 | * Must return the comparison symbol. 17 | */ 18 | abstract public function symbol(): string; 19 | 20 | final public function comparisonString(): string 21 | { 22 | switch ($this->symbol()) { 23 | case self::SYMBOL_MAX_INCLUSIVE: 24 | $comparison = 'less than or equal to'; 25 | 26 | break; 27 | 28 | case self::SYMBOL_MIN_INCLUSIVE: 29 | $comparison = 'greater than or equal to'; 30 | 31 | break; 32 | 33 | case self::SYMBOL_MIN_EXCLUSIVE: 34 | $comparison = 'greater than'; 35 | 36 | break; 37 | 38 | case self::SYMBOL_MAX_EXCLUSIVE: 39 | $comparison = 'less than'; 40 | 41 | break; 42 | 43 | case self::SYMBOL_STRICT: 44 | $comparison = 'equal to'; 45 | 46 | break; 47 | 48 | default: 49 | throw new \InvalidArgumentException(sprintf('Invalid value %s returned by symbol() method, can\'t determine comparison string', $this->symbol())); 50 | } 51 | 52 | return $comparison; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/File/Validation/ArrayRule.php: -------------------------------------------------------------------------------- 1 | getAttribute()->isArray(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/File/Validation/BoolRule.php: -------------------------------------------------------------------------------- 1 | getRestrictionModel()) { 28 | $test = sprintf('!%s::%s($%s)', $this->getRestrictionModel()->getPackagedName(true), StructEnum::METHOD_VALUE_IS_VALID, $parameterName); 29 | } 30 | 31 | return $test; 32 | } 33 | 34 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 35 | { 36 | $exceptionMessage = ''; 37 | if ($restrictionModel = $this->getRestrictionModel()) { 38 | $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); 39 | } 40 | 41 | return $exceptionMessage; 42 | } 43 | 44 | protected function getRestrictionModel(): ?Struct 45 | { 46 | if (!$this->model) { 47 | $this->model = $this->getFile()->getRestrictionFromStructAttribute($this->getAttribute()); 48 | } 49 | 50 | return $this->model; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/File/Validation/FloatRule.php: -------------------------------------------------------------------------------- 1 | %2$d', $parameterName, $value); 23 | } 24 | 25 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 26 | { 27 | 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); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/File/Validation/IntRule.php: -------------------------------------------------------------------------------- 1 | getItemSanityCheck($parameterName)); 19 | } 20 | 21 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 22 | { 23 | 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); 24 | } 25 | 26 | /** 27 | * The second case which used PHP native functions is voluntarily limited by the native functions provided by PHP, 28 | * and the possible types defined in xsd_types.yml. 29 | */ 30 | protected function getItemSanityCheck(string $itemName): string 31 | { 32 | $model = $this->getFile()->getModelFromStructAttribute($this->getAttribute()); 33 | $sanityCheck = 'false'; 34 | if ($model instanceof Struct && !$model->isList() && ($model->isStruct() || ($model->isArray() && $model->getInheritanceStruct() instanceof Struct))) { 35 | $sanityCheck = sprintf('!$%s instanceof %s', $itemName, $this->getFile()->getStructAttributeTypeAsPhpType($this->getAttribute(), false)); 36 | } elseif ($this->getAttribute()->isXml()) { 37 | $sanityCheck = $this->getRules()->getXmlRule()->testConditions($itemName, null, true); 38 | } else { 39 | $type = $this->getFile()->getStructAttributeTypeAsPhpType($this->getAttribute(), false); 40 | if ($rule = $this->getRules()->getRule($type)) { 41 | $sanityCheck = $rule->testConditions($itemName, null, true); 42 | } 43 | } 44 | 45 | return $sanityCheck; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/File/Validation/LengthRule.php: -------------------------------------------------------------------------------- 1 | getAttribute()->isList(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/File/Validation/MaxExclusiveRule.php: -------------------------------------------------------------------------------- 1 | %2$d', $parameterName, $value); 23 | } 24 | 25 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 26 | { 27 | 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); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/File/Validation/XmlRule.php: -------------------------------------------------------------------------------- 1 | loadXML($%1$s)))))', $parameterName); 17 | } 18 | 19 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 20 | { 21 | return sprintf('sprintf(\'Invalid value %%s, please provide a valid XML string\', var_export($%1$s, true))', $parameterName); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Generator/AbstractGeneratorAware.php: -------------------------------------------------------------------------------- 1 | setGenerator($generator); 14 | } 15 | 16 | public function getGenerator(): ?Generator 17 | { 18 | return $this->generator; 19 | } 20 | 21 | protected function setGenerator(Generator $generator): self 22 | { 23 | $this->generator = $generator; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Generator/GeneratorContainers.php: -------------------------------------------------------------------------------- 1 | initStructs() 21 | ->initServices() 22 | ; 23 | } 24 | 25 | public function getServices(): ServiceContainer 26 | { 27 | return $this->services; 28 | } 29 | 30 | public function getStructs(): StructContainer 31 | { 32 | return $this->structs; 33 | } 34 | 35 | public function jsonSerialize(): array 36 | { 37 | return [ 38 | 'services' => $this->services, 39 | 'structs' => $this->structs, 40 | ]; 41 | } 42 | 43 | protected function initStructs(): self 44 | { 45 | if (!isset($this->structs)) { 46 | $this->structs = new StructContainer($this->generator); 47 | } 48 | 49 | return $this; 50 | } 51 | 52 | protected function initServices(): self 53 | { 54 | if (!isset($this->services)) { 55 | $this->services = new ServiceContainer($this->generator); 56 | } 57 | 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Generator/SoapClient.php: -------------------------------------------------------------------------------- 1 | initContentFromContentString($content); 18 | } 19 | 20 | public function getContent(): AbstractDocumentHandler 21 | { 22 | return $this->content; 23 | } 24 | 25 | abstract protected function contentClass(): string; 26 | 27 | protected function initContentFromContentString(string $content): AbstractDocument 28 | { 29 | $contentClass = $this->contentClass(); 30 | $domDocument = new \DOMDocument('1.0', 'utf-8'); 31 | 32 | try { 33 | $domDocument->loadXML($content, LIBXML_NOERROR); 34 | $this->content = new $contentClass($domDocument, $this->generator); 35 | } catch (\Exception $exception) { 36 | throw new \InvalidArgumentException(sprintf('Unable to load document at "%s"', $this->getName()), __LINE__, $exception); 37 | } 38 | 39 | return $this; 40 | } 41 | 42 | protected function toJsonSerialize(): array 43 | { 44 | return []; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Model/EmptyModel.php: -------------------------------------------------------------------------------- 1 | schemas = new SchemaContainer($generator); 19 | } 20 | 21 | public function getContent(): WsdlDocument 22 | { 23 | return parent::getContent(); 24 | } 25 | 26 | public function addSchema(Schema $schema): self 27 | { 28 | $this->getContent()->addExternalSchema($schema->getContent()); 29 | 30 | $this->schemas->add($schema); 31 | 32 | return $this; 33 | } 34 | 35 | public function hasSchema(string $schemaLocation): bool 36 | { 37 | return $this->schemas->getSchemaByName($schemaLocation) instanceof Schema; 38 | } 39 | 40 | public function getSchemas(): SchemaContainer 41 | { 42 | return $this->schemas; 43 | } 44 | 45 | protected function contentClass(): string 46 | { 47 | return WsdlDocument::class; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Parser/AbstractParser.php: -------------------------------------------------------------------------------- 1 | getSuitableParent(); 17 | 18 | if ($parent instanceof Tag) { 19 | $model = $this->getModel($parent); 20 | if ($model instanceof Struct) { 21 | if ($tag->hasAttributeName() && ($modelAttribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) { 22 | $this->parseTagAttributes($tag, $model, $modelAttribute); 23 | 24 | return; 25 | } 26 | 27 | if ($tag->hasAttributeRef() && ($modelAttribute = $model->getAttribute($tag->getAttributeRef())) instanceof StructAttribute) { 28 | $this->parseTagAttributes($tag, $model, $modelAttribute); 29 | 30 | return; 31 | } 32 | 33 | $this->parseTagAttributes($tag, $model); 34 | } 35 | } 36 | 37 | $this->parseTagAttributes($tag); 38 | } 39 | 40 | protected function parseWsdl(Wsdl $wsdl): void 41 | { 42 | foreach ($this->getTags() as $tag) { 43 | $this->parseTag($tag); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/AbstractTagImportParser.php: -------------------------------------------------------------------------------- 1 | getTags() as $tag) { 17 | if (empty($location = $tag->getLocationAttributeValue())) { 18 | continue; 19 | } 20 | 21 | $finalLocation = Utils::resolveCompletePath($this->getLocation($wsdl, $schema), $location); 22 | $this->generator->addSchemaToWsdl($wsdl, $finalLocation); 23 | } 24 | } 25 | 26 | protected function getLocation(Wsdl $wsdl, Schema $schema = null): string 27 | { 28 | return ($schema ?? $wsdl)->getName(); 29 | } 30 | 31 | /** 32 | * 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. 33 | * 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. 34 | */ 35 | protected function parseSchema(Wsdl $wsdl, Schema $schema): void 36 | { 37 | if (0 < count($this->getTags())) { 38 | $this->parseWsdl($wsdl, $schema); 39 | } else { 40 | $this->getTagParser()->parse(); 41 | } 42 | } 43 | 44 | protected function getTagParser(): ?AbstractTagImportParser 45 | { 46 | $tagName = null; 47 | 48 | switch ($this->parsingTag()) { 49 | case AbstractDocument::TAG_IMPORT: 50 | $tagName = AbstractDocument::TAG_INCLUDE; 51 | 52 | break; 53 | 54 | case AbstractDocument::TAG_INCLUDE: 55 | $tagName = AbstractDocument::TAG_IMPORT; 56 | 57 | break; 58 | } 59 | 60 | return $this->getGenerator()->getParsers()->getParsers()->getParserByName($tagName); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/README.md: -------------------------------------------------------------------------------- 1 | The Wsdl parsers 2 | ================ 3 | 4 | The key of these parsers is to do the minimum treatments meaning that we must load the minimum amount of nodes in order to speed it up and to low the memory usage. 5 | 6 | Nevertheless, the goals of these parsers are various: 7 | 8 | - Get the maximum amount of information about each structs and operations 9 | - Consolidate the information parsed by the SoapClient parsers with information they can't see as: 10 | - SoapHeaders (header tags) 11 | - Enumerations values 12 | - Restrictions on parameters 13 | - Default parameter value 14 | - Abstract elements 15 | - Input/Output parameters type 16 | - Values of type array 17 | - Inheritance between elements 18 | 19 | Knowing this, it is simpler to understand why simpleType are not parsed as parsing them would mean that: 20 | 21 | - We would retrieve each tag 22 | - For each tag we would apply various methods to test the presence of each possible information we want to get (possibly none) and each possibility 23 | - For each child tag, parse its information and its own children recursively 24 | 25 | This shows that potentially we would load lots of nodes for nothing if they don't contain anything interesting. We simply do the opposite by: 26 | 27 | - Retrieve each tag that provide additional useful information 28 | - For each retrieved tag, climb to its parent 29 | - Parse the tag and consolidate its parent's information with it 30 | 31 | So, if we load all the documentation nodes that contain textual information about its container, if documentations are numerous it's good because it means that the Web Service is well documented. 32 | 33 | On the other hand, if there is no documentation node, then we won't do anything meaning that we won't loose time to parse any node. 34 | 35 | After all! 36 | ---------- 37 | 38 | After all, if you think it is not a good choice to not parse simpleType and so on, please let me know the reasons. 39 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagAttribute.php: -------------------------------------------------------------------------------- 1 | getSuitableParent(); 20 | 21 | // Is it part of an attributeGroup? 22 | if (!$tag->hasAttribute('type') || !$parent instanceof TagAttributeGroup) { 23 | return; 24 | } 25 | 26 | foreach ($parent->getReferencingElements() as $element) { 27 | if (($model = $this->getModel($element)) instanceof Struct && ($attribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) { 28 | $this->parseTagAttributes($tag, $attribute); 29 | } 30 | } 31 | } 32 | 33 | protected function parsingTag(): string 34 | { 35 | return WsdlDocument::TAG_ATTRIBUTE; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagChoice.php: -------------------------------------------------------------------------------- 1 | getSuitableParent(); 23 | $children = $choice->getChildrenElements(); 24 | if ($parent && count($children) && ($struct = $this->getModel($parent)) instanceof Struct) { 25 | $unionNames = []; 26 | foreach ($children as $child) { 27 | $unionNames[] = $child->getAttributeName() ? $child->getAttributeName() : $child->getAttributeRef(); 28 | } 29 | foreach ($children as $child) { 30 | $this->parseChoiceChild($choice, $unionNames, $child, $struct); 31 | } 32 | unset($unionNames); 33 | } 34 | } 35 | 36 | protected function parseWsdl(Wsdl $wsdl): void 37 | { 38 | foreach ($this->getTags() as $tag) { 39 | $this->parseChoice($tag); 40 | } 41 | } 42 | 43 | protected function parsingTag(): string 44 | { 45 | return WsdlDocument::TAG_CHOICE; 46 | } 47 | 48 | protected function parseChoiceChild(Choice $choice, array $choiceNames, AbstractTag $child, Struct $struct): void 49 | { 50 | $attributeName = $child->getAttributeName(); 51 | if (empty($attributeName) && ($attributeRef = $child->getAttributeRef())) { 52 | $attributeName = $attributeRef; 53 | } 54 | 55 | if (($structAttribute = $struct->getAttribute($attributeName)) instanceof StructAttribute) { 56 | $structAttribute 57 | ->setContainsElements($choice->canOccurSeveralTimes()) 58 | ->addMeta('choice', $choiceNames) 59 | ->addMeta('choiceMaxOccurs', $choice->getMaxOccurs()) 60 | ->addMeta('choiceMinOccurs', $choice->getMinOccurs()) 61 | ; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagComplexType.php: -------------------------------------------------------------------------------- 1 | parseTagAttributes($complexType); 16 | } 17 | 18 | protected function parseWsdl(Wsdl $wsdl): void 19 | { 20 | foreach ($this->getTags() as $tag) { 21 | $this->parseComplexType($tag); 22 | } 23 | } 24 | 25 | protected function parsingTag(): string 26 | { 27 | return WsdlDocument::TAG_COMPLEX_TYPE; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagElement.php: -------------------------------------------------------------------------------- 1 | setContainsElements($tag->canOccurSeveralTimes()) 28 | ->setRemovableFromRequest($tag->isRemovable()) 29 | ; 30 | 31 | $sequence = $tag->getSuitableParent(false, [AbstractDocument::TAG_SEQUENCE]); 32 | if ($sequence instanceof TagSequence && $sequence->canOccurSeveralTimes()) { 33 | $structAttribute->setContainsElements(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagEnumeration.php: -------------------------------------------------------------------------------- 1 | getModel($tag, $enumeration->getRestrictionParentType()); 21 | $struct = $struct ? $struct : $this->getModel($tag); 22 | if (!$struct instanceof Struct) { 23 | return; 24 | } 25 | 26 | // issue #177: the aim of redefining the $struct variable is to keep the reference to the right struct 27 | $struct = $struct->addValue($enumeration->getValue()); 28 | if (($value = $struct->getValue($enumeration->getValue())) instanceof StructValue) { 29 | $this->parseTagAttributes($enumeration, $value); 30 | } 31 | } 32 | 33 | protected function parseWsdl(Wsdl $wsdl): void 34 | { 35 | foreach ($this->getTags() as $tag) { 36 | $this->parseEnumeration($tag); 37 | } 38 | } 39 | 40 | protected function parsingTag(): string 41 | { 42 | return WsdlDocument::TAG_ENUMERATION; 43 | } 44 | 45 | protected function parseEnumeration(Enumeration $enumeration): void 46 | { 47 | $parent = $enumeration->getSuitableParent(); 48 | 49 | if (!$parent instanceof Tag) { 50 | return; 51 | } 52 | 53 | $this->addStructValue($parent, $enumeration); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagExtension.php: -------------------------------------------------------------------------------- 1 | getAttribute('base')->getValue(); 18 | $parent = $extension->getSuitableParent(); 19 | if (!empty($base) && $parent instanceof AbstractTag && $this->getModel($parent) instanceof AbstractModel && $parent->getAttributeName() !== $base) { 20 | $this->getModel($parent)->setInheritance($base); 21 | } 22 | } 23 | 24 | protected function parseWsdl(Wsdl $wsdl): void 25 | { 26 | foreach ($this->getTags() as $tag) { 27 | $this->parseExtension($tag); 28 | } 29 | } 30 | 31 | protected function parsingTag(): string 32 | { 33 | return WsdlDocument::TAG_EXTENSION; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagHeader.php: -------------------------------------------------------------------------------- 1 | getParentOperation(); 24 | $input = $header->getParentInput(); 25 | if (!$operation instanceof Operation || !$input instanceof Input) { 26 | return; 27 | } 28 | 29 | $serviceMethod = $this->getModel($operation); 30 | if (!$serviceMethod instanceof Method || $this->isSoapHeaderAlreadyDefined($serviceMethod, $header->getHeaderName())) { 31 | return; 32 | } 33 | 34 | $serviceMethod 35 | ->addMeta(self::META_SOAP_HEADERS, [ 36 | $header->getHeaderRequired(), 37 | ]) 38 | ->addMeta(self::META_SOAP_HEADER_NAMES, [ 39 | $header->getHeaderName(), 40 | ]) 41 | ->addMeta(self::META_SOAP_HEADER_TYPES, [ 42 | $header->getHeaderType(), 43 | ]) 44 | ->addMeta(self::META_SOAP_HEADER_NAMESPACES, [ 45 | $header->getHeaderNamespace(), 46 | ]) 47 | ; 48 | } 49 | 50 | protected function parseWsdl(Wsdl $wsdl): void 51 | { 52 | foreach ($this->getTags() as $tag) { 53 | $this->parseHeader($tag); 54 | } 55 | } 56 | 57 | protected function parsingTag(): string 58 | { 59 | return WsdlDocument::TAG_HEADER; 60 | } 61 | 62 | protected function isSoapHeaderAlreadyDefined(Method $method, string $soapHeaderName): bool 63 | { 64 | $methodSoapHeaders = $method->getMetaValue(self::META_SOAP_HEADER_NAMES, []); 65 | 66 | return in_array($soapHeaderName, $methodSoapHeaders, true); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagImport.php: -------------------------------------------------------------------------------- 1 | getParameterType(); 20 | } 21 | 22 | protected function setKnownType(Method $method, $knownType): self 23 | { 24 | $method->setParameterType($knownType); 25 | 26 | return $this; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagList.php: -------------------------------------------------------------------------------- 1 | getSuitableParent(); 19 | if (!$parent instanceof AbstractTag) { 20 | return; 21 | } 22 | 23 | $parentParent = $parent->getSuitableParent(); 24 | $model = $this->getModel($parent); 25 | if (is_null($model) && $parentParent instanceof AbstractTag) { 26 | $model = $this->getModel($parentParent); 27 | } 28 | 29 | if (!$model instanceof Struct) { 30 | return; 31 | } 32 | 33 | $itemType = $tag->getItemType(); 34 | $struct = $this->getStructByName($itemType); 35 | 36 | $type = $struct instanceof Struct ? $struct->getName() : $itemType; 37 | if ($parentParent instanceof AbstractTag && ($attribute = $model->getAttribute($parent->getAttributeName())) instanceof StructAttribute) { 38 | $attribute 39 | ->setContainsElements(true) 40 | ->setType($type) 41 | ->setInheritance($type) 42 | ; 43 | } else { 44 | $model 45 | ->setList($type) 46 | ->setInheritance(sprintf('%s[]', $type)) 47 | ; 48 | } 49 | } 50 | 51 | protected function parseWsdl(Wsdl $wsdl): void 52 | { 53 | foreach ($this->getTags() as $tag) { 54 | $this->parseList($tag); 55 | } 56 | } 57 | 58 | protected function parsingTag(): string 59 | { 60 | return WsdlDocument::TAG_LIST; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Parser/Wsdl/TagOutput.php: -------------------------------------------------------------------------------- 1 | getReturnType(); 20 | } 21 | 22 | protected function setKnownType(Method $method, $knownType): self 23 | { 24 | $method->setReturnType($knownType); 25 | 26 | return $this; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/resources/config/service_reserved_keywords.yml: -------------------------------------------------------------------------------- 1 | # List of PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | # It includes the pre defined functions by PackageBase classes too. 4 | 5 | reserved_keywords: 6 | case_sensitive: 7 | - 8 | case_insensitive: 9 | # methods from AbstractSoapClientBase 10 | - "__construct" 11 | - "getSoapClient" 12 | - "setSoapClient" 13 | - "initSoapClient" 14 | - "getSoapClientClassName" 15 | - "getDefaultWsdlOptions" 16 | - "setLocation" 17 | - "getLastRequest" 18 | - "getLastResponse" 19 | - "getLastXml" 20 | - "getLastRequestHeaders" 21 | - "getLastResponseHeaders" 22 | - "getLastHeaders" 23 | - "getFormattedXml" 24 | - "convertStringHeadersToArray" 25 | - "setSoapHeader" 26 | - "setHttpHeader" 27 | - "getLastError" 28 | - "setLastError" 29 | - "saveLastError" 30 | - "getLastErrorForMethod" 31 | - "getResult" 32 | - "setResult" 33 | -------------------------------------------------------------------------------- /src/resources/config/struct_array_reserved_keywords.yml: -------------------------------------------------------------------------------- 1 | # List of PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | # It includes the pre defined functions by PackageBase classes too. 4 | 5 | reserved_keywords: 6 | case_sensitive: 7 | - 8 | case_insensitive: 9 | # methods from AbstractStructArrayBase 10 | - "getPropertyValue" 11 | - "setPropertyValue" 12 | - "getAttributeName" 13 | - "length" 14 | - "count" 15 | - "current" 16 | - "next" 17 | - "rewind" 18 | - "valid" 19 | - "key" 20 | - "item" 21 | - "add" 22 | - "first" 23 | - "last" 24 | - "offsetExists" 25 | - "offsetGet" 26 | - "offsetSet" 27 | - "offsetUnset" 28 | - "getInternArray" 29 | - "setInternArray" 30 | - "getInternArrayOffset" 31 | - "initInternArray" 32 | - "setInternArrayOffset" 33 | - "getInternArrayIsArray" 34 | - "setInternArrayIsArray" 35 | -------------------------------------------------------------------------------- /src/resources/config/struct_reserved_keywords.yml: -------------------------------------------------------------------------------- 1 | # List of PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | # It includes the pre defined functions by PackageBase classes too. 4 | 5 | reserved_keywords: 6 | case_sensitive: 7 | - 8 | case_insensitive: 9 | # methods from AbstractStructBase 10 | - "setPropertValue" 11 | - "getPropertyValue" 12 | -------------------------------------------------------------------------------- /src/resources/config/xsd_types.yml: -------------------------------------------------------------------------------- 1 | # List of XSD types that can be defined as a type hint parameter. 2 | 3 | xsd_types: 4 | anonymous: "string" 5 | anySimpleType: "string" 6 | anyType: "string" 7 | anyURI: "string" 8 | base64Binary: "string" 9 | bool: "bool" 10 | boolean: "bool" 11 | byte: "string" 12 | date: "string" 13 | dateTime: "string" 14 | decimal: "float" 15 | double: "float" 16 | DayOfWeekType: "string" 17 | DOMDocument: "string" 18 | duration: "string" 19 | ENTITY: "string" 20 | ENTITIES: "string" 21 | float: "float" 22 | gDay: "string" 23 | gMonth: "string" 24 | gMonthDay: "string" 25 | gYear: "string" 26 | gYearMonth: "string" 27 | hexBinary: "string" 28 | int: "int" 29 | integer: "int" 30 | ID: "string" 31 | IDREF: "string" 32 | IDREFS: "string" 33 | language: "string" 34 | long: "int" 35 | Name: "string" 36 | negativeInteger: "int" 37 | nonNegativeInteger: "int" 38 | nonPositiveInteger: "int" 39 | normalizedString: "string" 40 | NCName: "string" 41 | NMTOKEN: "string" 42 | NMTOKENS: "string" 43 | NOTATION: "string" 44 | positiveInteger: "int" 45 | QName: "string" 46 | short: "int" 47 | string: "string" 48 | timestamp: "int" 49 | timeStamp: "int" 50 | time: "string" 51 | token: "string" 52 | unsignedByte: "string" 53 | unsignedInt: "int" 54 | unsignedLong: "int" 55 | unsignedShort: "int" 56 | UID: "string" 57 | UNKNOWN: "string" 58 | -------------------------------------------------------------------------------- /tests/ConfigurationReader/XsdTypesTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 24 | 25 | XsdTypes::instance(__DIR__.'/../resources/bad_xsd_types.yml'); 26 | } 27 | 28 | public function testExceptionForUnexistingFile(): void 29 | { 30 | $this->expectException(\InvalidArgumentException::class); 31 | 32 | XsdTypes::instance(__DIR__.'/../resources/bad_xsd_types'); 33 | } 34 | 35 | public function testIsXsdTrue(): void 36 | { 37 | $this->assertTrue(self::instance()->isXsd('duration')); 38 | } 39 | 40 | public function testIsXsdFalse(): void 41 | { 42 | $this->assertFalse(self::instance()->isXsd('Duration')); 43 | } 44 | 45 | public function testPhpXsd(): void 46 | { 47 | $this->assertSame('string', self::instance()->phpType('duration')); 48 | } 49 | 50 | public function testPhpNonXsd(): void 51 | { 52 | $this->assertSame('', self::instance()->phpType('Duration')); 53 | } 54 | 55 | public function testIsAnonymous(): void 56 | { 57 | $this->assertTrue(self::instance()->isAnonymous('anonymous159')); 58 | } 59 | 60 | public function testAnonymousPhpType(): void 61 | { 62 | $this->assertSame('string', self::instance()->phpType('anonymous159')); 63 | } 64 | 65 | public function testBase64BinaryXsd() 66 | { 67 | $this->assertTrue(self::instance()->isXsd('base64Binary')); 68 | } 69 | 70 | public function testBase64BinaryPhpType() 71 | { 72 | $this->assertSame('string', self::instance()->phpType('base64Binary')); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /tests/Container/ContainerTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 18 | 19 | $container = new ObjectContainerTest(self::getBingGeneratorInstance()); 20 | $container->add(new FalseObjectTest()); 21 | } 22 | 23 | public function testOffsetSetWithException(): void 24 | { 25 | $this->expectException(\InvalidArgumentException::class); 26 | 27 | $container = new ObjectContainerTest(self::getBingGeneratorInstance()); 28 | $container->offsetSet(1, new FalseObjectTest()); 29 | } 30 | 31 | public function testInvalidPropertyName(): void 32 | { 33 | $this->expectException(\InvalidArgumentException::class); 34 | 35 | $container = new FalseObjectContainerTest(self::getBingGeneratorInstance()); 36 | $container->add(new FalseObjectTest()); 37 | } 38 | 39 | public function testJsonSerialize(): void 40 | { 41 | $object = new ObjectTest(); 42 | $container = new ObjectContainerTest(self::getBingGeneratorInstance()); 43 | $container->add($object); 44 | $this->assertSame([ 45 | $object, 46 | ], $container->jsonSerialize()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/Container/FalseObjectContainerTest.php: -------------------------------------------------------------------------------- 1 | add(new MethodModel(self::getBingGeneratorInstance(), 'Foo', 'string', 'int', $service)); 26 | $methodContainer->add(new MethodModel(self::getBingGeneratorInstance(), 'Bar', 'string', 'int', $service)); 27 | $methodContainer->add(new MethodModel(self::getBingGeneratorInstance(), 'FooBar', [ 28 | 'string', 29 | 'int', 30 | 'int', 31 | ], 'int', $service)); 32 | 33 | return $methodContainer; 34 | } 35 | 36 | public function testGetMethodByName(): void 37 | { 38 | $methodContainer = self::instance(); 39 | 40 | $this->assertInstanceOf(MethodModel::class, $methodContainer->getMethodByName('Foo')); 41 | $this->assertNull($methodContainer->getMethodByName('boo')); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/Container/Model/SchemaContainerTest.php: -------------------------------------------------------------------------------- 1 | add(new SchemaModel(self::getBingGeneratorInstance(), self::SCHEMA_BING, file_get_contents(self::wsdlBingPath()))); 24 | $schemaContainer->add(new SchemaModel(self::getBingGeneratorInstance(), self::SCHEMA_EBAY, file_get_contents(self::wsdlEbayPath()))); 25 | 26 | return $schemaContainer; 27 | } 28 | 29 | public function testGetSchemaByName(): void 30 | { 31 | $schemaContainer = self::instance(); 32 | 33 | $this->assertInstanceOf(SchemaModel::class, $schemaContainer->getSchemaByName(self::SCHEMA_BING)); 34 | $this->assertInstanceOf(SchemaModel::class, $schemaContainer->getSchemaByName(self::SCHEMA_EBAY)); 35 | $this->assertNull($schemaContainer->getSchemaByName('Bar')); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Container/Model/ServiceContainerTest.php: -------------------------------------------------------------------------------- 1 | add(new ServiceModel(self::getBingGeneratorInstance(), 'Foo')); 21 | 22 | return $serviceContainer; 23 | } 24 | 25 | public function testGetServiceByName(): void 26 | { 27 | $serviceContainer = self::instance(); 28 | 29 | $this->assertInstanceOf(ServiceModel::class, $serviceContainer->getServiceByName('Foo')); 30 | $this->assertNull($serviceContainer->getServiceByName('Bar')); 31 | } 32 | 33 | public function testAddServiceNonUnique(): void 34 | { 35 | $serviceContainer = self::instance(); 36 | 37 | $serviceContainer->addService('Foo', 'bar', 'string', 'int'); 38 | $serviceContainer->addService('Foo', 'bar', 'int', 'string'); 39 | 40 | $fooService = $serviceContainer->getServiceByName('Foo'); 41 | 42 | $this->assertCount(2, $fooService->getMethods()); 43 | 44 | $count = 0; 45 | foreach ($fooService->getMethods() as $method) { 46 | $this->assertFalse($method->isUnique()); 47 | ++$count; 48 | } 49 | $this->assertSame(2, $count); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/Container/Model/StructAttributeContainerTest.php: -------------------------------------------------------------------------------- 1 | add(new StructAttribute(self::getBingGeneratorInstance(), 'foo', 'string', $struct)); 23 | $structAttributeContainer->add(new StructAttribute(self::getBingGeneratorInstance(), 'bar', 'int', $struct)); 24 | $structAttributeContainer->add(new StructAttribute(self::getBingGeneratorInstance(), 'Bar', 'float', $struct)); 25 | $structAttributeContainer->add(new StructAttribute(self::getBingGeneratorInstance(), 'fooBar', 'bool', $struct)); 26 | 27 | return $structAttributeContainer; 28 | } 29 | 30 | public function testGetStructAttributeByName(): void 31 | { 32 | $structAttributeContainer = self::instance(); 33 | 34 | $this->assertInstanceOf('\WsdlTophp\PackageGenerator\Model\StructAttribute', $structAttributeContainer->getStructAttributeByName('foo')); 35 | $this->assertInstanceOf('\WsdlTophp\PackageGenerator\Model\StructAttribute', $structAttributeContainer->getStructAttributeByName('bar')); 36 | $this->assertInstanceOf('\WsdlTophp\PackageGenerator\Model\StructAttribute', $structAttributeContainer->getStructAttributeByName('fooBar')); 37 | $this->assertNull($structAttributeContainer->getStructAttributeByName('foobar')); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Container/Model/StructValueContainerTest.php: -------------------------------------------------------------------------------- 1 | add(new StructValue(self::getBingGeneratorInstance(), 1, 0, $struct)); 25 | $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 2, 1, $struct)); 26 | $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 'any', 2, $struct)); 27 | $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 'bar', 3, $struct)); 28 | 29 | return $structValueContainer; 30 | } 31 | 32 | public function testGetStructValueByName(): void 33 | { 34 | $structValueContainer = self::instance(); 35 | 36 | $this->assertInstanceOf(StructValueModel::class, $structValueContainer->getStructValueByName(1)); 37 | $this->assertInstanceOf(StructValueModel::class, $structValueContainer->getStructValueByName(2)); 38 | $this->assertInstanceOf(StructValueModel::class, $structValueContainer->getStructValueByName('any')); 39 | $this->assertNull($structValueContainer->getStructValueByName('Bar')); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/Container/ObjectContainerTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 19 | 20 | $container = new Parser(self::getBingGeneratorInstance()); 21 | $container->add($container); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Container/PhpElement/ConstantTest.php: -------------------------------------------------------------------------------- 1 | add(new PhpConstant('foo', 1)); 23 | 24 | $this->assertCount(1, $constant); 25 | $this->assertInstanceOf(PhpConstant::class, $constant->get('foo')); 26 | } 27 | 28 | public function testAddWithException(): void 29 | { 30 | $this->expectException(\InvalidArgumentException::class); 31 | 32 | $constant = new Constant(self::getBingGeneratorInstance()); 33 | 34 | $constant->add(new PhpMethod('Bar')); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Container/PhpElement/MethodTest.php: -------------------------------------------------------------------------------- 1 | add(new PhpMethod('foo')); 23 | 24 | $this->assertCount(1, $method); 25 | $this->assertInstanceOf(PhpMethod::class, $method->get('foo')); 26 | } 27 | 28 | public function testAddWithException(): void 29 | { 30 | $this->expectException(\InvalidArgumentException::class); 31 | 32 | $method = new Method(self::getBingGeneratorInstance()); 33 | 34 | $method->add(new PhpConstant('Bar')); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Container/PhpElement/PropertyTest.php: -------------------------------------------------------------------------------- 1 | add(new PhpProperty('foo')); 23 | 24 | $this->assertCount(1, $property); 25 | $this->assertInstanceOf(PhpProperty::class, $property->get('foo')); 26 | } 27 | 28 | public function testAddWithException(): void 29 | { 30 | $this->expectException(\InvalidArgumentException::class); 31 | 32 | $property = new Property(self::getBingGeneratorInstance()); 33 | 34 | $property->add(new PhpConstant('Bar')); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/File/Validation/BooleanRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\TypeError::class); 16 | 17 | $instance = self::getWhlBookingChannelInstance(); 18 | 19 | $instance->setPrimary('true'); 20 | } 21 | 22 | public function testSetPrimaryWithTrueValueMustPass(): void 23 | { 24 | $instance = self::getWhlBookingChannelInstance(); 25 | 26 | $this->assertSame($instance, $instance->setPrimary(true)); 27 | } 28 | 29 | public function testSetPrimaryWithFalseValueMustPass(): void 30 | { 31 | $instance = self::getWhlBookingChannelInstance(); 32 | 33 | $this->assertSame($instance, $instance->setPrimary(false)); 34 | } 35 | 36 | public function testSetPrimaryWithNullValueMustPass(): void 37 | { 38 | $instance = self::getWhlBookingChannelInstance(); 39 | 40 | $this->assertSame($instance, $instance->setPrimary(null)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/File/Validation/ChoiceRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 21 | $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.'); 22 | 23 | $instance = self::getQueueMessageAttributeValueInstance(); 24 | 25 | $instance 26 | ->setBinaryValue('1234567980') 27 | ->setStringValue('0987654321') 28 | ; 29 | } 30 | 31 | /** 32 | * - choice: StringValue | BinaryValue 33 | * - choiceMaxOccurs: 1 34 | * - choiceMinOccurs: 1. 35 | */ 36 | public function testSetStringValueAloneMustPass(): void 37 | { 38 | $instance = self::getQueueMessageAttributeValueInstance(true); 39 | 40 | $this->assertSame($instance, $instance->setStringValue('0987654321')); 41 | } 42 | 43 | /** 44 | * - choice: StringValue | BinaryValue 45 | * - choiceMaxOccurs: 1 46 | * - choiceMinOccurs: 1. 47 | */ 48 | public function testSetStringValueAloneWithNullMustPass(): void 49 | { 50 | // true to avoid having the instance modified previously 51 | $instance = self::getQueueMessageAttributeValueInstance(true); 52 | 53 | $this->assertSame($instance, $instance->setStringValue(null)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/File/Validation/EnumerationRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 18 | $this->expectExceptionMessage('Invalid value(s) \'foo\', please use one of: Off, Moderate, Strict from enumeration class \EnumType\ApiAdultOption'); 19 | 20 | $instance = self::getBingSearchRequestInstance(); 21 | 22 | $instance->setAdult('foo'); 23 | } 24 | 25 | public function testSetAdultValueWithValidValueMustPass(): void 26 | { 27 | $instance = self::getBingSearchRequestInstance(); 28 | 29 | $this->assertSame($instance, $instance->setAdult(ApiAdultOption::VALUE_MODERATE)); 30 | } 31 | 32 | public function testSetAdultValueWithNullValueMustPass(): void 33 | { 34 | $instance = self::getBingSearchRequestInstance(); 35 | 36 | $this->assertSame($instance, $instance->setAdult(null)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/File/Validation/FloatRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\TypeError::class); 16 | 17 | $instance = self::getWhlTaxTypeInstance(); 18 | 19 | $instance->setPercent('foo'); 20 | } 21 | 22 | public function testSetPercentValueWithIntValueMustPass(): void 23 | { 24 | $instance = self::getWhlTaxTypeInstance(); 25 | 26 | $this->assertSame($instance, $instance->setPercent(85)); 27 | } 28 | 29 | public function testSetPercentValueWithFloatValueMustPass(): void 30 | { 31 | $instance = self::getWhlTaxTypeInstance(); 32 | 33 | $this->assertSame($instance, $instance->setPercent(8.5)); 34 | } 35 | 36 | public function testSetPercentValueWithNullValueMustPass(): void 37 | { 38 | $instance = self::getWhlTaxTypeInstance(); 39 | 40 | $this->assertSame($instance, $instance->setPercent(null)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/File/Validation/IntRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\TypeError::class); 16 | 17 | $instance = self::getWhlTaxTypeInstance(); 18 | 19 | $instance->setDecimalPlaces('foo'); 20 | } 21 | 22 | public function testSetDecimalPlacesValueWithIntValueMustPass(): void 23 | { 24 | $instance = self::getWhlTaxTypeInstance(); 25 | 26 | $this->assertSame($instance, $instance->setDecimalPlaces(18)); 27 | } 28 | 29 | public function testSetDecimalPlacesValueWithStringIntValueMustPass(): void 30 | { 31 | $instance = self::getWhlTaxTypeInstance(); 32 | 33 | $this->assertSame($instance, $instance->setDecimalPlaces(18)); 34 | } 35 | 36 | public function testSetDecimalPlacesValueWithFloatValueMustThrowAnException(): void 37 | { 38 | $this->expectException(\TypeError::class); 39 | 40 | $instance = self::getWhlTaxTypeInstance(); 41 | 42 | $instance->setDecimalPlaces(18.5); 43 | } 44 | 45 | public function testSetDecimalPlacesValueWithStringFloatValueMustThrowAnException(): void 46 | { 47 | $this->expectException(\TypeError::class); 48 | 49 | $instance = self::getWhlTaxTypeInstance(); 50 | 51 | $instance->setDecimalPlaces('18.5'); 52 | } 53 | 54 | public function testSetDecimalPlacesValueWithNullValueMustPass(): void 55 | { 56 | $instance = self::getWhlTaxTypeInstance(); 57 | 58 | $this->assertSame($instance, $instance->setDecimalPlaces(null)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /tests/File/Validation/InvalidRuleClass.php: -------------------------------------------------------------------------------- 1 | '; 19 | } 20 | 21 | public function testConditions(string $parameterName, $value, bool $itemType = false): string 22 | { 23 | return 'true'; 24 | } 25 | 26 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string 27 | { 28 | return ''; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/File/Validation/InvalidRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 22 | $this->expectExceptionMessage('Invalid value <> returned by symbol() method, can\'t determine comparison string'); 23 | 24 | $instance = self::bingGeneratorInstance(); 25 | $i = new InvalidRuleClass(new Rules(new Struct($instance, 'Foo'), new PhpMethod('bar'), new StructAttribute($instance, 'FooBar'), new Method($instance))); 26 | $i->comparisonString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/File/Validation/LengthRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 22 | $this->expectExceptionMessage('Invalid length of 5, the number of characters/octets contained by the literal must be equal to 4'); 23 | 24 | $instance = self::getOrderContractAddressDeliveryTypeInstance(); 25 | 26 | $instance->setPostalCode('12345'); 27 | } 28 | 29 | /** 30 | * The PostalCode 31 | * Meta informations extracted from the WSDL 32 | * - base: string 33 | * - length: 4. 34 | */ 35 | public function testAddToAddressLineWithTooLessCharactersLengthMustThrowAnException(): void 36 | { 37 | $this->expectException(\InvalidArgumentException::class); 38 | $this->expectExceptionMessage('Invalid length of 3, the number of characters/octets contained by the literal must be equal to 4'); 39 | 40 | $instance = self::getOrderContractAddressDeliveryTypeInstance(); 41 | 42 | $instance->setPostalCode('123'); 43 | } 44 | 45 | /** 46 | * The PostalCode 47 | * Meta informations extracted from the WSDL 48 | * - base: string 49 | * - length: 4. 50 | */ 51 | public function testAddToAddressLineWithSAmeCharactersLengthMustPass(): void 52 | { 53 | $instance = self::getOrderContractAddressDeliveryTypeInstance(); 54 | 55 | $this->assertSame($instance, $instance->setPostalCode('1234')); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tests/File/Validation/TotalDigitsRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 24 | $this->expectExceptionMessage('Invalid value 123456789101112.12, the value must at most contain 2 fraction digits, 17 given'); 25 | 26 | // hack as precision can return false negative with 1.23457E+14, 27 | ini_set('serialize_precision', '17'); 28 | 29 | $instance = self::getReformaHouseProfileDataInstance(); 30 | 31 | $instance->setArea_total(123_456_789_101_112.12); 32 | } 33 | 34 | /** 35 | * The area_total 36 | * Meta informations extracted from the WSDL 37 | * - base: xsd:decimal 38 | * - fractionDigits: 2 39 | * - totalDigits: 15 40 | * - var: float. 41 | */ 42 | public function testSetAreaTotalWithFloatExactDigitsMustThrowAnException(): void 43 | { 44 | $instance = self::getReformaHouseProfileDataInstance(); 45 | 46 | $this->assertSame($instance, $instance->setArea_total(1_234_567_891_011.12)); 47 | } 48 | 49 | /** 50 | * The area_total 51 | * Meta informations extracted from the WSDL 52 | * - base: xsd:decimal 53 | * - fractionDigits: 2 54 | * - totalDigits: 15 55 | * - var: float. 56 | */ 57 | public function testSetAreaTotalWithFloatLessDigitsMustThrowAnException(): void 58 | { 59 | $instance = self::getReformaHouseProfileDataInstance(); 60 | 61 | $this->assertSame($instance, $instance->setArea_total(1.12)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/File/Validation/XmlRuleTest.php: -------------------------------------------------------------------------------- 1 | expectException(\InvalidArgumentException::class); 16 | 17 | $instance = self::getActonItemInstance(); 18 | 19 | $instance->setAny(''); 20 | } 21 | 22 | public function testSetAnyWithInvalidXmlStringMustThrowAnException(): void 23 | { 24 | $this->expectException(\InvalidArgumentException::class); 25 | 26 | $instance = self::getActonItemInstance(); 27 | 28 | @$instance->setAny('1setAny($string = '1'); 36 | 37 | $this->assertSame($string, $instance->getAny()); 38 | } 39 | 40 | public function testSetAnyWithIntMustThrowAnException(): void 41 | { 42 | $this->expectException(\InvalidArgumentException::class); 43 | 44 | $instance = self::getActonItemInstance(); 45 | 46 | $instance->setAny(2); 47 | } 48 | 49 | public function testSetAnyWithDomDocumentMustPass(): void 50 | { 51 | $instance = self::getActonItemInstance(); 52 | $domDocument = new \DOMDocument(); 53 | $domDocument->appendChild($domDocument->createElement('element', '147')); 54 | 55 | $instance->setAny($domDocument); 56 | 57 | $this->assertSame('147', $instance->getAny()); 58 | } 59 | 60 | public function testSetAnyWithInvalidObjectMustThrowAnException(): void 61 | { 62 | $this->expectException(\InvalidArgumentException::class); 63 | 64 | $instance = self::getActonItemInstance(); 65 | 66 | $instance->setAny(new \stdClass()); 67 | } 68 | 69 | public function testSetAnyWithArrayMustThrowAnException(): void 70 | { 71 | $this->expectException(\InvalidArgumentException::class); 72 | 73 | $instance = self::getActonItemInstance(); 74 | 75 | $instance->setAny([]); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tests/Generator/GeneratorContainerTest.php: -------------------------------------------------------------------------------- 1 | assertSame([ 21 | 'services' => $container->getServices(), 22 | 'structs' => $container->getStructs(), 23 | ], $container->jsonSerialize()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Generator/GeneratorSoapClientTest.php: -------------------------------------------------------------------------------- 1 | setComposerName('wsdltophp/invalid') 22 | ->setDestination(self::getTestDirectory()) 23 | ->setOrigin(self::schemaPartnerPath()) 24 | ; 25 | 26 | $this->expectException(\InvalidArgumentException::class); 27 | 28 | new Generator($options); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/Model/ServiceTest.php: -------------------------------------------------------------------------------- 1 | addMethod('getBar', 'string', 'int'); 27 | $service->addMethod('getFoo', 'string', 'int'); 28 | 29 | $this->assertInstanceOf(Method::class, $service->getMethod('getBar')); 30 | $this->assertNotInstanceOf(Method::class, $service->getMethod('getbar')); 31 | 32 | $service->getMethod('getBar')->setName('getbar'); 33 | $this->assertInstanceOf(Method::class, $service->getMethod('getbar')); 34 | } 35 | 36 | public function testGetReservedMethodsInstance(): void 37 | { 38 | $this->assertInstanceOf(ServiceReservedMethod::class, self::instance('foo')->getReservedMethodsInstance()); 39 | } 40 | 41 | public function testGetNamespaceWithCustomDirectoryStructureMustReturnTheDirectoryWithinTheNamespace(): void 42 | { 43 | ($model = self::instance('foo'))->getGenerator()->setOptionServicesFolder('Domain/Services'); 44 | $this->assertSame('Domain\Services', $model->getNamespace()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/Parser/SoapClient/SoapClientParser.php: -------------------------------------------------------------------------------- 1 | parse(); 31 | 32 | $count = 0; 33 | $structs = $tagEnumerationParser->getGenerator()->getStructs(); 34 | if ($structs->count() > 0) { 35 | if ($structs->getStructByName('AddDisputeRequestType') instanceof Struct) { 36 | $this->assertSame('AbstractRequestType', $structs->getStructByName('AddDisputeRequestType')->getInheritance()); 37 | ++$count; 38 | } 39 | if ($structs->getStructByName('TaxIdentifierAttributeType') instanceof Struct) { 40 | $this->assertSame('string', $structs->getStructByName('TaxIdentifierAttributeType')->getInheritance()); 41 | ++$count; 42 | } 43 | } 44 | $this->assertSame(2, $count); 45 | } 46 | 47 | public function testParseWcf(): void 48 | { 49 | $tagEnumerationParser = self::wcfInstanceParser(); 50 | 51 | $tagEnumerationParser->parse(); 52 | 53 | $count = 0; 54 | $structs = $tagEnumerationParser->getGenerator()->getStructs(); 55 | if ($structs->count() > 0) { 56 | if ($structs->getStructByName('offer') instanceof Struct) { 57 | $this->assertSame('order', $structs->getStructByName('offer')->getInheritance()); 58 | ++$count; 59 | } 60 | if ($structs->getStructByName('order') instanceof Struct) { 61 | $this->assertSame('', $structs->getStructByName('order')->getInheritance()); 62 | ++$count; 63 | } 64 | } 65 | $this->assertSame(2, $count); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/Parser/Wsdl/TagOutputTest.php: -------------------------------------------------------------------------------- 1 | parse(); 31 | 32 | $count = 0; 33 | $soapFunctions = $soapClient->__getFunctions(); 34 | foreach ($soapFunctions as $soapFunction) { 35 | $methodData = self::getMethodDataFromSoapFunction($soapFunction); 36 | $method = $tagOutputParser->getGenerator()->getServiceMethod($methodData['name']); 37 | if (TagOutput::UNKNOWN === strtolower($methodData['return'])) { 38 | $this->assertNotSame(TagOutput::UNKNOWN, strtolower($method->getReturnType())); 39 | ++$count; 40 | } 41 | } 42 | $this->assertSame(126, $count); 43 | } 44 | 45 | /** 46 | * @param string $soapFunction 47 | * 48 | * @return string[] 49 | */ 50 | public static function getMethodDataFromSoapFunction($soapFunction) 51 | { 52 | if (0 === stripos($soapFunction, TagOutput::UNKNOWN)) { 53 | $returnType = sprintf('(%s)', TagOutput::UNKNOWN); 54 | } else { 55 | $returnType = '([a-zA-Z_]*)'; 56 | } 57 | $matches = []; 58 | preg_match(sprintf('/%s\s([a-zA-Z_]*)\(.*/i', $returnType), $soapFunction, $matches); 59 | 60 | return [ 61 | 'name' => $matches[2], 62 | 'return' => $matches[1], 63 | ]; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/Parser/Wsdl/WsdlParser.php: -------------------------------------------------------------------------------- 1 | parse(); 34 | } 35 | 36 | return $generator; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/resources/bad_generator_options.yml: -------------------------------------------------------------------------------- 1 | # The generator options are defined once in this file. 2 | # Each option can be overridden when using the command line tool. 3 | # Each option option can be overridden using your own config file too. 4 | category -------------------------------------------------------------------------------- /tests/resources/bad_xsd_types.yml: -------------------------------------------------------------------------------- 1 | # List oh PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | 4 | xsdtypes: 5 | string:string -------------------------------------------------------------------------------- /tests/resources/empty.wsdl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/resources/existing_config/wsdltophp.yml: -------------------------------------------------------------------------------- 1 | # This file's content is a copy of the file located at src/resources/config/generator_options.yml. 2 | # Which options file is used: 3 | # - the one indicated by the --config option OR 4 | # - your wsdltophp.yml file located where the command line is executed OR 5 | # - this file if it exists OR 6 | # - the original file located at src/resources/config/generator_options.yml. 7 | 8 | category: 9 | default: 'cat' 10 | values: [ 'none', 'cat' ] 11 | gather_methods: 12 | default: 'start' 13 | values: ['start', 'end', 'none' ] 14 | generic_constants_names: 15 | default: false 16 | values: [ true, false ] 17 | generate_tutorial_file: 18 | default: true 19 | values: [ true, false ] 20 | add_comments: 21 | default: [ ] 22 | values: null 23 | namespace_prefix: 24 | default: '' 25 | values: '' 26 | standalone: 27 | default: true 28 | values: [ true, false ] 29 | struct_class: 30 | default: 'WsdlToPhp\PackageBase\AbstractStructBase' 31 | values: '' 32 | struct_array_class: 33 | default: 'WsdlToPhp\PackageBase\AbstractStructArrayBase' 34 | values: '' 35 | soap_client_class: 36 | default: 'WsdlToPhp\PackageBase\AbstractSoapClientBase' 37 | values: '' 38 | origin: 39 | default: '' 40 | values: '' 41 | destination: 42 | default: '' 43 | values: '' 44 | prefix: 45 | default: '' 46 | values: '' 47 | suffix: 48 | default: '' 49 | values: '' 50 | basic_login: 51 | default: '' 52 | values: '' 53 | basic_password: 54 | default: '' 55 | values: '' 56 | proxy_host: 57 | default: '' 58 | values: '' 59 | proxy_port: 60 | default: '' 61 | values: '' 62 | proxy_login: 63 | default: '' 64 | values: '' 65 | proxy_password: 66 | default: '' 67 | values: '' 68 | soap_options: 69 | default: [] 70 | values: null 71 | composer_name: 72 | default: '' 73 | values: '' 74 | structs_folder: 75 | default: 'StructType' 76 | values: '' 77 | arrays_folder: 78 | default: 'ArrayType' 79 | values: '' 80 | enums_folder: 81 | default: 'EnumType' 82 | values: '' 83 | services_folder: 84 | default: 'ServiceType' 85 | values: '' 86 | schemas_save: 87 | default: false 88 | values: [ true, false ] 89 | schemas_folder: 90 | default: 'wsdl' 91 | values: '' 92 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidApiAdultOption.php: -------------------------------------------------------------------------------- 1 | setProcessByDistributor($processByDistributor); 36 | } 37 | /** 38 | * Get ProcessByDistributor value 39 | * @return bool|null 40 | */ 41 | public function getProcessByDistributor(): ?bool 42 | { 43 | return $this->ProcessByDistributor; 44 | } 45 | /** 46 | * Set ProcessByDistributor value 47 | * @param bool $processByDistributor 48 | * @return \StructType\ApiControlsType 49 | */ 50 | public function setProcessByDistributor(?bool $processByDistributor = null): self 51 | { 52 | // validation for constraint: boolean 53 | if (!is_null($processByDistributor) && !is_bool($processByDistributor)) { 54 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($processByDistributor, true), gettype($processByDistributor)), __LINE__); 55 | } 56 | $this->ProcessByDistributor = $processByDistributor; 57 | 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidApiDs_weblog_formats.php: -------------------------------------------------------------------------------- 1 | setResult($resultLogin = $this->getSoapClient()->__soapCall('Login', [ 33 | $login, 34 | $password, 35 | ], [], [], $this->outputHeaders)); 36 | 37 | return $resultLogin; 38 | } catch (SoapFault $soapFault) { 39 | $this->saveLastError(__METHOD__, $soapFault); 40 | 41 | return false; 42 | } 43 | } 44 | /** 45 | * Returns the result 46 | * @see AbstractSoapClientBase::getResult() 47 | * @return string 48 | */ 49 | public function getResult() 50 | { 51 | return parent::getResult(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidApiPhonebookSortOption.php: -------------------------------------------------------------------------------- 1 | setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ 30 | $parameters, 31 | ], [], [], $this->outputHeaders)); 32 | 33 | return $resultSearch; 34 | } catch (SoapFault $soapFault) { 35 | $this->saveLastError(__METHOD__, $soapFault); 36 | 37 | return false; 38 | } 39 | } 40 | /** 41 | * Returns the result 42 | * @see AbstractSoapClientBase::getResult() 43 | * @return \StructType\ApiSearchResponse 44 | */ 45 | public function getResult() 46 | { 47 | return parent::getResult(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidApiSearchBingApi.php: -------------------------------------------------------------------------------- 1 | setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ 30 | $parameters, 31 | ], [], [], $this->outputHeaders)); 32 | 33 | return $resultSearch; 34 | } catch (SoapFault $soapFault) { 35 | $this->saveLastError(__METHOD__, $soapFault); 36 | 37 | return false; 38 | } 39 | } 40 | /** 41 | * Returns the result 42 | * @see AbstractSoapClientBase::getResult() 43 | * @return \StructType\SearchResponseBingApi 44 | */ 45 | public function getResult() 46 | { 47 | return parent::getResult(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidApiWebSearchOption.php: -------------------------------------------------------------------------------- 1 | setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ 30 | $parameters, 31 | ], [], [], $this->outputHeaders)); 32 | 33 | return $resultSearch; 34 | } catch (SoapFault $soapFault) { 35 | $this->saveLastError(__METHOD__, $soapFault); 36 | 37 | return false; 38 | } 39 | } 40 | /** 41 | * Returns the result 42 | * @see AbstractSoapClientBase::getResult() 43 | * @return \StructType\ApiSearchResponse 44 | */ 45 | public function getResult() 46 | { 47 | return parent::getResult(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingComposer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wsdltophp/bing", 3 | "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", 4 | "require": { 5 | "php": ">=7.4", 6 | "ext-dom": "*", 7 | "ext-mbstring": "*", 8 | "ext-soap": "*", 9 | "wsdltophp/packagebase": "~5.0" 10 | }, 11 | "autoload": { 12 | "psr-4": { 13 | "": "./src/" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingComposerEmptySrcDirname.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wsdltophp/bing", 3 | "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", 4 | "require": { 5 | "php": ">=7.4", 6 | "ext-dom": "*", 7 | "ext-mbstring": "*", 8 | "ext-soap": "*", 9 | "wsdltophp/packagebase": "~5.0" 10 | }, 11 | "autoload": { 12 | "psr-4": { 13 | "": "./" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingComposerSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wsdltophp/bing", 3 | "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", 4 | "require": { 5 | "php": ">=7.4", 6 | "ext-dom": "*", 7 | "ext-mbstring": "*", 8 | "ext-soap": "*", 9 | "wsdltophp/packagebase": "~5.0", 10 | "wsdltophp/wssecurity": "dev-master" 11 | }, 12 | "autoload": { 13 | "psr-4": { 14 | "": "./src/" 15 | } 16 | }, 17 | "config": { 18 | "disable-tls": true 19 | } 20 | } -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingComposerSlashSrcDirname.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wsdltophp/bing", 3 | "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", 4 | "require": { 5 | "php": ">=7.4", 6 | "ext-dom": "*", 7 | "ext-mbstring": "*", 8 | "ext-soap": "*", 9 | "wsdltophp/packagebase": "~5.0" 10 | }, 11 | "autoload": { 12 | "psr-4": { 13 | "": "./" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingEmptyComposerNameComposer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wsdltophp/bing", 3 | "description": "Package generated from __WSDL_URL__ using wsdltophp/packagegenerator", 4 | "require": { 5 | "php": ">=7.4", 6 | "ext-dom": "*", 7 | "ext-mbstring": "*", 8 | "ext-soap": "*", 9 | "wsdltophp/packagebase": "~5.0" 10 | }, 11 | "autoload": { 12 | "psr-4": { 13 | "": "./src/" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingTutorial.php: -------------------------------------------------------------------------------- 1 | '__WSDL_URL__', 10 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, 11 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', 12 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', 13 | * ]; 14 | * etc... 15 | */ 16 | require_once __DIR__ . '/vendor/autoload.php'; 17 | /** 18 | * Minimal options 19 | */ 20 | $options = [ 21 | WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', 22 | WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ApiClassMap::get(), 23 | ]; 24 | /** 25 | * Samples for Search ServiceType 26 | */ 27 | $search = new \ServiceType\ApiSearch($options); 28 | /** 29 | * Sample call for Search operation/method 30 | */ 31 | if ($search->Search(new \StructType\ApiSearchRequest()) !== false) { 32 | print_r($search->getResult()); 33 | } else { 34 | print_r($search->getLastError()); 35 | } 36 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingTutorialNoPrefix.php: -------------------------------------------------------------------------------- 1 | '__WSDL_URL__', 10 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, 11 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', 12 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', 13 | * ]; 14 | * etc... 15 | */ 16 | require_once __DIR__ . '/vendor/autoload.php'; 17 | /** 18 | * Minimal options 19 | */ 20 | $options = [ 21 | WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', 22 | WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(), 23 | ]; 24 | /** 25 | * Samples for Search ServiceType 26 | */ 27 | $search = new \ServiceType\Search($options); 28 | /** 29 | * Sample call for Search operation/method 30 | */ 31 | if ($search->Search(new \StructType\SearchRequest()) !== false) { 32 | print_r($search->getResult()); 33 | } else { 34 | print_r($search->getLastError()); 35 | } 36 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidBingTutorialNotStandalone.php: -------------------------------------------------------------------------------- 1 | '__WSDL_URL__', 10 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true, 11 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login', 12 | * WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password', 13 | * ]; 14 | * etc... 15 | * ################################################################################ 16 | * Don't forget to add wsdltophp/packagebase:~5.0 to your main composer.json. 17 | * ################################################################################ 18 | */ 19 | /** 20 | * Minimal options 21 | */ 22 | $options = [ 23 | WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => '__WSDL_URL__', 24 | WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ApiClassMap::get(), 25 | ]; 26 | /** 27 | * Samples for Search ServiceType 28 | */ 29 | $search = new \ServiceType\ApiSearch($options); 30 | /** 31 | * Sample call for Search operation/method 32 | */ 33 | if ($search->Search(new \StructType\ApiSearchRequest()) !== false) { 34 | print_r($search->getResult()); 35 | } else { 36 | print_r($search->getLastError()); 37 | } 38 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidFieldString1000.php: -------------------------------------------------------------------------------- 1 | setResult($resultListPaymentMethods = $this->getSoapClient()->__soapCall('listPaymentMethods', [ 31 | $parameters, 32 | ], [], [], $this->outputHeaders)); 33 | 34 | return $resultListPaymentMethods; 35 | } catch (SoapFault $soapFault) { 36 | $this->saveLastError(__METHOD__, $soapFault); 37 | 38 | return false; 39 | } 40 | } 41 | /** 42 | * Returns the result 43 | * @see AbstractSoapClientBase::getResult() 44 | * @return \StructType\ListPaymentMethodsResponse 45 | */ 46 | public function getResult() 47 | { 48 | return parent::getResult(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidMyProjectApiSearchProject.php: -------------------------------------------------------------------------------- 1 | setResult($resultSearch = $this->getSoapClient()->__soapCall('Search', [ 30 | $parameters, 31 | ], [], [], $this->outputHeaders)); 32 | 33 | return $resultSearch; 34 | } catch (SoapFault $soapFault) { 35 | $this->saveLastError(__METHOD__, $soapFault); 36 | 37 | return false; 38 | } 39 | } 40 | /** 41 | * Returns the result 42 | * @see AbstractSoapClientBase::getResult() 43 | * @return \My\Project\StructType\ApiSearchResponseProject 44 | */ 45 | public function getResult() 46 | { 47 | return parent::getResult(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/resources/generated/ValidProposeNewTimeType.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Request for available images. Copyright 2007 Estes Express Lines, Inc. 4 | 5 | 6 | 7 | 8 | 9 | PRO is deprecated; provided for backward compatibility 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/resources/image/availableImagesResponse.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | Available images response. Copyright 2007 Estes Express Lines, Inc. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/resources/image/imageViewCommon.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | Common elements for image retrieval service. Copyright 2007 Estes Express Lines, Inc. 4 | 5 | 6 | 7 | Document type code 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | PRO is 10 digits or 11 digits with dash. 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Generic search criteria for image search 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Image search item 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/resources/image/imagesRequest.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | Request for document images. Copyright 2007 Estes Express Lines, Inc. 4 | 5 | 6 | 7 | 8 | 9 | PRO is deprecated; provided for backward compatibility 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/resources/image/imagesResponse.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | Document images response. Copyright 2007 Estes Express Lines, Inc. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Image file name and Base64 encoded binary source data 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/resources/numeric_enumeration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.10.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.11.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.12.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.13.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.14.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.15.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.16.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.17.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.2.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.4.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.5.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.6.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.7.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.8.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/resources/partner/PartnerService.9.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/resources/paypal/EnhancedDataTypes.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/resources/service_reserved_keywords.yml: -------------------------------------------------------------------------------- 1 | # List of PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | # It includes the pre defined functions by PackageBase classes too. 4 | 5 | reserved_keywords: 6 | case_sensitive: 7 | - 8 | case_insensitive: 9 | # methods from AbstractSoapClientBase 10 | - "__construct" 11 | - "getSoapClient" 12 | - "setSoapClient" 13 | - "initSoapClient" 14 | - "getSoapClientClassName" 15 | - "getDefaultWsdlOptions" 16 | - "setLocation" 17 | - "getLastRequest" 18 | - "getLastResponse" 19 | - "getLastXml" 20 | - "getLastRequestHeaders" 21 | - "getLastResponseHeaders" 22 | - "getLastHeaders" 23 | - "getFormattedXml" 24 | - "convertStringHeadersToArray" 25 | - "setSoapHeader" 26 | - "setHttpHeader" 27 | - "getLastError" 28 | - "setLastError" 29 | - "saveLastError" 30 | - "getLastErrorForMethod" 31 | - "getResult" 32 | - "setResult" 33 | -------------------------------------------------------------------------------- /tests/resources/struct_array_reserved_keywords.yml: -------------------------------------------------------------------------------- 1 | # List of PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | # It includes the pre defined functions by PackageBase classes too. 4 | 5 | reserved_keywords: 6 | case_sensitive: 7 | - 8 | case_insensitive: 9 | # methods from AbstractStructArrayBase 10 | - "_get" 11 | - "_set" 12 | - "getAttributeName" 13 | - "length" 14 | - "count" 15 | - "current" 16 | - "next" 17 | - "rewind" 18 | - "valid" 19 | - "key" 20 | - "item" 21 | - "add" 22 | - "first" 23 | - "last" 24 | - "offsetExists" 25 | - "offsetGet" 26 | - "offsetSet" 27 | - "offsetUnset" 28 | - "getInternArray" 29 | - "setInternArray" 30 | - "getInternArrayOffset" 31 | - "initInternArray" 32 | - "setInternArrayOffset" 33 | - "getInternArrayIsArray" 34 | - "setInternArrayIsArray" 35 | -------------------------------------------------------------------------------- /tests/resources/struct_reserved_keywords.yml: -------------------------------------------------------------------------------- 1 | # List of PHP reserved keywords that must not be used within generated classes. 2 | # If an element matched one of this reserved keywords, it is replaced by "_" + {reserved_keyword} + nb_used_times 3 | # It includes the pre defined functions by PackageBase classes too. 4 | 5 | reserved_keywords: 6 | case_sensitive: 7 | - 8 | case_insensitive: 9 | # methods from AbstractStructBase 10 | - "_set" 11 | - "_get" -------------------------------------------------------------------------------- /tests/resources/wcf/Service1.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/resources/wcf/Service10.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/resources/wcf/Service11.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/resources/xmlmime.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/resources/xsd_types.yml: -------------------------------------------------------------------------------- 1 | # List of XSD types that can be defined as a type hint parameter. 2 | 3 | xsd_types: 4 | anonymous: "string" 5 | anySimpleType: "string" 6 | anyType: "string" 7 | anyURI: "string" 8 | base64Binary: "string" 9 | bool: "bool" 10 | boolean: "bool" 11 | byte: "string" 12 | date: "string" 13 | dateTime: "string" 14 | decimal: "float" 15 | double: "float" 16 | DayOfWeekType: "string" 17 | DOMDocument: "string" 18 | duration: "string" 19 | ENTITY: "string" 20 | ENTITIES: "string" 21 | float: "float" 22 | gDay: "string" 23 | gMonth: "string" 24 | gMonthDay: "string" 25 | gYear: "string" 26 | gYearMonth: "string" 27 | hexBinary: "string" 28 | int: "int" 29 | integer: "int" 30 | ID: "string" 31 | IDREF: "string" 32 | IDREFS: "string" 33 | language: "string" 34 | long: "int" 35 | Name: "string" 36 | negativeInteger: "int" 37 | nonNegativeInteger: "int" 38 | nonPositiveInteger: "int" 39 | normalizedString: "string" 40 | NCName: "string" 41 | NMTOKEN: "string" 42 | NMTOKENS: "string" 43 | NOTATION: "string" 44 | positiveInteger: "int" 45 | QName: "string" 46 | short: "int" 47 | string: "string" 48 | timestamp: "int" 49 | timeStamp: "int" 50 | time: "string" 51 | token: "string" 52 | unsignedByte: "string" 53 | unsignedInt: "int" 54 | unsignedLong: "int" 55 | unsignedShort: "int" 56 | UID: "string" 57 | UNKNOWN: "string" 58 | --------------------------------------------------------------------------------