diff --git a/.travis.yml b/.travis.yml index 6458c71..ec3e9bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,21 +5,12 @@ php: - 5.4 - 5.5 - 5.6 - -env: - - SYMFONY_VERSION=2.6.* - - SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev" + - 7.0 + - 7.1 before_script: - composer self-update - - composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update - - composer update --no-interaction --prefer-source - - ./src/BeSimple/SoapClient/Tests/bin/phpwebserver.sh - - ./src/BeSimple/SoapClient/Tests/bin/axis.sh + - composer install script: - - phpunit --coverage-text - -matrix: - allow_failures: - - env: SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev" + - vendor/phing/phing/bin/phing -f build.xml diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..55b3393 --- /dev/null +++ b/build.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + project.basedir: ${project.basedir} + + buildOutputPath: ${buildOutputPath} + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codesniffer-ruleset.xml b/codesniffer-ruleset.xml new file mode 100644 index 0000000..ceb782d --- /dev/null +++ b/codesniffer-ruleset.xml @@ -0,0 +1,52 @@ + + + Coding standards + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json index 8de1795..2640a55 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,11 @@ "require-dev": { "ext-mcrypt": "*", "mikey179/vfsStream": "~1.0", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.0", + "phpstan/phpstan": "dev-master", + "phing/phing": "^2.16", + "jakub-onderka/php-var-dump-check": "^0.2.0", + "squizlabs/php_codesniffer": "^3.0" }, "autoload": { "psr-0": { "BeSimple\\": "src/" } @@ -53,5 +57,11 @@ "branch-alias": { "dev-master": "0.4-dev" } - } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/tuscanicz/phpstan.git" + } + ] } diff --git a/composer.lock b/composer.lock index e88b242..3b9c1c9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "7601f1ec280c086361e1deaf021f8ca1", - "content-hash": "59372f34124af17d5c35938dfffc6075", + "hash": "635c398afa1d5c217b5b8679b348ddc7", + "content-hash": "08f419455dd969e9145b8adfc84a03e9", "packages": [ { "name": "ass/xmlsecurity", @@ -229,6 +229,52 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "jakub-onderka/php-var-dump-check", + "version": "v0.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Var-Dump-Check.git", + "reference": "c00c52f1503c537a3da394520717a7331eb290a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Var-Dump-Check/zipball/c00c52f1503c537a3da394520717a7331eb290a1", + "reference": "c00c52f1503c537a3da394520717a7331eb290a1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "~0.8", + "phpunit/phpunit": "~4.5" + }, + "suggest": { + "jakub-onderka/php-console-highlighter": "For colored console output" + }, + "bin": [ + "var-dump-check" + ], + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpVarDumpCheck": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com" + } + ], + "description": "Find forgotten variables dump in PHP source code.", + "time": "2015-03-13 12:02:23" + }, { "name": "mikey179/vfsStream", "version": "v1.6.4", @@ -275,6 +321,643 @@ "homepage": "http://vfs.bovigo.org/", "time": "2016-07-18 14:02:57" }, + { + "name": "nette/bootstrap", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/nette/bootstrap.git", + "reference": "2c27747f5aff2e436ebf542e0ea566bea1db2d53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/2c27747f5aff2e436ebf542e0ea566bea1db2d53", + "reference": "2c27747f5aff2e436ebf542e0ea566bea1db2d53", + "shasum": "" + }, + "require": { + "nette/di": "~2.4.7", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.2", + "nette/application": "~2.3", + "nette/caching": "~2.3", + "nette/database": "~2.3", + "nette/forms": "~2.3", + "nette/http": "~2.4.0", + "nette/mail": "~2.3", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/safe-stream": "~2.2", + "nette/security": "~2.3", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4.1" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableTracy()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Bootstrap", + "homepage": "https://nette.org", + "time": "2017-02-19 22:15:02" + }, + { + "name": "nette/caching", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/nette/caching.git", + "reference": "2436e530484a346d0a246733519ceaa40b943bd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/caching/zipball/2436e530484a346d0a246733519ceaa40b943bd6", + "reference": "2436e530484a346d0a246733519ceaa40b943bd6", + "shasum": "" + }, + "require": { + "nette/finder": "^2.2 || ~3.0.0", + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "^2.4", + "nette/di": "^2.4 || ~3.0.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Caching Component", + "homepage": "https://nette.org", + "time": "2017-01-29 20:40:55" + }, + { + "name": "nette/di", + "version": "v2.4.8", + "source": { + "type": "git", + "url": "https://github.com/nette/di.git", + "reference": "b3fe8551162279216e251e49b406e55cd2d255d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/di/zipball/b3fe8551162279216e251e49b406e55cd2d255d5", + "reference": "b3fe8551162279216e251e49b406e55cd2d255d5", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/neon": "^2.3.3 || ~3.0.0", + "nette/php-generator": "^2.6.1 || ~3.0.0", + "nette/utils": "^2.4.3 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/bootstrap": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Dependency Injection Component", + "homepage": "https://nette.org", + "time": "2017-03-14 17:16:14" + }, + { + "name": "nette/finder", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/5cabd5fe89f9903715359a403b820c7f94f9bb5e", + "reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Finder: Files Searching", + "homepage": "https://nette.org", + "time": "2016-05-17 15:49:06" + }, + { + "name": "nette/neon", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "1a78ff64b1e161ebccc03bdf9366450a69365f5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/1a78ff64b1e161ebccc03bdf9366450a69365f5b", + "reference": "1a78ff64b1e161ebccc03bdf9366450a69365f5b", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette NEON: parser & generator for Nette Object Notation", + "homepage": "http://ne-on.org", + "time": "2017-01-13 08:00:19" + }, + { + "name": "nette/php-generator", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "8605fd18857a4beef4aa0afc19eb9a7f876237e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/php-generator/zipball/8605fd18857a4beef4aa0afc19eb9a7f876237e8", + "reference": "8605fd18857a4beef4aa0afc19eb9a7f876237e8", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4.2 || ~3.0.0", + "php": ">=7.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Generates neat PHP code for you. Supports new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2017-03-18 15:20:10" + }, + { + "name": "nette/robot-loader", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/nette/robot-loader.git", + "reference": "459fc6bf08f0fd7f6889897e3acdff523dbf1159" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/459fc6bf08f0fd7f6889897e3acdff523dbf1159", + "reference": "459fc6bf08f0fd7f6889897e3acdff523dbf1159", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/finder": "^2.3 || ^3.0", + "nette/utils": "^2.4 || ^3.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍀 RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", + "homepage": "https://nette.org", + "keywords": [ + "autoload", + "class", + "interface", + "nette", + "trait" + ], + "time": "2017-02-10 13:44:22" + }, + { + "name": "nette/utils", + "version": "v2.4.6", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "266160aec0d99516e0ea510de1dfa24a0dc1e76e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/266160aec0d99516e0ea510de1dfa24a0dc1e76e", + "reference": "266160aec0d99516e0ea510de1dfa24a0dc1e76e", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Utility Classes", + "homepage": "https://nette.org", + "time": "2017-04-26 10:04:49" + }, + { + "name": "nikic/php-parser", + "version": "v3.0.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2017-03-05 18:23:57" + }, + { + "name": "phing/phing", + "version": "2.16.0", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing.git", + "reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/151a0f4d8cebf7711eccc62dde3f09bc36a00d7b", + "reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b", + "shasum": "" + }, + "require": { + "php": ">=5.2.0", + "symfony/yaml": "^3.1" + }, + "require-dev": { + "ext-pdo_sqlite": "*", + "mikey179/vfsstream": "^1.6", + "pdepend/pdepend": "2.x", + "pear/archive_tar": "1.4.x", + "pear/http_request2": "dev-trunk", + "pear/net_growl": "dev-trunk", + "pear/pear-core-minimal": "1.10.1", + "pear/versioncontrol_git": "@dev", + "pear/versioncontrol_svn": "~0.5", + "phpdocumentor/phpdocumentor": "2.x", + "phploc/phploc": "~2.0.6", + "phpmd/phpmd": "~2.2", + "phpunit/phpunit": ">=3.7", + "sebastian/git": "~1.0", + "sebastian/phpcpd": "2.x", + "siad007/versioncontrol_hg": "^1.0", + "simpletest/simpletest": "^1.1", + "squizlabs/php_codesniffer": "~2.2" + }, + "suggest": { + "pdepend/pdepend": "PHP version of JDepend", + "pear/archive_tar": "Tar file management class", + "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository", + "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system", + "phpdocumentor/phpdocumentor": "Documentation Generator for PHP", + "phploc/phploc": "A tool for quickly measuring the size of a PHP project", + "phpmd/phpmd": "PHP version of PMD tool", + "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information", + "phpunit/phpunit": "The PHP Unit Testing Framework", + "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code", + "siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.", + "tedivm/jshrink": "Javascript Minifier built in PHP" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.16.x-dev" + } + }, + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Phing Community", + "homepage": "https://www.phing.info/trac/wiki/Development/Contributors" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "https://www.phing.info/", + "keywords": [ + "build", + "phing", + "task", + "tool" + ], + "time": "2016-12-22 20:16:33" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", @@ -484,6 +1167,68 @@ ], "time": "2016-11-21 14:58:47" }, + { + "name": "phpstan/phpstan", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/tuscanicz/phpstan.git", + "reference": "11d705360de768c8f0f9431288228ecd85ac14dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tuscanicz/phpstan/zipball/11d705360de768c8f0f9431288228ecd85ac14dd", + "reference": "11d705360de768c8f0f9431288228ecd85ac14dd", + "shasum": "" + }, + "require": { + "nette/bootstrap": "^2.4 || ^3.0", + "nette/caching": "^2.4 || ^3.0", + "nette/di": "^2.4 || ^3.0", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/utils": "^2.4 || ^3.0", + "nikic/php-parser": "^2.1 || ^3.0.2", + "php": "~7.0", + "symfony/console": "~2.7 || ~3.0", + "symfony/finder": "~2.7 || ~3.0" + }, + "require-dev": { + "consistence/coding-standard": "~0.13.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpunit/phpunit": "^6.0.7", + "satooshi/php-coveralls": "^1.0", + "slevomat/coding-standard": "^2.0" + }, + "bin": [ + "bin/phpstan" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.7-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "autoload-dev": { + "classmap": [ + "tests/PHPStan", + "tests/TestCase.php" + ] + }, + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "source": "https://github.com/tuscanicz/phpstan/tree/master" + }, + "time": "2017-06-07 13:05:16" + }, { "name": "phpunit/php-code-coverage", "version": "2.2.4", @@ -855,6 +1600,53 @@ ], "time": "2015-10-02 06:51:40" }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, { "name": "sebastian/comparator", "version": "1.2.4", @@ -1227,6 +2019,290 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "b95ff2c3b122a3ee4b57d149a57d2afce65522c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b95ff2c3b122a3ee4b57d149a57d2afce65522c3", + "reference": "b95ff2c3b122a3ee4b57d149a57d2afce65522c3", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-05-04 00:33:04" + }, + { + "name": "symfony/console", + "version": "v3.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e", + "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3", + "symfony/dependency-injection": "~3.3", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/filesystem": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-06-02 19:24:58" + }, + { + "name": "symfony/debug", + "version": "v3.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d", + "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-06-01 21:01:25" + }, + { + "name": "symfony/finder", + "version": "v3.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4", + "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2017-06-01 21:01:25" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14 01:06:16" + }, { "name": "symfony/yaml", "version": "v3.2.2", @@ -1335,7 +2411,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "phpstan/phpstan": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/phing b/phing new file mode 100755 index 0000000..6e364ef --- /dev/null +++ b/phing @@ -0,0 +1,6 @@ +#!/usr/bin/env php +tests + + + + + diff --git a/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php b/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php index b83e38d..d0dcc5b 100644 --- a/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php +++ b/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php @@ -12,7 +12,7 @@ namespace BeSimple\SoapBundle\Converter; use BeSimple\SoapBundle\Soap\SoapRequest; use BeSimple\SoapBundle\Soap\SoapResponse; -use BeSimple\SoapBundle\Util\String; +use BeSimple\SoapBundle\Util\StringUtility; use BeSimple\SoapCommon\Converter\TypeConverterInterface; /** @@ -40,7 +40,7 @@ class XopIncludeTypeConverter implements TypeConverterInterface $ref = $include->getAttribute('href'); - if (String::startsWith($ref, 'cid:')) { + if (StringUtility::startsWith($ref, 'cid:')) { $cid = urldecode(substr($ref, 4)); return $request->getSoapAttachments()->get($cid)->getContent(); diff --git a/src/BeSimple/SoapBundle/Handler/ExceptionHandler.php b/src/BeSimple/SoapBundle/Handler/ExceptionHandler.php index 2a2d613..7a95152 100644 --- a/src/BeSimple/SoapBundle/Handler/ExceptionHandler.php +++ b/src/BeSimple/SoapBundle/Handler/ExceptionHandler.php @@ -12,7 +12,7 @@ namespace BeSimple\SoapBundle\Handler; -use BeSimple\SoapServer\Exception\ReceiverSoapFault; +use SoapFault; use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\HttpFoundation\Response; @@ -44,7 +44,8 @@ class ExceptionHandler $code = $this->exception->getStatusCode(); - throw new ReceiverSoapFault( + throw new SoapFault( + 'receiver', isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', null, $this->details diff --git a/src/BeSimple/SoapBundle/Resources/doc/soapserver/tutorial/associative_array.rst b/src/BeSimple/SoapBundle/Resources/doc/soapserver/tutorial/associative_array.rst index 045cb5b..119c210 100644 --- a/src/BeSimple/SoapBundle/Resources/doc/soapserver/tutorial/associative_array.rst +++ b/src/BeSimple/SoapBundle/Resources/doc/soapserver/tutorial/associative_array.rst @@ -7,7 +7,7 @@ Pre-existent Type +------------------------------------------------+-----------------+ | Php Type | Value Type | +================================================+=================+ -| BeSimple\\SoapCommon\\Type\\KeyValue\\String | String | +| BeSimple\\SoapCommon\\Type\\KeyValue\\StringUtility | StringUtility | +------------------------------------------------+-----------------+ | BeSimple\\SoapCommon\\Type\\KeyValue\\Boolean | Boolean | +------------------------------------------------+-----------------+ @@ -34,7 +34,7 @@ Controller { /** * @Soap\Method("returnAssocArray") - * @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]") + * @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\StringUtility[]") */ public function assocArrayOfStringAction() { @@ -46,8 +46,8 @@ Controller /** * @Soap\Method("sendAssocArray") - * @Soap\Param("assocArray", phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]") - * @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]") + * @Soap\Param("assocArray", phpType = "BeSimple\SoapCommon\Type\KeyValue\StringUtility[]") + * @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\StringUtility[]") */ public function sendAssocArrayOfStringAction(array $assocArray) { diff --git a/src/BeSimple/SoapBundle/Util/String.php b/src/BeSimple/SoapBundle/Util/StringUtility.php similarity index 94% rename from src/BeSimple/SoapBundle/Util/String.php rename to src/BeSimple/SoapBundle/Util/StringUtility.php index b95d53e..d3664b0 100644 --- a/src/BeSimple/SoapBundle/Util/String.php +++ b/src/BeSimple/SoapBundle/Util/StringUtility.php @@ -11,11 +11,11 @@ namespace BeSimple\SoapBundle\Util; /** - * String provides utility methods for strings. + * StringUtility provides utility methods for strings. * * @author Christian Kerl */ -class String +class StringUtility { /** * Checks if a string starts with a given string. diff --git a/src/BeSimple/SoapClient/Curl/Curl.php b/src/BeSimple/SoapClient/Curl/Curl.php index dab5243..3c36f4e 100644 --- a/src/BeSimple/SoapClient/Curl/Curl.php +++ b/src/BeSimple/SoapClient/Curl/Curl.php @@ -120,7 +120,7 @@ class Curl $httpAuthenticationBasic = $options->getHttpAuthentication(); curl_setopt($curlSession, CURLOPT_HTTPAUTH, $httpAuthenticationBasic->getAuthenticationType()); curl_setopt($curlSession, CURLOPT_USERPWD, $httpAuthenticationBasic->getUsername() . ':' . $httpAuthenticationBasic->getPassword()); - } else if ($options->hasHttpAuthenticationDigest()) { + } elseif ($options->hasHttpAuthenticationDigest()) { /** @var HttpAuthenticationDigestOptions $httpAuthenticationDigest */ $httpAuthenticationDigest = $options->getHttpAuthentication(); curl_setopt($curlSession, CURLOPT_HTTPAUTH, $httpAuthenticationDigest->getAuthenticationType()); diff --git a/src/BeSimple/SoapClient/Curl/CurlOptionsBuilder.php b/src/BeSimple/SoapClient/Curl/CurlOptionsBuilder.php index 473fdf6..f76ebe1 100644 --- a/src/BeSimple/SoapClient/Curl/CurlOptionsBuilder.php +++ b/src/BeSimple/SoapClient/Curl/CurlOptionsBuilder.php @@ -50,13 +50,14 @@ class CurlOptionsBuilder $basicAuthentication->getPassword() ); - } else if ($soapClientOptions->hasAuthenticationDigest()) { + } + if ($soapClientOptions->hasAuthenticationDigest()) { return new HttpAuthenticationDigestOptions(); - } else { - throw new Exception('Unresolved authentication type: '.get_class($soapClientOptions->getAuthentication())); } + + throw new Exception('Unresolved authentication type: '.get_class($soapClientOptions->getAuthentication())); } return null; diff --git a/src/BeSimple/SoapClient/SoapClient.php b/src/BeSimple/SoapClient/SoapClient.php index 0e68fc0..95dd5a0 100644 --- a/src/BeSimple/SoapClient/SoapClient.php +++ b/src/BeSimple/SoapClient/SoapClient.php @@ -43,8 +43,6 @@ class SoapClient extends \SoapClient { use SoapClientNativeMethodsTrait; - /** @var SoapClientOptions */ - protected $soapClientOptions; /** @var SoapOptions */ protected $soapOptions; /** @var Curl */ diff --git a/src/BeSimple/SoapClient/SoapClientNativeMethodsTrait.php b/src/BeSimple/SoapClient/SoapClientNativeMethodsTrait.php index e185cae..086f7ed 100644 --- a/src/BeSimple/SoapClient/SoapClientNativeMethodsTrait.php +++ b/src/BeSimple/SoapClient/SoapClientNativeMethodsTrait.php @@ -9,6 +9,7 @@ use Exception; trait SoapClientNativeMethodsTrait { + protected $soapClientOptions; /** @var SoapAttachment[] */ private $soapAttachmentsOnRequestStorage; /** @var SoapResponse */ diff --git a/src/BeSimple/SoapClient/WsAddressingFilter.php b/src/BeSimple/SoapClient/WsAddressingFilter.php index 721fe87..29cd3de 100644 --- a/src/BeSimple/SoapClient/WsAddressingFilter.php +++ b/src/BeSimple/SoapClient/WsAddressingFilter.php @@ -94,16 +94,16 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter /** * List of reference parameters associated with this soap message. * - * @var unknown_type + * @var array */ - protected $referenceParametersSet = array(); + protected $referenceParametersSet; /** * List of reference parameters recieved with this soap message. * - * @var unknown_type + * @var array */ - protected $referenceParametersRecieved = array(); + protected $referenceParametersRecieved; /** * RelatesTo. @@ -214,7 +214,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter public function setMessageId($messageId = null) { if (null === $messageId) { - $messageId = 'uuid:' . Helper::generateUUID(); + $messageId = 'uuid:' . Helper::generateUuid(); } $this->messageId = $messageId; } @@ -259,7 +259,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter * * @return void */ - public function filterRequest(CommonSoapRequest $request) + public function filterRequest(CommonSoapRequest $request, $attachmentType) { // get \DOMDocument from SOAP request $dom = $request->getContentDocument(); @@ -328,7 +328,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter * * @return void */ - public function filterResponse(CommonSoapResponse $response) + public function filterResponse(CommonSoapResponse $response, $attachmentType) { // get \DOMDocument from SOAP response $dom = $response->getContentDocument(); @@ -344,4 +344,4 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter } } } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapClient/WsSecurityFilter.php b/src/BeSimple/SoapClient/WsSecurityFilter.php index af51a62..965a8cd 100644 --- a/src/BeSimple/SoapClient/WsSecurityFilter.php +++ b/src/BeSimple/SoapClient/WsSecurityFilter.php @@ -104,10 +104,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque * Modify the given request XML. * * @param \BeSimple\SoapCommon\SoapRequest $request SOAP request + * @param int $attachmentType * * @return void */ - public function filterRequest(CommonSoapRequest $request) + public function filterRequest(CommonSoapRequest $request, $attachmentType) { // get \DOMDocument from SOAP request $dom = $request->getContentDocument(); @@ -174,7 +175,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque } if (null !== $this->userSecurityKey && $this->userSecurityKey->hasKeys()) { - $guid = 'CertId-' . Helper::generateUUID(); + $guid = 'CertId-' . Helper::generateUuid(); // add token references $keyInfo = null; if (null !== $this->tokenReferenceSignature) { @@ -200,7 +201,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque // encrypt soap document if (null !== $this->serviceSecurityKey && $this->serviceSecurityKey->hasKeys()) { - $guid = 'EncKey-' . Helper::generateUUID(); + $guid = 'EncKey-' . Helper::generateUuid(); // add token references $keyInfo = null; if (null !== $this->tokenReferenceEncryption) { @@ -226,10 +227,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque * Modify the given request XML. * * @param \BeSimple\SoapCommon\SoapResponse $response SOAP response + * @param int $attachmentType * * @return void */ - public function filterResponse(CommonSoapResponse $response) + public function filterResponse(CommonSoapResponse $response, $attachmentType) { // get \DOMDocument from SOAP response $dom = $response->getContentDocument(); diff --git a/src/BeSimple/SoapClient/WsdlDownloader.php b/src/BeSimple/SoapClient/WsdlDownloader.php index 87eb633..e3a5d0b 100644 --- a/src/BeSimple/SoapClient/WsdlDownloader.php +++ b/src/BeSimple/SoapClient/WsdlDownloader.php @@ -78,8 +78,8 @@ class WsdlDownloader throw new Exception('Could not write WSDL cache file: empty curl response from: '.$wsdlPath); } if ($resolveRemoteIncludes === true) { - $document = $this->getXmlFileDOMDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath); - $this->saveXmlDOMDocument($document, $cacheFilePath); + $document = $this->getXmlFileDomDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath); + $this->saveXmlDomDocument($document, $cacheFilePath); } else { file_put_contents($cacheFilePath, $curlResponse->getResponseBody()); } @@ -88,8 +88,8 @@ class WsdlDownloader } } else { if (file_exists($wsdlPath)) { - $document = $this->getXmlFileDOMDocument($curl, $cacheType, file_get_contents($wsdlPath)); - $this->saveXmlDOMDocument($document, $cacheFilePath); + $document = $this->getXmlFileDomDocument($curl, $cacheType, file_get_contents($wsdlPath)); + $this->saveXmlDomDocument($document, $cacheFilePath); } else { throw new Exception('Could write WSDL cache file: local file does not exist: '.$wsdlPath); } @@ -102,9 +102,9 @@ class WsdlDownloader return realpath($wsdlPath); - } else { - throw new Exception('Could not download WSDL: local file does not exist: '.$wsdlPath); } + + throw new Exception('Could not download WSDL: local file does not exist: '.$wsdlPath); } /** @@ -118,11 +118,9 @@ class WsdlDownloader if (isset($parsedUrlOrFalse['scheme']) && substr($parsedUrlOrFalse['scheme'], 0, 4) === 'http') { return true; - - } else { - - return false; } + + return false; } throw new Exception('Could not determine wsdlPath is remote: '.$wsdlPath); @@ -137,7 +135,7 @@ class WsdlDownloader * @param boolean $parentFilePath Parent file name * @return DOMDocument */ - private function getXmlFileDOMDocument(Curl $curl, $cacheType, $xmlFileSource, $parentFilePath = null) + private function getXmlFileDomDocument(Curl $curl, $cacheType, $xmlFileSource, $parentFilePath = null) { $document = new DOMDocument('1.0', 'utf-8'); if ($document->loadXML($xmlFileSource) === false) { @@ -151,7 +149,7 @@ class WsdlDownloader return $document; } - private function saveXmlDOMDocument(DOMDocument $document, $cacheFilePath) + private function saveXmlDomDocument(DOMDocument $document, $cacheFilePath) { try { $xmlContents = $document->saveXML(); @@ -191,7 +189,7 @@ class WsdlDownloader true ) ); - } else if ($parentFilePath !== null) { + } elseif ($parentFilePath !== null) { $node->setAttribute( $locationAttributeName, $this->getWsdlPath( diff --git a/src/BeSimple/SoapCommon/Cache.php b/src/BeSimple/SoapCommon/Cache.php index 39f2e60..654b28e 100644 --- a/src/BeSimple/SoapCommon/Cache.php +++ b/src/BeSimple/SoapCommon/Cache.php @@ -113,4 +113,4 @@ class Cache { ini_set($key, $value); } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/Converter/DateTimeTypeConverter.php b/src/BeSimple/SoapCommon/Converter/DateTimeTypeConverter.php index 6b0a729..d312182 100644 --- a/src/BeSimple/SoapCommon/Converter/DateTimeTypeConverter.php +++ b/src/BeSimple/SoapCommon/Converter/DateTimeTypeConverter.php @@ -44,4 +44,3 @@ class DateTimeTypeConverter implements TypeConverterInterface return sprintf('<%1$s>%2$s', $this->getTypeName(), $data->format('Y-m-d\TH:i:sP')); } } - diff --git a/src/BeSimple/SoapCommon/Converter/DateTypeConverter.php b/src/BeSimple/SoapCommon/Converter/DateTypeConverter.php index 11d5ad2..66dcbd8 100644 --- a/src/BeSimple/SoapCommon/Converter/DateTypeConverter.php +++ b/src/BeSimple/SoapCommon/Converter/DateTypeConverter.php @@ -44,4 +44,3 @@ class DateTypeConverter implements TypeConverterInterface return sprintf('<%1$s>%2$s', $this->getTypeName(), $data->format('Y-m-d')); } } - diff --git a/src/BeSimple/SoapCommon/Converter/TypeConverterCollection.php b/src/BeSimple/SoapCommon/Converter/TypeConverterCollection.php index 02ea70e..6d918a0 100644 --- a/src/BeSimple/SoapCommon/Converter/TypeConverterCollection.php +++ b/src/BeSimple/SoapCommon/Converter/TypeConverterCollection.php @@ -74,10 +74,10 @@ class TypeConverterCollection $typemap[] = array( 'type_name' => $converter->getTypeName(), 'type_ns' => $converter->getTypeNamespace(), - 'from_xml' => function($input) use ($converter) { + 'from_xml' => function ($input) use ($converter) { return $converter->convertXmlToPhp($input); }, - 'to_xml' => function($input) use ($converter) { + 'to_xml' => function ($input) use ($converter) { return $converter->convertPhpToXml($input); }, ); diff --git a/src/BeSimple/SoapCommon/Converter/TypeConverterInterface.php b/src/BeSimple/SoapCommon/Converter/TypeConverterInterface.php index e390963..50be071 100644 --- a/src/BeSimple/SoapCommon/Converter/TypeConverterInterface.php +++ b/src/BeSimple/SoapCommon/Converter/TypeConverterInterface.php @@ -24,14 +24,14 @@ interface TypeConverterInterface * * @return string */ - function getTypeNamespace(); + public function getTypeNamespace(); /** * Get type name. * * @return string */ - function getTypeName(); + public function getTypeName(); /** * Convert given XML string to PHP type. @@ -40,7 +40,7 @@ interface TypeConverterInterface * * @return mixed */ - function convertXmlToPhp($data); + public function convertXmlToPhp($data); /** * Convert PHP type to XML string. @@ -49,5 +49,5 @@ interface TypeConverterInterface * * @return string */ - function convertPhpToXml($data); -} \ No newline at end of file + public function convertPhpToXml($data); +} diff --git a/src/BeSimple/SoapCommon/FilterHelper.php b/src/BeSimple/SoapCommon/FilterHelper.php index 01a1717..7806617 100644 --- a/src/BeSimple/SoapCommon/FilterHelper.php +++ b/src/BeSimple/SoapCommon/FilterHelper.php @@ -175,4 +175,4 @@ class FilterHelper $this->namespaces[$namespaceURI] = $prefix; } } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/Helper.php b/src/BeSimple/SoapCommon/Helper.php index c33a9df..5a340e1 100644 --- a/src/BeSimple/SoapCommon/Helper.php +++ b/src/BeSimple/SoapCommon/Helper.php @@ -167,12 +167,13 @@ class Helper * @see http://de.php.net/manual/en/function.uniqid.php#94959 * @return string */ - public static function generateUUID() + public static function generateUuid() { return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" - mt_rand(0, 0xffff), mt_rand(0, 0xffff), + mt_rand(0, 0xffff), + mt_rand(0, 0xffff), // 16 bits for "time_mid" mt_rand(0, 0xffff), // 16 bits for "time_hi_and_version", @@ -183,7 +184,9 @@ class Helper // two most significant bits holds zero and one for variant DCE1.1 mt_rand(0, 0x3fff) | 0x8000, // 48 bits for "node" - mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) + mt_rand(0, 0xffff), + mt_rand(0, 0xffff), + mt_rand(0, 0xffff) ); } @@ -198,9 +201,9 @@ class Helper { if ($version === SOAP_1_2) { return self::NS_SOAP_1_2; - } else { - return self::NS_SOAP_1_1; } + + return self::NS_SOAP_1_1; } /** @@ -214,8 +217,8 @@ class Helper { if ($namespace === self::NS_SOAP_1_2) { return SOAP_1_2; - } else { - return SOAP_1_1; } + + return SOAP_1_1; } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/Mime/MultiPart.php b/src/BeSimple/SoapCommon/Mime/MultiPart.php index 952c860..21b2e17 100644 --- a/src/BeSimple/SoapCommon/Mime/MultiPart.php +++ b/src/BeSimple/SoapCommon/Mime/MultiPart.php @@ -179,11 +179,11 @@ class MultiPart extends PartHeader */ public function generateBoundary() { - return 'multipart-boundary-' . Helper::generateUUID() . '@response.info'; + return 'multipart-boundary-' . Helper::generateUuid() . '@response.info'; } public function getMainPartContentId() { return $this->mainPartContentId; } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/Mime/Parser/ParsedPartsGetter.php b/src/BeSimple/SoapCommon/Mime/Parser/ParsedPartsGetter.php index b277f2d..07a617f 100644 --- a/src/BeSimple/SoapCommon/Mime/Parser/ParsedPartsGetter.php +++ b/src/BeSimple/SoapCommon/Mime/Parser/ParsedPartsGetter.php @@ -113,7 +113,7 @@ class ParsedPartsGetter $hitFirstBoundary = true; $inHeader = true; $messagePartStringContent = ''; - } else if (MimeBoundaryAnalyser::isMessageLineLastBoundary($mimeMessageLine, $contentTypeBoundary)) { + } elseif (MimeBoundaryAnalyser::isMessageLineLastBoundary($mimeMessageLine, $contentTypeBoundary)) { $currentPartContent = self::decodeContent( $currentPart, substr($messagePartStringContent, 0, -1) @@ -166,7 +166,7 @@ class ParsedPartsGetter if ($encoding === Part::ENCODING_BASE64) { $partStringContent = base64_decode($partStringContent); - } else if ($encoding === Part::ENCODING_QUOTED_PRINTABLE) { + } elseif ($encoding === Part::ENCODING_QUOTED_PRINTABLE) { $partStringContent = quoted_printable_decode($partStringContent); } diff --git a/src/BeSimple/SoapCommon/Mime/Part.php b/src/BeSimple/SoapCommon/Mime/Part.php index 2e76b93..787e346 100644 --- a/src/BeSimple/SoapCommon/Mime/Part.php +++ b/src/BeSimple/SoapCommon/Mime/Part.php @@ -154,6 +154,6 @@ class Part extends PartHeader */ protected function generateContentId() { - return 'part-' . Helper::generateUUID() . '@response.info'; + return 'part-' . Helper::generateUuid() . '@response.info'; } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/SoapMessage.php b/src/BeSimple/SoapCommon/SoapMessage.php index f528ec3..3682f2b 100644 --- a/src/BeSimple/SoapCommon/SoapMessage.php +++ b/src/BeSimple/SoapCommon/SoapMessage.php @@ -92,14 +92,14 @@ abstract class SoapMessage /** * SOAP version (SOAP_1_1|SOAP_1_2) * - * @var string + * @var int */ protected $version; /** * Get content type for given SOAP version. * - * @param string $version SOAP version constant SOAP_1_1|SOAP_1_2 + * @param int $version SOAP version constant SOAP_1_1|SOAP_1_2 * * @return string * @throws \InvalidArgumentException @@ -232,9 +232,9 @@ abstract class SoapMessage } /** - * Get version. + * Get SOAP version SOAP_1_1|SOAP_1_2 * - * @return string + * @return int */ public function getVersion() { @@ -244,7 +244,7 @@ abstract class SoapMessage /** * Set version. * - * @param string $version SOAP version SOAP_1_1|SOAP_1_2 + * @param int $version SOAP version SOAP_1_1|SOAP_1_2 */ public function setVersion($version) { diff --git a/src/BeSimple/SoapCommon/SoapRequestFactory.php b/src/BeSimple/SoapCommon/SoapRequestFactory.php index 38888c4..5e9e45f 100644 --- a/src/BeSimple/SoapCommon/SoapRequestFactory.php +++ b/src/BeSimple/SoapCommon/SoapRequestFactory.php @@ -36,7 +36,7 @@ class SoapRequestFactory * * @param string $location Location * @param string $action SOAP action - * @param string $version SOAP version + * @param int $version SOAP version * @param string $content Content * @return SoapRequest */ diff --git a/src/BeSimple/SoapCommon/SoapRequestFilter.php b/src/BeSimple/SoapCommon/SoapRequestFilter.php index 26a2764..c8a5ae4 100644 --- a/src/BeSimple/SoapCommon/SoapRequestFilter.php +++ b/src/BeSimple/SoapCommon/SoapRequestFilter.php @@ -27,4 +27,4 @@ interface SoapRequestFilter * @param int $attachmentType = SoapOptions::SOAP_ATTACHMENTS_TYPE_SWA|SoapOptions::ATTACHMENTS_TYPE_MTOM|SoapOptions::ATTACHMENTS_TYPE_BASE64 */ public function filterRequest(SoapRequest $request, $attachmentType); -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/SoapResponseFilter.php b/src/BeSimple/SoapCommon/SoapResponseFilter.php index a124053..ee6efe9 100644 --- a/src/BeSimple/SoapCommon/SoapResponseFilter.php +++ b/src/BeSimple/SoapCommon/SoapResponseFilter.php @@ -29,4 +29,4 @@ interface SoapResponseFilter * @param int $attachmentType = SoapOptions::SOAP_ATTACHMENTS_TYPE_SWA|SoapOptions::ATTACHMENTS_TYPE_MTOM|SoapOptions::ATTACHMENTS_TYPE_BASE64 */ public function filterResponse(SoapResponse $response, $attachmentType); -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/Tests/AbstractSoapBuilderTest.php b/src/BeSimple/SoapCommon/Tests/AbstractSoapBuilderTest.php deleted file mode 100644 index 33fda1e..0000000 --- a/src/BeSimple/SoapCommon/Tests/AbstractSoapBuilderTest.php +++ /dev/null @@ -1,211 +0,0 @@ - - * (c) Francis Besset - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace BeSimple\SoapCommon\Tests; - -use BeSimple\SoapCommon\Cache; -use BeSimple\SoapCommon\Classmap; -use BeSimple\SoapCommon\Converter\DateTimeTypeConverter; -use BeSimple\SoapCommon\Converter\DateTypeConverter; -use BeSimple\SoapCommon\Converter\TypeConverterCollection; -use BeSimple\SoapCommon\Tests\Fixtures\SoapBuilder; - -class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase -{ - private $defaultOptions = array( - 'features' => 0, - 'classmap' => array(), - 'typemap' => array(), - ); - - public function testContruct() - { - $options = $this - ->getSoapBuilder() - ->getSoapOptions() - ; - - $this->assertEquals($this->mergeOptions(array()), $options); - } - - public function testWithWsdl() - { - $builder = $this->getSoapBuilder(); - $this->assertNull($builder->getWsdl()); - - $builder->withWsdl('http://myWsdl/?wsdl'); - $this->assertEquals('http://myWsdl/?wsdl', $builder->getWsdl()); - } - - public function testWithSoapVersion() - { - $builder = $this->getSoapBuilder(); - - $builder->withSoapVersion11(); - $this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_1)), $builder->getSoapOptions()); - - $builder->withSoapVersion12(); - $this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2)), $builder->getSoapOptions()); - } - - public function testWithEncoding() - { - $builder = $this - ->getSoapBuilder() - ->withEncoding('ISO 8859-15') - ; - - $this->assertEquals($this->mergeOptions(array('encoding' => 'ISO 8859-15')), $builder->getSoapOptions()); - } - - public function testWithWsdlCache() - { - $builder = $this->getSoapBuilder(); - - $builder->withWsdlCache(Cache::TYPE_DISK_MEMORY); - $this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK_MEMORY)), $builder->getSoapOptions()); - - $builder->withWsdlCacheNone(); - $this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_NONE)), $builder->getSoapOptions()); - - $builder->withWsdlCacheDisk(); - $this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK)), $builder->getSoapOptions()); - - $builder->withWsdlCacheMemory(); - $this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_MEMORY)), $builder->getSoapOptions()); - - $builder->withWsdlCacheDiskAndMemory(); - $this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK_MEMORY)), $builder->getSoapOptions()); - } - - public function testWithWsdlCacheBadValue() - { - $builder = $this->getSoapBuilder(); - - $this->setExpectedException('InvalidArgumentException'); - $builder->withWsdlCache('foo'); - } - - public function testWithSingleElementArrays() - { - $options = $this - ->getSoapBuilder() - ->withSingleElementArrays() - ->getSoapOptions() - ; - - $this->assertEquals($this->mergeOptions(array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $options); - } - - public function testWithWaitOneWayCalls() - { - $options = $this - ->getSoapBuilder() - ->withWaitOneWayCalls() - ->getSoapOptions() - ; - - $this->assertEquals($this->mergeOptions(array('features' => SOAP_WAIT_ONE_WAY_CALLS)), $options); - } - - public function testWithUseXsiArrayType() - { - $options = $this - ->getSoapBuilder() - ->withUseXsiArrayType() - ->getSoapOptions() - ; - - $this->assertEquals($this->mergeOptions(array('features' => SOAP_USE_XSI_ARRAY_TYPE)), $options); - } - - public function testFeatures() - { - $builder = $this->getSoapBuilder(); - $features = 0; - - $builder->withSingleElementArrays(); - $features |= SOAP_SINGLE_ELEMENT_ARRAYS; - $this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions()); - - $builder->withWaitOneWayCalls(); - $features |= SOAP_WAIT_ONE_WAY_CALLS; - $this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions()); - - $builder->withUseXsiArrayType(); - $features |= SOAP_USE_XSI_ARRAY_TYPE; - $this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions()); - } - - public function testWithTypeConverters() - { - $builder = $this->getSoapBuilder(); - - $builder->withTypeConverter(new DateTypeConverter()); - $options = $builder->getSoapOptions(); - - $this->assertEquals(1, count($options['typemap'])); - - $converters = new TypeConverterCollection(); - $converters->add(new DateTimeTypeConverter()); - $builder->withTypeConverters($converters); - $options = $builder->getSoapOptions(); - - $this->assertEquals(2, count($options['typemap'])); - - $builder->withTypeConverters($converters, false); - $options = $builder->getSoapOptions(); - - $this->assertEquals(1, count($options['typemap'])); - } - - public function testClassmap() - { - $builder = $this->getSoapBuilder(); - - $builder->withClassMapping('foo', __CLASS__); - $options = $builder->getSoapOptions(); - - $this->assertEquals(1, count($options['classmap'])); - - $classmap = new ClassMap(); - $classmap->add('bar', __CLASS__); - $builder->withClassmap($classmap); - $options = $builder->getSoapOptions(); - - $this->assertEquals(2, count($options['classmap'])); - - $builder->withClassmap($classmap, false); - $options = $builder->getSoapOptions(); - - $this->assertEquals(1, count($options['classmap'])); - } - - public function testCreateWithDefaults() - { - $builder = SoapBuilder::createWithDefaults(); - - $this->assertInstanceOf('BeSimple\SoapCommon\Tests\Fixtures\SoapBuilder', $builder); - - $this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $builder->getSoapOptions()); - } - - private function getSoapBuilder() - { - return new SoapBuilder(); - } - - private function mergeOptions(array $options) - { - return array_merge($this->defaultOptions, $options); - } -} diff --git a/src/BeSimple/SoapCommon/Tests/CacheTest.php b/src/BeSimple/SoapCommon/Tests/CacheTest.php index 291ff42..307f2d9 100644 --- a/src/BeSimple/SoapCommon/Tests/CacheTest.php +++ b/src/BeSimple/SoapCommon/Tests/CacheTest.php @@ -16,7 +16,7 @@ use BeSimple\SoapCommon\Cache; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamWrapper; -class SoapRequestTest extends \PHPUnit_Framework_TestCase +class CacheTest extends \PHPUnit_Framework_TestCase { public function testSetEnabled() { diff --git a/src/BeSimple/SoapCommon/Tests/Converter/DateTimeTypeConverterTest.php b/src/BeSimple/SoapCommon/Tests/Converter/DateTimeTypeConverterTest.php index 9546722..44d1ddd 100644 --- a/src/BeSimple/SoapCommon/Tests/Converter/DateTimeTypeConverterTest.php +++ b/src/BeSimple/SoapCommon/Tests/Converter/DateTimeTypeConverterTest.php @@ -51,4 +51,3 @@ class DateTimeTypeConverterTest extends \PHPUnit_Framework_TestCase $this->assertNull($date); } } - diff --git a/src/BeSimple/SoapCommon/Tests/Converter/DateTypeConverterTest.php b/src/BeSimple/SoapCommon/Tests/Converter/DateTypeConverterTest.php index 48bddcc..6bc4b53 100644 --- a/src/BeSimple/SoapCommon/Tests/Converter/DateTypeConverterTest.php +++ b/src/BeSimple/SoapCommon/Tests/Converter/DateTypeConverterTest.php @@ -49,4 +49,3 @@ class DateTypeConverterTest extends \PHPUnit_Framework_TestCase $this->assertNull($date); } } - diff --git a/src/BeSimple/SoapCommon/Tests/Converter/TypeConverterCollectionTest.php b/src/BeSimple/SoapCommon/Tests/Converter/TypeConverterCollectionTest.php index b445075..39f5bb3 100644 --- a/src/BeSimple/SoapCommon/Tests/Converter/TypeConverterCollectionTest.php +++ b/src/BeSimple/SoapCommon/Tests/Converter/TypeConverterCollectionTest.php @@ -30,19 +30,19 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase $dateTimeTypeConverter = new DateTimeTypeConverter(); $converters->add($dateTimeTypeConverter); - $this->assertSame(array($dateTimeTypeConverter), $converters->getAll()); + $this->assertSame([$dateTimeTypeConverter], $converters->getAll()); $dateTypeConverter = new DateTypeConverter(); $converters->add($dateTypeConverter); - $this->assertSame(array($dateTimeTypeConverter, $dateTypeConverter), $converters->getAll()); + $this->assertSame([$dateTimeTypeConverter, $dateTypeConverter], $converters->getAll()); } public function testGetTypemap() { $converters = new TypeConverterCollection(); - $this->assertEquals(array(), $converters->getTypemap()); + $this->assertEquals([], $converters->getTypemap()); $dateTimeTypeConverter = new DateTimeTypeConverter(); $converters->add($dateTimeTypeConverter); @@ -70,7 +70,9 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase $dateTimeTypeConverter = new DateTimeTypeConverter(); $converters->add($dateTimeTypeConverter); - $converter = array(new DateTypeConverter); + $converter = [ + new DateTypeConverter() + ]; $converters->set($converter); $this->assertSame($converter, $converters->getAll()); @@ -85,9 +87,9 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase $converters2->add($dateTimeTypeConverter); $converters1->addCollection($converters2); - $this->assertSame(array($dateTimeTypeConverter), $converters1->getAll()); + $this->assertSame([$dateTimeTypeConverter], $converters1->getAll()); $this->setExpectedException('InvalidArgumentException'); $converters1->addCollection($converters2); } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapCommon/Tests/Mime/MultiPartTest.php b/src/BeSimple/SoapCommon/Tests/Mime/MultiPartTest.php index fe51190..e1782c6 100644 --- a/src/BeSimple/SoapCommon/Tests/Mime/MultiPartTest.php +++ b/src/BeSimple/SoapCommon/Tests/Mime/MultiPartTest.php @@ -131,13 +131,13 @@ class MultiPartTest extends \PHPUnit_Framework_TestCase $mp->addPart($p2); $withoutMain = array( - trim($p2->getHeader('Content-ID'),'<>') => $p2, + trim($p2->getHeader('Content-ID'), '<>') => $p2, ); $this->assertEquals($withoutMain, $mp->getParts()); $withMain = array( - trim($p1->getHeader('Content-ID'),'<>') => $p1, - trim($p2->getHeader('Content-ID'),'<>') => $p2, + trim($p1->getHeader('Content-ID'), '<>') => $p1, + trim($p2->getHeader('Content-ID'), '<>') => $p2 ); $this->assertEquals($withMain, $mp->getParts(true)); } diff --git a/src/BeSimple/SoapCommon/Tests/Mime/ParserTest.php b/src/BeSimple/SoapCommon/Tests/Mime/ParserTest.php index 8ce3a99..d584a7a 100644 --- a/src/BeSimple/SoapCommon/Tests/Mime/ParserTest.php +++ b/src/BeSimple/SoapCommon/Tests/Mime/ParserTest.php @@ -115,7 +115,8 @@ class ParserTest extends \PHPUnit_Framework_TestCase $mimeMessage = file_get_contents($filename); $headers = array( - 'Content-Type' => 'multipart/related; type="application/xop+xml";start="";boundary="uuid:0ca0e16e-feb1-426c-97d8-c4508ada5e82+id=7";start-info="application/soap+xml"', + 'Content-Type' => + 'multipart/related; type="application/xop+xml";start="";boundary="uuid:0ca0e16e-feb1-426c-97d8-c4508ada5e82+id=7";start-info="application/soap+xml"', 'Content-Length' => 1941, 'Host' => '131.107.72.15', 'Expect' => '100-continue', diff --git a/src/BeSimple/SoapCommon/WsSecurityFilterClientServer.php b/src/BeSimple/SoapCommon/WsSecurityFilterClientServer.php index 15b0d25..010d086 100644 --- a/src/BeSimple/SoapCommon/WsSecurityFilterClientServer.php +++ b/src/BeSimple/SoapCommon/WsSecurityFilterClientServer.php @@ -325,7 +325,6 @@ abstract class WsSecurityFilterClientServer if (Helper::NS_WSS === $key->namespaceURI) { switch ($key->localName) { case 'KeyIdentifier': - return $this->serviceSecurityKey->getPublicKey(); case 'Reference': $uri = $key->getAttribute('URI'); @@ -336,7 +335,8 @@ abstract class WsSecurityFilterClientServer $key = XmlSecurityEnc::decryptEncryptedKey($referencedNode, $this->userSecurityKey->getPrivateKey()); return XmlSecurityKey::factory($algorithm, $key, false, XmlSecurityKey::TYPE_PRIVATE); - } elseif (Helper::NS_WSS === $referencedNode->namespaceURI + } + if (Helper::NS_WSS === $referencedNode->namespaceURI && 'BinarySecurityToken' == $referencedNode->localName) { $key = XmlSecurityPem::formatKeyInPemFormat($referencedNode->textContent); diff --git a/src/BeSimple/SoapCommon/WsSecurityKey.php b/src/BeSimple/SoapCommon/WsSecurityKey.php index 432e654..d6e03e6 100644 --- a/src/BeSimple/SoapCommon/WsSecurityKey.php +++ b/src/BeSimple/SoapCommon/WsSecurityKey.php @@ -113,4 +113,4 @@ class WsSecurityKey { return null !== $this->publicKey; } -} \ No newline at end of file +} diff --git a/src/BeSimple/SoapServer/Exception/ReceiverSoapFault.php b/src/BeSimple/SoapServer/Exception/ReceiverSoapFault.php deleted file mode 100644 index 105e3b5..0000000 --- a/src/BeSimple/SoapServer/Exception/ReceiverSoapFault.php +++ /dev/null @@ -1,26 +0,0 @@ - - * (c) Francis Besset - * (c) Andreas Schamberger - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace BeSimple\SoapServer\Exception; - -/** - * ReceiverSoapFault send a "Receiver" fault code to client. - * This fault code is standardized: http://www.w3.org/TR/soap12-part1/#tabsoapfaultcodes - */ -class ReceiverSoapFault extends \SoapFault -{ - public function __construct($faultstring, $faultactor = null, $detail = null, $faultname = null, $headerfault = null) - { - parent::__construct('Receiver', $faultstring, $faultactor, $detail, $faultname, $headerfault); - } -} diff --git a/src/BeSimple/SoapServer/Exception/SenderSoapFault.php b/src/BeSimple/SoapServer/Exception/SenderSoapFault.php deleted file mode 100644 index de9c358..0000000 --- a/src/BeSimple/SoapServer/Exception/SenderSoapFault.php +++ /dev/null @@ -1,26 +0,0 @@ - - * (c) Francis Besset - * (c) Andreas Schamberger - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace BeSimple\SoapServer\Exception; - -/** - * SenderSoapFault send a "Sender" fault code to client. - * This fault code is standardized: http://www.w3.org/TR/soap12-part1/#tabsoapfaultcodes - */ -class SenderSoapFault extends \SoapFault -{ - public function __construct($faultstring, $faultactor = null, $detail = null, $faultname = null, $headerfault = null) - { - parent::__construct('Sender', $faultstring, $faultactor, $detail, $faultname, $headerfault); - } -} diff --git a/src/BeSimple/SoapServer/SoapOptions/SoapServerOptions.php b/src/BeSimple/SoapServer/SoapOptions/SoapServerOptions.php index e36b858..f75a3e7 100644 --- a/src/BeSimple/SoapServer/SoapOptions/SoapServerOptions.php +++ b/src/BeSimple/SoapServer/SoapOptions/SoapServerOptions.php @@ -21,6 +21,7 @@ class SoapServerOptions private $handlerObject; private $keepAlive; private $errorReporting; + private $exceptions; private $persistence; /** @@ -47,18 +48,20 @@ class SoapServerOptions public function getHandler() { + if ($this->hasHandlerObject() && $this->hasHandlerClass()) { + + throw new Exception('Both HandlerClass and HandlerObject set: please specify only one'); + } if ($this->hasHandlerObject()) { return $this->getHandlerObject(); - - } else if ($this->hasHandlerClass()) { + } + if ($this->hasHandlerClass()) { return $this->getHandlerClass(); - - } else { - - throw new Exception('No HandlerClass or HandlerObject set'); } + + throw new Exception('No HandlerClass or HandlerObject set'); } public function getHandlerInstance() @@ -94,7 +97,7 @@ class SoapServerOptions public function hasPersistence() { - return $this->persistence !== SoapServerOptions::SOAP_SERVER_PERSISTENCE_NONE; + return $this->persistence !== self::SOAP_SERVER_PERSISTENCE_NONE; } public function getPersistence() @@ -136,14 +139,13 @@ class SoapServerOptions if (is_string($handler) && class_exists($handler)) { return null; - - } elseif (is_object($handler)) { + } + if (is_object($handler)) { return $handler; - - } else { - throw new \InvalidArgumentException('The handler has to be a class name or an object'); } + + throw new \InvalidArgumentException('The handler has to be a class name or an object'); } /** @@ -155,13 +157,12 @@ class SoapServerOptions if (is_string($handler) && class_exists($handler)) { return $handler; - - } elseif (is_object($handler)) { + } + if (is_object($handler)) { return null; - - } else { - throw new \InvalidArgumentException('The handler has to be a class name or an object'); } + + throw new \InvalidArgumentException('The handler has to be a class name or an object'); } } diff --git a/src/BeSimple/SoapServer/SoapServerBuilder.php b/src/BeSimple/SoapServer/SoapServerBuilder.php index f62a2f9..d7417f4 100644 --- a/src/BeSimple/SoapServer/SoapServerBuilder.php +++ b/src/BeSimple/SoapServer/SoapServerBuilder.php @@ -14,6 +14,7 @@ namespace BeSimple\SoapServer; use BeSimple\SoapCommon\SoapOptions\SoapOptions; use BeSimple\SoapServer\SoapOptions\SoapServerOptions; +use Exception; /** * SoapServerBuilder provides a SoapServer instance from SoapServerOptions and SoapOptions. @@ -40,9 +41,16 @@ class SoapServerBuilder } if ($soapServerOptions->hasHandlerClass()) { $server->setClass($soapServerOptions->getHandlerClass()); - } else if ($soapServerOptions->hasHandlerObject()) { + } + if ($soapServerOptions->hasHandlerObject()) { $server->setObject($soapServerOptions->getHandlerObject()); } + if ($soapServerOptions->hasHandlerClass() && $soapServerOptions->hasHandlerObject()) { + + throw new Exception( + 'Could not create SoapServer: HandlerClass and HandlerObject are set: please specify only one' + ); + } return $server; } diff --git a/src/BeSimple/SoapServer/WsSecurityFilter.php b/src/BeSimple/SoapServer/WsSecurityFilter.php index b2e86a0..0de19e9 100644 --- a/src/BeSimple/SoapServer/WsSecurityFilter.php +++ b/src/BeSimple/SoapServer/WsSecurityFilter.php @@ -67,10 +67,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque * Modify the given request XML. * * @param \BeSimple\SoapCommon\SoapRequest $request SOAP request + * @param int $attachmentType * * @return void */ - public function filterRequest(CommonSoapRequest $request) + public function filterRequest(CommonSoapRequest $request, $attachmentType) { // get \DOMDocument from SOAP request $dom = $request->getContentDocument(); @@ -152,10 +153,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque * Modify the given request XML. * * @param \BeSimple\SoapCommon\SoapResponse $response SOAP response + * @param int $attachmentType * * @return void */ - public function filterResponse(CommonSoapResponse $response) + public function filterResponse(CommonSoapResponse $response, $attachmentType) { // get \DOMDocument from SOAP response $dom = $response->getContentDocument(); @@ -190,7 +192,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque } if (null !== $this->userSecurityKey && $this->userSecurityKey->hasKeys()) { - $guid = 'CertId-' . Helper::generateUUID(); + $guid = 'CertId-' . Helper::generateUuid(); // add token references $keyInfo = null; if (null !== $this->tokenReferenceSignature) { @@ -216,7 +218,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque // encrypt soap document if (null !== $this->serviceSecurityKey && $this->serviceSecurityKey->hasKeys()) { - $guid = 'EncKey-' . Helper::generateUUID(); + $guid = 'EncKey-' . Helper::generateUuid(); // add token references $keyInfo = null; if (null !== $this->tokenReferenceEncryption) { diff --git a/tests/BeSimple/SoapCommon/Fault/SoapFaultParserTest.php b/tests/BeSimple/SoapCommon/Fault/SoapFaultParserTest.php index b1fb2a8..8270696 100644 --- a/tests/BeSimple/SoapCommon/Fault/SoapFaultParserTest.php +++ b/tests/BeSimple/SoapCommon/Fault/SoapFaultParserTest.php @@ -9,7 +9,15 @@ class SoapFaultParserTest extends PHPUnit_Framework_TestCase { public function testParse() { - $soapFaultXml = '911This is a dummy SoapFault.'; + $soapFaultXml = ''. + ''. + ''. + ''. + '911'. + 'This is a dummy SoapFault.'. + ''. + ''. + ''; $soapFault = SoapFaultParser::parseSoapFault($soapFaultXml); self::assertInstanceOf(SoapFault::class, $soapFault);