diff --git a/composer.json b/composer.json index 08a15c5..dc2d88f 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "require": { "php": "^8.1", "ext-soap": "*", - "scn/evalanche-soap-api-struct": "^2.5", + "scn/evalanche-soap-api-struct": "^2.6", "scn/hydrator": "^2|^3", "scn/hydrator-property-values": "^2.0|^3.0" }, diff --git a/composer.lock b/composer.lock index 58a9dda..4bab0a0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5dbef3ef40eb1099ff396b134f619841", + "content-hash": "c63fd1daf1f17a20224ba45a8fb1d914", "packages": [ { "name": "scn/evalanche-soap-api-struct", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/SC-Networks/evalanche-soap-api-struct.git", - "reference": "1ae911cfe7868a9eac51484f841debba86b4fcbf" + "reference": "ae64b868df4a2570c9473ae4153fb37a7211a2e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SC-Networks/evalanche-soap-api-struct/zipball/1ae911cfe7868a9eac51484f841debba86b4fcbf", - "reference": "1ae911cfe7868a9eac51484f841debba86b4fcbf", + "url": "https://api.github.com/repos/SC-Networks/evalanche-soap-api-struct/zipball/ae64b868df4a2570c9473ae4153fb37a7211a2e0", + "reference": "ae64b868df4a2570c9473ae4153fb37a7211a2e0", "shasum": "" }, "require": { @@ -61,9 +61,9 @@ ], "support": { "issues": "https://github.com/SC-Networks/evalanche-soap-api-struct/issues", - "source": "https://github.com/SC-Networks/evalanche-soap-api-struct/tree/2.5.0" + "source": "https://github.com/SC-Networks/evalanche-soap-api-struct/tree/2.6.0" }, - "time": "2025-09-17T08:10:08+00:00" + "time": "2025-11-11T08:25:11+00:00" }, { "name": "scn/hydrator", @@ -554,16 +554,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.87.2", + "version": "v3.89.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "da5f0a7858c79b56fc0b8c36d3efcfe5f37f0992" + "reference": "7569658f91e475ec93b99bd5964b059ad1336dcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/da5f0a7858c79b56fc0b8c36d3efcfe5f37f0992", - "reference": "da5f0a7858c79b56fc0b8c36d3efcfe5f37f0992", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7569658f91e475ec93b99bd5964b059ad1336dcf", + "reference": "7569658f91e475ec93b99bd5964b059ad1336dcf", "shasum": "" }, "require": { @@ -578,7 +578,6 @@ "php": "^7.4 || ^8.0", "react/child-process": "^0.6.6", "react/event-loop": "^1.5", - "react/promise": "^3.3", "react/socket": "^1.16", "react/stream": "^1.4", "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", @@ -590,20 +589,20 @@ "symfony/polyfill-mbstring": "^1.33", "symfony/polyfill-php80": "^1.33", "symfony/polyfill-php81": "^1.33", + "symfony/polyfill-php84": "^1.33", "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2", "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0" }, "require-dev": { "facile-it/paraunit": "^1.3.1 || ^2.7", - "infection/infection": "^0.29.14", + "infection/infection": "^0.31.0", "justinrainbow/json-schema": "^6.5", "keradus/cli-executor": "^2.2", "mikey179/vfsstream": "^1.6.12", - "php-coveralls/php-coveralls": "^2.8", + "php-coveralls/php-coveralls": "^2.9", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", "phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34", - "symfony/polyfill-php84": "^1.33", "symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2", "symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2" }, @@ -646,7 +645,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.87.2" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.89.2" }, "funding": [ { @@ -654,7 +653,7 @@ "type": "github" } ], - "time": "2025-09-10T09:51:40+00:00" + "time": "2025-11-06T21:12:50+00:00" }, { "name": "myclabs/deep-copy", @@ -718,16 +717,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.6.1", + "version": "v5.6.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2" + "reference": "3a454ca033b9e06b63282ce19562e892747449bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb", + "reference": "3a454ca033b9e06b63282ce19562e892747449bb", "shasum": "" }, "require": { @@ -770,9 +769,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2" }, - "time": "2025-08-13T20:13:15+00:00" + "time": "2025-10-21T19:32:17+00:00" }, { "name": "phar-io/manifest", @@ -894,16 +893,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.26", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "b13345001a8553ec405b7741be0c6b8d7f8b5bf5" - }, + "version": "2.1.31", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b13345001a8553ec405b7741be0c6b8d7f8b5bf5", - "reference": "b13345001a8553ec405b7741be0c6b8d7f8b5bf5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ead89849d879fe203ce9292c6ef5e7e76f867b96", + "reference": "ead89849d879fe203ce9292c6ef5e7e76f867b96", "shasum": "" }, "require": { @@ -948,25 +942,25 @@ "type": "github" } ], - "time": "2025-09-16T11:33:46+00:00" + "time": "2025-10-10T14:14:11+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "2.0.6", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094" + "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f9f77efa9de31992a832ff77ea52eb42d675b094", - "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d6211c46213d4181054b3d77b10a5c5cb0d59538", + "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.0.4" + "phpstan/phpstan": "^2.1.29" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", @@ -994,9 +988,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.6" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.7" }, - "time": "2025-07-21T12:19:29+00:00" + "time": "2025-09-26T11:19:08+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1321,16 +1315,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.55", + "version": "10.5.58", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4b2d546b336876bd9562f24641b08a25335b06b6" + "reference": "e24fb46da450d8e6a5788670513c1af1424f16ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4b2d546b336876bd9562f24641b08a25335b06b6", - "reference": "4b2d546b336876bd9562f24641b08a25335b06b6", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e24fb46da450d8e6a5788670513c1af1424f16ca", + "reference": "e24fb46da450d8e6a5788670513c1af1424f16ca", "shasum": "" }, "require": { @@ -1354,7 +1348,7 @@ "sebastian/comparator": "^5.0.4", "sebastian/diff": "^5.1.1", "sebastian/environment": "^6.1.0", - "sebastian/exporter": "^5.1.2", + "sebastian/exporter": "^5.1.4", "sebastian/global-state": "^6.0.2", "sebastian/object-enumerator": "^5.0.0", "sebastian/recursion-context": "^5.0.1", @@ -1402,7 +1396,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.55" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.58" }, "funding": [ { @@ -1426,7 +1420,7 @@ "type": "tidelift" } ], - "time": "2025-09-14T06:19:20+00:00" + "time": "2025-09-28T12:04:46+00:00" }, { "name": "psr/container", @@ -2555,16 +2549,16 @@ }, { "name": "sebastian/exporter", - "version": "5.1.2", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "955288482d97c19a372d3f31006ab3f37da47adf" + "reference": "0735b90f4da94969541dac1da743446e276defa6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", - "reference": "955288482d97c19a372d3f31006ab3f37da47adf", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0735b90f4da94969541dac1da743446e276defa6", + "reference": "0735b90f4da94969541dac1da743446e276defa6", "shasum": "" }, "require": { @@ -2573,7 +2567,7 @@ "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.5" }, "type": "library", "extra": { @@ -2621,15 +2615,27 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.4" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" } ], - "time": "2024-03-02T07:17:12+00:00" + "time": "2025-09-24T06:09:11+00:00" }, { "name": "sebastian/global-state", @@ -3050,16 +3056,16 @@ }, { "name": "symfony/console", - "version": "v7.3.3", + "version": "v7.3.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7" + "reference": "c28ad91448f86c5f6d9d2c70f0cf68bf135f252a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7", - "reference": "cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7", + "url": "https://api.github.com/repos/symfony/console/zipball/c28ad91448f86c5f6d9d2c70f0cf68bf135f252a", + "reference": "c28ad91448f86c5f6d9d2c70f0cf68bf135f252a", "shasum": "" }, "require": { @@ -3124,7 +3130,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.3.3" + "source": "https://github.com/symfony/console/tree/v7.3.6" }, "funding": [ { @@ -3144,7 +3150,7 @@ "type": "tidelift" } ], - "time": "2025-08-25T06:35:40+00:00" + "time": "2025-11-04T01:21:42+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3375,16 +3381,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.3.2", + "version": "v7.3.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd" + "reference": "e9bcfd7837928ab656276fe00464092cc9e1826a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edcbb768a186b5c3f25d0643159a787d3e63b7fd", - "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e9bcfd7837928ab656276fe00464092cc9e1826a", + "reference": "e9bcfd7837928ab656276fe00464092cc9e1826a", "shasum": "" }, "require": { @@ -3421,7 +3427,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.3.2" + "source": "https://github.com/symfony/filesystem/tree/v7.3.6" }, "funding": [ { @@ -3441,20 +3447,20 @@ "type": "tidelift" } ], - "time": "2025-07-07T08:17:47+00:00" + "time": "2025-11-05T09:52:27+00:00" }, { "name": "symfony/finder", - "version": "v7.3.2", + "version": "v7.3.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "2a6614966ba1074fa93dae0bc804227422df4dfe" + "reference": "9f696d2f1e340484b4683f7853b273abff94421f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/2a6614966ba1074fa93dae0bc804227422df4dfe", - "reference": "2a6614966ba1074fa93dae0bc804227422df4dfe", + "url": "https://api.github.com/repos/symfony/finder/zipball/9f696d2f1e340484b4683f7853b273abff94421f", + "reference": "9f696d2f1e340484b4683f7853b273abff94421f", "shasum": "" }, "require": { @@ -3489,7 +3495,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.3.2" + "source": "https://github.com/symfony/finder/tree/v7.3.5" }, "funding": [ { @@ -3509,7 +3515,7 @@ "type": "tidelift" } ], - "time": "2025-07-15T13:41:35+00:00" + "time": "2025-10-15T18:45:57+00:00" }, { "name": "symfony/options-resolver", @@ -4081,18 +4087,98 @@ ], "time": "2024-09-09T11:45:10+00:00" }, + { + "name": "symfony/polyfill-php84", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "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 backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-24T13:30:11+00:00" + }, { "name": "symfony/process", - "version": "v7.3.3", + "version": "v7.3.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "32241012d521e2e8a9d713adb0812bb773b907f1" + "reference": "f24f8f316367b30810810d4eb30c543d7003ff3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/32241012d521e2e8a9d713adb0812bb773b907f1", - "reference": "32241012d521e2e8a9d713adb0812bb773b907f1", + "url": "https://api.github.com/repos/symfony/process/zipball/f24f8f316367b30810810d4eb30c543d7003ff3b", + "reference": "f24f8f316367b30810810d4eb30c543d7003ff3b", "shasum": "" }, "require": { @@ -4124,7 +4210,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.3.3" + "source": "https://github.com/symfony/process/tree/v7.3.4" }, "funding": [ { @@ -4144,20 +4230,20 @@ "type": "tidelift" } ], - "time": "2025-08-18T09:42:54+00:00" + "time": "2025-09-11T10:12:26+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", "shasum": "" }, "require": { @@ -4211,7 +4297,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" }, "funding": [ { @@ -4222,12 +4308,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-04-25T09:37:31+00:00" + "time": "2025-07-15T11:30:57+00:00" }, { "name": "symfony/stopwatch", @@ -4293,16 +4383,16 @@ }, { "name": "symfony/string", - "version": "v7.3.3", + "version": "v7.3.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "17a426cce5fd1f0901fefa9b2a490d0038fd3c9c" + "reference": "f96476035142921000338bad71e5247fbc138872" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/17a426cce5fd1f0901fefa9b2a490d0038fd3c9c", - "reference": "17a426cce5fd1f0901fefa9b2a490d0038fd3c9c", + "url": "https://api.github.com/repos/symfony/string/zipball/f96476035142921000338bad71e5247fbc138872", + "reference": "f96476035142921000338bad71e5247fbc138872", "shasum": "" }, "require": { @@ -4317,7 +4407,6 @@ }, "require-dev": { "symfony/emoji": "^7.1", - "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", "symfony/translation-contracts": "^2.5|^3.0", @@ -4360,7 +4449,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.3.3" + "source": "https://github.com/symfony/string/tree/v7.3.4" }, "funding": [ { @@ -4380,7 +4469,7 @@ "type": "tidelift" } ], - "time": "2025-08-25T06:35:40+00:00" + "time": "2025-09-11T14:36:48+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Client/LeadPage/LeadpageClient.php b/src/Client/LeadPage/LeadpageClient.php index 197ab5d..fc0a5fc 100644 --- a/src/Client/LeadPage/LeadpageClient.php +++ b/src/Client/LeadPage/LeadpageClient.php @@ -124,4 +124,60 @@ public function setContentContainerData(int $leadpageId, HashMapInterface $hashM $this->hydratorConfigFactory->createResourceInformationConfig() ); } + + /** @inheritdoc */ + public function removeAllArticles(int $id): bool + { + return $this->responseMapper->getBoolean( + $this->soapClient->removeAllArticles([ + 'leadpage_id' => $id + ]), + 'removeAllArticlesResult' + ); + } + + /** @inheritdoc */ + public function removeArticles(int $id, array $referenceIds): array + { + return $this->responseMapper->getObjects( + $this->soapClient->removeArticles( + [ + 'leadpage_id' => $id, + 'reference_ids' => $referenceIds, + ] + ), + 'removeArticlesResult', + $this->hydratorConfigFactory->createLeadpageArticleConfig() + ); + } + + /** @inheritdoc */ + public function getArticlesByLeadpageId(int $id): array + { + return $this->responseMapper->getObjects( + $this->soapClient->getArticles([ + 'leadpage_id' => $id + ]), + 'getArticlesResult', + $this->hydratorConfigFactory->createLeadpageArticleConfig() + ); + } + + /** @inheritdoc */ + public function addArticles(int $id, array $articles): array + { + return $this->responseMapper->getObjects( + $this->soapClient->addArticles( + [ + 'leadpage_id' => $id, + 'articles' => $this->extractor->extractArray( + $this->hydratorConfigFactory->createLeadpageArticleConfig(), + $articles + ) + ] + ), + 'addArticlesResult', + $this->hydratorConfigFactory->createLeadpageArticleConfig() + ); + } } diff --git a/src/Client/LeadPage/LeadpageClientInterface.php b/src/Client/LeadPage/LeadpageClientInterface.php index 47468cc..08ca8bc 100644 --- a/src/Client/LeadPage/LeadpageClientInterface.php +++ b/src/Client/LeadPage/LeadpageClientInterface.php @@ -9,6 +9,7 @@ use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException; use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface; use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticleInterface; use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageConfigurationInterface; interface LeadpageClientInterface extends @@ -69,4 +70,48 @@ public function getContentContainerData(int $leadpageId): HashMapInterface; * @throws EmptyResultException */ public function setContentContainerData(int $leadpageId, HashMapInterface $hashMap): ResourceInformationInterface; + + /** + * Remove all articles from the leadpage + * + * @param int $id + * + * @return bool + * + * @throws EmptyResultException + */ + public function removeAllArticles(int $id): bool; + + /** + * Remove certain articles from the leadpage + * + * @param int $id + * @param int[] $referenceIds + * + * @return LeadpageArticleInterface[] + * + * @throws EmptyResultException + */ + public function removeArticles(int $id, array $referenceIds): array; + + /** + * Retrieve all articles of the leadpage + * + * @param int $id + * + * @return LeadpageArticleInterface[] + * @throws EmptyResultException + */ + public function getArticlesByLeadpageId(int $id): array; + + /** + * Add articles to a leadpage + * + * @param int $id + * @param array $articles + * + * @return LeadpageArticleInterface[] + * @throws EmptyResultException + */ + public function addArticles(int $id, array $articles): array; } diff --git a/src/Client/LeadPageTemplate/LeadpageTemplateClient.php b/src/Client/LeadPageTemplate/LeadpageTemplateClient.php index dabce01..e446b9b 100644 --- a/src/Client/LeadPageTemplate/LeadpageTemplateClient.php +++ b/src/Client/LeadPageTemplate/LeadpageTemplateClient.php @@ -133,4 +133,60 @@ public function setConfiguration( $this->hydratorConfigFactory->createLeadpageTemplateConfigurationConfig(), ); } + + /** @inheritdoc */ + public function removeAllArticles(int $id): bool + { + return $this->responseMapper->getBoolean( + $this->soapClient->removeAllArticles([ + 'leadpage_template_id' => $id + ]), + 'removeAllArticlesResult' + ); + } + + /** @inheritdoc */ + public function removeArticles(int $id, array $referenceIds): array + { + return $this->responseMapper->getObjects( + $this->soapClient->removeArticles( + [ + 'leadpage_template_id' => $id, + 'reference_ids' => $referenceIds, + ] + ), + 'removeArticlesResult', + $this->hydratorConfigFactory->createLeadpageArticleConfig() + ); + } + + /** @inheritdoc */ + public function getArticlesByLeadpageTemplateId(int $id): array + { + return $this->responseMapper->getObjects( + $this->soapClient->getArticles([ + 'leadpage_template_id' => $id + ]), + 'getArticlesResult', + $this->hydratorConfigFactory->createLeadpageArticleConfig() + ); + } + + /** @inheritdoc */ + public function addArticles(int $id, array $articles): array + { + return $this->responseMapper->getObjects( + $this->soapClient->addArticles( + [ + 'leadpage_template_id' => $id, + 'articles' => $this->extractor->extractArray( + $this->hydratorConfigFactory->createLeadpageArticleConfig(), + $articles + ) + ] + ), + 'addArticlesResult', + $this->hydratorConfigFactory->createLeadpageArticleConfig() + ); + } } diff --git a/src/Client/LeadPageTemplate/LeadpageTemplateClientInterface.php b/src/Client/LeadPageTemplate/LeadpageTemplateClientInterface.php index 627bc5f..04bddd5 100644 --- a/src/Client/LeadPageTemplate/LeadpageTemplateClientInterface.php +++ b/src/Client/LeadPageTemplate/LeadpageTemplateClientInterface.php @@ -6,6 +6,7 @@ use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTraitInterface; use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException; use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticleInterface; use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\LeadpageTemplateConfigurationInterface; use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSourcesInterface; @@ -63,4 +64,48 @@ public function setConfiguration( int $id, LeadpageTemplateConfigurationInterface $configuration ): LeadpageTemplateConfigurationInterface; + + /** + * Remove all articles from the leadpage-template + * + * @param int $id + * + * @return bool + * + * @throws EmptyResultException + */ + public function removeAllArticles(int $id): bool; + + /** + * Remove certain articles from the leadpage-template + * + * @param int $id + * @param int[] $referenceIds + * + * @return LeadpageArticleInterface[] + * + * @throws EmptyResultException + */ + public function removeArticles(int $id, array $referenceIds): array; + + /** + * Retrieve all articles of the leadpage-template + * + * @param int $id + * + * @return LeadpageArticleInterface[] + * @throws EmptyResultException + */ + public function getArticlesByLeadpageTemplateId(int $id): array; + + /** + * Add articles to a leadpage-template + * + * @param int $id + * @param array $articles + * + * @return LeadpageArticleInterface[] + * @throws EmptyResultException + */ + public function addArticles(int $id, array $articles): array; } diff --git a/src/Hydrator/Config/HydratorConfigFactory.php b/src/Hydrator/Config/HydratorConfigFactory.php index d5e1648..c371c1d 100644 --- a/src/Hydrator/Config/HydratorConfigFactory.php +++ b/src/Hydrator/Config/HydratorConfigFactory.php @@ -23,6 +23,7 @@ use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ResourceInformationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ResourceTypeInformationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ServiceStatusConfig; +use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage\LeadpageArticleConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage\LeadpageConfigurationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPageTemplate\LeadpageTemplateSourcesConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPageTemplate\LeadpageTemplateConfigurationConfig; @@ -238,6 +239,11 @@ public function createMailingArticleConfig(): HydratorConfigInterface return new MailingArticleConfig(); } + public function createLeadpageArticleConfig(): HydratorConfigInterface + { + return new LeadpageArticleConfig(); + } + public function createMailingDetailConfig(): HydratorConfigInterface { return new MailingDetailConfig(); diff --git a/src/Hydrator/Config/HydratorConfigFactoryInterface.php b/src/Hydrator/Config/HydratorConfigFactoryInterface.php index f8233a1..4e6b2b1 100644 --- a/src/Hydrator/Config/HydratorConfigFactoryInterface.php +++ b/src/Hydrator/Config/HydratorConfigFactoryInterface.php @@ -72,6 +72,8 @@ public function createMassUpdateResultConfig(): HydratorConfigInterface; public function createMailingArticleConfig(): HydratorConfigInterface; + public function createLeadpageArticleConfig(): HydratorConfigInterface; + public function createMailingDetailConfig(): HydratorConfigInterface; public function createMailingClickConfig(): HydratorConfigInterface; diff --git a/src/Hydrator/Config/LeadPage/LeadpageArticleConfig.php b/src/Hydrator/Config/LeadPage/LeadpageArticleConfig.php new file mode 100644 index 0000000..b8c3f55 --- /dev/null +++ b/src/Hydrator/Config/LeadPage/LeadpageArticleConfig.php @@ -0,0 +1,56 @@ + IntegerValue::set('id'), + 'article_id' => IntegerValue::set('articleId'), + 'targetgroup_id' => IntegerValue::set('targetGroupId'), + 'landingpage_preset_id' => IntegerValue::set('landingpagePresetId'), + 'mobile_preset_id' => IntegerValue::set('mobilePresetId'), + 'sort_pos' => IntegerValue::set('sortPos'), + 'slot' => IntegerValue::set('slot'), + ]; + } + + /** + * @return array + */ + public function getExtractorProperties(): array + { + return [ + 'id' => IntegerValue::get('id'), + 'article_id' => IntegerValue::get('articleId'), + 'targetgroup_id' => IntegerValue::get('targetGroupId'), + 'landingpage_preset_id' => IntegerValue::get('landingpagePresetId'), + 'mobile_preset_id' => IntegerValue::get('mobilePresetId'), + 'sort_pos' => IntegerValue::get('sortPos'), + 'slot' => IntegerValue::get('slot'), + ]; + } +} diff --git a/tests/Client/LeadPage/LeadpageClientTest.php b/tests/Client/LeadPage/LeadpageClientTest.php index 4f3db44..e550117 100644 --- a/tests/Client/LeadPage/LeadpageClientTest.php +++ b/tests/Client/LeadPage/LeadpageClientTest.php @@ -15,6 +15,7 @@ use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface; use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; use Scn\EvalancheSoapStruct\Struct\Generic\ResourceTypeInformationInterface; +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticleInterface; use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageConfigurationInterface; use \stdClass; @@ -52,7 +53,11 @@ public function setUp(): void 'getContentContainerData', 'setContentContainerData', 'updateModuleTypes', - 'retrieveModuleTypes' + 'retrieveModuleTypes', + 'removeAllArticles', + 'removeArticles', + 'getArticles', + 'addArticles', ]); $this->responseMapper = $this->getMockBuilder(ResponseMapperInterface::class)->getMock(); $this->hydratorConfigFactory = $this->getMockBuilder(HydratorConfigFactoryInterface::class)->getMock(); @@ -489,4 +494,159 @@ public function testGetModuleTypesCanReturnString(): void static::assertSame('some-thing', $this->subject->getModuleTypes($id)); } + + public function testRemoveAllArticlesCalls(): void + { + $id = 23; + + $response = new stdClass(); + $response->removeAllArticleResult = true; + + $this->soapClient->expects($this->once()) + ->method('removeAllArticles') + ->with([ + 'leadpage_id' => $id + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getBoolean') + ->with( + $response, + 'removeAllArticlesResult' + ) + ->willReturn($response->removeAllArticleResult); + + + static::assertTrue( + $this->subject->removeAllArticles($id) + ); + } + + public function testRemoveArticlesCalls(): void + { + $id = 23; + $referenceIds = [42, 666]; + $response = new stdClass(); + $result = ['some-result']; + + $config = $this->createMock(HydratorConfigInterface::class); + + $this->soapClient->expects($this->once()) + ->method('removeArticles') + ->with([ + 'leadpage_id' => $id, + 'reference_ids' => $referenceIds, + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getObjects') + ->with( + $response, + 'removeArticlesResult', + $config, + ) + ->willReturn($result); + + $this->hydratorConfigFactory->expects(static::once()) + ->method('createLeadpageArticleConfig') + ->willReturn($config); + + static::assertSame( + $result, + $this->subject->removeArticles($id, $referenceIds) + ); + } + + public function testAddArticlesCalls(): void + { + $id = 1234; + $articles = [ + $this->createMock(LeadpageArticleInterface::class), + ]; + + $config = $this->createMock(HydratorConfigInterface::class); + + $response = new stdClass(); + $response->addArticlesResult = $articles; + + $extractedData = [ + [ + 'some' => 'data' + ], + ]; + + $this->extractor->expects($this->once()) + ->method('extractArray') + ->with( + $config, + $articles + ) + ->willReturn($extractedData); + + $this->hydratorConfigFactory->expects($this->exactly(2)) + ->method('createLeadpageArticleConfig') + ->willReturn($config); + + $this->soapClient->expects($this->once()) + ->method('addArticles') + ->with([ + 'leadpage_id' => $id, + 'articles' => $extractedData + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getObjects') + ->with( + $response, + 'addArticlesResult', + $config + ) + ->willReturn($response->addArticlesResult); + + $this->assertContainsOnlyInstancesOf( + LeadpageArticleInterface::class, + $this->subject->addArticles($id, $articles) + ); + } + + public function testGetArticlesByLeadpageIdCallsAndReturnsArticles(): void + { + $id = 123; + + $config = $this->createMock(HydratorConfigInterface::class); + $object = $this->createMock(LeadpageArticleInterface::class); + + $response = new stdClass(); + $response->getArticlesResult = [ + $object, + ]; + + $this->hydratorConfigFactory->expects($this->once()) + ->method('createLeadpageArticleConfig') + ->willReturn($config); + + $this->soapClient->expects($this->once()) + ->method('getArticles') + ->with([ + 'leadpage_id' => $id, + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getObjects') + ->with( + $response, + 'getArticlesResult', + $config + ) + ->willReturn($response->getArticlesResult); + + $this->assertContainsOnlyInstancesOf( + LeadpageArticleInterface::class, + $this->subject->getArticlesByLeadpageId($id) + ); + } } diff --git a/tests/Client/LeadPageTemplate/LeadpageTemplateClientTest.php b/tests/Client/LeadPageTemplate/LeadpageTemplateClientTest.php index 599f92a..6c133ba 100644 --- a/tests/Client/LeadPageTemplate/LeadpageTemplateClientTest.php +++ b/tests/Client/LeadPageTemplate/LeadpageTemplateClientTest.php @@ -12,6 +12,7 @@ use Scn\EvalancheSoapApiConnector\Hydrator\Config\HydratorConfigInterface; use Scn\EvalancheSoapApiConnector\Mapper\ResponseMapperInterface; use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticleInterface; use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\LeadpageTemplateConfigurationInterface; use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSourcesInterface; use \stdClass; @@ -56,6 +57,10 @@ public function setUp(): void 'setConfiguration', 'setSources', 'getSources', + 'removeAllArticles', + 'removeArticles', + 'getArticles', + 'addArticles', ]); $this->responseMapper = $this->createMock(ResponseMapperInterface::class); $this->hydratorConfigFactory = $this->createMock(HydratorConfigFactoryInterface::class); @@ -286,4 +291,159 @@ public function testGetConfigurationCanReturnInstanceOfLeadpageTemplateConfigura $this->subject->getConfiguration($id), ); } + + public function testRemoveAllArticlesCalls(): void + { + $id = 23; + + $response = new stdClass(); + $response->removeAllArticleResult = true; + + $this->soapClient->expects($this->once()) + ->method('removeAllArticles') + ->with([ + 'leadpage_template_id' => $id + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getBoolean') + ->with( + $response, + 'removeAllArticlesResult' + ) + ->willReturn($response->removeAllArticleResult); + + + static::assertTrue( + $this->subject->removeAllArticles($id) + ); + } + + public function testRemoveArticlesCalls(): void + { + $id = 23; + $referenceIds = [42, 666]; + $response = new stdClass(); + $result = ['some-result']; + + $config = $this->createMock(HydratorConfigInterface::class); + + $this->soapClient->expects($this->once()) + ->method('removeArticles') + ->with([ + 'leadpage_template_id' => $id, + 'reference_ids' => $referenceIds, + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getObjects') + ->with( + $response, + 'removeArticlesResult', + $config, + ) + ->willReturn($result); + + $this->hydratorConfigFactory->expects(static::once()) + ->method('createLeadpageArticleConfig') + ->willReturn($config); + + static::assertSame( + $result, + $this->subject->removeArticles($id, $referenceIds) + ); + } + + public function testAddArticlesCalls(): void + { + $id = 1234; + $articles = [ + $this->createMock(LeadpageArticleInterface::class), + ]; + + $config = $this->createMock(HydratorConfigInterface::class); + + $response = new stdClass(); + $response->addArticlesResult = $articles; + + $extractedData = [ + [ + 'some' => 'data' + ], + ]; + + $this->extractor->expects($this->once()) + ->method('extractArray') + ->with( + $config, + $articles + ) + ->willReturn($extractedData); + + $this->hydratorConfigFactory->expects($this->exactly(2)) + ->method('createLeadpageArticleConfig') + ->willReturn($config); + + $this->soapClient->expects($this->once()) + ->method('addArticles') + ->with([ + 'leadpage_template_id' => $id, + 'articles' => $extractedData + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getObjects') + ->with( + $response, + 'addArticlesResult', + $config + ) + ->willReturn($response->addArticlesResult); + + $this->assertContainsOnlyInstancesOf( + LeadpageArticleInterface::class, + $this->subject->addArticles($id, $articles) + ); + } + + public function testGetArticlesByLeadpageTemplateIdCallsAndReturnsArticles(): void + { + $id = 123; + + $config = $this->createMock(HydratorConfigInterface::class); + $object = $this->createMock(LeadpageArticleInterface::class); + + $response = new stdClass(); + $response->getArticlesResult = [ + $object, + ]; + + $this->hydratorConfigFactory->expects($this->once()) + ->method('createLeadpageArticleConfig') + ->willReturn($config); + + $this->soapClient->expects($this->once()) + ->method('getArticles') + ->with([ + 'leadpage_template_id' => $id, + ]) + ->willReturn($response); + + $this->responseMapper->expects($this->once()) + ->method('getObjects') + ->with( + $response, + 'getArticlesResult', + $config + ) + ->willReturn($response->getArticlesResult); + + $this->assertContainsOnlyInstancesOf( + LeadpageArticleInterface::class, + $this->subject->getArticlesByLeadpageTemplateId($id) + ); + } } diff --git a/tests/Hydrator/Config/HydratorConfigFactoryTest.php b/tests/Hydrator/Config/HydratorConfigFactoryTest.php index c757919..e987bd9 100644 --- a/tests/Hydrator/Config/HydratorConfigFactoryTest.php +++ b/tests/Hydrator/Config/HydratorConfigFactoryTest.php @@ -25,6 +25,7 @@ use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ResourceInformationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ResourceTypeInformationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ServiceStatusConfig; +use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage\LeadpageArticleConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage\LeadpageConfigurationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadpageTemplate\LeadpageTemplateConfigurationConfig; use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPageTemplate\LeadpageTemplateSourcesConfig; @@ -129,6 +130,7 @@ public static function factoryDataProvider() ['createTargetGroupMemberShipConfig', TargetGroupMemberShipConfig::class], ['createMassUpdateResultConfig', MassUpdateResultConfig::class], ['createMailingArticleConfig', MailingArticleConfig::class], + ['createLeadpageArticleConfig', LeadpageArticleConfig::class], ['createMailingDetailConfig', MailingDetailConfig::class], ['createMailingClickConfig', MailingClickConfig::class], ['createMailingConfigurationConfig', MailingConfigurationConfig::class], diff --git a/tests/Hydrator/Config/LeadPage/LeadpageArticleConfigTest.php b/tests/Hydrator/Config/LeadPage/LeadpageArticleConfigTest.php new file mode 100644 index 0000000..6977ed8 --- /dev/null +++ b/tests/Hydrator/Config/LeadPage/LeadpageArticleConfigTest.php @@ -0,0 +1,56 @@ + */ + private array $arrayKeys = [ + 'id', + 'article_id', + 'targetgroup_id', + 'landingpage_preset_id', + 'mobile_preset_id', + 'sort_pos', + 'slot', + ]; + + public function setUp(): void + { + $this->subject = new LeadpageArticleConfig(); + } + + public function testGetObjectCanReturnInstanceOfUser(): void + { + self::assertInstanceOf( + LeadpageArticleInterface::class, + $this->subject->getObject() + ); + } + + public function testGetHydratorPropertiesCanReturnArray(): void + { + foreach ($this->arrayKeys as $arrayKey) { + self::assertArrayHasKey($arrayKey, $this->subject->getHydratorProperties()); + } + } + + public function testGetExtractorPropertiesCanReturnArray(): void + { + foreach ($this->arrayKeys as $arrayKey) { + self::assertArrayHasKey($arrayKey, $this->subject->getExtractorProperties()); + } + } +}