diff --git a/composer.lock b/composer.lock index 116f766..1361b56 100644 --- a/composer.lock +++ b/composer.lock @@ -260,16 +260,16 @@ }, { "name": "doctrine/dbal", - "version": "3.3.6", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21" + "reference": "118a360e9437e88d49024f36283c8bcbd76105f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/9e7f76dd1cde81c62574fdffa5a9c655c847ad21", - "reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/118a360e9437e88d49024f36283c8bcbd76105f5", + "reference": "118a360e9437e88d49024f36283c8bcbd76105f5", "shasum": "" }, "require": { @@ -277,21 +277,21 @@ "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1.0", - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "psr/cache": "^1|^2|^3", "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "9.0.0", "jetbrains/phpstorm-stubs": "2022.1", - "phpstan/phpstan": "1.6.3", - "phpstan/phpstan-strict-rules": "^1.2", - "phpunit/phpunit": "9.5.20", - "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.2", - "symfony/cache": "^5.2|^6.0", - "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.23.0" + "phpstan/phpstan": "1.8.2", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "9.5.21", + "psalm/plugin-phpunit": "0.17.0", + "squizlabs/php_codesniffer": "3.7.1", + "symfony/cache": "^5.4|^6.0", + "symfony/console": "^4.4|^5.4|^6.0", + "vimeo/psalm": "4.24.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -351,7 +351,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.3.6" + "source": "https://github.com/doctrine/dbal/tree/3.4.0" }, "funding": [ { @@ -367,7 +367,7 @@ "type": "tidelift" } ], - "time": "2022-05-02T17:21:01+00:00" + "time": "2022-08-06T20:35:57+00:00" }, { "name": "doctrine/deprecations", @@ -414,34 +414,31 @@ }, { "name": "doctrine/event-manager", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/eb2ecf80e3093e8f3c2769ac838e27d8ede8e683", + "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { - "doctrine/common": "<2.9@dev" + "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpunit/phpunit": "^7.0" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "~1.4.10 || ^1.5.4", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\": "lib/Doctrine/Common" @@ -488,7 +485,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + "source": "https://github.com/doctrine/event-manager/tree/1.1.2" }, "funding": [ { @@ -504,7 +501,7 @@ "type": "tidelift" } ], - "time": "2020-05-29T18:28:51+00:00" + "time": "2022-07-27T22:18:11+00:00" }, { "name": "doctrine/inflector", @@ -745,16 +742,16 @@ }, { "name": "doctrine/orm", - "version": "2.12.2", + "version": "2.13.1", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "8291a7f09b12d14783ed6537b4586583d155869e" + "reference": "35c44a56677adb3ce796138b6e4934ce93ec6811" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/8291a7f09b12d14783ed6537b4586583d155869e", - "reference": "8291a7f09b12d14783ed6537b4586583d155869e", + "url": "https://api.github.com/repos/doctrine/orm/zipball/35c44a56677adb3ce796138b6e4934ce93ec6811", + "reference": "35c44a56677adb3ce796138b6e4934ce93ec6811", "shasum": "" }, "require": { @@ -783,15 +780,16 @@ "doctrine/annotations": "^1.13", "doctrine/coding-standard": "^9.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.6.3", + "phpstan/phpstan": "~1.4.10 || 1.8.2", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "psr/log": "^1 || ^2 || ^3", - "squizlabs/php_codesniffer": "3.6.2", + "squizlabs/php_codesniffer": "3.7.1", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.23.0" + "vimeo/psalm": "4.26.0" }, "suggest": { + "ext-dom": "Provides support for XSD validation for XML mapping files", "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" }, @@ -838,26 +836,25 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.12.2" + "source": "https://github.com/doctrine/orm/tree/2.13.1" }, - "time": "2022-05-02T19:10:07+00:00" + "time": "2022-08-08T09:00:16+00:00" }, { "name": "doctrine/persistence", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "25ec98a8cbd1f850e60fdb62c0ef77c162da8704" + "reference": "ac6fce61f037d7e54dbb2435f5b5648d86548e23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/25ec98a8cbd1f850e60fdb62c0ef77c162da8704", - "reference": "25ec98a8cbd1f850e60fdb62c0ef77c162da8704", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/ac6fce61f037d7e54dbb2435f5b5648d86548e23", + "reference": "ac6fce61f037d7e54dbb2435f5b5648d86548e23", "shasum": "" }, "require": { - "doctrine/collections": "^1.0", "doctrine/event-manager": "^1.0", "php": "^7.2 || ^8.0", "psr/cache": "^1.0 || ^2.0 || ^3.0" @@ -925,7 +922,7 @@ ], "support": { "issues": "https://github.com/doctrine/persistence/issues", - "source": "https://github.com/doctrine/persistence/tree/3.0.2" + "source": "https://github.com/doctrine/persistence/tree/3.0.3" }, "funding": [ { @@ -941,7 +938,7 @@ "type": "tidelift" } ], - "time": "2022-05-06T06:10:05+00:00" + "time": "2022-08-04T21:14:21+00:00" }, { "name": "psr/cache", @@ -1092,16 +1089,16 @@ }, { "name": "symfony/console", - "version": "v5.4.9", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb" + "reference": "535846c7ee6bc4dd027ca0d93220601456734b10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/829d5d1bf60b2efeb0887b7436873becc71a45eb", - "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb", + "url": "https://api.github.com/repos/symfony/console/zipball/535846c7ee6bc4dd027ca0d93220601456734b10", + "reference": "535846c7ee6bc4dd027ca0d93220601456734b10", "shasum": "" }, "require": { @@ -1171,7 +1168,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.9" + "source": "https://github.com/symfony/console/tree/v5.4.11" }, "funding": [ { @@ -1187,11 +1184,11 @@ "type": "tidelift" } ], - "time": "2022-05-18T06:17:34+00:00" + "time": "2022-07-22T10:42:43+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -1238,7 +1235,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -1826,16 +1823,16 @@ }, { "name": "symfony/service-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { @@ -1889,7 +1886,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -1905,20 +1902,20 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:07:29+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/string", - "version": "v5.4.9", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99" + "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", - "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "url": "https://api.github.com/repos/symfony/string/zipball/5eb661e49ad389e4ae2b6e4df8d783a8a6548322", + "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322", "shasum": "" }, "require": { @@ -1975,7 +1972,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.9" + "source": "https://github.com/symfony/string/tree/v5.4.11" }, "funding": [ { @@ -1991,7 +1988,7 @@ "type": "tidelift" } ], - "time": "2022-04-19T10:40:37+00:00" + "time": "2022-07-24T16:15:25+00:00" } ], "packages-dev": [ @@ -2768,16 +2765,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.20", + "version": "9.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", "shasum": "" }, "require": { @@ -2811,7 +2808,6 @@ "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*", "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { @@ -2855,7 +2851,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" }, "funding": [ { @@ -2867,7 +2863,7 @@ "type": "github" } ], - "time": "2022-04-01T12:37:26+00:00" + "time": "2022-06-19T12:14:25+00:00" }, { "name": "sebastian/cli-parser", diff --git a/src/Article.php b/src/Article.php index b37eb35..23eae3e 100644 --- a/src/Article.php +++ b/src/Article.php @@ -1,6 +1,7 @@ options = new \ArrayIterator(); + $this->displayGroups = new \ArrayIterator(); $this->preCalc = new PreCalc(); $this->setName($name); } @@ -37,6 +42,16 @@ class Article $this->options->append($option); } + public function addDisplayGroup(DisplayGroup $var): void + { + $this->displayGroups->append($var); + } + + public function getDisplayGroups(): ArrayIterator + { + return $this->displayGroups; + } + /** * @param $params \Array */ diff --git a/src/DisplayGroup.php b/src/DisplayGroup.php new file mode 100644 index 0000000..1dad2c2 --- /dev/null +++ b/src/DisplayGroup.php @@ -0,0 +1,25 @@ +id = $id; + $this->name = $name; + } + + public function getId(): string + { + return $this->id; + } + + public function getName(): string + { + return $this->name; + } +} \ No newline at end of file diff --git a/src/Option/Parser/Base.php b/src/Option/Parser/Base.php index 89012cb..210cd31 100644 --- a/src/Option/Parser/Base.php +++ b/src/Option/Parser/Base.php @@ -40,6 +40,9 @@ class Base if(isset($this->node['amount']) && (string)$this->node['amount'] == 0) { $this->element->setAmount(false); } + if(isset($this->node['display_group']) && (string)$this->node['display_group'] != "") { + $this->element->setDisplayGroup((string)$this->node['display_group']); + } } diff --git a/src/Option/Type/Base.php b/src/Option/Type/Base.php index 535a0a7..8a64959 100644 --- a/src/Option/Type/Base.php +++ b/src/Option/Type/Base.php @@ -33,6 +33,8 @@ class Base /** @var string $value */ protected $value = ''; + protected string $displayGroup = ''; + /** @var EdgeCollectionContainer */ protected $edgesCollectionContainer = null; @@ -90,6 +92,16 @@ class Base return $this->type; } + public function setDisplayGroup(string $var): void + { + $this->displayGroup = $var; + } + + public function getDisplayGroup(): string + { + return $this->displayGroup; + } + /** * @param string $type */ diff --git a/src/Parser.php b/src/Parser.php index 0aa2c9d..4d7e188 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -38,6 +38,13 @@ class Parser $this->article->setPreCalc($parser->parse()); } + if(isset($node->displaygroups)) { + + foreach($node->displaygroups->group as $group) { + $this->article->addDisplayGroup(new DisplayGroup((string)$group['id'], (string)$group['name'])); + } + } + foreach ($node->option as $option) { $obj = $optionParser->getOptByType($option); if($obj) { diff --git a/tests/General/DisplayGroupTest.php b/tests/General/DisplayGroupTest.php new file mode 100644 index 0000000..70b8062 --- /dev/null +++ b/tests/General/DisplayGroupTest.php @@ -0,0 +1,49 @@ +parse(simplexml_load_string(file_get_contents(__DIR__ . '/../TestFiles/Complex/papierContainer.xml'))); + + $this->engine = new Engine(); + $this->engine->setPaperContainer($paperContainer); + $this->engine->setPaperRepository($repository); + + $this->engine->loadString(file_get_contents(__DIR__ .'/../TestFiles/SampleArticle/article1.xml')); + + } + + public function tearDown(): void + { + $this->engine = null; + } + + public function testDisplayGroup() + { + + $article = $this->engine->getArticle(); + + $this->assertEquals(2, $article->getDisplayGroups()->count()); + + $group = $article->getDisplayGroups()[0]; + + $this->assertEquals("1", $group->getId()); + + $this->assertEquals("2", $article->getOptionById("produktion")->getDisplayGroup()); + } + +} diff --git a/tests/TestFiles/SampleArticle/article1.xml b/tests/TestFiles/SampleArticle/article1.xml index 5b6f623..7b0c4f6 100644 --- a/tests/TestFiles/SampleArticle/article1.xml +++ b/tests/TestFiles/SampleArticle/article1.xml @@ -10,6 +10,11 @@ + + + + + - + - - - + // Ab hier Gewichtsberechnung