Update VENDOR : remove useless
This commit is contained in:
parent
fd21804f21
commit
0c0a1113e1
108 changed files with 192 additions and 14803 deletions
|
|
@ -2,9 +2,10 @@
|
||||||
"require": {
|
"require": {
|
||||||
"horstoeko/zugferd": "^1.0",
|
"horstoeko/zugferd": "^1.0",
|
||||||
"zetacomponents/mail": "^1.10",
|
"zetacomponents/mail": "^1.10",
|
||||||
"num-num/ubl-invoice": "^1.21",
|
|
||||||
"php-curl-class/php-curl-class": "^12.0",
|
"php-curl-class/php-curl-class": "^12.0",
|
||||||
"chillerlan/php-authenticator": "^5.2",
|
"chillerlan/php-authenticator": "^5.2",
|
||||||
"endroid/qr-code": "^6.0"
|
"endroid/qr-code": "^6.0",
|
||||||
|
"smalot/pdfparser": "^2.12",
|
||||||
|
"atgp/factur-x": "^2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
275
composer.lock
generated
275
composer.lock
generated
|
|
@ -4,8 +4,68 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "03e0b831d2d0674eac8b1d9fb8f1a615",
|
"content-hash": "68f9e79352fa7a801c4e3e4382827005",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "atgp/factur-x",
|
||||||
|
"version": "v2.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/atgp/factur-x.git",
|
||||||
|
"reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/atgp/factur-x/zipball/0edbe1e935c3f81dcf3e306b2ce5876bf715bea1",
|
||||||
|
"reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"ext-zlib": "*",
|
||||||
|
"php": ">=7.4",
|
||||||
|
"setasign/fpdf": "^1.8",
|
||||||
|
"setasign/fpdi": "^2.0",
|
||||||
|
"smalot/pdfparser": "^0.19.0|~1.0|~2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "~3.1",
|
||||||
|
"phpstan/phpstan": "^2.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Atgp\\FacturX\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "@GP",
|
||||||
|
"homepage": "https://www.atgp.net/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files",
|
||||||
|
"keywords": [
|
||||||
|
"ZUGFeRD",
|
||||||
|
"factur-x",
|
||||||
|
"invoice",
|
||||||
|
"pdf",
|
||||||
|
"php",
|
||||||
|
"xml"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/atgp/factur-x/issues",
|
||||||
|
"source": "https://github.com/atgp/factur-x/tree/v2.4.0"
|
||||||
|
},
|
||||||
|
"time": "2025-09-24T13:02:08+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
"version": "v3.0.1",
|
"version": "v3.0.1",
|
||||||
|
|
@ -887,78 +947,6 @@
|
||||||
],
|
],
|
||||||
"time": "2025-05-26T15:55:41+00:00"
|
"time": "2025-05-26T15:55:41+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "num-num/ubl-invoice",
|
|
||||||
"version": "v1.21.2",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/num-num/ubl-invoice.git",
|
|
||||||
"reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/num-num/ubl-invoice/zipball/195712b3071e23c5aaa6fe95cb9e2de55c3d1348",
|
|
||||||
"reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^7.3 || ^8.0",
|
|
||||||
"sabre/xml": "^4.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpstan/phpstan": "^1.10",
|
|
||||||
"phpunit/phpunit": "^9.0",
|
|
||||||
"squizlabs/php_codesniffer": "^3.7"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"NumNum\\UBL\\": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"NumNum\\UBL\\Tests\\": [
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Bert Devriese",
|
|
||||||
"email": "bert@numnum.be",
|
|
||||||
"homepage": "https://www.numnum.be",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files",
|
|
||||||
"homepage": "https://github.com/num-num/ubl-invoice",
|
|
||||||
"keywords": [
|
|
||||||
"E-Invoice",
|
|
||||||
"digital invoice",
|
|
||||||
"efff",
|
|
||||||
"einvoice",
|
|
||||||
"electronic invoice",
|
|
||||||
"euinvoice",
|
|
||||||
"invoice",
|
|
||||||
"peppol",
|
|
||||||
"peppol bis",
|
|
||||||
"peppol invoice",
|
|
||||||
"peppolbis",
|
|
||||||
"ubl",
|
|
||||||
"ubl invoice",
|
|
||||||
"ublinvoice",
|
|
||||||
"xml",
|
|
||||||
"xml invoice"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/num-num/ubl-invoice/issues",
|
|
||||||
"source": "https://github.com/num-num/ubl-invoice/tree/v1.21.2"
|
|
||||||
},
|
|
||||||
"time": "2025-07-01T11:58:25+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "paragonie/constant_time_encoding",
|
"name": "paragonie/constant_time_encoding",
|
||||||
"version": "v3.0.0",
|
"version": "v3.0.0",
|
||||||
|
|
@ -1153,135 +1141,6 @@
|
||||||
},
|
},
|
||||||
"time": "2025-07-13T07:04:09+00:00"
|
"time": "2025-07-13T07:04:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "sabre/uri",
|
|
||||||
"version": "3.0.2",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/sabre-io/uri.git",
|
|
||||||
"reference": "38eeab6ed9eec435a2188db489d4649c56272c51"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/sabre-io/uri/zipball/38eeab6ed9eec435a2188db489d4649c56272c51",
|
|
||||||
"reference": "38eeab6ed9eec435a2188db489d4649c56272c51",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^7.4 || ^8.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.64",
|
|
||||||
"phpstan/extension-installer": "^1.4",
|
|
||||||
"phpstan/phpstan": "^1.12",
|
|
||||||
"phpstan/phpstan-phpunit": "^1.4",
|
|
||||||
"phpstan/phpstan-strict-rules": "^1.6",
|
|
||||||
"phpunit/phpunit": "^9.6"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"lib/functions.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
|
||||||
"Sabre\\Uri\\": "lib/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"BSD-3-Clause"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Evert Pot",
|
|
||||||
"email": "me@evertpot.com",
|
|
||||||
"homepage": "http://evertpot.com/",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Functions for making sense out of URIs.",
|
|
||||||
"homepage": "http://sabre.io/uri/",
|
|
||||||
"keywords": [
|
|
||||||
"rfc3986",
|
|
||||||
"uri",
|
|
||||||
"url"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"forum": "https://groups.google.com/group/sabredav-discuss",
|
|
||||||
"issues": "https://github.com/sabre-io/uri/issues",
|
|
||||||
"source": "https://github.com/fruux/sabre-uri"
|
|
||||||
},
|
|
||||||
"time": "2024-09-04T15:30:08+00:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sabre/xml",
|
|
||||||
"version": "4.0.6",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/sabre-io/xml.git",
|
|
||||||
"reference": "a89257fd188ce30e456b841b6915f27905dfdbe3"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/sabre-io/xml/zipball/a89257fd188ce30e456b841b6915f27905dfdbe3",
|
|
||||||
"reference": "a89257fd188ce30e456b841b6915f27905dfdbe3",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"ext-dom": "*",
|
|
||||||
"ext-xmlreader": "*",
|
|
||||||
"ext-xmlwriter": "*",
|
|
||||||
"lib-libxml": ">=2.6.20",
|
|
||||||
"php": "^7.4 || ^8.0",
|
|
||||||
"sabre/uri": ">=2.0,<4.0.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.64",
|
|
||||||
"phpstan/phpstan": "^1.12",
|
|
||||||
"phpunit/phpunit": "^9.6"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"lib/Deserializer/functions.php",
|
|
||||||
"lib/Serializer/functions.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
|
||||||
"Sabre\\Xml\\": "lib/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"BSD-3-Clause"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Evert Pot",
|
|
||||||
"email": "me@evertpot.com",
|
|
||||||
"homepage": "http://evertpot.com/",
|
|
||||||
"role": "Developer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Markus Staab",
|
|
||||||
"email": "markus.staab@redaxo.de",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "sabre/xml is an XML library that you may not hate.",
|
|
||||||
"homepage": "https://sabre.io/xml/",
|
|
||||||
"keywords": [
|
|
||||||
"XMLReader",
|
|
||||||
"XMLWriter",
|
|
||||||
"dom",
|
|
||||||
"xml"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"forum": "https://groups.google.com/group/sabredav-discuss",
|
|
||||||
"issues": "https://github.com/sabre-io/xml/issues",
|
|
||||||
"source": "https://github.com/fruux/sabre-xml"
|
|
||||||
},
|
|
||||||
"time": "2024-09-06T08:00:55+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setasign/fpdf",
|
"name": "setasign/fpdf",
|
||||||
"version": "1.8.6",
|
"version": "1.8.6",
|
||||||
|
|
@ -1402,16 +1261,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "smalot/pdfparser",
|
"name": "smalot/pdfparser",
|
||||||
"version": "v2.12.0",
|
"version": "v2.12.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/smalot/pdfparser.git",
|
"url": "https://github.com/smalot/pdfparser.git",
|
||||||
"reference": "8440edbf58c8596074e78ada38dcb0bd041a5948"
|
"reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/8440edbf58c8596074e78ada38dcb0bd041a5948",
|
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/98d31ba34ef5b5a98897ef4b6c3925d502ea53b1",
|
||||||
"reference": "8440edbf58c8596074e78ada38dcb0bd041a5948",
|
"reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -1447,9 +1306,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/smalot/pdfparser/issues",
|
"issues": "https://github.com/smalot/pdfparser/issues",
|
||||||
"source": "https://github.com/smalot/pdfparser/tree/v2.12.0"
|
"source": "https://github.com/smalot/pdfparser/tree/v2.12.1"
|
||||||
},
|
},
|
||||||
"time": "2025-03-31T13:16:09+00:00"
|
"time": "2025-07-31T06:19:56+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/deprecation-contracts",
|
"name": "symfony/deprecation-contracts",
|
||||||
|
|
|
||||||
3
vendor/composer/autoload_files.php
vendored
3
vendor/composer/autoload_files.php
vendored
|
|
@ -9,8 +9,5 @@ return array(
|
||||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||||
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
||||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||||
'383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php',
|
|
||||||
'662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php',
|
'662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php',
|
||||||
'3569eecfeed3bcf0bad3c998a494ecb8' => $vendorDir . '/sabre/xml/lib/Deserializer/functions.php',
|
|
||||||
'93aa591bc4ca510c520999e34229ee79' => $vendorDir . '/sabre/xml/lib/Serializer/functions.php',
|
|
||||||
);
|
);
|
||||||
|
|
|
||||||
5
vendor/composer/autoload_psr4.php
vendored
5
vendor/composer/autoload_psr4.php
vendored
|
|
@ -20,12 +20,8 @@ return array(
|
||||||
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),
|
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),
|
||||||
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
|
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
|
||||||
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
|
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
|
||||||
'Sabre\\Xml\\' => array($vendorDir . '/sabre/xml/lib'),
|
|
||||||
'Sabre\\Uri\\' => array($vendorDir . '/sabre/uri/lib'),
|
|
||||||
'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'),
|
'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'),
|
||||||
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
|
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
|
||||||
'NumNum\\UBL\\Tests\\' => array($vendorDir . '/num-num/ubl-invoice/tests'),
|
|
||||||
'NumNum\\UBL\\' => array($vendorDir . '/num-num/ubl-invoice/src'),
|
|
||||||
'Metadata\\' => array($vendorDir . '/jms/metadata/src'),
|
'Metadata\\' => array($vendorDir . '/jms/metadata/src'),
|
||||||
'JMS\\Serializer\\' => array($vendorDir . '/jms/serializer/src'),
|
'JMS\\Serializer\\' => array($vendorDir . '/jms/serializer/src'),
|
||||||
'GoetasWebservices\\Xsd\\XsdToPhpRuntime\\' => array($vendorDir . '/goetas-webservices/xsd2php-runtime/src'),
|
'GoetasWebservices\\Xsd\\XsdToPhpRuntime\\' => array($vendorDir . '/goetas-webservices/xsd2php-runtime/src'),
|
||||||
|
|
@ -35,4 +31,5 @@ return array(
|
||||||
'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'),
|
'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'),
|
||||||
'Curl\\' => array($vendorDir . '/php-curl-class/php-curl-class/src/Curl'),
|
'Curl\\' => array($vendorDir . '/php-curl-class/php-curl-class/src/Curl'),
|
||||||
'BaconQrCode\\' => array($vendorDir . '/bacon/bacon-qr-code/src'),
|
'BaconQrCode\\' => array($vendorDir . '/bacon/bacon-qr-code/src'),
|
||||||
|
'Atgp\\FacturX\\' => array($vendorDir . '/atgp/factur-x/src'),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
34
vendor/composer/autoload_static.php
vendored
34
vendor/composer/autoload_static.php
vendored
|
|
@ -10,10 +10,7 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
|
||||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||||
'383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php',
|
|
||||||
'662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php',
|
'662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php',
|
||||||
'3569eecfeed3bcf0bad3c998a494ecb8' => __DIR__ . '/..' . '/sabre/xml/lib/Deserializer/functions.php',
|
|
||||||
'93aa591bc4ca510c520999e34229ee79' => __DIR__ . '/..' . '/sabre/xml/lib/Serializer/functions.php',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $prefixLengthsPsr4 = array (
|
public static $prefixLengthsPsr4 = array (
|
||||||
|
|
@ -42,19 +39,12 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
|
||||||
'Symfony\\Component\\Validator\\' => 28,
|
'Symfony\\Component\\Validator\\' => 28,
|
||||||
'Symfony\\Component\\Process\\' => 26,
|
'Symfony\\Component\\Process\\' => 26,
|
||||||
'Symfony\\Component\\Finder\\' => 25,
|
'Symfony\\Component\\Finder\\' => 25,
|
||||||
'Sabre\\Xml\\' => 10,
|
|
||||||
'Sabre\\Uri\\' => 10,
|
|
||||||
),
|
),
|
||||||
'P' =>
|
'P' =>
|
||||||
array (
|
array (
|
||||||
'ParagonIE\\ConstantTime\\' => 23,
|
'ParagonIE\\ConstantTime\\' => 23,
|
||||||
'PHPStan\\PhpDocParser\\' => 21,
|
'PHPStan\\PhpDocParser\\' => 21,
|
||||||
),
|
),
|
||||||
'N' =>
|
|
||||||
array (
|
|
||||||
'NumNum\\UBL\\Tests\\' => 17,
|
|
||||||
'NumNum\\UBL\\' => 11,
|
|
||||||
),
|
|
||||||
'M' =>
|
'M' =>
|
||||||
array (
|
array (
|
||||||
'Metadata\\' => 9,
|
'Metadata\\' => 9,
|
||||||
|
|
@ -85,6 +75,10 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
|
||||||
array (
|
array (
|
||||||
'BaconQrCode\\' => 12,
|
'BaconQrCode\\' => 12,
|
||||||
),
|
),
|
||||||
|
'A' =>
|
||||||
|
array (
|
||||||
|
'Atgp\\FacturX\\' => 13,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $prefixDirsPsr4 = array (
|
public static $prefixDirsPsr4 = array (
|
||||||
|
|
@ -144,14 +138,6 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/symfony/finder',
|
0 => __DIR__ . '/..' . '/symfony/finder',
|
||||||
),
|
),
|
||||||
'Sabre\\Xml\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/sabre/xml/lib',
|
|
||||||
),
|
|
||||||
'Sabre\\Uri\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/sabre/uri/lib',
|
|
||||||
),
|
|
||||||
'ParagonIE\\ConstantTime\\' =>
|
'ParagonIE\\ConstantTime\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src',
|
0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src',
|
||||||
|
|
@ -160,14 +146,6 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
|
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
|
||||||
),
|
),
|
||||||
'NumNum\\UBL\\Tests\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/num-num/ubl-invoice/tests',
|
|
||||||
),
|
|
||||||
'NumNum\\UBL\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/num-num/ubl-invoice/src',
|
|
||||||
),
|
|
||||||
'Metadata\\' =>
|
'Metadata\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/jms/metadata/src',
|
0 => __DIR__ . '/..' . '/jms/metadata/src',
|
||||||
|
|
@ -204,6 +182,10 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src',
|
0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src',
|
||||||
),
|
),
|
||||||
|
'Atgp\\FacturX\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/atgp/factur-x/src',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $prefixesPsr0 = array (
|
public static $prefixesPsr0 = array (
|
||||||
|
|
|
||||||
287
vendor/composer/installed.json
vendored
287
vendor/composer/installed.json
vendored
|
|
@ -1,5 +1,68 @@
|
||||||
{
|
{
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "atgp/factur-x",
|
||||||
|
"version": "v2.4.0",
|
||||||
|
"version_normalized": "2.4.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/atgp/factur-x.git",
|
||||||
|
"reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/atgp/factur-x/zipball/0edbe1e935c3f81dcf3e306b2ce5876bf715bea1",
|
||||||
|
"reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"ext-zlib": "*",
|
||||||
|
"php": ">=7.4",
|
||||||
|
"setasign/fpdf": "^1.8",
|
||||||
|
"setasign/fpdi": "^2.0",
|
||||||
|
"smalot/pdfparser": "^0.19.0|~1.0|~2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "~3.1",
|
||||||
|
"phpstan/phpstan": "^2.0"
|
||||||
|
},
|
||||||
|
"time": "2025-09-24T13:02:08+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Atgp\\FacturX\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "@GP",
|
||||||
|
"homepage": "https://www.atgp.net/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files",
|
||||||
|
"keywords": [
|
||||||
|
"ZUGFeRD",
|
||||||
|
"factur-x",
|
||||||
|
"invoice",
|
||||||
|
"pdf",
|
||||||
|
"php",
|
||||||
|
"xml"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/atgp/factur-x/issues",
|
||||||
|
"source": "https://github.com/atgp/factur-x/tree/v2.4.0"
|
||||||
|
},
|
||||||
|
"install-path": "../atgp/factur-x"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
"version": "v3.0.1",
|
"version": "v3.0.1",
|
||||||
|
|
@ -920,81 +983,6 @@
|
||||||
],
|
],
|
||||||
"install-path": "../jms/serializer"
|
"install-path": "../jms/serializer"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "num-num/ubl-invoice",
|
|
||||||
"version": "v1.21.2",
|
|
||||||
"version_normalized": "1.21.2.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/num-num/ubl-invoice.git",
|
|
||||||
"reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/num-num/ubl-invoice/zipball/195712b3071e23c5aaa6fe95cb9e2de55c3d1348",
|
|
||||||
"reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^7.3 || ^8.0",
|
|
||||||
"sabre/xml": "^4.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpstan/phpstan": "^1.10",
|
|
||||||
"phpunit/phpunit": "^9.0",
|
|
||||||
"squizlabs/php_codesniffer": "^3.7"
|
|
||||||
},
|
|
||||||
"time": "2025-07-01T11:58:25+00:00",
|
|
||||||
"type": "library",
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"NumNum\\UBL\\": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"NumNum\\UBL\\Tests\\": [
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Bert Devriese",
|
|
||||||
"email": "bert@numnum.be",
|
|
||||||
"homepage": "https://www.numnum.be",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files",
|
|
||||||
"homepage": "https://github.com/num-num/ubl-invoice",
|
|
||||||
"keywords": [
|
|
||||||
"E-Invoice",
|
|
||||||
"digital invoice",
|
|
||||||
"efff",
|
|
||||||
"einvoice",
|
|
||||||
"electronic invoice",
|
|
||||||
"euinvoice",
|
|
||||||
"invoice",
|
|
||||||
"peppol",
|
|
||||||
"peppol bis",
|
|
||||||
"peppol invoice",
|
|
||||||
"peppolbis",
|
|
||||||
"ubl",
|
|
||||||
"ubl invoice",
|
|
||||||
"ublinvoice",
|
|
||||||
"xml",
|
|
||||||
"xml invoice"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/num-num/ubl-invoice/issues",
|
|
||||||
"source": "https://github.com/num-num/ubl-invoice/tree/v1.21.2"
|
|
||||||
},
|
|
||||||
"install-path": "../num-num/ubl-invoice"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "paragonie/constant_time_encoding",
|
"name": "paragonie/constant_time_encoding",
|
||||||
"version": "v3.0.0",
|
"version": "v3.0.0",
|
||||||
|
|
@ -1198,141 +1186,6 @@
|
||||||
},
|
},
|
||||||
"install-path": "../phpstan/phpdoc-parser"
|
"install-path": "../phpstan/phpdoc-parser"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "sabre/uri",
|
|
||||||
"version": "3.0.2",
|
|
||||||
"version_normalized": "3.0.2.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/sabre-io/uri.git",
|
|
||||||
"reference": "38eeab6ed9eec435a2188db489d4649c56272c51"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/sabre-io/uri/zipball/38eeab6ed9eec435a2188db489d4649c56272c51",
|
|
||||||
"reference": "38eeab6ed9eec435a2188db489d4649c56272c51",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^7.4 || ^8.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.64",
|
|
||||||
"phpstan/extension-installer": "^1.4",
|
|
||||||
"phpstan/phpstan": "^1.12",
|
|
||||||
"phpstan/phpstan-phpunit": "^1.4",
|
|
||||||
"phpstan/phpstan-strict-rules": "^1.6",
|
|
||||||
"phpunit/phpunit": "^9.6"
|
|
||||||
},
|
|
||||||
"time": "2024-09-04T15:30:08+00:00",
|
|
||||||
"type": "library",
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"lib/functions.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
|
||||||
"Sabre\\Uri\\": "lib/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"BSD-3-Clause"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Evert Pot",
|
|
||||||
"email": "me@evertpot.com",
|
|
||||||
"homepage": "http://evertpot.com/",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Functions for making sense out of URIs.",
|
|
||||||
"homepage": "http://sabre.io/uri/",
|
|
||||||
"keywords": [
|
|
||||||
"rfc3986",
|
|
||||||
"uri",
|
|
||||||
"url"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"forum": "https://groups.google.com/group/sabredav-discuss",
|
|
||||||
"issues": "https://github.com/sabre-io/uri/issues",
|
|
||||||
"source": "https://github.com/fruux/sabre-uri"
|
|
||||||
},
|
|
||||||
"install-path": "../sabre/uri"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sabre/xml",
|
|
||||||
"version": "4.0.6",
|
|
||||||
"version_normalized": "4.0.6.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/sabre-io/xml.git",
|
|
||||||
"reference": "a89257fd188ce30e456b841b6915f27905dfdbe3"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/sabre-io/xml/zipball/a89257fd188ce30e456b841b6915f27905dfdbe3",
|
|
||||||
"reference": "a89257fd188ce30e456b841b6915f27905dfdbe3",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"ext-dom": "*",
|
|
||||||
"ext-xmlreader": "*",
|
|
||||||
"ext-xmlwriter": "*",
|
|
||||||
"lib-libxml": ">=2.6.20",
|
|
||||||
"php": "^7.4 || ^8.0",
|
|
||||||
"sabre/uri": ">=2.0,<4.0.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.64",
|
|
||||||
"phpstan/phpstan": "^1.12",
|
|
||||||
"phpunit/phpunit": "^9.6"
|
|
||||||
},
|
|
||||||
"time": "2024-09-06T08:00:55+00:00",
|
|
||||||
"type": "library",
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"lib/Deserializer/functions.php",
|
|
||||||
"lib/Serializer/functions.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
|
||||||
"Sabre\\Xml\\": "lib/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"BSD-3-Clause"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Evert Pot",
|
|
||||||
"email": "me@evertpot.com",
|
|
||||||
"homepage": "http://evertpot.com/",
|
|
||||||
"role": "Developer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Markus Staab",
|
|
||||||
"email": "markus.staab@redaxo.de",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "sabre/xml is an XML library that you may not hate.",
|
|
||||||
"homepage": "https://sabre.io/xml/",
|
|
||||||
"keywords": [
|
|
||||||
"XMLReader",
|
|
||||||
"XMLWriter",
|
|
||||||
"dom",
|
|
||||||
"xml"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"forum": "https://groups.google.com/group/sabredav-discuss",
|
|
||||||
"issues": "https://github.com/sabre-io/xml/issues",
|
|
||||||
"source": "https://github.com/fruux/sabre-xml"
|
|
||||||
},
|
|
||||||
"install-path": "../sabre/xml"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setasign/fpdf",
|
"name": "setasign/fpdf",
|
||||||
"version": "1.8.6",
|
"version": "1.8.6",
|
||||||
|
|
@ -1459,17 +1312,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "smalot/pdfparser",
|
"name": "smalot/pdfparser",
|
||||||
"version": "v2.12.0",
|
"version": "v2.12.1",
|
||||||
"version_normalized": "2.12.0.0",
|
"version_normalized": "2.12.1.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/smalot/pdfparser.git",
|
"url": "https://github.com/smalot/pdfparser.git",
|
||||||
"reference": "8440edbf58c8596074e78ada38dcb0bd041a5948"
|
"reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/8440edbf58c8596074e78ada38dcb0bd041a5948",
|
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/98d31ba34ef5b5a98897ef4b6c3925d502ea53b1",
|
||||||
"reference": "8440edbf58c8596074e78ada38dcb0bd041a5948",
|
"reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -1478,7 +1331,7 @@
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
"symfony/polyfill-mbstring": "^1.18"
|
"symfony/polyfill-mbstring": "^1.18"
|
||||||
},
|
},
|
||||||
"time": "2025-03-31T13:16:09+00:00",
|
"time": "2025-07-31T06:19:56+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|
@ -1507,7 +1360,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/smalot/pdfparser/issues",
|
"issues": "https://github.com/smalot/pdfparser/issues",
|
||||||
"source": "https://github.com/smalot/pdfparser/tree/v2.12.0"
|
"source": "https://github.com/smalot/pdfparser/tree/v2.12.1"
|
||||||
},
|
},
|
||||||
"install-path": "../smalot/pdfparser"
|
"install-path": "../smalot/pdfparser"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
46
vendor/composer/installed.php
vendored
46
vendor/composer/installed.php
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
'name' => '__root__',
|
'name' => '__root__',
|
||||||
'pretty_version' => 'dev-master',
|
'pretty_version' => 'dev-master',
|
||||||
'version' => 'dev-master',
|
'version' => 'dev-master',
|
||||||
'reference' => '9584a3090ab8e976441fa6e8ab7798db0a361830',
|
'reference' => '86019118eddd8ca179d77922326c82bf3507b3cf',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|
@ -13,12 +13,21 @@
|
||||||
'__root__' => array(
|
'__root__' => array(
|
||||||
'pretty_version' => 'dev-master',
|
'pretty_version' => 'dev-master',
|
||||||
'version' => 'dev-master',
|
'version' => 'dev-master',
|
||||||
'reference' => '9584a3090ab8e976441fa6e8ab7798db0a361830',
|
'reference' => '86019118eddd8ca179d77922326c82bf3507b3cf',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
|
'atgp/factur-x' => array(
|
||||||
|
'pretty_version' => 'v2.4.0',
|
||||||
|
'version' => '2.4.0.0',
|
||||||
|
'reference' => '0edbe1e935c3f81dcf3e306b2ce5876bf715bea1',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../atgp/factur-x',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
'bacon/bacon-qr-code' => array(
|
'bacon/bacon-qr-code' => array(
|
||||||
'pretty_version' => 'v3.0.1',
|
'pretty_version' => 'v3.0.1',
|
||||||
'version' => '3.0.1.0',
|
'version' => '3.0.1.0',
|
||||||
|
|
@ -136,15 +145,6 @@
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'num-num/ubl-invoice' => array(
|
|
||||||
'pretty_version' => 'v1.21.2',
|
|
||||||
'version' => '1.21.2.0',
|
|
||||||
'reference' => '195712b3071e23c5aaa6fe95cb9e2de55c3d1348',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../num-num/ubl-invoice',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev_requirement' => false,
|
|
||||||
),
|
|
||||||
'paragonie/constant_time_encoding' => array(
|
'paragonie/constant_time_encoding' => array(
|
||||||
'pretty_version' => 'v3.0.0',
|
'pretty_version' => 'v3.0.0',
|
||||||
'version' => '3.0.0.0',
|
'version' => '3.0.0.0',
|
||||||
|
|
@ -172,24 +172,6 @@
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'sabre/uri' => array(
|
|
||||||
'pretty_version' => '3.0.2',
|
|
||||||
'version' => '3.0.2.0',
|
|
||||||
'reference' => '38eeab6ed9eec435a2188db489d4649c56272c51',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../sabre/uri',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev_requirement' => false,
|
|
||||||
),
|
|
||||||
'sabre/xml' => array(
|
|
||||||
'pretty_version' => '4.0.6',
|
|
||||||
'version' => '4.0.6.0',
|
|
||||||
'reference' => 'a89257fd188ce30e456b841b6915f27905dfdbe3',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../sabre/xml',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev_requirement' => false,
|
|
||||||
),
|
|
||||||
'setasign/fpdf' => array(
|
'setasign/fpdf' => array(
|
||||||
'pretty_version' => '1.8.6',
|
'pretty_version' => '1.8.6',
|
||||||
'version' => '1.8.6.0',
|
'version' => '1.8.6.0',
|
||||||
|
|
@ -209,9 +191,9 @@
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'smalot/pdfparser' => array(
|
'smalot/pdfparser' => array(
|
||||||
'pretty_version' => 'v2.12.0',
|
'pretty_version' => 'v2.12.1',
|
||||||
'version' => '2.12.0.0',
|
'version' => '2.12.1.0',
|
||||||
'reference' => '8440edbf58c8596074e78ada38dcb0bd041a5948',
|
'reference' => '98d31ba34ef5b5a98897ef4b6c3925d502ea53b1',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../smalot/pdfparser',
|
'install_path' => __DIR__ . '/../smalot/pdfparser',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|
|
||||||
15
vendor/num-num/ubl-invoice/.editorconfig
vendored
15
vendor/num-num/ubl-invoice/.editorconfig
vendored
|
|
@ -1,15 +0,0 @@
|
||||||
; This file is for unifying the coding style for different editors and IDEs.
|
|
||||||
; More information at http://editorconfig.org
|
|
||||||
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_size = 4
|
|
||||||
indent_style = space
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
83
vendor/num-num/ubl-invoice/.gitignore
vendored
83
vendor/num-num/ubl-invoice/.gitignore
vendored
|
|
@ -1,83 +0,0 @@
|
||||||
## Composer
|
|
||||||
.idea
|
|
||||||
composer.phar
|
|
||||||
/vendor/
|
|
||||||
|
|
||||||
|
|
||||||
## Linux
|
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
||||||
.fuse_hidden*
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
|
||||||
.nfs*
|
|
||||||
|
|
||||||
|
|
||||||
## macOS
|
|
||||||
# General
|
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
|
||||||
.LSOverride
|
|
||||||
|
|
||||||
# Icon must end with two \r
|
|
||||||
Icon
|
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
|
||||||
._*
|
|
||||||
|
|
||||||
# Files that might appear in the root of a volume
|
|
||||||
.DocumentRevisions-V100
|
|
||||||
.fseventsd
|
|
||||||
.Spotlight-V100
|
|
||||||
.TemporaryItems
|
|
||||||
.Trashes
|
|
||||||
.VolumeIcon.icns
|
|
||||||
.com.apple.timemachine.donotpresent
|
|
||||||
|
|
||||||
# Directories potentially created on remote AFP share
|
|
||||||
.AppleDB
|
|
||||||
.AppleDesktop
|
|
||||||
Network Trash Folder
|
|
||||||
Temporary Items
|
|
||||||
.apdisk
|
|
||||||
|
|
||||||
|
|
||||||
## Windows
|
|
||||||
# Windows thumbnail cache files
|
|
||||||
Thumbs.db
|
|
||||||
ehthumbs.db
|
|
||||||
ehthumbs_vista.db
|
|
||||||
|
|
||||||
# Dump file
|
|
||||||
*.stackdump
|
|
||||||
|
|
||||||
# Folder config file
|
|
||||||
[Dd]esktop.ini
|
|
||||||
|
|
||||||
# Recycle Bin used on file shares
|
|
||||||
$RECYCLE.BIN/
|
|
||||||
|
|
||||||
# Windows Installer files
|
|
||||||
*.cab
|
|
||||||
*.msi
|
|
||||||
*.msix
|
|
||||||
*.msm
|
|
||||||
*.msp
|
|
||||||
|
|
||||||
# Windows shortcuts
|
|
||||||
*.lnk
|
|
||||||
|
|
||||||
# Generated XML files from tests
|
|
||||||
/tests/*.xml
|
|
||||||
|
|
||||||
# Test cache
|
|
||||||
.phpunit.result.cache
|
|
||||||
|
|
||||||
# Editors
|
|
||||||
.vscode/
|
|
||||||
261
vendor/num-num/ubl-invoice/CHANGELOG.md
vendored
261
vendor/num-num/ubl-invoice/CHANGELOG.md
vendored
|
|
@ -1,261 +0,0 @@
|
||||||
# Changelog for v1.21.2
|
|
||||||
|
|
||||||
#### Bug fixes
|
|
||||||
|
|
||||||
- <cbc:MultiplierFactorNumeric> in AllowanceCharge should not crash when the system uses localized number output
|
|
||||||
- documentTypeCode in AdditionalDocumentReference should not be limited to int values - Thanks [@tgeorgel](https://github.com/tgeorgel)
|
|
||||||
|
|
||||||
# Changelog for v1.21.1
|
|
||||||
|
|
||||||
#### Bug fixes
|
|
||||||
|
|
||||||
- <cac:Price> <cbc:PriceAmount> should not be rounded to zero decimals
|
|
||||||
|
|
||||||
# Changelog for v1.21.0
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add missing ICD Code list. See also https://docs.peppol.eu/poacc/billing/3.0/codelist/ICD/
|
|
||||||
- Make <cac:ClassifiedTaxCategory> <cbc:Percent> optional - Thanks [@chipco](https://github.com/chipco)
|
|
||||||
- Add <cac:AccountingContact> to <Invoice> - Thanks [@tgeorgel](https://github.com/tgeorgel)
|
|
||||||
- Add <cbc:ID> to <cac:Contact> - Thanks [@tgeorgel](https://github.com/tgeorgel)
|
|
||||||
- Allow both <cbc:DocumentTypeCode> and <cbc:DocumentType> to be present in <cac:AdditionalDocumentReference> - Thanks [@tgeorgel](https://github.com/tgeorgel)
|
|
||||||
|
|
||||||
# Changelog for v1.20.0
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- General change: don't round numbers to two decimals, always use the amount of provided decimals
|
|
||||||
|
|
||||||
# Changelog for v1.19.1
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cbc:PayableRoundingAmount />` to `<cac:LegalMonetaryTotal>` - Thanks [@ronaldsgailis](https://github.com/ronaldsgailis)
|
|
||||||
|
|
||||||
# Changelog for v1.19.0
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cac:CommodityClassification />` to `<cac:Item>`
|
|
||||||
-
|
|
||||||
# Changelog for v1.18.2
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cac:ProjectReference />` to `<Invoice>`
|
|
||||||
|
|
||||||
#### Bug fixes
|
|
||||||
|
|
||||||
- Fix Amount, BaseAmount, TaxCategory tag sort in `<cac:AllowanceCharge />`
|
|
||||||
- Fix parameter type for `<cac:AllowanceCharge>` on `<cac:InvoiceLine>` to array
|
|
||||||
|
|
||||||
# Changelog for v1.18.1
|
|
||||||
|
|
||||||
#### Bug fixes
|
|
||||||
|
|
||||||
- Fix Creditnote `<cac:BillingReference>` validation issues, this tag should be optional
|
|
||||||
|
|
||||||
# Changelog for 1.18.0
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Support for `<cav:Item>` `<cac:StandardItemIdentification>` --> `cbc:IDPeppol` Scheme identifier - Thanks [@dragonfly4](https://github.com/dragonfly4)
|
|
||||||
- Support to add `<cac:Attachment>` content without having to use an external file ref but by adding it as a fileStream/fileContents - Thanks [@dietercoopman](https://github.com/dietercoopman), [@bagulho](https://github.com/bagulho)
|
|
||||||
- Add `<cbc:CompanyLegalForm>` to `<cac:PartyLegalEntity>` - Thanks [@vsadrn](https://github.com/vsadrn)
|
|
||||||
- Improved `UNCL4461` support for `<cac:PaymentMeans>` - Thanks [@TSimkus](https://github.com/TSimkus), [@TecsiAron](https://github.com/TecsiAron)
|
|
||||||
- Add `<cac:OrderLineReference>` support for `<cac:InvoiceLine>` - Thanks [@TSimkus](https://github.com/TSimkus)
|
|
||||||
- Add `<cac:AllowanceCharge>` to `<cac:InvoiceLine>` - Thanks [@TSimkus](https://github.com/TSimkus)
|
|
||||||
- Add support for `<cac:BillingReference>` in Creditnotes - Thanks [@UlusoftConsultancy](https://github.com/UlusoftConsultancy)
|
|
||||||
- Add `<cbc:ChargeTotalAmount>` to `<cac:LegalMonetaryTotal>` - Thanks [@Quazz](https://github.com/Quazz)
|
|
||||||
- Add support for TaxExemptionReason and TaxExemptionReasonCode to `<cac:ClassifiedTaxCategory>` - Thanks [@bagulho](https://github.com/bagulho)
|
|
||||||
|
|
||||||
### Breaking changes
|
|
||||||
|
|
||||||
- Add support to include multiple `PaymentMeans` - Thanks [@Quazz](https://github.com/Quazz)
|
|
||||||
|
|
||||||
#### Bug fixes
|
|
||||||
|
|
||||||
- Fix `InvoiceTypeCode` documentation dead link - Thanks [@TSimkus](https://github.com/TSimkus)
|
|
||||||
- Changed `<cbc:MultiplierFactorNumeric />` type from `int` to `float` - Thanks [@TSimkus](https://github.com/TSimkus)
|
|
||||||
|
|
||||||
# Changelog for version 1.17.0
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add list of `VatExemptionCode` options
|
|
||||||
|
|
||||||
# Changelog for version 1.16.0
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cac:StandardItemIdentification>` to `<cac:Item>`
|
|
||||||
- Add `<cac:PayeeParty>` to `<Invoice>`
|
|
||||||
|
|
||||||
# Changelog for version 1.15.5
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Don't output an InvoiceLine `<cac:TaxScheme />` when no `<cac:Price />` was set
|
|
||||||
- Don't output `<cac:Item>` under InvoiceLine unless explicitely set
|
|
||||||
|
|
||||||
# Changelog for version v1.15.4
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added UNCL5305 codes to be used in various implementations
|
|
||||||
- Improved default result for UNCL5305 code in `TaxCategory->getId()` if `TaxCategory->setId()` was not used
|
|
||||||
|
|
||||||
# Changelog for version v1.15.3
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added more EAS codes to be used in various implementations
|
|
||||||
|
|
||||||
# Changelog for version v1.15.2
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added `EASCode` list with additional EAS codes to be used in various implementations
|
|
||||||
|
|
||||||
# Changelog for version v1.15.1
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `PrepaidAmount` to `LegalMonetaryTotal`
|
|
||||||
- Add `IssueDate` to `OrderReference`
|
|
||||||
- Add `ICDCode` list to be used in various other places
|
|
||||||
- Fixed LegalMonetaryTotal which contained a syntax error
|
|
||||||
|
|
||||||
# Changelog for version v1.15
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added the possibility to use `AdditionalDocumentReference` without `Attachment` - Thanks [@pjcarly](https://github.com/pjcarly)
|
|
||||||
- Added `DocumentTypeCode` on `AdditionalDocumentReference`
|
|
||||||
- Added setter/getter `InvoicePeriod` `DescriptionCode` (VAT date code UNCL2005 subset) - Thanks [@markovic131](https://github.com/markovic131)
|
|
||||||
- Added `PartyIdentificationSchemeName` to `Party` - Thanks [@tgeorgel](https://github.com/tgeorgel)
|
|
||||||
- Added deprecation warning for setAdditionalDocumentReference
|
|
||||||
- Fixed `ContractDocumentReference` XML position - Thanks [@markovic131](https://github.com/markovic131)
|
|
||||||
- Fixed `Name` position in `TaxScheme` - Thanks [@tgeorgel](https://github.com/tgeorgel)
|
|
||||||
- Fixed `InvoicePeriod`, `OrderReference`, `ContractDocumentReference` sorting
|
|
||||||
- Fixed DocumentType which is not a CommonAggregateComponent - Thanks [@christopheg](https://github.com/christopheg)
|
|
||||||
|
|
||||||
# Changelog for version 1.14
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add support for the `CreditNote` root tag and `CreditNoteLine` tags - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Added `DocumentDescription` in `AdditionalDocumentReference` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Added `ExternalReference` (`URI`) as an alternative for an `EmbeddedDocumentBinaryObject` in `Attachment` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Fixed the appearing order of `Name` and `Percent` in `ClassifiedTaxCategory` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Added `ProfileID` to `Invoice` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Added support for multiple `AdditionalDocumentReference` children to `Invoice` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Made `Description` optional in `Item` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Added `EndpointID` to `Party` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Made `PartyName` optional in `Party` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
- Added PHP 8 support in `composer.json` - Thanks [@antal-levente](https://github.com/antal-levente)
|
|
||||||
- Added `Address->CountrySubentity()` - Thanks [@antal-levente](https://github.com/antal-levente)
|
|
||||||
- Fixed `xmlSerialize()` compatibility warnings - Thanks [@antal-levente](https://github.com/antal-levente)
|
|
||||||
- Fixed number_format null values warning - Thanks [@antal-levente](https://github.com/antal-levente)
|
|
||||||
- Add support for `cac:PartyIdentification` `schemeId` attribute
|
|
||||||
- Add support for `cac:AllowanceCharge` in `Price` tag
|
|
||||||
|
|
||||||
### Breaking changes
|
|
||||||
|
|
||||||
- Changed `InvoiceLine`'s default `UnitCode` from `'MON'` to `UnitCode::UNIT` (in order to match `Price`'s default UnitCode) - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
|
|
||||||
### Breaking changes
|
|
||||||
|
|
||||||
- Changed `InvoiceLine`'s default `UnitCode` from `'MON'` to `UnitCode::UNIT` (in order to match `Price`'s default UnitCode) - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
|
|
||||||
|
|
||||||
# Changelog for version 1.13
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cac:AccountingCost>` child node for `<cac:InvoiceLine>`
|
|
||||||
|
|
||||||
# Changelog for version 1.12
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- PHP8 Support — Thanks [@ChristianVermeulen](https://github.com/ChristianVermeulen)
|
|
||||||
|
|
||||||
# Changelog for version 1.11
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added new ContractDocumentReference class & tag `<cac:ContractDocumentReference />` to Invoice — Thanks [@mabjavaid](https://github.com/mabjavaid)
|
|
||||||
- Remove duplicate validation for `id` on invoice — Thanks [@mabjavaid](https://github.com/mabjavaid)
|
|
||||||
- Added new cac:PartyIdentification tag to cac:Party
|
|
||||||
|
|
||||||
# Changelog for version 1.10.2
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added AdditionalStreetName in Address.php — Thanks [@jbputit](https://github.com/jbputit)
|
|
||||||
|
|
||||||
# Changelog for version 1.10.1
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added year, month and piece as additional units in UnitCode.php — Thanks [@jbputit](https://github.com/jbputit)
|
|
||||||
- Added possibility to set InvoicePeriod in InvoiceLine — Thanks [@jbputit](https://github.com/jbputit)
|
|
||||||
|
|
||||||
# Changelog for version 1.10
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added new OrderReferen class & tag `<cac:OrderReference>` to Invoice — Thanks [@jbputit](https://github.com/jbputit)
|
|
||||||
|
|
||||||
# Changelog for version 1.9.6
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Support for `<cbc:SupplierAssignedAccountID>` in `<cac:AccountingCustomerParty>` — Thanks [@eborned](https://github.com/eborned)
|
|
||||||
|
|
||||||
# Changelog for version 1.9.5
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cac:BuyersItemIdentification>` child node for `<cac:Item>` — Thanks [@eborned](https://github.com/eborned)
|
|
||||||
|
|
||||||
# Changelog for version 1.9.4
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Bugfix: Fix order of `<cbc:DueDate>` node in `<Invoice>`
|
|
||||||
|
|
||||||
# Changelog for version 1.9.3
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Bugfix: Use correct number formatting when `<cbc:InvoicedQuantity>` in `<cac:InvoiceLine>` contains a float value
|
|
||||||
- Bugfix: Use correct number formatting when `<cbc:BaseQuantity>` in `<cac:Price>` contains a float value
|
|
||||||
- Bugfix: Use correct number formatting when `<cbc:PriceAmount>` in `<cac:Price>` contains a float value
|
|
||||||
|
|
||||||
# Changelog for version 1.9.2
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Add `<cbc:InstructionNote>` to `<cac:PaymentMeans>` for non structured payment instructions
|
|
||||||
|
|
||||||
# Changelog for version 1.9.1
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Bugfix in `<cac:Party>`, set correct order for child nodes `<cac:PartyLegalEntity>` & `<cac:Contact>` — Thanks [@stedekay](https://github.com/stedekay)
|
|
||||||
|
|
||||||
# Changelog for version 1.9
|
|
||||||
|
|
||||||
### New features & improvements
|
|
||||||
|
|
||||||
- Added return type declarations in every class
|
|
||||||
- Added `PartyTaxScheme`
|
|
||||||
- Added `Party->setPartyTaxScheme()`
|
|
||||||
|
|
||||||
### Breaking changes
|
|
||||||
|
|
||||||
- `Party->setTaxCompanyName(string)` has been removed since `PartyTaxScheme` has been added
|
|
||||||
- `Party->setTaxCompanyId(string)` has been removed since `PartyTaxScheme` has been added
|
|
||||||
- `Party->setTaxScheme(string)` has been removed since `PartyTaxScheme` has been added
|
|
||||||
60
vendor/num-num/ubl-invoice/CONTRIBUTING.md
vendored
60
vendor/num-num/ubl-invoice/CONTRIBUTING.md
vendored
|
|
@ -1,60 +0,0 @@
|
||||||
# Contributing to ubl-invoice
|
|
||||||
|
|
||||||
Are you missing a feature and would you like to add it to the library? Great! Any contributions to this library are welcome. We try to be responsive and release new, non-breaking features as fast as possible.
|
|
||||||
|
|
||||||
## Reporting issues
|
|
||||||
|
|
||||||
This package uses the [GitHub issue tracker](https://github.com/num-num/ubl-invoice/issues) to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted.
|
|
||||||
|
|
||||||
## Contributing code
|
|
||||||
|
|
||||||
If you want to add additional tags, attributes or functionality to the library, please feel free to create a [pull request](https://github.com/num-num/ubl-invoice/pulls) with your changes.
|
|
||||||
|
|
||||||
Please try to follow this workflow:
|
|
||||||
|
|
||||||
- Fork the project
|
|
||||||
- Create a new branch forked from the master branch with a title for your feature (e.g. feature-that-i-want)
|
|
||||||
- Commit all your code into this branch until you are happy with your contribution
|
|
||||||
- Document your changes in the **changelog/next-release.md** file ⚠️
|
|
||||||
- If possible; try to add unit tests for your contribution
|
|
||||||
- Create a pull request with your commits
|
|
||||||
|
|
||||||
## Formatting ⚠️
|
|
||||||
|
|
||||||
Please try to follow [PSR-12](https://www.php-fig.org/psr/psr-12/) rules when writing code. A PSR-12 compliant [phpcs.xml](phpcs.xml) is provided, so if your editor supports [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), your editor should automatically warn you if you are deviating from PSR-12 compliant formatting.
|
|
||||||
|
|
||||||
You can also check code style manually by running `composer phpcs` in the projects' root folder on your disk.
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
$ cd ubl-invoice
|
|
||||||
$ composer phpcs
|
|
||||||
```
|
|
||||||
|
|
||||||
The project also has PHPStan integrated for code checking, which can be triggered with:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
$ cd ubl-invoice
|
|
||||||
$ composer phpstan
|
|
||||||
```
|
|
||||||
|
|
||||||
## Unit testing ⚠️
|
|
||||||
|
|
||||||
### A note on unit testing
|
|
||||||
|
|
||||||
Although unit testing is included, this repository does not provide exhaustive unit testing for *all* possibilities the library offers. This is definitely a long-term goal. So please try to add unit tests for new functionality that you add.
|
|
||||||
|
|
||||||
### Running the unit tests
|
|
||||||
|
|
||||||
To run the complete suite of unit tests
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
$ cd ubl-invoice
|
|
||||||
$ composer test
|
|
||||||
```
|
|
||||||
|
|
||||||
To run a single unit test
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
$ cd ubl-invoice
|
|
||||||
$ composer test tests/SimpleInvoiceTest.php
|
|
||||||
```
|
|
||||||
24
vendor/num-num/ubl-invoice/LICENSE
vendored
24
vendor/num-num/ubl-invoice/LICENSE
vendored
|
|
@ -1,24 +0,0 @@
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018 Num•Num
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
|
||||||
obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without
|
|
||||||
restriction, including without limitation the rights to use,
|
|
||||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following
|
|
||||||
conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
31
vendor/num-num/ubl-invoice/README.md
vendored
31
vendor/num-num/ubl-invoice/README.md
vendored
|
|
@ -1,31 +0,0 @@
|
||||||
# UBL-Invoice
|
|
||||||
|
|
||||||
A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files. Please feel free to [contribute](https://github.com/num-num/ubl-invoice/pulls) if you are missing features or tags.
|
|
||||||
|
|
||||||
[](https://packagist.org/packages/num-num/ubl-invoice)
|
|
||||||
[](https://packagist.org/packages/num-num/ubl-invoice)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Installation and usage
|
|
||||||
|
|
||||||
This package requires PHP 7.4 or higher and is fully compatible with PHP8. Installation can be done through [composer](https://www.getcomposer.org).
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
$ composer require num-num/ubl-invoice
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
This library is not 100% UBL/Peppol feature-complete, in the sense that it doesn't (yet) support **all** UBL XML tags & functionality. "Yet" being the keyword, since this definitely is the long-term goal. All common UBL tags that are required for most invoices are present in the library. This includes tags for discounts, cash discounts, special vat rates, etc...
|
|
||||||
|
|
||||||
If you are missing functionality, please feel free to add it :-) Adding additional tags & attributes is fairly straight-forward. Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
|
||||||
|
|
||||||
## Examples & documentation
|
|
||||||
|
|
||||||
This repository does not have a documentation website at this moment. For now, please check out some code examples by checking the unit tests in the `tests` folder.
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
A changelog is available since version v1.9.0. If you are upgrading a minor version (1.x) or major version, please check the changelog to see if you need to implement any breaking changes...
|
|
||||||
|
|
||||||
56
vendor/num-num/ubl-invoice/composer.json
vendored
56
vendor/num-num/ubl-invoice/composer.json
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
{
|
|
||||||
"name": "num-num/ubl-invoice",
|
|
||||||
"description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files",
|
|
||||||
"keywords": [
|
|
||||||
"ubl",
|
|
||||||
"invoice",
|
|
||||||
"ublinvoice",
|
|
||||||
"ubl invoice",
|
|
||||||
"efff",
|
|
||||||
"electronic invoice",
|
|
||||||
"digital invoice",
|
|
||||||
"xml",
|
|
||||||
"xml invoice",
|
|
||||||
"peppol",
|
|
||||||
"peppol bis",
|
|
||||||
"peppolbis",
|
|
||||||
"peppol invoice",
|
|
||||||
"e-invoice",
|
|
||||||
"einvoice",
|
|
||||||
"euinvoice"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/num-num/ubl-invoice",
|
|
||||||
"license": "MIT",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Bert Devriese",
|
|
||||||
"email": "bert@numnum.be",
|
|
||||||
"homepage": "https://www.numnum.be",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"php": "^7.3 || ^8.0",
|
|
||||||
"sabre/xml": "^4.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^9.0",
|
|
||||||
"squizlabs/php_codesniffer": "^3.7",
|
|
||||||
"phpstan/phpstan": "^1.10"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"NumNum\\UBL\\": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"NumNum\\UBL\\Tests\\": [
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "vendor/bin/phpunit",
|
|
||||||
"phpstan": "vendor/bin/phpstan analyse src tests",
|
|
||||||
"phpcs": "vendor/bin/phpcs -n --standard=phpcs.xml ./src/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1996
vendor/num-num/ubl-invoice/composer.lock
generated
vendored
1996
vendor/num-num/ubl-invoice/composer.lock
generated
vendored
File diff suppressed because it is too large
Load diff
350
vendor/num-num/ubl-invoice/phpcs.xml
vendored
350
vendor/num-num/ubl-invoice/phpcs.xml
vendored
|
|
@ -1,350 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR12" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
|
||||||
<description>The PSR-12 coding standard.</description>
|
|
||||||
<arg name="tab-width" value="4"/>
|
|
||||||
|
|
||||||
<!-- 2. General -->
|
|
||||||
|
|
||||||
<!-- 2.1 Basic Coding Standard -->
|
|
||||||
|
|
||||||
<!-- Code MUST follow all rules outlined in PSR-1. -->
|
|
||||||
<rule ref="PSR1"/>
|
|
||||||
|
|
||||||
<!-- The term 'StudlyCaps' in PSR-1 MUST be interpreted as PascalCase where the first letter of each word is capitalized including the very first letter. -->
|
|
||||||
|
|
||||||
<!-- 2.2 Files -->
|
|
||||||
|
|
||||||
<!-- All PHP files MUST use the Unix LF (linefeed) line ending only. -->
|
|
||||||
<rule ref="Generic.Files.LineEndings">
|
|
||||||
<properties>
|
|
||||||
<property name="eolChar" value="\n"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- All PHP files MUST end with a non-blank line, terminated with a single LF. -->
|
|
||||||
<rule ref="PSR2.Files.EndFileNewline"/>
|
|
||||||
|
|
||||||
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
|
|
||||||
<rule ref="PSR2.Files.ClosingTag"/>
|
|
||||||
|
|
||||||
<!-- 2.3 Lines -->
|
|
||||||
|
|
||||||
<!-- There MUST NOT be a hard limit on line length.
|
|
||||||
The soft limit on line length MUST be 120 characters.
|
|
||||||
Lines SHOULD NOT be longer than 80 characters; lines longer than that SHOULD be split into multiple subsequent lines of no more than 80 characters each. -->
|
|
||||||
<rule ref="Generic.Files.LineLength">
|
|
||||||
<properties>
|
|
||||||
<property name="lineLimit" value="120"/>
|
|
||||||
<property name="absoluteLineLimit" value="0"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- There MUST NOT be trailing whitespace at the end of lines.
|
|
||||||
Blank lines MAY be added to improve readability and to indicate related blocks of code except where explicitly forbidden. -->
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
|
||||||
<properties>
|
|
||||||
<property name="ignoreBlankLines" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- There MUST NOT be more than one statement per line. -->
|
|
||||||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
|
||||||
|
|
||||||
<!-- 2.4 Indenting -->
|
|
||||||
|
|
||||||
<!-- Code MUST use an indent of 4 spaces for each indent level, and MUST NOT use tabs for indenting. -->
|
|
||||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
|
||||||
<properties>
|
|
||||||
<property name="ignoreIndentationTokens" type="array">
|
|
||||||
<element value="T_COMMENT"/>
|
|
||||||
<element value="T_DOC_COMMENT_OPEN_TAG"/>
|
|
||||||
</property>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
|
||||||
|
|
||||||
<!-- 2.5 Keywords and Types -->
|
|
||||||
|
|
||||||
<!-- All PHP reserved keywords and types [1][2] MUST be in lower case.
|
|
||||||
Any new types and keywords added to future PHP versions MUST be in lower case. -->
|
|
||||||
<rule ref="Generic.PHP.LowerCaseKeyword"/>
|
|
||||||
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
|
||||||
<rule ref="Generic.PHP.LowerCaseType"/>
|
|
||||||
|
|
||||||
<!-- Short form of type keywords MUST be used i.e. bool instead of boolean, int instead of integer etc. -->
|
|
||||||
<!-- checked by PSR12.Keywords.ShortFormTypeKeywords -->
|
|
||||||
|
|
||||||
<!-- 3. Declare Statements, Namespace, and Import Statements -->
|
|
||||||
|
|
||||||
<!-- The header of a PHP file may consist of a number of different blocks. If present, each of the blocks below MUST be separated by a single blank line, and MUST NOT contain a blank line. Each block MUST be in the order listed below, although blocks that are not relevant may be omitted.
|
|
||||||
|
|
||||||
Opening php tag.
|
|
||||||
File-level docblock.
|
|
||||||
One or more declare statements.
|
|
||||||
The namespace declaration of the file.
|
|
||||||
One or more class-based use import statements.
|
|
||||||
One or more function-based use import statements.
|
|
||||||
One or more constant-based use import statements.
|
|
||||||
The remainder of the code in the file. -->
|
|
||||||
<!-- checked by PSR12.Files.FileHeader -->
|
|
||||||
|
|
||||||
<!-- When a file contains a mix of HTML and PHP, any of the above sections may still be used. If so, they MUST be present at the top of the file, even if the remainder of the code consists of a closing PHP tag and then a mixture of HTML and PHP. -->
|
|
||||||
|
|
||||||
<!-- When the opening php tag is on the first line of the file, it MUST be on its own line with no other statements unless it is a file containing markup outside of PHP opening and closing tags. -->
|
|
||||||
|
|
||||||
<!-- Import statements MUST never begin with a leading backslash as they must always be fully qualified. -->
|
|
||||||
<!-- checked by PSR12.Files.ImportStatement -->
|
|
||||||
|
|
||||||
<!-- Compound namespaces with a depth of more than two MUST NOT be used. -->
|
|
||||||
<!-- checked by PSR12.Namespaces.CompoundNamespaceDepth -->
|
|
||||||
|
|
||||||
<!-- When wishing to declare strict types in files containing markup outside PHP opening and closing tags, the declaration MUST be on the first line of the file and include an opening PHP tag, the strict types declaration and closing tag. -->
|
|
||||||
<!-- Declare statements MUST contain no spaces and MUST be exactly declare(strict_types=1) (with an optional semi-colon terminator). -->
|
|
||||||
<!-- Block declare statements are allowed and MUST be formatted as below. -->
|
|
||||||
<!-- checked by PSR12.Files.DeclareStatement -->
|
|
||||||
|
|
||||||
<!-- 4. Classes, Properties, and Methods -->
|
|
||||||
|
|
||||||
<!-- Any closing brace MUST NOT be followed by any comment or statement on the same line. -->
|
|
||||||
<!-- checked by PSR12.Classes.ClosingBrace -->
|
|
||||||
|
|
||||||
<!-- When instantiating a new class, parentheses MUST always be present even when there are no arguments passed to the constructor. -->
|
|
||||||
<!-- checked by PSR12.Classes.ClassInstantiation -->
|
|
||||||
|
|
||||||
<!-- 4.1 Extends and Implements -->
|
|
||||||
|
|
||||||
<!-- The extends and implements keywords MUST be declared on the same line as the class name. -->
|
|
||||||
<!-- The opening brace for the class MUST go on its own line; the closing brace for the class MUST go on the next line after the body. -->
|
|
||||||
<!-- Opening braces MUST be on their own line and MUST NOT be preceded or followed by a blank line. -->
|
|
||||||
<!-- Closing braces MUST be on their own line and MUST NOT be preceded by a blank line. -->
|
|
||||||
<!-- Lists of implements and, in the case of interfaces, extends MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one interface per line. -->
|
|
||||||
<rule ref="PSR2.Classes.ClassDeclaration"/>
|
|
||||||
|
|
||||||
<!-- 4.2 Using traits -->
|
|
||||||
|
|
||||||
<!-- The use keyword used inside the classes to implement traits MUST be declared on the next line after the opening brace. -->
|
|
||||||
<!-- Each individual trait that is imported into a class MUST be included one-per-line and each inclusion MUST have its own use import statement. -->
|
|
||||||
<!-- When the class has nothing after the use import statement, the class closing brace MUST be on the next line after the use import statement. Otherwise, it MUST have a blank line after the use import statement. -->
|
|
||||||
<!-- When using the insteadof and as operators they must be used as follows taking note of indentation, spacing, and new lines. -->
|
|
||||||
<!-- checked by PSR12.Traits.UseDeclaration -->
|
|
||||||
|
|
||||||
<!-- 4.3 Properties and Constants -->
|
|
||||||
|
|
||||||
<!-- Visibility MUST be declared on all properties. -->
|
|
||||||
<!-- The var keyword MUST NOT be used to declare a property. -->
|
|
||||||
<!-- There MUST NOT be more than one property declared per statement. -->
|
|
||||||
<!-- Property names MUST NOT be prefixed with a single underscore to indicate protected or private visibility.
|
|
||||||
That is, an underscore prefix explicitly has no meaning. -->
|
|
||||||
<!-- There MUST be a space between type declaration and property name. -->
|
|
||||||
<rule ref="PSR2.Classes.PropertyDeclaration"/>
|
|
||||||
|
|
||||||
<!-- Visibility MUST be declared on all constants if your project PHP minimum version supports constant visibilities (PHP 7.1 or later). -->
|
|
||||||
<!-- checked by PSR12.Properties.ConstantVisibility -->
|
|
||||||
|
|
||||||
<!-- 4.4 Methods and Functions -->
|
|
||||||
|
|
||||||
<!-- Visibility MUST be declared on all methods. -->
|
|
||||||
<rule ref="Squiz.Scope.MethodScope"/>
|
|
||||||
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
|
|
||||||
|
|
||||||
<!-- Method names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix explicitly has no meaning. -->
|
|
||||||
<rule ref="PSR2.Methods.MethodDeclaration"/>
|
|
||||||
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
|
|
||||||
<type>error</type>
|
|
||||||
<message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- Method and function names MUST NOT be declared with space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. -->
|
|
||||||
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
|
|
||||||
<rule ref="Squiz.Functions.FunctionDeclaration"/>
|
|
||||||
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
|
|
||||||
|
|
||||||
<!-- 4.5 Method and Function Arguments -->
|
|
||||||
|
|
||||||
<!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
|
|
||||||
<!-- When using the reference operator & before an argument, there MUST NOT be a space after it. -->
|
|
||||||
<!-- There MUST NOT be a space between the variadic three dot operator and the argument name. -->
|
|
||||||
<!-- When combining both the reference operator and the variadic three dot operator, there MUST NOT be any space between the two of them. -->
|
|
||||||
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
|
||||||
<properties>
|
|
||||||
<property name="equalsSpacing" value="1"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- Method and function arguments with default values MUST go at the end of the argument list. -->
|
|
||||||
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
|
||||||
|
|
||||||
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line.
|
|
||||||
When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
|
||||||
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
|
|
||||||
|
|
||||||
<!-- When you have a return type declaration present, there MUST be one space after the colon followed by the type declaration. The colon and declaration MUST be on the same line as the argument list closing parenthesis with no spaces between the two characters. -->
|
|
||||||
<!-- checked by PSR12.Functions.ReturnTypeDeclaration -->
|
|
||||||
|
|
||||||
<!-- In nullable type declarations, there MUST NOT be a space between the question mark and the type. -->
|
|
||||||
<!-- checked by PSR12.Functions.NullableTypeDeclaration -->
|
|
||||||
|
|
||||||
<!-- 4.6 abstract, final, and static -->
|
|
||||||
|
|
||||||
<!-- When present, the abstract and final declarations MUST precede the visibility declaration. -->
|
|
||||||
<!-- When present, the static declaration MUST come after the visibility declaration. -->
|
|
||||||
<!-- checked by PSR2.Methods.MethodDeclaration included above -->
|
|
||||||
|
|
||||||
<!-- 4.7 Method and Function Calls -->
|
|
||||||
|
|
||||||
<!-- When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
|
|
||||||
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. A single argument being split across multiple lines (as might be the case with an anonymous function or array) does not constitute splitting the argument list itself. -->
|
|
||||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
|
||||||
<rule ref="PSR2.Methods.FunctionCallSignature"/>
|
|
||||||
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
<rule ref="PSR2.Methods.FunctionCallSignature.OpeningIndent">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- 5. Control Structures -->
|
|
||||||
|
|
||||||
<!-- The general style rules for control structures are as follows:
|
|
||||||
There MUST be one space after the control structure keyword
|
|
||||||
There MUST NOT be a space after the opening parenthesis
|
|
||||||
There MUST NOT be a space before the closing parenthesis
|
|
||||||
There MUST be one space between the closing parenthesis and the opening brace
|
|
||||||
The structure body MUST be indented once
|
|
||||||
The body MUST be on the next line after the opening brace
|
|
||||||
The closing brace MUST be on the next line after the body
|
|
||||||
The body of each structure MUST be enclosed by braces. This standardizes how the structures look and reduces the likelihood of introducing errors as new lines get added to the body. -->
|
|
||||||
<rule ref="Squiz.ControlStructures.ControlSignature"/>
|
|
||||||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
|
|
||||||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
|
|
||||||
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
|
||||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
|
|
||||||
<rule ref="Squiz.ControlStructures.ForLoopDeclaration">
|
|
||||||
<properties>
|
|
||||||
<property name="ignoreNewlines" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
|
|
||||||
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
|
||||||
|
|
||||||
<!-- exclude this message as it is already checked in Generic.PHP.LowerCaseKeyword -->
|
|
||||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- 5.1 if, elseif, else -->
|
|
||||||
|
|
||||||
<!-- else and elseif are on the same line as the closing brace from the earlier body. -->
|
|
||||||
<!-- checked by Squiz.ControlStructures.ControlSignature included above -->
|
|
||||||
|
|
||||||
<!-- The keyword elseif SHOULD be used instead of else if so that all control keywords look like single words. -->
|
|
||||||
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
|
|
||||||
|
|
||||||
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
|
|
||||||
<!-- checked by Squiz.ControlStructures.ControlSignature -->
|
|
||||||
|
|
||||||
<!-- 5.2 switch, case -->
|
|
||||||
|
|
||||||
<!-- The case statement MUST be indented once from switch, and the break keyword (or other terminating keywords) MUST be indented at the same level as the case body. There MUST be a comment such as // no break when fall-through is intentional in a non-empty case body. -->
|
|
||||||
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
|
|
||||||
|
|
||||||
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
|
|
||||||
<!-- checked by Squiz.ControlStructures.ControlSignature -->
|
|
||||||
|
|
||||||
<!-- 5.3.1 while -->
|
|
||||||
|
|
||||||
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
|
|
||||||
<!-- checked by Squiz.ControlStructures.ControlSignature -->
|
|
||||||
|
|
||||||
<!-- 5.3.2 do while -->
|
|
||||||
|
|
||||||
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
|
|
||||||
<!-- checked by Squiz.ControlStructures.ControlSignature -->
|
|
||||||
|
|
||||||
<!-- 5.4 for -->
|
|
||||||
|
|
||||||
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first expression MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
|
|
||||||
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
|
|
||||||
<!-- checked by Squiz.ControlStructures.ControlSignature -->
|
|
||||||
|
|
||||||
<!-- 5.5 foreach -->
|
|
||||||
|
|
||||||
<!-- exclude these messages as they are already checked by PSR2.ControlStructures.ControlStructureSpacing -->
|
|
||||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
|
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- 5.6 try, catch, finally -->
|
|
||||||
|
|
||||||
<!-- 6. Operators -->
|
|
||||||
|
|
||||||
<!-- When space is permitted around an operator, multiple spaces MAY be used for readability purposes. -->
|
|
||||||
<!-- All operators not described here are left undefined. -->
|
|
||||||
|
|
||||||
<!-- 6.1. Unary operators -->
|
|
||||||
|
|
||||||
<!-- The increment/decrement operators MUST NOT have any space between the operator and operand. -->
|
|
||||||
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
|
||||||
|
|
||||||
<!-- Type casting operators MUST NOT have any space within the parentheses. -->
|
|
||||||
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
|
||||||
|
|
||||||
<!-- 6.2. Binary operators -->
|
|
||||||
|
|
||||||
<!-- All binary arithmetic, comparison, assignment, bitwise, logical, string, and type operators MUST be preceded and followed by at least one space. -->
|
|
||||||
<!-- checked by PSR12.Operators.OperatorSpacing -->
|
|
||||||
|
|
||||||
<!-- 6.3. Ternary operators -->
|
|
||||||
|
|
||||||
<!-- The conditional operator, also known simply as the ternary operator, MUST be preceded and followed by at least one space around both the ? and : characters. -->
|
|
||||||
<!-- When the middle operand of the conditional operator is omitted, the operator MUST follow the same style rules as other binary comparison operators. -->
|
|
||||||
<!-- checked by PSR12.Operators.OperatorSpacing -->
|
|
||||||
|
|
||||||
<!-- 7. Closures -->
|
|
||||||
|
|
||||||
<!-- Closures MUST be declared with a space after the function keyword, and a space before and after the use keyword. -->
|
|
||||||
<!-- The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body. -->
|
|
||||||
<!-- There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list. -->
|
|
||||||
<!-- In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
|
|
||||||
<!-- Closure arguments with default values MUST go at the end of the argument list. -->
|
|
||||||
<!-- Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line. -->
|
|
||||||
<!-- When the ending list (whether of arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
|
||||||
<!-- checked by Squiz.Functions.MultiLineFunctionDeclaration -->
|
|
||||||
|
|
||||||
<!-- If a return type is present, it MUST follow the same rules as with normal functions and methods; if the use keyword is present, the colon MUST follow the use list closing parentheses with no spaces between the two characters. -->
|
|
||||||
<!-- checked by PSR12.Functions.ReturnTypeDeclaration -->
|
|
||||||
|
|
||||||
<!-- 8. Anonymous Classes -->
|
|
||||||
|
|
||||||
<!-- Anonymous Classes MUST follow the same guidelines and principles as closures in the above section. -->
|
|
||||||
<!-- The opening brace MAY be on the same line as the class keyword so long as the list of implements interfaces does not wrap. If the list of interfaces wraps, the brace MUST be placed on the line immediately following the last interface. -->
|
|
||||||
<!-- checked by PSR12.Classes.AnonClassDeclaration -->
|
|
||||||
|
|
||||||
</ruleset>
|
|
||||||
13
vendor/num-num/ubl-invoice/phpunit.xml.dist
vendored
13
vendor/num-num/ubl-invoice/phpunit.xml.dist
vendored
|
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
|
||||||
<coverage>
|
|
||||||
<include>
|
|
||||||
<directory suffix=".php">src/</directory>
|
|
||||||
</include>
|
|
||||||
</coverage>
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="Num–Num UBL-invoice Test Suite">
|
|
||||||
<directory>tests</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
</phpunit>
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class AdditionalDocumentReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $documentType;
|
|
||||||
private $documentTypeCode;
|
|
||||||
private $documentDescription;
|
|
||||||
private $attachment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return AdditionalDocumentReference
|
|
||||||
*/
|
|
||||||
public function setId(string $id): AdditionalDocumentReference
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDocumentType(): ?string
|
|
||||||
{
|
|
||||||
return $this->documentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $documentType
|
|
||||||
* @return AdditionalDocumentReference
|
|
||||||
*/
|
|
||||||
public function setDocumentType(string $documentType): AdditionalDocumentReference
|
|
||||||
{
|
|
||||||
$this->documentType = $documentType;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int|string|null
|
|
||||||
*/
|
|
||||||
public function getDocumentTypeCode()
|
|
||||||
{
|
|
||||||
return $this->documentTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int|string $documentTypeCode
|
|
||||||
* @return AdditionalDocumentReference
|
|
||||||
*/
|
|
||||||
public function setDocumentTypeCode($documentTypeCode): AdditionalDocumentReference
|
|
||||||
{
|
|
||||||
$this->documentTypeCode = $documentTypeCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDocumentDescription(): ?string
|
|
||||||
{
|
|
||||||
return $this->documentDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $documentDescription
|
|
||||||
* @return AdditionalDocumentReference
|
|
||||||
*/
|
|
||||||
public function setDocumentDescription(string $documentDescription): AdditionalDocumentReference
|
|
||||||
{
|
|
||||||
$this->documentDescription = $documentDescription;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Attachment
|
|
||||||
*/
|
|
||||||
public function getAttachment(): ?Attachment
|
|
||||||
{
|
|
||||||
return $this->attachment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Attachment $attachment
|
|
||||||
* @return AdditionalDocumentReference
|
|
||||||
*/
|
|
||||||
public function setAttachment(Attachment $attachment): AdditionalDocumentReference
|
|
||||||
{
|
|
||||||
$this->attachment = $attachment;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([ Schema::CBC . 'ID' => $this->id ]);
|
|
||||||
|
|
||||||
if ($this->documentTypeCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'DocumentTypeCode' => $this->documentTypeCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->documentType !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'DocumentType' => $this->documentType
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->documentDescription !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'DocumentDescription' => $this->documentDescription
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->attachment !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'Attachment' => $this->attachment
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
189
vendor/num-num/ubl-invoice/src/Address.php
vendored
189
vendor/num-num/ubl-invoice/src/Address.php
vendored
|
|
@ -1,189 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class Address implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $streetName;
|
|
||||||
private $additionalStreetName;
|
|
||||||
private $buildingNumber;
|
|
||||||
private $cityName;
|
|
||||||
private $postalZone;
|
|
||||||
private $countrySubentity;
|
|
||||||
private $country;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getStreetName(): ?string
|
|
||||||
{
|
|
||||||
return $this->streetName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $streetName
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setStreetName(?string $streetName): Address
|
|
||||||
{
|
|
||||||
$this->streetName = $streetName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAdditionalStreetName(): ?string
|
|
||||||
{
|
|
||||||
return $this->additionalStreetName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $additionalStreetName
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setAdditionalStreetName(?string $additionalStreetName): Address
|
|
||||||
{
|
|
||||||
$this->additionalStreetName = $additionalStreetName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getBuildingNumber(): ?string
|
|
||||||
{
|
|
||||||
return $this->buildingNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $buildingNumber
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setBuildingNumber(?string $buildingNumber): Address
|
|
||||||
{
|
|
||||||
$this->buildingNumber = $buildingNumber;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCityName(): ?string
|
|
||||||
{
|
|
||||||
return $this->cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $cityName
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setCityName(?string $cityName): Address
|
|
||||||
{
|
|
||||||
$this->cityName = $cityName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPostalZone(): ?string
|
|
||||||
{
|
|
||||||
return $this->postalZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $postalZone
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setPostalZone(?string $postalZone): Address
|
|
||||||
{
|
|
||||||
$this->postalZone = $postalZone;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCountrySubentity(): ?string
|
|
||||||
{
|
|
||||||
return $this->countrySubentity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $subentity
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setCountrySubentity(string $countrySubentity): Address
|
|
||||||
{
|
|
||||||
$this->countrySubentity = $countrySubentity;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Country
|
|
||||||
*/
|
|
||||||
public function getCountry(): ?Country
|
|
||||||
{
|
|
||||||
return $this->country;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Country $country
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function setCountry(Country $country): Address
|
|
||||||
{
|
|
||||||
$this->country = $country;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->streetName !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'StreetName' => $this->streetName
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->additionalStreetName !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'AdditionalStreetName' => $this->additionalStreetName
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->buildingNumber !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'BuildingNumber' => $this->buildingNumber
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->cityName !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'CityName' => $this->cityName,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->postalZone !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'PostalZone' => $this->postalZone,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->countrySubentity !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'CountrySubentity' => $this->countrySubentity,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->country !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'Country' => $this->country,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
227
vendor/num-num/ubl-invoice/src/AllowanceCharge.php
vendored
227
vendor/num-num/ubl-invoice/src/AllowanceCharge.php
vendored
|
|
@ -1,227 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class AllowanceCharge implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $chargeIndicator;
|
|
||||||
private $allowanceChargeReasonCode;
|
|
||||||
private $allowanceChargeReason;
|
|
||||||
private $multiplierFactorNumeric;
|
|
||||||
private $baseAmount;
|
|
||||||
private $amount;
|
|
||||||
private $taxTotal;
|
|
||||||
private $taxCategory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isChargeIndicator(): bool
|
|
||||||
{
|
|
||||||
return $this->chargeIndicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bool $chargeIndicator
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setChargeIndicator(bool $chargeIndicator): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->chargeIndicator = $chargeIndicator;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getAllowanceChargeReasonCode(): ?int
|
|
||||||
{
|
|
||||||
return $this->allowanceChargeReasonCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $allowanceChargeReasonCode
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setAllowanceChargeReasonCode(?int $allowanceChargeReasonCode): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->allowanceChargeReasonCode = $allowanceChargeReasonCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAllowanceChargeReason(): ?string
|
|
||||||
{
|
|
||||||
return $this->allowanceChargeReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $allowanceChargeReason
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setAllowanceChargeReason(?string $allowanceChargeReason): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->allowanceChargeReason = $allowanceChargeReason;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getMultiplierFactorNumeric(): ?float
|
|
||||||
{
|
|
||||||
return $this->multiplierFactorNumeric;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $multiplierFactorNumeric
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setMultiplierFactorNumeric(?float $multiplierFactorNumeric): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->multiplierFactorNumeric = $multiplierFactorNumeric;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getBaseAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->baseAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $baseAmount
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setBaseAmount(?float $baseAmount): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->baseAmount = $baseAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $amount
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setAmount(?float $amount): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->amount = $amount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function getTaxCategory(): ?TaxCategory
|
|
||||||
{
|
|
||||||
return $this->taxCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxCategory $taxCategory
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setTaxCategory(?TaxCategory $taxCategory): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->taxCategory = $taxCategory;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function getTaxtotal(): ?TaxTotal
|
|
||||||
{
|
|
||||||
return $this->taxTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxTotal $taxTotal
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function setTaxtotal(?TaxTotal $taxTotal): AllowanceCharge
|
|
||||||
{
|
|
||||||
$this->taxTotal = $taxTotal;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ChargeIndicator' => $this->chargeIndicator ? 'true' : 'false',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->allowanceChargeReasonCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'AllowanceChargeReasonCode' => $this->allowanceChargeReasonCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->allowanceChargeReason !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'AllowanceChargeReason' => $this->allowanceChargeReason
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->multiplierFactorNumeric !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'MultiplierFactorNumeric' => NumberFormatter::format($this->baseAmount)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'Amount',
|
|
||||||
'value' => NumberFormatter::format($this->amount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->baseAmount !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'BaseAmount',
|
|
||||||
'value' => NumberFormatter::format($this->baseAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxCategory !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxCategory' => $this->taxCategory
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxTotal !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxTotal' => $this->taxTotal
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
180
vendor/num-num/ubl-invoice/src/Attachment.php
vendored
180
vendor/num-num/ubl-invoice/src/Attachment.php
vendored
|
|
@ -1,180 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class Attachment implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $filePath;
|
|
||||||
private $externalReference;
|
|
||||||
private $fileStream;
|
|
||||||
private $fileName;
|
|
||||||
private $mimeType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception exception when the mime type cannot be determined
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getFilePathMimeType(): string
|
|
||||||
{
|
|
||||||
if (($mime_type = mime_content_type($this->filePath)) !== false) {
|
|
||||||
return $mime_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception('Could not determine mime_type of '.$this->filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getFilePath(): ?string
|
|
||||||
{
|
|
||||||
return $this->filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $filePath
|
|
||||||
* @return Attachment
|
|
||||||
*/
|
|
||||||
public function setFilePath(string $filePath): Attachment
|
|
||||||
{
|
|
||||||
$this->filePath = $filePath;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getExternalReference(): ?string
|
|
||||||
{
|
|
||||||
return $this->externalReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $externalReference
|
|
||||||
* @return Attachment
|
|
||||||
*/
|
|
||||||
public function setExternalReference(string $externalReference): Attachment
|
|
||||||
{
|
|
||||||
$this->externalReference = $externalReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFileStream(): ?string
|
|
||||||
{
|
|
||||||
return $this->fileStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $fileStream Base64 encoded filestream
|
|
||||||
* @param string $fileName
|
|
||||||
* @return Attachment
|
|
||||||
*/
|
|
||||||
public function setFileStream(string $fileStream, string $fileName, ?string $mimeType): Attachment
|
|
||||||
{
|
|
||||||
$this->fileStream = $fileStream;
|
|
||||||
$this->fileName = $fileName;
|
|
||||||
$this->mimeType = $mimeType;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getFileName(): string
|
|
||||||
{
|
|
||||||
return $this->fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $fileName
|
|
||||||
* @return Attachment
|
|
||||||
*/
|
|
||||||
public function setFileName(string $fileName): Attachment
|
|
||||||
{
|
|
||||||
$this->fileName = $fileName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ?string
|
|
||||||
*/
|
|
||||||
public function getMimeType(): ?string
|
|
||||||
{
|
|
||||||
return $this->mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?string $mimeType
|
|
||||||
* @return Attachment
|
|
||||||
*/
|
|
||||||
public function setMimeType(?string $mimeType): Attachment
|
|
||||||
{
|
|
||||||
$this->mimeType = $mimeType;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->filePath === null && $this->externalReference === null && $this->fileStream === null) {
|
|
||||||
throw new InvalidArgumentException('Attachment must have a filePath, an externalReference, or a fileContent');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->fileStream !== null && $this->mimeType === null) {
|
|
||||||
throw new InvalidArgumentException('Using fileStream, you need to define a mimeType by also using setFileMimeType');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->filePath !== null && !file_exists($this->filePath)) {
|
|
||||||
throw new InvalidArgumentException('Attachment at filePath does not exist');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
if (!empty($this->filePath)) {
|
|
||||||
$fileContents = base64_encode(file_get_contents($this->filePath));
|
|
||||||
$fileName = basename($this->filePath);
|
|
||||||
$mimeType = $this->getFilePathMimeType();
|
|
||||||
} else {
|
|
||||||
$fileContents = $this->fileStream;
|
|
||||||
$fileName = $this->fileName;
|
|
||||||
$mimeType = $this->mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'EmbeddedDocumentBinaryObject',
|
|
||||||
'value' => $fileContents,
|
|
||||||
'attributes' => [
|
|
||||||
'mimeCode' => $mimeType,
|
|
||||||
'filename' => $fileName,
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->externalReference) {
|
|
||||||
$writer->writeElement(
|
|
||||||
Schema::CAC . 'ExternalReference',
|
|
||||||
[ Schema::CBC . 'URI' => $this->externalReference ]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class BillingReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $invoiceDocumentReference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return ?InvoiceDocumentReference
|
|
||||||
*/
|
|
||||||
public function getInvoiceDocumentReference(): ?InvoiceDocumentReference
|
|
||||||
{
|
|
||||||
return $this->invoiceDocumentReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return BillingReference
|
|
||||||
*/
|
|
||||||
public function setInvoiceDocumentReference($invoiceDocumentReference): BillingReference
|
|
||||||
{
|
|
||||||
$this->invoiceDocumentReference = $invoiceDocumentReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->invoiceDocumentReference === null) {
|
|
||||||
throw new InvalidArgumentException('Missing billingreference invoicedocumentreference');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([Schema::CAC . 'InvoiceDocumentReference' => $this->invoiceDocumentReference]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,239 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class ClassifiedTaxCategory implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $name;
|
|
||||||
private $percent;
|
|
||||||
private $taxScheme;
|
|
||||||
private $taxExemptionReason;
|
|
||||||
private $taxExemptionReasonCode;
|
|
||||||
private $schemeID;
|
|
||||||
private $schemeName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
if (!empty($this->id)) {
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getPercent() !== null) {
|
|
||||||
return ($this->getPercent() > 0)
|
|
||||||
? UNCL5305::STANDARD_RATE
|
|
||||||
: UNCL5305::ZERO_RATED_GOODS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setId(?string $id): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setName(?string $name): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getPercent(): ?float
|
|
||||||
{
|
|
||||||
return $this->percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $percent
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setPercent(?float $percent): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->percent = $percent;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return TaxScheme
|
|
||||||
*/
|
|
||||||
public function getTaxScheme(): ?TaxScheme
|
|
||||||
{
|
|
||||||
return $this->taxScheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxScheme $taxScheme
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setTaxScheme(?TaxScheme $taxScheme): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->taxScheme = $taxScheme;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getSchemeID(): ?string
|
|
||||||
{
|
|
||||||
return $this->schemeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setSchemeID(?string $id): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->schemeID = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getSchemeName(): ?string
|
|
||||||
{
|
|
||||||
return $this->schemeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setSchemeName(?string $name): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->schemeName = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTaxExemptionReason(): ?string
|
|
||||||
{
|
|
||||||
return $this->taxExemptionReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $taxExemptionReason
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setTaxExemptionReason(?string $taxExemptionReason): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->taxExemptionReason = $taxExemptionReason;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTaxExemptionReasonCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->taxExemptionReasonCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $taxExemptionReasonCode
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function setTaxExemptionReasonCode(?string $taxExemptionReasonCode): ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
$this->taxExemptionReasonCode = $taxExemptionReasonCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->getId() === null) {
|
|
||||||
throw new InvalidArgumentException('Missing taxcategory id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$schemeAttributes = [];
|
|
||||||
if ($this->schemeID !== null) {
|
|
||||||
$schemeAttributes['schemeID'] = $this->schemeID;
|
|
||||||
}
|
|
||||||
if ($this->schemeName !== null) {
|
|
||||||
$schemeAttributes['schemeName'] = $this->schemeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'ID',
|
|
||||||
'value' => $this->getId(),
|
|
||||||
'attributes' => $schemeAttributes
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->name !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Name' => $this->name,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->percent !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Percent' => number_format($this->percent, 2, '.', ''),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxExemptionReasonCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'TaxExemptionReasonCode' => $this->taxExemptionReasonCode,
|
|
||||||
Schema::CBC . 'TaxExemptionReason' => $this->taxExemptionReason,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxScheme !== null) {
|
|
||||||
$writer->write([Schema::CAC . 'TaxScheme' => $this->taxScheme]);
|
|
||||||
} else {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxScheme' => null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class CommodityClassification implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $itemClassificationCode;
|
|
||||||
private $itemClassificationListId;
|
|
||||||
private $itemClassificationListVersionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getItemClassificationCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->itemClassificationCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $itemClassificationCode
|
|
||||||
* @return CommodityClassification
|
|
||||||
*/
|
|
||||||
public function setItemClassificationCode(?string $itemClassificationCode): CommodityClassification
|
|
||||||
{
|
|
||||||
$this->itemClassificationCode = $itemClassificationCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ?string
|
|
||||||
*/
|
|
||||||
public function getItemClassificationListId(): ?string
|
|
||||||
{
|
|
||||||
return $this->itemClassificationListId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?string $itemClassificationListId
|
|
||||||
* @return CommodityClassification
|
|
||||||
*/
|
|
||||||
public function setItemClassificationListId(?string $itemClassificationListId): CommodityClassification
|
|
||||||
{
|
|
||||||
$this->itemClassificationListId = $itemClassificationListId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ?string
|
|
||||||
*/
|
|
||||||
public function getItemClassificationListVersionId(): ?string
|
|
||||||
{
|
|
||||||
return $this->itemClassificationListVersionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?string $itemClassificationListVersionId
|
|
||||||
* @return CommodityClassification
|
|
||||||
*/
|
|
||||||
public function setItemClassificationListVersionId(?string $itemClassificationListVersionId): CommodityClassification
|
|
||||||
{
|
|
||||||
$this->itemClassificationListVersionId = $itemClassificationListVersionId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$attributes = [
|
|
||||||
'listID' => $this->itemClassificationListId ?? '',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!empty($this->itemClassificationListVersionId)) {
|
|
||||||
$attributes['listVersionID'] = $this->itemClassificationListVersionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'ItemClassificationCode',
|
|
||||||
'value' => $this->itemClassificationCode ?? '',
|
|
||||||
'attributes' => $attributes
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
144
vendor/num-num/ubl-invoice/src/Contact.php
vendored
144
vendor/num-num/ubl-invoice/src/Contact.php
vendored
|
|
@ -1,144 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class Contact implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $name;
|
|
||||||
private $telephone;
|
|
||||||
private $telefax;
|
|
||||||
private $electronicMail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return Contact
|
|
||||||
*/
|
|
||||||
public function setId(string $id): Contact
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $name
|
|
||||||
* @return Contact
|
|
||||||
*/
|
|
||||||
public function setName($name): Contact
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTelephone(): ?string
|
|
||||||
{
|
|
||||||
return $this->telephone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $telephone
|
|
||||||
* @return Contact
|
|
||||||
*/
|
|
||||||
public function setTelephone(?string $telephone): Contact
|
|
||||||
{
|
|
||||||
$this->telephone = $telephone;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTelefax(): ?string
|
|
||||||
{
|
|
||||||
return $this->telefax;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $telefax
|
|
||||||
* @return Contact
|
|
||||||
*/
|
|
||||||
public function setTelefax(?string $telefax): Contact
|
|
||||||
{
|
|
||||||
$this->telefax = $telefax;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getElectronicMail(): ?string
|
|
||||||
{
|
|
||||||
return $this->electronicMail;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $electronicMail
|
|
||||||
* @return Contact
|
|
||||||
*/
|
|
||||||
public function setElectronicMail(?string $electronicMail): Contact
|
|
||||||
{
|
|
||||||
$this->electronicMail = $electronicMail;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->id !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ID' => $this->id
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->name !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Name' => $this->name
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->telephone !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Telephone' => $this->telephone
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->telefax !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Telefax' => $this->telefax
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->electronicMail !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ElectronicMail' => $this->electronicMail
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class ContractDocumentReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return ContractDocumentReference
|
|
||||||
*/
|
|
||||||
public function setId(string $id): ContractDocumentReference
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->id !== null) {
|
|
||||||
$writer->write([ Schema::CBC . 'ID' => $this->id ]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
69
vendor/num-num/ubl-invoice/src/Country.php
vendored
69
vendor/num-num/ubl-invoice/src/Country.php
vendored
|
|
@ -1,69 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class Country implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $identificationCode;
|
|
||||||
private $listId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getIdentificationCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->identificationCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $identificationCode
|
|
||||||
* @return Country
|
|
||||||
*/
|
|
||||||
public function setIdentificationCode(?string $identificationCode): Country
|
|
||||||
{
|
|
||||||
$this->identificationCode = $identificationCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getListId(): ?string
|
|
||||||
{
|
|
||||||
return $this->listId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $listId
|
|
||||||
* @return Country
|
|
||||||
*/
|
|
||||||
public function setListId(?string $listId): Country
|
|
||||||
{
|
|
||||||
$this->listId = $listId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$attributes = [];
|
|
||||||
|
|
||||||
if (!empty($this->listId)) {
|
|
||||||
$attributes['listID'] = 'ISO3166-1:Alpha2';
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'IdentificationCode',
|
|
||||||
'value' => $this->identificationCode,
|
|
||||||
'attributes' => $attributes
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
30
vendor/num-num/ubl-invoice/src/CreditNote.php
vendored
30
vendor/num-num/ubl-invoice/src/CreditNote.php
vendored
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class CreditNote extends Invoice implements XmlSerializable
|
|
||||||
{
|
|
||||||
public $xmlTagName = 'CreditNote';
|
|
||||||
protected $invoiceTypeCode = InvoiceTypeCode::CREDIT_NOTE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return CreditNoteLine[]
|
|
||||||
*/
|
|
||||||
public function getCreditNoteLines(): ?array
|
|
||||||
{
|
|
||||||
return $this->invoiceLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param CreditNoteLine[] $creditNoteLines
|
|
||||||
* @return CreditNote
|
|
||||||
*/
|
|
||||||
public function setCreditNoteLines(array $creditNoteLines): CreditNote
|
|
||||||
{
|
|
||||||
$this->invoiceLines = $creditNoteLines;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
class CreditNoteLine extends InvoiceLine
|
|
||||||
{
|
|
||||||
public $xmlTagName = 'CreditNoteLine';
|
|
||||||
protected $isCreditNoteLine = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getCreditedQuantity(): ?float
|
|
||||||
{
|
|
||||||
return $this->invoicedQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?float $creditedQuantity
|
|
||||||
* @return CreditNoteLine
|
|
||||||
*/
|
|
||||||
public function setCreditedQuantity(?float $creditedQuantity): CreditNoteLine
|
|
||||||
{
|
|
||||||
$this->invoicedQuantity = $creditedQuantity;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
93
vendor/num-num/ubl-invoice/src/Delivery.php
vendored
93
vendor/num-num/ubl-invoice/src/Delivery.php
vendored
|
|
@ -1,93 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
use DateTime;
|
|
||||||
|
|
||||||
class Delivery implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $actualDeliveryDate;
|
|
||||||
private $deliveryLocation;
|
|
||||||
private $deliveryParty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getActualDeliveryDate()
|
|
||||||
{
|
|
||||||
return $this->actualDeliveryDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $actualDeliveryDate
|
|
||||||
* @return Delivery
|
|
||||||
*/
|
|
||||||
public function setActualDeliveryDate($actualDeliveryDate): Delivery
|
|
||||||
{
|
|
||||||
$this->actualDeliveryDate = $actualDeliveryDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function getDeliveryLocation()
|
|
||||||
{
|
|
||||||
return $this->deliveryLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Address $deliveryLocation
|
|
||||||
* @return Delivery
|
|
||||||
*/
|
|
||||||
public function setDeliveryLocation($deliveryLocation): Delivery
|
|
||||||
{
|
|
||||||
$this->deliveryLocation = $deliveryLocation;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function getDeliveryParty()
|
|
||||||
{
|
|
||||||
return $this->deliveryParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Party $deliveryParty
|
|
||||||
* @return Delivery
|
|
||||||
*/
|
|
||||||
public function setDeliveryParty($deliveryParty): Delivery
|
|
||||||
{
|
|
||||||
$this->deliveryParty = $deliveryParty;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->actualDeliveryDate != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ActualDeliveryDate' => $this->actualDeliveryDate->format('Y-m-d')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->deliveryLocation != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'DeliveryLocation' => [ Schema::CAC . 'Address' => $this->deliveryLocation ]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->deliveryParty != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'DeliveryParty' => $this->deliveryParty
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
109
vendor/num-num/ubl-invoice/src/EASCode.php
vendored
109
vendor/num-num/ubl-invoice/src/EASCode.php
vendored
|
|
@ -1,109 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible ICD Identificiation Codes that can be used
|
|
||||||
* To extend, see also:
|
|
||||||
* https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
|
|
||||||
* https://docs.peppol.eu/edelivery/codelists/v7.4/Peppol%20Code%20Lists%20-%20Participant%20identifier%20schemes%20v7.4.html
|
|
||||||
*/
|
|
||||||
class EASCode
|
|
||||||
{
|
|
||||||
const SIRENE = "0002";
|
|
||||||
const ORGANISATIONSNUMMER = "0007";
|
|
||||||
const SIRET_CODE = "0009";
|
|
||||||
const LY_TUNNUS = "0037";
|
|
||||||
const DUNS_NUMBER = "0060";
|
|
||||||
const EAN_LOCATION_CODE = "0088";
|
|
||||||
const DANISH_CHAMBER_OF_COMMERCE_SCHEME_EDIRA = "0096";
|
|
||||||
const FTI_EDIFORUM_ITALIA_EDIRA = "0097";
|
|
||||||
const KVK_NETHERLANDS_EDIRA = "0106";
|
|
||||||
const DIRECTORATES_OF_THE_EUROPEAN_COMMISSION = "0130";
|
|
||||||
const SIA_OBJECT_IDENTIFIERS = "0135";
|
|
||||||
const SECETI_OBJECT_IDENTIFIERS = "0142";
|
|
||||||
const AUSTRALIAN_BUSINESS_NUMBER_SCHEME = "0151";
|
|
||||||
const SWISS_UIDB = "0183";
|
|
||||||
const DIGSTORG = "0184";
|
|
||||||
const CORPORATE_NUMBER_OF_THE_SOCIAL_SECURITY_AND_TAX_NUMBER_SYSTEM = "0188";
|
|
||||||
const DUTCH_ORIGINATOR_IDENTIFICATION_NUMBER = "0190";
|
|
||||||
const CENTRE_OF_REGISTERS_AND_INFORMATION_SYSTEMS_OF_THE_MINISTRY_OF_JUSTICE = "0191";
|
|
||||||
const ENHETSREGISTERET_VED_BRONNOYSUNDREGISTERNE = "0192";
|
|
||||||
const UBL_BE_PARTY_IDENTIFIER = "0193";
|
|
||||||
const SINGAPORE_UEN_IDENTIFIER = "0195";
|
|
||||||
const ICELAND_LEGAL_ID_FOR_INDIVIDUALS_AND_LEGAL_ENTITIES = "0196";
|
|
||||||
const ERSTORG = "0198";
|
|
||||||
const LEGAL_ENTITY_IDENTIFIER_LEI = "0199";
|
|
||||||
const LEGAL_ENTITY_CODE_LITHUANIA = "0200";
|
|
||||||
const CODICE_UNIVOCO_UNITÀ_ORGANIZZATIVA_IPA = "0201";
|
|
||||||
const INDIRIZZO_DI_POSTA_ELETTRONICA_CERTIFICATA = "0202";
|
|
||||||
const LEITWEG_ID = "0204";
|
|
||||||
const ENTERPRISE_NUMBER = "0208";
|
|
||||||
const GS1_IDENTIFICATION_KEYS = "0209";
|
|
||||||
const CODICE_FISCALE = "0210";
|
|
||||||
const PARTITA_IVA = "0211";
|
|
||||||
const FINNISH_ORGANIZATION_IDENTIFIER = "0212";
|
|
||||||
const FINNISH_ORGANIZATION_VALUE_ADD_TAX_IDENTIFIER = "0213";
|
|
||||||
const NET_SERVICE_ID = "0215";
|
|
||||||
const OVTCODE = "0216";
|
|
||||||
const REGISTERED_NUMBER_OF_THE_QUALIFIED_INVOICE_ISSUER_JAPAN = "0221";
|
|
||||||
const NATIONAL_EINVOICING_FRAMEWORK_MALAYSIA = "0230";
|
|
||||||
const DANISH_MINISTRY_OF_THE_INTERIOR_AND_HEALTH = "9901";
|
|
||||||
/** @deprecated */
|
|
||||||
const NORWEGIAN_VAT_NUMBER = "9909";
|
|
||||||
const HUNGARY_VAT_NUMBER = "9910";
|
|
||||||
/** @deprecated */
|
|
||||||
const NATIONAL_MINISTRIES_OF_ECONOMY = "9912";
|
|
||||||
const BUSINESS_REGISTERS_NETWORK = "9913";
|
|
||||||
const ÖSTERREICHISCHE_UMSATZSTEUER_IDENTIFIKATIONSNUMMER = "9914";
|
|
||||||
const ÖSTERREICHISCHES_VERWALTUNGS_BZW_ORGANISATIONSKENNZEICHEN = "9915";
|
|
||||||
/** @deprecated */
|
|
||||||
const FIRMENIDENTIFIKATIONSNUMMER_AUSTRIA = "9916";
|
|
||||||
/** @deprecated */
|
|
||||||
const ICELANDIC_NATIONAL_REGISTRY = "9917";
|
|
||||||
const SOCIETY_FOR_WORLDWIDE_INTERBANK_FINANCIAL_TELECOMMUNICATION_SWIFT = "9918";
|
|
||||||
const KENNZIFFER_DES_UNTERNEHMENSREGISTERS = "9919";
|
|
||||||
const AGENCIA_ESPAÑOLA_DE_ADMINISTRACIÓN_TRIBUTARIA = "9920";
|
|
||||||
/** @deprecated */
|
|
||||||
const INDICE_DELLE_PUBBLICHE_AMMINISTRAZIONI_ITALIA = "9921";
|
|
||||||
const ANDORRA_VATNUMBER = "9922";
|
|
||||||
const ALBANIA_VATNUMBER = "9923";
|
|
||||||
const BOSNIA_AND_HERZEGOVINA_VATNUMBER = "9924";
|
|
||||||
const BELGIUM_VATNUMBER = "9925";
|
|
||||||
const BULGARIA_VATNUMBER = "9926";
|
|
||||||
const SWITZERLAND_VATNUMBER = "9927";
|
|
||||||
const CYPRUS_VATNUMBER = "9928";
|
|
||||||
const CZECH_REPUBLIC_VATNUMBER = "9929";
|
|
||||||
const GERMANY_VATNUMBER = "9930";
|
|
||||||
const ESTONIA_VATNUMBER = "9931";
|
|
||||||
const UNITED_KINGDOM_VATNUMBER = "9932";
|
|
||||||
const GREECE_VATNUMBER = "9933";
|
|
||||||
const CROATIA_VATNUMBER = "9934";
|
|
||||||
const IRELAND_VATNUMBER = "9935";
|
|
||||||
const LIECHTENSTEIN_VATNUMBER = "9936";
|
|
||||||
const LITHUANIA_VATNUMBER = "9937";
|
|
||||||
const LUXEMBURG_VATNUMBER = "9938";
|
|
||||||
const LATVIA_VATNUMBER = "9939";
|
|
||||||
const MONACO_VATNUMBER = "9940";
|
|
||||||
const MONTENEGRO_VATNUMBER = "9941";
|
|
||||||
const MACEDONIA_VATNUMBER = "9942";
|
|
||||||
const MALTA_VATNUMBER = "9943";
|
|
||||||
const NETHERLANDS_VATNUMBER = "9944";
|
|
||||||
const POLAND_VATNUMBER = "9945";
|
|
||||||
const PORTUGAL_VATNUMBER = "9946";
|
|
||||||
const ROMANIA_VATNUMBER = "9947";
|
|
||||||
const SERBIA_VATNUMBER = "9948";
|
|
||||||
const SLOVENIA_VATNUMBER = "9949";
|
|
||||||
const SLOVAKIA_VATNUMBER = "9950";
|
|
||||||
const SAN_MARINO_VATNUMBER = "9951";
|
|
||||||
const TURKEY_VATNUMBER = "9952";
|
|
||||||
const VATICAN_VATNUMBER = "9953";
|
|
||||||
/** @deprecated */
|
|
||||||
const DUTCH_ORIGINATORS_IDENTIFICATION_NUMBER = "9954";
|
|
||||||
/** @deprecated */
|
|
||||||
const BELGIAN_CROSSROAD_BANK_OF_ENTERPRISE_NUMBER = "9956";
|
|
||||||
const FRANCE_VATNUMBER = "9957";
|
|
||||||
/** @deprecated */
|
|
||||||
const GERMAN_LEITWEG_ID = "9958";
|
|
||||||
const EIN_USA_EMPLOYER_IDENTIFICATION_NUMBER = "9959";
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class FinancialInstitutionBranch implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return FinancialInstitutionBranch
|
|
||||||
*/
|
|
||||||
public function setId(?string $id): FinancialInstitutionBranch
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ID' => $this->id
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
44
vendor/num-num/ubl-invoice/src/Generator.php
vendored
44
vendor/num-num/ubl-invoice/src/Generator.php
vendored
|
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Service;
|
|
||||||
|
|
||||||
class Generator
|
|
||||||
{
|
|
||||||
public static $currencyID;
|
|
||||||
|
|
||||||
public static function invoice(Invoice $invoice, $currencyId = 'EUR')
|
|
||||||
{
|
|
||||||
self::$currencyID = $currencyId;
|
|
||||||
|
|
||||||
$xmlService = new Service();
|
|
||||||
|
|
||||||
$xmlService->namespaceMap = [
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:' . $invoice->xmlTagName . '-2' => '',
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc',
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac'
|
|
||||||
];
|
|
||||||
|
|
||||||
return $xmlService->write($invoice->xmlTagName, [
|
|
||||||
$invoice
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function creditNote(CreditNote $creditNote, $currencyId = 'EUR')
|
|
||||||
{
|
|
||||||
self::$currencyID = $currencyId;
|
|
||||||
|
|
||||||
$xmlService = new Service();
|
|
||||||
|
|
||||||
$xmlService->namespaceMap = [
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:' . $creditNote->xmlTagName . '-2' => '',
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc',
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac'
|
|
||||||
];
|
|
||||||
|
|
||||||
return $xmlService->write($creditNote->xmlTagName, [
|
|
||||||
$creditNote
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
244
vendor/num-num/ubl-invoice/src/ICDCode.php
vendored
244
vendor/num-num/ubl-invoice/src/ICDCode.php
vendored
|
|
@ -1,244 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible ICD Identificiation Codes that can be used
|
|
||||||
* To extend, see also: https://docs.peppol.eu/poacc/billing/3.0/codelist/ICD/
|
|
||||||
*/
|
|
||||||
class ICDCode
|
|
||||||
{
|
|
||||||
public const SIRENE = "0002";
|
|
||||||
public const BELGIAN_FINANCIAL_INSTITUTIONS = "0003";
|
|
||||||
public const NBS_OSI_NETWORK = "0004";
|
|
||||||
public const USA_FED_GOV_OSI_NETWORK = "0005";
|
|
||||||
public const USA_DOD_OSI_NETWORK = "0006";
|
|
||||||
public const ORGANISATIONSNUMMER = "0007";
|
|
||||||
public const LE_NUMERO_NATIONAL = "0008";
|
|
||||||
public const SIRET_CODE = "0009";
|
|
||||||
public const ORGANIZATIONAL_IDENTIFIERS = "0010";
|
|
||||||
public const OSI_AMATEUR_RADIO_ORGANIZATIONS = "0011";
|
|
||||||
public const EUROPEAN_COMPUTER_MANUFACTURERS_ASSOCIATION = "0012";
|
|
||||||
public const VSA_FTP_CODE = "0013";
|
|
||||||
public const NIST_OSI_IMPLEMENTERS_WORKSHOP = "0014";
|
|
||||||
public const ELECTRONIC_DATA_INTERCHANGE = "0015";
|
|
||||||
public const EWOS_OBJECT_IDENTIFIERS = "0016";
|
|
||||||
public const COMMON_LANGUAGE = "0017";
|
|
||||||
public const SNA_OSI_NETWORK = "0018";
|
|
||||||
public const AIR_TRANSPORT_INDUSTRY_SERVICES = "0019";
|
|
||||||
public const EUROPEAN_LABORATORY_FOR_PARTICLE_PHYSICS = "0020";
|
|
||||||
public const SOCIETY_FOR_WORLDWIDE_INTERBANK_FINANCIAL_TELECOMMUNICATION = "0021";
|
|
||||||
public const OSF_DISTRIBUTED_COMPUTING_OBJECT_IDENTIFICATION = "0022";
|
|
||||||
public const NORDUNET = "0023";
|
|
||||||
public const DIGITAL_EQUIPMENT_CORPORATION_DEC = "0024";
|
|
||||||
public const OSI_ASIA_OCEANIA_WORKSHOP = "0025";
|
|
||||||
public const NATO_ISO_6523_ICDE = "0026";
|
|
||||||
public const AERONAUTICAL_TELECOMMUNICATIONS_NETWORK_ATN = "0027";
|
|
||||||
public const INTERNATIONAL_STANDARD_ISO_6523 = "0028";
|
|
||||||
public const ALL_UNION_CLASSIFIER_ENTERPRISES_ORGANISATIONS = "0029";
|
|
||||||
public const ATT_OSI_NETWORK = "0030";
|
|
||||||
public const EDI_PARTNER_IDENTIFICATION_CODE = "0031";
|
|
||||||
public const TELECOM_AUSTRALIA = "0032";
|
|
||||||
public const SGW_OSI_INTERNETWORK = "0033";
|
|
||||||
public const REUTER_OPEN_ADDRESS_STANDARD = "0034";
|
|
||||||
public const ISO_6523_ICD_BP = "0035";
|
|
||||||
public const TELETRUST_OBJECT_IDENTIFIERS = "0036";
|
|
||||||
public const LY_TUNNUS = "0037";
|
|
||||||
public const AUSTRALIAN_GOSIP_NETWORK = "0038";
|
|
||||||
public const OZ_DOD_OSI_NETWORK = "0039";
|
|
||||||
public const UNILEVER_GROUP_COMPANIES = "0040";
|
|
||||||
public const CITICORP_GLOBAL_INFORMATION_NETWORK = "0041";
|
|
||||||
public const DBP_TELEKOM_OBJECT_IDENTIFIERS = "0042";
|
|
||||||
public const HYDRONETT = "0043";
|
|
||||||
public const THAI_INDUSTRIAL_STANDARDS_INSTITUTE_TISI = "0044";
|
|
||||||
public const ICI_COMPANY_IDENTIFICATION_SYSTEM = "0045";
|
|
||||||
public const FUNLOC = "0046";
|
|
||||||
public const BULL_ODI_DSA_UNIX_NETWORK = "0047";
|
|
||||||
public const OSINZ = "0048";
|
|
||||||
public const AUCKLAND_AREA_HEALTH = "0049";
|
|
||||||
public const FIRMENICH = "0050";
|
|
||||||
public const AGFA_DIS = "0051";
|
|
||||||
public const SMPTE = "0052";
|
|
||||||
public const MIGROS_NETWORK_M_NETOPZ = "0053";
|
|
||||||
public const ISO6523_ICDPCR = "0054";
|
|
||||||
public const ENERGY_NET = "0055";
|
|
||||||
public const NOKIA_OBJECT_IDENTIFIERS_NOI = "0056";
|
|
||||||
public const SAINT_GOBAIN = "0057";
|
|
||||||
public const SIEMENS_CORPORATE_NETWORK = "0058";
|
|
||||||
public const DANZNET = "0059";
|
|
||||||
public const DUNS = "0060";
|
|
||||||
public const SOFFEX_OSI = "0061";
|
|
||||||
public const KPN_OVN = "0062";
|
|
||||||
public const ASCOMOSINET = "0063";
|
|
||||||
public const UTC_UNIFORME_TRANSPORT_CODE = "0064";
|
|
||||||
public const SOLVAY_OSI_CODING = "0065";
|
|
||||||
public const ROCHE_CORPORATE_NETWORK = "0066";
|
|
||||||
public const ZELLWEGEROSINET = "0067";
|
|
||||||
public const INTEL_CORPORATION_OSI = "0068";
|
|
||||||
public const SITA_OBJECT_IDENTIFIER_TREE = "0069";
|
|
||||||
public const DAIMLERCHRYSLER_CORPORATE_NETWORK = "0070";
|
|
||||||
public const LEGO_OSI_NETWORK = "0071";
|
|
||||||
public const NAVISTAR_OSI_NETWORK = "0072";
|
|
||||||
public const ICD_FORMATTED_ATM_ADDRESS = "0073";
|
|
||||||
public const ARINC = "0074";
|
|
||||||
public const ALCANET_ALCATEL_ALSTHOM_CORPORATE_NETWORK = "0075";
|
|
||||||
public const SISTEMA_ITALIANO_UNINFO = "0076";
|
|
||||||
public const SISTEMA_ITALIANO_UNINFO_NETWORK = "0077";
|
|
||||||
public const MITEL_TERMINAL_SWITCHING_EQUIPMENT = "0078";
|
|
||||||
public const ATM_FORUM = "0079";
|
|
||||||
public const UK_NATIONAL_HEALTH_SERVICE_SCHEME = "0080";
|
|
||||||
public const INTERNATIONAL_NSAP = "0081";
|
|
||||||
public const NORWEGIAN_TELECOMMUNICATIONS_AUTHORITY = "0082";
|
|
||||||
public const ATM_LTD_CORPORATE_NETWORK = "0083";
|
|
||||||
public const ATHENS_CHAMBER_OF_COMMERCE = "0084";
|
|
||||||
public const SWISS_CHAMBERS_OF_COMMERCE = "0085";
|
|
||||||
public const USCIB = "0086";
|
|
||||||
public const BELGIAN_CHAMBERS_OF_COMMERCE = "0087";
|
|
||||||
public const EAN_LOCATION_CODE = "0088";
|
|
||||||
public const BRITISH_CHAMBERS_OF_COMMERCE = "0089";
|
|
||||||
public const INTERNET_IP_ADDRESSING = "0090";
|
|
||||||
public const CISCO_SYSTEMS_OSI_NETWORK = "0091";
|
|
||||||
public const CODE_0093 = "0093";
|
|
||||||
public const DEUTSCHER_INDUSTRIE_UND_HANDELSTAG = "0094";
|
|
||||||
public const HEWLETT_PACKARD_COMPANY_INTERNAL_AM_NETWORK = "0095";
|
|
||||||
public const DANISH_CHAMBER_OF_COMMERCE = "0096";
|
|
||||||
public const FTI_EDIFORUM_ITALIA = "0097";
|
|
||||||
public const CHAMBER_OF_COMMERCE_TEL_AVIV_JAFFA = "0098";
|
|
||||||
public const SIEMENS_SUPERVISORY_SYSTEMS_NETWORK = "0099";
|
|
||||||
public const PNG_ICD_SCHEME = "0100";
|
|
||||||
public const SOUTH_AFRICAN_CODE_ALLOCATION = "0101";
|
|
||||||
public const HEAG = "0102";
|
|
||||||
public const CODE_0104 = "0104";
|
|
||||||
public const PORTUGUESE_CHAMBER_OF_COMMERCE = "0105";
|
|
||||||
public const DUTCH_CHAMBER_OF_COMMERCE = "0106";
|
|
||||||
public const SWEDISH_CHAMBERS_OF_COMMERCE = "0107";
|
|
||||||
public const AUSTRALIAN_CHAMBERS_OF_COMMERCE = "0108";
|
|
||||||
public const BELLSOUTH_ICD_AESA = "0109";
|
|
||||||
public const BELL_ATLANTIC = "0110";
|
|
||||||
public const OBJECT_IDENTIFIERS_IEEE = "0111";
|
|
||||||
public const ISO_REGISTER_FOR_STANDARDS_PRODUCING_ORGANIZATIONS = "0112";
|
|
||||||
public const ORIGINNET = "0113";
|
|
||||||
public const CHECK_POINT_SOFTWARE_TECHNOLOGIES = "0114";
|
|
||||||
public const PACIFIC_BELL_DATA_COMMUNICATIONS_NETWORK = "0115";
|
|
||||||
public const PSS_OBJECT_IDENTIFIERS = "0116";
|
|
||||||
public const STENTOR_ICD_CODING_SYSTEM = "0117";
|
|
||||||
public const ATM_NETWORK_ZN96 = "0118";
|
|
||||||
public const MCI_OSI_NETWORK = "0119";
|
|
||||||
public const ADVANTIS = "0120";
|
|
||||||
public const AFFABLE_SOFTWARE_DATA_INTERCHANGE_CODES = "0121";
|
|
||||||
public const BB_DATA_GMBH = "0122";
|
|
||||||
public const BASF_COMPANY_ATM_NETWORK = "0123";
|
|
||||||
public const IOTA_IDENTIFIERS_FOR_ORGANIZATIONS = "0124";
|
|
||||||
public const HENKEL_CORPORATE_NETWORK = "0125";
|
|
||||||
public const GTE_OSI_NETWORK = "0126";
|
|
||||||
public const DRESDNER_BANK_CORPORATE_NETWORK = "0127";
|
|
||||||
public const BCNR_SWISS_CLEARING_BANK_NUMBER = "0128";
|
|
||||||
public const BPI_SWISS_BUSINESS_PARTNER_IDENTIFICATION = "0129";
|
|
||||||
public const DIRECTORATES_OF_THE_EUROPEAN_COMMISSION = "0130";
|
|
||||||
public const CHINA_NATIONAL_ORGANIZATION_CODE = "0131";
|
|
||||||
public const CERTICOM_OBJECT_IDENTIFIERS = "0132";
|
|
||||||
public const TC68_OID = "0133";
|
|
||||||
public const INFONET_SERVICES_CORPORATION = "0134";
|
|
||||||
public const SIA_OBJECT_IDENTIFIERS = "0135";
|
|
||||||
public const CABLE_WIRELESS_GLOBAL_ATM_END_SYSTEM_ADDRESS_PLAN = "0136";
|
|
||||||
public const GLOBAL_AESA_SCHEME = "0137";
|
|
||||||
public const FRANCE_TELECOM_ATM_END_SYSTEM_ADDRESS_PLAN = "0138";
|
|
||||||
public const SAVVIS_COMMUNICATIONS_AESA = "0139";
|
|
||||||
public const TOSHIBA_TOPAS_CODE = "0140";
|
|
||||||
public const NATO_COMMERCIAL_AND_GOV_ENTITY_SYSTEM = "0141";
|
|
||||||
public const SECETI_OBJECT_IDENTIFIERS = "0142";
|
|
||||||
public const EINSTEINET_AG = "0143";
|
|
||||||
public const DODAAC = "0144";
|
|
||||||
public const DGCP_ADMINISTRATIVE_ACCOUNTING_IDENTIFICATION = "0145";
|
|
||||||
public const DGI_CODE = "0146";
|
|
||||||
public const STANDARD_COMPANY_CODE = "0147";
|
|
||||||
public const ITU_DATA_NETWORK_IDENTIFICATION_CODES = "0148";
|
|
||||||
public const GLOBAL_BUSINESS_IDENTIFIER = "0149";
|
|
||||||
public const MADGE_NETWORKS_ICD_ATM_ADDRESSING = "0150";
|
|
||||||
public const AUSTRALIAN_BUSINESS_NUMBER_ABN = "0151";
|
|
||||||
public const EDIRA_SCHEME_IDENTIFIER_CODE = "0152";
|
|
||||||
public const CONCERT_GLOBAL_NETWORK_SERVICES_ICD_AESA = "0153";
|
|
||||||
public const CZECH_ICO_IDENTIFICATION_NUMBER = "0154";
|
|
||||||
public const GLOBAL_CROSSING_AESA = "0155";
|
|
||||||
public const AUNA = "0156";
|
|
||||||
public const ATM_INTERCONNECTION_KPN_TELECOM = "0157";
|
|
||||||
public const SLOVAK_ICO_IDENTIFICATION_NUMBER = "0158";
|
|
||||||
public const ACTALIS_OBJECT_IDENTIFIERS = "0159";
|
|
||||||
public const GTIN_GLOBAL_TRADE_ITEM_NUMBER = "0160";
|
|
||||||
public const ECCMA_OPEN_TECHNICAL_DIRECTORY = "0161";
|
|
||||||
public const CEN_ISSS_OBJECT_IDENTIFIER_SCHEME = "0162";
|
|
||||||
public const US_EPA_FACILITY_IDENTIFIER = "0163";
|
|
||||||
public const TELUS_CORPORATION = "0164";
|
|
||||||
public const FIEIE_OBJECT_IDENTIFIERS = "0165";
|
|
||||||
public const SWISSGUIDE_IDENTIFIER_SCHEME = "0166";
|
|
||||||
public const PRIORITY_TELECOM_ATM_END_SYSTEM_ADDRESS_PLAN = "0167";
|
|
||||||
public const VODAFONE_IRELAND_OSI_ADDRESSING = "0168";
|
|
||||||
public const SWISS_FEDERAL_BUSINESS_IDENTIFICATION_NUMBER = "0169";
|
|
||||||
public const TEIKOKU_COMPANY_CODE = "0170";
|
|
||||||
public const LUXEMBOURG_CP_CPS_INDEX = "0171";
|
|
||||||
public const PROLIST = "0172";
|
|
||||||
public const ECLASS = "0173";
|
|
||||||
public const STEPNEXUS = "0174";
|
|
||||||
public const SIEMENS_AG = "0175";
|
|
||||||
public const PARADINE_GMBH = "0176";
|
|
||||||
public const ODETTE_INTERNATIONAL = "0177";
|
|
||||||
public const ROUTE1_MOBINET = "0178";
|
|
||||||
public const PENANGO_OBJECT_IDENTIFIERS = "0179";
|
|
||||||
public const LITHUANIAN_MILITARY_PKI = "0180";
|
|
||||||
public const SWISS_UNIQUE_BUSINESS_IDENTIFICATION_NUMBER = "0183";
|
|
||||||
public const DIGSTORG = "0184";
|
|
||||||
public const PERCEVAL_OBJECT_CODE = "0185";
|
|
||||||
public const TRUSTPOINT_OBJECT_IDENTIFIERS = "0186";
|
|
||||||
public const AMAZON_UNIQUE_IDENTIFICATION_SCHEME = "0187";
|
|
||||||
public const JAPAN_CORPORATE_NUMBER = "0188";
|
|
||||||
public const EUROPEAN_BUSINESS_IDENTIFIER_EBID = "0189";
|
|
||||||
public const ORGANISATIE_IDENTIFICATIE_NUMMER_OIN = "0190";
|
|
||||||
public const ESTONIA_COMPANY_CODE = "0191";
|
|
||||||
public const NORWAY_ORGANISASJONSNUMMER = "0192";
|
|
||||||
public const UBL_BE_PARTY_IDENTIFIER = "0193";
|
|
||||||
public const KOIOS_OPEN_TECHNICAL_DICTIONARY = "0194";
|
|
||||||
public const SINGAPORE_NATIONWIDE_EINVOICE_FRAMEWORK = "0195";
|
|
||||||
public const ICELANDIC_IDENTIFIER = "0196";
|
|
||||||
public const APPLIA_PI_STANDARD = "0197";
|
|
||||||
public const ERSTORG = "0198";
|
|
||||||
public const LEGAL_ENTITY_IDENTIFIER_LEI = "0199";
|
|
||||||
public const LEGAL_ENTITY_CODE_LITHUANIA = "0200";
|
|
||||||
public const CODICE_UNIVOCO_UNITA_ORGANIZZATIVA_IPA = "0201";
|
|
||||||
public const INDIRIZZO_POSTA_ELETTRONICA_CERTIFICATA = "0202";
|
|
||||||
public const EDELIVERY_NETWORK_PARTICIPANT_IDENTIFIER = "0203";
|
|
||||||
public const LEITWEG_ID = "0204";
|
|
||||||
public const CODDEST = "0205";
|
|
||||||
public const REGISTRE_DU_COMMERCE_ET_DE_L_INDUSTRIE_RCI = "0206";
|
|
||||||
public const PILOG_ONTOLOGY_CODIFICATION_IDENTIFIER_POCI = "0207";
|
|
||||||
public const ENTERPRISE_NUMBER = "0208";
|
|
||||||
public const CODE_0209 = "0209";
|
|
||||||
public const CODICE_FISCALE = "0210";
|
|
||||||
public const PARTITA_IVA = "0211";
|
|
||||||
public const FINNISH_ORGANIZATION_IDENTIFIER = "0212";
|
|
||||||
public const FINNISH_ORGANIZATION_VAT_IDENTIFIER = "0213";
|
|
||||||
public const TRADEPLACE_TRADEPI_STANDARD = "0214";
|
|
||||||
public const NET_SERVICE_ID = "0215";
|
|
||||||
public const OVTCODE = "0216";
|
|
||||||
public const NETHERLANDS_CHAMBER_OF_COMMERCE_ESTABLISHMENT_NUMBER = "0217";
|
|
||||||
public const UNIFIED_REGISTRATION_NUMBER_LATVIA = "0218";
|
|
||||||
public const TAXPAYER_REGISTRATION_CODE_LATVIA = "0219";
|
|
||||||
public const REGISTER_OF_NATURAL_PERSONS_LATVIA = "0220";
|
|
||||||
public const QUALIFIED_INVOICE_ISSUER_NUMBER_JAPAN = "0221";
|
|
||||||
public const METADATA_REGISTRY_SUPPORT = "0222";
|
|
||||||
public const EU_BASED_COMPANY = "0223";
|
|
||||||
public const FTCTC_CODE_ROUTAGE = "0224";
|
|
||||||
public const FRCTC_ELECTRONIC_ADDRESS = "0225";
|
|
||||||
public const FRCTC_PARTICULIER = "0226";
|
|
||||||
public const NON_EU_BASED_COMPANY = "0227";
|
|
||||||
public const RIDET = "0228";
|
|
||||||
public const TAHITI = "0229";
|
|
||||||
public const NATIONAL_EINVOICING_FRAMEWORK_MALAYSIA = "0230";
|
|
||||||
public const SINGLE_TAXABLE_COMPANY_FRANCE = "0231";
|
|
||||||
public const NOBB_PRODUCT_NUMBER = "0232";
|
|
||||||
public const CODE_0233 = "0233";
|
|
||||||
public const TOIMITUSOSOITE_ID = "0234";
|
|
||||||
public const UAE_TAX_IDENTIFICATION_NUMBER = "0235";
|
|
||||||
public const CODE_0236 = "0236";
|
|
||||||
public const CPR_DANISH_PERSON_CIVIL_REGISTRATION_NUMBER = "0237";
|
|
||||||
public const PPF_PDP_EINVOICING_PLATFORM_FRANCE = "0238";
|
|
||||||
}
|
|
||||||
826
vendor/num-num/ubl-invoice/src/Invoice.php
vendored
826
vendor/num-num/ubl-invoice/src/Invoice.php
vendored
|
|
@ -1,826 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class Invoice implements XmlSerializable
|
|
||||||
{
|
|
||||||
public $xmlTagName = 'Invoice';
|
|
||||||
private $UBLVersionID = '2.1';
|
|
||||||
private $customizationID = '1.0';
|
|
||||||
private $profileID;
|
|
||||||
private $id;
|
|
||||||
private $copyIndicator;
|
|
||||||
private $issueDate;
|
|
||||||
protected $invoiceTypeCode = InvoiceTypeCode::INVOICE;
|
|
||||||
private $note;
|
|
||||||
private $taxPointDate;
|
|
||||||
private $dueDate;
|
|
||||||
private $paymentTerms;
|
|
||||||
private $accountingSupplierParty;
|
|
||||||
private $accountingCustomerParty;
|
|
||||||
private $accountingCustomerPartyContact;
|
|
||||||
private $payeeParty;
|
|
||||||
private $supplierAssignedAccountID;
|
|
||||||
/** @var PaymentMeans[] $paymentMeans */
|
|
||||||
private $paymentMeans;
|
|
||||||
private $taxTotal;
|
|
||||||
private $legalMonetaryTotal;
|
|
||||||
/** @var InvoiceLine[] $invoiceLines */
|
|
||||||
protected $invoiceLines;
|
|
||||||
private $allowanceCharges;
|
|
||||||
private $additionalDocumentReferences = [];
|
|
||||||
private $projectReference;
|
|
||||||
private $documentCurrencyCode = 'EUR';
|
|
||||||
private $buyerReference;
|
|
||||||
private $accountingCostCode;
|
|
||||||
private $invoicePeriod;
|
|
||||||
private $billingReference;
|
|
||||||
private $delivery;
|
|
||||||
private $orderReference;
|
|
||||||
private $contractDocumentReference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUBLVersionID(): ?string
|
|
||||||
{
|
|
||||||
return $this->UBLVersionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $UBLVersionID
|
|
||||||
* eg. '2.0', '2.1', '2.2', ...
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setUBLVersionID(?string $UBLVersionID): Invoice
|
|
||||||
{
|
|
||||||
$this->UBLVersionID = $UBLVersionID;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $id
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setId(?string $id): Invoice
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $customizationID
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setCustomizationID(?string $customizationID): Invoice
|
|
||||||
{
|
|
||||||
$this->customizationID = $customizationID;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $profileID
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setProfileID(?string $profileID): Invoice
|
|
||||||
{
|
|
||||||
$this->profileID = $profileID;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isCopyIndicator(): bool
|
|
||||||
{
|
|
||||||
return $this->copyIndicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bool $copyIndicator
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setCopyIndicator(bool $copyIndicator): Invoice
|
|
||||||
{
|
|
||||||
$this->copyIndicator = $copyIndicator;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getIssueDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->issueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $issueDate
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setIssueDate(DateTime $issueDate): Invoice
|
|
||||||
{
|
|
||||||
$this->issueDate = $issueDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getDueDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->dueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $dueDate
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setDueDate(DateTime $dueDate): Invoice
|
|
||||||
{
|
|
||||||
$this->dueDate = $dueDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $currencyCode
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setDocumentCurrencyCode(string $currencyCode = 'EUR'): Invoice
|
|
||||||
{
|
|
||||||
$this->documentCurrencyCode = $currencyCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getInvoiceTypeCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->invoiceTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $invoiceTypeCode
|
|
||||||
* See also: src/InvoiceTypeCode.php
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setInvoiceTypeCode(string $invoiceTypeCode): Invoice
|
|
||||||
{
|
|
||||||
$this->invoiceTypeCode = $invoiceTypeCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getNote()
|
|
||||||
{
|
|
||||||
return $this->note;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $note
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setNote(string $note)
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getTaxPointDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->taxPointDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $taxPointDate
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setTaxPointDate(DateTime $taxPointDate): Invoice
|
|
||||||
{
|
|
||||||
$this->taxPointDate = $taxPointDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return PaymentTerms
|
|
||||||
*/
|
|
||||||
public function getPaymentTerms(): ?PaymentTerms
|
|
||||||
{
|
|
||||||
return $this->paymentTerms;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PaymentTerms $paymentTerms
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setPaymentTerms(PaymentTerms $paymentTerms): Invoice
|
|
||||||
{
|
|
||||||
$this->paymentTerms = $paymentTerms;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function getAccountingSupplierParty(): ?Party
|
|
||||||
{
|
|
||||||
return $this->accountingSupplierParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Party $accountingSupplierParty
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAccountingSupplierParty(Party $accountingSupplierParty): Invoice
|
|
||||||
{
|
|
||||||
$this->accountingSupplierParty = $accountingSupplierParty;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function getSupplierAssignedAccountID(): ?string
|
|
||||||
{
|
|
||||||
return $this->supplierAssignedAccountID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $supplierAssignedAccountID
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setSupplierAssignedAccountID(string $supplierAssignedAccountID): Invoice
|
|
||||||
{
|
|
||||||
$this->supplierAssignedAccountID = $supplierAssignedAccountID;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function getAccountingCustomerParty(): ?Party
|
|
||||||
{
|
|
||||||
return $this->accountingCustomerParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Party $accountingCustomerParty
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAccountingCustomerParty(Party $accountingCustomerParty): Invoice
|
|
||||||
{
|
|
||||||
$this->accountingCustomerParty = $accountingCustomerParty;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ?Contact
|
|
||||||
*/
|
|
||||||
public function getAccountingCustomerPartyContact(): ?Contact
|
|
||||||
{
|
|
||||||
return $this->accountingCustomerPartyContact;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Contact $accountingCustomerPartyContact
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAccountingCustomerPartyContact(Contact $accountingCustomerPartyContact): Invoice
|
|
||||||
{
|
|
||||||
$this->accountingCustomerPartyContact = $accountingCustomerPartyContact;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function getPayeeParty(): ?Party
|
|
||||||
{
|
|
||||||
return $this->payeeParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Party $payeeParty
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setPayeeParty(Party $payeeParty): Invoice
|
|
||||||
{
|
|
||||||
$this->payeeParty = $payeeParty;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return PaymentMeans[]
|
|
||||||
*/
|
|
||||||
public function getPaymentMeans(): ?array
|
|
||||||
{
|
|
||||||
return $this->paymentMeans;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PaymentMeans[] $paymentMeans
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setPaymentMeans(array $paymentMeans): Invoice
|
|
||||||
{
|
|
||||||
$this->paymentMeans = $paymentMeans;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return TaxTotal
|
|
||||||
*/
|
|
||||||
public function getTaxTotal(): ?TaxTotal
|
|
||||||
{
|
|
||||||
return $this->taxTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxTotal $taxTotal
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setTaxTotal(TaxTotal $taxTotal): Invoice
|
|
||||||
{
|
|
||||||
$this->taxTotal = $taxTotal;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function getLegalMonetaryTotal(): ?LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
return $this->legalMonetaryTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LegalMonetaryTotal $legalMonetaryTotal
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setLegalMonetaryTotal(LegalMonetaryTotal $legalMonetaryTotal): Invoice
|
|
||||||
{
|
|
||||||
$this->legalMonetaryTotal = $legalMonetaryTotal;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return InvoiceLine[]
|
|
||||||
*/
|
|
||||||
public function getInvoiceLines(): ?array
|
|
||||||
{
|
|
||||||
return $this->invoiceLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param InvoiceLine[] $invoiceLines
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setInvoiceLines(array $invoiceLines): Invoice
|
|
||||||
{
|
|
||||||
$this->invoiceLines = $invoiceLines;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return AllowanceCharge[]
|
|
||||||
*/
|
|
||||||
public function getAllowanceCharges(): ?array
|
|
||||||
{
|
|
||||||
return $this->allowanceCharges;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AllowanceCharge[] $allowanceCharges
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAllowanceCharges(array $allowanceCharges): Invoice
|
|
||||||
{
|
|
||||||
$this->allowanceCharges = $allowanceCharges;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return AdditionalDocumentReference
|
|
||||||
* @deprecated Deprecated since v1.16 - Replace implementation with setAdditionalDocumentReference or addAdditionalDocumentReference to add/set a single AdditionalDocumentReference
|
|
||||||
*/
|
|
||||||
public function getAdditionalDocumentReference(): ?AdditionalDocumentReference
|
|
||||||
{
|
|
||||||
return $this->additionalDocumentReferences[0] ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<AdditionalDocumentReference>
|
|
||||||
*/
|
|
||||||
public function getAdditionalDocumentReferences(): array
|
|
||||||
{
|
|
||||||
return $this->additionalDocumentReferences ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AdditionalDocumentReference $additionalDocumentReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAdditionalDocumentReference(AdditionalDocumentReference $additionalDocumentReference): Invoice
|
|
||||||
{
|
|
||||||
$this->additionalDocumentReferences = [$additionalDocumentReference];
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AdditionalDocumentReference $additionalDocumentReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAdditionalDocumentReferences(array $additionalDocumentReference): Invoice
|
|
||||||
{
|
|
||||||
$this->additionalDocumentReferences = $additionalDocumentReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AdditionalDocumentReference $additionalDocumentReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function addAdditionalDocumentReference(AdditionalDocumentReference $additionalDocumentReference): Invoice
|
|
||||||
{
|
|
||||||
$this->additionalDocumentReferences[] = $additionalDocumentReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ProjectReference $projectReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setProjectReference(ProjectReference $projectReference): Invoice
|
|
||||||
{
|
|
||||||
$this->projectReference = $projectReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ProjectReference projectReference
|
|
||||||
*/
|
|
||||||
public function getProjectReference(): ?ProjectReference
|
|
||||||
{
|
|
||||||
return $this->projectReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $buyerReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setBuyerReference(string $buyerReference): Invoice
|
|
||||||
{
|
|
||||||
$this->buyerReference = $buyerReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string buyerReference
|
|
||||||
*/
|
|
||||||
public function getBuyerReference(): ?string
|
|
||||||
{
|
|
||||||
return $this->buyerReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getAccountingCostCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->accountingCostCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $accountingCostCode
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setAccountingCostCode(string $accountingCostCode): Invoice
|
|
||||||
{
|
|
||||||
$this->accountingCostCode = $accountingCostCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return InvoicePeriod
|
|
||||||
*/
|
|
||||||
public function getInvoicePeriod(): ?InvoicePeriod
|
|
||||||
{
|
|
||||||
return $this->invoicePeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param InvoicePeriod $invoicePeriod
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setInvoicePeriod(InvoicePeriod $invoicePeriod): Invoice
|
|
||||||
{
|
|
||||||
$this->invoicePeriod = $invoicePeriod;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the reference to the invoice that is being credited
|
|
||||||
*
|
|
||||||
* @return ?BillingReference
|
|
||||||
*/
|
|
||||||
public function getBillingReference(): ?BillingReference
|
|
||||||
{
|
|
||||||
return $this->billingReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the reference to the invoice that is being credited
|
|
||||||
*
|
|
||||||
* @return CreditNote
|
|
||||||
*/
|
|
||||||
public function setBillingReference($billingReference): CreditNote
|
|
||||||
{
|
|
||||||
$this->billingReference = $billingReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Delivery
|
|
||||||
*/
|
|
||||||
public function getDelivery(): ?Delivery
|
|
||||||
{
|
|
||||||
return $this->delivery;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Delivery $delivery
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setDelivery(Delivery $delivery): Invoice
|
|
||||||
{
|
|
||||||
$this->delivery = $delivery;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return OrderReference
|
|
||||||
*/
|
|
||||||
public function getOrderReference(): ?OrderReference
|
|
||||||
{
|
|
||||||
return $this->orderReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OrderReference $orderReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setOrderReference(OrderReference $orderReference): Invoice
|
|
||||||
{
|
|
||||||
$this->orderReference = $orderReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ContractDocumentReference
|
|
||||||
*/
|
|
||||||
public function getContractDocumentReference(): ?ContractDocumentReference
|
|
||||||
{
|
|
||||||
return $this->contractDocumentReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $ContractDocumentReference
|
|
||||||
* @return Invoice
|
|
||||||
*/
|
|
||||||
public function setContractDocumentReference(ContractDocumentReference $contractDocumentReference): Invoice
|
|
||||||
{
|
|
||||||
$this->contractDocumentReference = $contractDocumentReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->id === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoice id');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->issueDate instanceof DateTime) {
|
|
||||||
throw new InvalidArgumentException('Invalid invoice issueDate');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->invoiceTypeCode === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoice invoiceTypeCode');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->accountingSupplierParty === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoice accountingSupplierParty');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->accountingCustomerParty === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoice accountingCustomerParty');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->invoiceLines === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoice lines');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->legalMonetaryTotal === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoice LegalMonetaryTotal');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'UBLVersionID' => $this->UBLVersionID,
|
|
||||||
Schema::CBC . 'CustomizationID' => $this->customizationID,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->profileID !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ProfileID' => $this->profileID
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ID' => $this->id
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->copyIndicator !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'CopyIndicator' => $this->copyIndicator ? 'true' : 'false'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'IssueDate' => $this->issueDate->format('Y-m-d'),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->dueDate !== null && $this->xmlTagName === 'Invoice') {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'DueDate' => $this->dueDate->format('Y-m-d')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->invoiceTypeCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . $this->xmlTagName . 'TypeCode' => $this->invoiceTypeCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->note !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Note' => $this->note
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxPointDate !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'TaxPointDate' => $this->taxPointDate->format('Y-m-d')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'DocumentCurrencyCode' => $this->documentCurrencyCode,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->accountingCostCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'AccountingCostCode' => $this->accountingCostCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->buyerReference != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'BuyerReference' => $this->buyerReference
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->invoicePeriod != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'InvoicePeriod' => $this->invoicePeriod
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->orderReference != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'OrderReference' => $this->orderReference
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->billingReference != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'BillingReference' => $this->billingReference
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->contractDocumentReference !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'ContractDocumentReference' => $this->contractDocumentReference,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->additionalDocumentReferences)) {
|
|
||||||
foreach ($this->additionalDocumentReferences as $additionalDocumentReference) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'AdditionalDocumentReference' => $additionalDocumentReference
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->projectReference != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'ProjectReference' => $this->projectReference
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$customerParty = array_filter([
|
|
||||||
Schema::CBC . 'SupplierAssignedAccountID' => $this->supplierAssignedAccountID,
|
|
||||||
Schema::CAC . 'Party' => $this->accountingCustomerParty,
|
|
||||||
Schema::CAC . 'AccountingContact' => $this->accountingCustomerPartyContact,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'AccountingSupplierParty' => [Schema::CAC . 'Party' => $this->accountingSupplierParty],
|
|
||||||
Schema::CAC . 'AccountingCustomerParty' => $customerParty,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->payeeParty != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PayeeParty' => $this->payeeParty
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->delivery != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'Delivery' => $this->delivery
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->paymentMeans !== null) {
|
|
||||||
foreach($this->paymentMeans as $paymentMeans) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . $paymentMeans->xmlTagName => $paymentMeans
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->paymentTerms !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PaymentTerms' => $this->paymentTerms
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->allowanceCharges !== null) {
|
|
||||||
foreach ($this->allowanceCharges as $allowanceCharge) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'AllowanceCharge' => $allowanceCharge
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxTotal !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxTotal' => $this->taxTotal
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'LegalMonetaryTotal' => $this->legalMonetaryTotal
|
|
||||||
]);
|
|
||||||
|
|
||||||
foreach ($this->invoiceLines as $invoiceLine) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . $invoiceLine->xmlTagName => $invoiceLine
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class InvoiceDocumentReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $originalInvoiceId;
|
|
||||||
private $issueDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the id of the invoice that is being credited
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getOriginalInvoiceId(): ?string
|
|
||||||
{
|
|
||||||
return $this->originalInvoiceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the id of the invoice that is being credited
|
|
||||||
*
|
|
||||||
* @return InvoiceDocumentReference
|
|
||||||
*/
|
|
||||||
public function setOriginalInvoiceId(string $invoiceRef): InvoiceDocumentReference
|
|
||||||
{
|
|
||||||
$this->originalInvoiceId = $invoiceRef;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the issue date of the original invoice that is being credited
|
|
||||||
*
|
|
||||||
* @return ?DateTime
|
|
||||||
*/
|
|
||||||
public function getIssueDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->issueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the issue date of the original invoice that is being credited
|
|
||||||
*
|
|
||||||
* @return InvoiceDocumentReference
|
|
||||||
*/
|
|
||||||
public function setIssueDate(DateTime $issueDate): InvoiceDocumentReference
|
|
||||||
{
|
|
||||||
$this->issueDate = $issueDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->originalInvoiceId === null) {
|
|
||||||
throw new InvalidArgumentException('Missing invoicedocumentreference originalinvoiceid');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'ID',
|
|
||||||
'value' => $this->originalInvoiceId
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->issueDate != null)
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'IssueDate',
|
|
||||||
'value' => $this->issueDate->format('Y-m-d')
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
367
vendor/num-num/ubl-invoice/src/InvoiceLine.php
vendored
367
vendor/num-num/ubl-invoice/src/InvoiceLine.php
vendored
|
|
@ -1,367 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class InvoiceLine implements XmlSerializable
|
|
||||||
{
|
|
||||||
public $xmlTagName = 'InvoiceLine';
|
|
||||||
private $id;
|
|
||||||
protected $invoicedQuantity;
|
|
||||||
private $lineExtensionAmount;
|
|
||||||
private $unitCode = UnitCode::UNIT;
|
|
||||||
private $unitCodeListId;
|
|
||||||
private $taxTotal;
|
|
||||||
private $invoicePeriod;
|
|
||||||
private $orderLineReference;
|
|
||||||
private $note;
|
|
||||||
private $item;
|
|
||||||
private $price;
|
|
||||||
private $accountingCostCode;
|
|
||||||
private $accountingCost;
|
|
||||||
/** @var AllowanceCharge[] $allowanceCharges */
|
|
||||||
private $allowanceCharges;
|
|
||||||
|
|
||||||
// See CreditNoteLine.php
|
|
||||||
protected $isCreditNoteLine = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setId(?string $id): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getInvoicedQuantity(): ?float
|
|
||||||
{
|
|
||||||
return $this->invoicedQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?float $invoicedQuantity
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setInvoicedQuantity(?float $invoicedQuantity): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->invoicedQuantity = $invoicedQuantity;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getLineExtensionAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->lineExtensionAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $lineExtensionAmount
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setLineExtensionAmount(?float $lineExtensionAmount): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->lineExtensionAmount = $lineExtensionAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return TaxTotal
|
|
||||||
*/
|
|
||||||
public function getTaxTotal(): ?TaxTotal
|
|
||||||
{
|
|
||||||
return $this->taxTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxTotal $taxTotal
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setTaxTotal(?TaxTotal $taxTotal): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->taxTotal = $taxTotal;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getNote(): ?string
|
|
||||||
{
|
|
||||||
return $this->note;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $note
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setNote(?string $note): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return InvoicePeriod
|
|
||||||
*/
|
|
||||||
public function getInvoicePeriod(): ?InvoicePeriod
|
|
||||||
{
|
|
||||||
return $this->invoicePeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param InvoicePeriod $invoicePeriod
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setInvoicePeriod(?InvoicePeriod $invoicePeriod)
|
|
||||||
{
|
|
||||||
$this->invoicePeriod = $invoicePeriod;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getOrderLineReference(): ?OrderLineReference
|
|
||||||
{
|
|
||||||
return $this->orderLineReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?string $orderLineReference
|
|
||||||
* @return OrderLineReference
|
|
||||||
*/
|
|
||||||
public function setOrderLineReference(?OrderLineReference $orderLineReference): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->orderLineReference = $orderLineReference;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function getItem(): ?Item
|
|
||||||
{
|
|
||||||
return $this->item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Item $item
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setItem(Item $item): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->item = $item;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Price
|
|
||||||
*/
|
|
||||||
public function getPrice(): ?Price
|
|
||||||
{
|
|
||||||
return $this->price;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Price $price
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setPrice(?Price $price): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->price = $price;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUnitCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->unitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $unitCode
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setUnitCode(?string $unitCode): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->unitCode = $unitCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUnitCodeListId(): ?string
|
|
||||||
{
|
|
||||||
return $this->unitCodeListId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $unitCodeListId
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setUnitCodeListId(?string $unitCodeListId)
|
|
||||||
{
|
|
||||||
$this->unitCodeListId = $unitCodeListId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAccountingCostCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->accountingCostCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $accountingCostCode
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setAccountingCostCode(?string $accountingCostCode): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->accountingCostCode = $accountingCostCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAccountingCost(): ?string
|
|
||||||
{
|
|
||||||
return $this->accountingCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $accountingCost
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setAccountingCost(?string $accountingCost): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->accountingCost = $accountingCost;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return AllowanceCharge[]
|
|
||||||
*/
|
|
||||||
public function getAllowanceCharges(): ?array
|
|
||||||
{
|
|
||||||
return $this->allowanceCharges;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AllowanceCharge[] $allowanceCharges
|
|
||||||
* @return InvoiceLine
|
|
||||||
*/
|
|
||||||
public function setAllowanceCharges(array $allowanceCharges): InvoiceLine
|
|
||||||
{
|
|
||||||
$this->allowanceCharges = $allowanceCharges;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ID' => $this->id
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!empty($this->getNote())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Note' => $this->getNote()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$invoicedQuantityAttributes = [
|
|
||||||
'unitCode' => $this->unitCode,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!empty($this->getUnitCodeListId())) {
|
|
||||||
$invoicedQuantityAttributes['unitCodeListID'] = $this->getUnitCodeListId();
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC .
|
|
||||||
($this->isCreditNoteLine ? 'CreditedQuantity' : 'InvoicedQuantity'),
|
|
||||||
'value' => NumberFormatter::format($this->invoicedQuantity),
|
|
||||||
'attributes' => $invoicedQuantityAttributes
|
|
||||||
]);
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'LineExtensionAmount',
|
|
||||||
'value' => NumberFormatter::format($this->lineExtensionAmount ?? 0, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->accountingCostCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'AccountingCostCode' => $this->accountingCostCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->accountingCost !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'AccountingCost' => $this->accountingCost
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->invoicePeriod !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'InvoicePeriod' => $this->invoicePeriod
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->orderLineReference !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'OrderLineReference' => $this->orderLineReference
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->allowanceCharges !== null) {
|
|
||||||
foreach ($this->allowanceCharges as $allowanceCharge) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'AllowanceCharge' => $allowanceCharge
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($this->taxTotal !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxTotal' => $this->taxTotal
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->item !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'Item' => $this->item,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->price !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'Price' => $this->price
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
109
vendor/num-num/ubl-invoice/src/InvoicePeriod.php
vendored
109
vendor/num-num/ubl-invoice/src/InvoicePeriod.php
vendored
|
|
@ -1,109 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
use DateTime;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class InvoicePeriod implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $startDate;
|
|
||||||
private $endDate;
|
|
||||||
private $descriptionCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getStartDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $startDate
|
|
||||||
* @return InvoicePeriod
|
|
||||||
*/
|
|
||||||
public function setStartDate(?DateTime $startDate): InvoicePeriod
|
|
||||||
{
|
|
||||||
$this->startDate = $startDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getEndDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->endDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $endDate
|
|
||||||
* @return InvoicePeriod
|
|
||||||
*/
|
|
||||||
public function setEndDate(?DateTime $endDate): InvoicePeriod
|
|
||||||
{
|
|
||||||
$this->endDate = $endDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getDescriptionCode(): ?int
|
|
||||||
{
|
|
||||||
return $this->descriptionCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Integer $descriptionCode
|
|
||||||
* @return InvoicePeriod
|
|
||||||
*/
|
|
||||||
public function setDescriptionCode(?int $descriptionCode): InvoicePeriod
|
|
||||||
{
|
|
||||||
$this->descriptionCode = $descriptionCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->descriptionCode === null && ($this->startDate === null && $this->endDate === null)) {
|
|
||||||
throw new InvalidArgumentException('Missing startDate or endDate or descriptionCode');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
if ($this->startDate != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'StartDate' => $this->startDate->format('Y-m-d'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->endDate != null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'EndDate' => $this->endDate->format('Y-m-d'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->descriptionCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'DescriptionCode' => $this->descriptionCode,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible Unit Codes that can be used
|
|
||||||
* To extend, see also: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL1001-inv/
|
|
||||||
*/
|
|
||||||
class InvoiceTypeCode
|
|
||||||
{
|
|
||||||
const INVOICE = 380;
|
|
||||||
const CREDIT_NOTE = 381;
|
|
||||||
const DEBIT_NOTE = 383;
|
|
||||||
const CORRECTED_INVOICE = 384;
|
|
||||||
const ADVANCE_INVOICE = 386;
|
|
||||||
const SELF_BILLING_INVOICE = 389;
|
|
||||||
}
|
|
||||||
205
vendor/num-num/ubl-invoice/src/Item.php
vendored
205
vendor/num-num/ubl-invoice/src/Item.php
vendored
|
|
@ -1,205 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class Item implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $description;
|
|
||||||
private $name;
|
|
||||||
private $buyersItemIdentification;
|
|
||||||
private $sellersItemIdentification;
|
|
||||||
private $standardItemIdentification;
|
|
||||||
private $standardItemIdentificationAttributes = [];
|
|
||||||
private $commodityClassification;
|
|
||||||
private $classifiedTaxCategory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDescription(): ?string
|
|
||||||
{
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $description
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setDescription(?string $description): Item
|
|
||||||
{
|
|
||||||
$this->description = $description;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $name
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setName(?string $name): Item
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getSellersItemIdentification(): ?string
|
|
||||||
{
|
|
||||||
return $this->sellersItemIdentification;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $sellersItemIdentification
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setSellersItemIdentification(?string $sellersItemIdentification): Item
|
|
||||||
{
|
|
||||||
$this->sellersItemIdentification = $sellersItemIdentification;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getStandardItemIdentification(): ?string
|
|
||||||
{
|
|
||||||
return $this->standardItemIdentification;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $standardItemIdentification
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setStandardItemIdentification(?string $standardItemIdentification, $attributes = null): Item
|
|
||||||
{
|
|
||||||
$this->standardItemIdentification = $standardItemIdentification;
|
|
||||||
if (isset($attributes)) {
|
|
||||||
$this->standardItemIdentificationAttributes = $attributes;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return CommodityClassification
|
|
||||||
*/
|
|
||||||
public function getCommodityClassification(): ?CommodityClassification
|
|
||||||
{
|
|
||||||
return $this->commodityClassification;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $commodityClassification
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setCommodityClassification(CommodityClassification $commodityClassification): Item
|
|
||||||
{
|
|
||||||
$this->commodityClassification = $commodityClassification;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getBuyersItemIdentification(): ?string
|
|
||||||
{
|
|
||||||
return $this->buyersItemIdentification;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $buyersItemIdentification
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setBuyersItemIdentification(?string $buyersItemIdentification): Item
|
|
||||||
{
|
|
||||||
$this->buyersItemIdentification = $buyersItemIdentification;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ClassifiedTaxCategory
|
|
||||||
*/
|
|
||||||
public function getClassifiedTaxCategory(): ?ClassifiedTaxCategory
|
|
||||||
{
|
|
||||||
return $this->classifiedTaxCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ClassifiedTaxCategory $classifiedTaxCategory
|
|
||||||
* @return Item
|
|
||||||
*/
|
|
||||||
public function setClassifiedTaxCategory(?ClassifiedTaxCategory $classifiedTaxCategory): Item
|
|
||||||
{
|
|
||||||
$this->classifiedTaxCategory = $classifiedTaxCategory;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if (!empty($this->getDescription())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Description' => $this->description
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Name' => $this->name
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!empty($this->getBuyersItemIdentification())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'BuyersItemIdentification' => [
|
|
||||||
Schema::CBC . 'ID' => $this->buyersItemIdentification
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->getSellersItemIdentification())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'SellersItemIdentification' => [
|
|
||||||
Schema::CBC . 'ID' => $this->sellersItemIdentification
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->getStandardItemIdentification())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'StandardItemIdentification' => [
|
|
||||||
Schema::CBC . 'ID' => [
|
|
||||||
'value' => $this->standardItemIdentification,
|
|
||||||
'attributes' => $this->standardItemIdentificationAttributes
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->getCommodityClassification())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'CommodityClassification' => $this->commodityClassification
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->getClassifiedTaxCategory())) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'ClassifiedTaxCategory' => $this->classifiedTaxCategory
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
99
vendor/num-num/ubl-invoice/src/LegalEntity.php
vendored
99
vendor/num-num/ubl-invoice/src/LegalEntity.php
vendored
|
|
@ -1,99 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class LegalEntity implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $registrationName;
|
|
||||||
private $companyId;
|
|
||||||
private $companyIdAttributes;
|
|
||||||
private $companyLegalForm;
|
|
||||||
private $companyLegalFormAttributes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getRegistrationName(): ?string
|
|
||||||
{
|
|
||||||
return $this->registrationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $registrationName
|
|
||||||
* @return LegalEntity
|
|
||||||
*/
|
|
||||||
public function setRegistrationName(?string $registrationName): LegalEntity
|
|
||||||
{
|
|
||||||
$this->registrationName = $registrationName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCompanyId(): ?string
|
|
||||||
{
|
|
||||||
return $this->companyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $companyId
|
|
||||||
* @return LegalEntity
|
|
||||||
*/
|
|
||||||
public function setCompanyId(?string $companyId, $attributes = null): LegalEntity
|
|
||||||
{
|
|
||||||
$this->companyId = $companyId;
|
|
||||||
if (isset($attributes)) {
|
|
||||||
$this->companyIdAttributes = $attributes;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param string $legalForm
|
|
||||||
* @return LegalEntity
|
|
||||||
*/
|
|
||||||
public function setCompanyLegalForm(?string $legalForm, $attributes = null) : LegalEntity
|
|
||||||
{
|
|
||||||
$this->companyLegalForm = $legalForm;
|
|
||||||
if (isset($attributes)) {
|
|
||||||
$this->companyLegalFormAttributes = $attributes;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'RegistrationName' => $this->registrationName,
|
|
||||||
]);
|
|
||||||
if ($this->companyId !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'CompanyID',
|
|
||||||
'value' => $this->companyId,
|
|
||||||
'attributes' => $this->companyIdAttributes,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->companyLegalForm !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'CompanyLegalForm',
|
|
||||||
'value' => $this->companyLegalForm,
|
|
||||||
'attributes' => $this->companyLegalFormAttributes
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,245 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class LegalMonetaryTotal implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $lineExtensionAmount = 0;
|
|
||||||
private $taxExclusiveAmount = 0;
|
|
||||||
private $taxInclusiveAmount = 0;
|
|
||||||
private $allowanceTotalAmount = 0;
|
|
||||||
private $chargeTotalAmount = 0;
|
|
||||||
private $prepaidAmount;
|
|
||||||
private $payableAmount = 0;
|
|
||||||
private $payableRoundingAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getLineExtensionAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->lineExtensionAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $lineExtensionAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setLineExtensionAmount(?float $lineExtensionAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->lineExtensionAmount = $lineExtensionAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getTaxExclusiveAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->taxExclusiveAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $taxExclusiveAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setTaxExclusiveAmount(?float $taxExclusiveAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->taxExclusiveAmount = $taxExclusiveAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getTaxInclusiveAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->taxInclusiveAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $taxInclusiveAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setTaxInclusiveAmount(?float $taxInclusiveAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->taxInclusiveAmount = $taxInclusiveAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getAllowanceTotalAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->allowanceTotalAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $allowanceTotalAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setAllowanceTotalAmount(?float $allowanceTotalAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->allowanceTotalAmount = $allowanceTotalAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getChargeTotalAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->chargeTotalAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $chargeTotalAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setChargeTotalAmount(?float $chargeTotalAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->chargeTotalAmount = $chargeTotalAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ?float
|
|
||||||
*/
|
|
||||||
public function getPrepaidAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->prepaidAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ?float $prepaidAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setPrepaidAmount(?float $prepaidAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->prepaidAmount = $prepaidAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getPayableAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->payableAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $payableAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setPayableAmount(?float $payableAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->payableAmount = $payableAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPayableRoundingAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->payableRoundingAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float|null $payableRoundingAmount
|
|
||||||
* @return LegalMonetaryTotal
|
|
||||||
*/
|
|
||||||
public function setPayableRoundingAmount(?float $payableRoundingAmount): LegalMonetaryTotal
|
|
||||||
{
|
|
||||||
$this->payableRoundingAmount = $payableRoundingAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'LineExtensionAmount',
|
|
||||||
'value' => NumberFormatter::format($this->lineExtensionAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'TaxExclusiveAmount',
|
|
||||||
'value' => NumberFormatter::format($this->taxExclusiveAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'TaxInclusiveAmount',
|
|
||||||
'value' => NumberFormatter::format($this->taxInclusiveAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'AllowanceTotalAmount',
|
|
||||||
'value' => NumberFormatter::format($this->allowanceTotalAmount,2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'ChargeTotalAmount',
|
|
||||||
'value' => NumberFormatter::format($this->chargeTotalAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->prepaidAmount !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'PrepaidAmount',
|
|
||||||
'value' => NumberFormatter::format($this->prepaidAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->payableRoundingAmount !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'PayableRoundingAmount',
|
|
||||||
'value' => NumberFormatter::format($this->payableRoundingAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'PayableAmount',
|
|
||||||
'value' => NumberFormatter::format($this->payableAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
class NumberFormatter
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Format numbers and optionally preserve decimals
|
|
||||||
*
|
|
||||||
* @param int|float $number
|
|
||||||
* @param int|null $decimals
|
|
||||||
* @param string $decimalSeparator
|
|
||||||
* @param string $thousandsSeparator
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function format($number, ?int $decimals = null, string $decimalSeparator = '.', string $thousandsSeparator = '')
|
|
||||||
{
|
|
||||||
if ($decimals == null) {
|
|
||||||
// Convert to string to detect decimals
|
|
||||||
// Get the current decimal point character according to the locale
|
|
||||||
$locale = localeconv();
|
|
||||||
$decimalPoint = $locale['decimal_point'] ?? '.';
|
|
||||||
|
|
||||||
// Convert to string to detect decimals
|
|
||||||
$parts = explode($decimalPoint, (string)$number);
|
|
||||||
|
|
||||||
// Count decimals, if any
|
|
||||||
$decimals = isset($parts[1]) ? strlen(rtrim($parts[1], '0')) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return number_format($number, $decimals, $decimalSeparator, $thousandsSeparator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-InvoiceLine/cac-OrderLineReference/
|
|
||||||
*/
|
|
||||||
class OrderLineReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $lineId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLineId(): ?string
|
|
||||||
{
|
|
||||||
return $this->lineId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $lineId
|
|
||||||
* @return OrderLineReference
|
|
||||||
*/
|
|
||||||
public function setLineId(?string $lineId): OrderLineReference
|
|
||||||
{
|
|
||||||
$this->lineId = $lineId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->lineId === null) {
|
|
||||||
throw new InvalidArgumentException('Missing OrderLineReference LineID');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'LineID' => $this->lineId
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class OrderReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $salesOrderId;
|
|
||||||
private $issueDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return OrderReference
|
|
||||||
*/
|
|
||||||
public function setId(string $id): OrderReference
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getSalesOrderId(): string
|
|
||||||
{
|
|
||||||
return $this->salesOrderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getIssueDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->issueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $issueDate
|
|
||||||
* @return OrderReference
|
|
||||||
*/
|
|
||||||
public function setIssueDate(DateTime $issueDate): OrderReference
|
|
||||||
{
|
|
||||||
$this->issueDate = $issueDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $salesOrderId
|
|
||||||
* @return OrderReference
|
|
||||||
*/
|
|
||||||
public function setSalesOrderId(string $salesOrderId): OrderReference
|
|
||||||
{
|
|
||||||
$this->salesOrderId = $salesOrderId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->id !== null) {
|
|
||||||
$writer->write([Schema::CBC . 'ID' => $this->id]);
|
|
||||||
}
|
|
||||||
if ($this->salesOrderId !== null) {
|
|
||||||
$writer->write([Schema::CBC . 'SalesOrderID' => $this->salesOrderId]);
|
|
||||||
}
|
|
||||||
if ($this->issueDate !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'IssueDate' => $this->issueDate->format('Y-m-d'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
276
vendor/num-num/ubl-invoice/src/Party.php
vendored
276
vendor/num-num/ubl-invoice/src/Party.php
vendored
|
|
@ -1,276 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class Party implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $name;
|
|
||||||
private $partyIdentificationId;
|
|
||||||
private $partyIdentificationSchemeId;
|
|
||||||
private $partyIdentificationSchemeName;
|
|
||||||
private $postalAddress;
|
|
||||||
private $physicalLocation;
|
|
||||||
private $contact;
|
|
||||||
private $partyTaxScheme;
|
|
||||||
private $legalEntity;
|
|
||||||
private $endpointID;
|
|
||||||
private $endpointID_schemeID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setName(?string $name): Party
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPartyIdentificationId(): ?string
|
|
||||||
{
|
|
||||||
return $this->partyIdentificationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $partyIdentificationId
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setPartyIdentificationId(?string $partyIdentificationId): Party
|
|
||||||
{
|
|
||||||
$this->partyIdentificationId = $partyIdentificationId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPartyIdentificationSchemeId(): ?string
|
|
||||||
{
|
|
||||||
return $this->partyIdentificationSchemeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $partyIdentificationSchemeId
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setPartyIdentificationSchemeId(?string $partyIdentificationSchemeId): Party
|
|
||||||
{
|
|
||||||
$this->partyIdentificationSchemeId = $partyIdentificationSchemeId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPartyIdentificationSchemeName(): ?string
|
|
||||||
{
|
|
||||||
return $this->partyIdentificationSchemeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $partyIdentificationSchemeName
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setPartyIdentificationSchemeName(?string $partyIdentificationSchemeName): Party
|
|
||||||
{
|
|
||||||
$this->partyIdentificationSchemeName = $partyIdentificationSchemeName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function getPostalAddress(): ?Address
|
|
||||||
{
|
|
||||||
return $this->postalAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Address $postalAddress
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setPostalAddress(?Address $postalAddress): Party
|
|
||||||
{
|
|
||||||
$this->postalAddress = $postalAddress;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return LegalEntity
|
|
||||||
*/
|
|
||||||
public function getLegalEntity(): ?LegalEntity
|
|
||||||
{
|
|
||||||
return $this->legalEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LegalEntity $legalEntity
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setLegalEntity(?LegalEntity $legalEntity): Party
|
|
||||||
{
|
|
||||||
$this->legalEntity = $legalEntity;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Address
|
|
||||||
*/
|
|
||||||
public function getPhysicalLocation(): ?Address
|
|
||||||
{
|
|
||||||
return $this->physicalLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Address $physicalLocation
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setPhysicalLocation(?Address $physicalLocation): Party
|
|
||||||
{
|
|
||||||
$this->physicalLocation = $physicalLocation;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return PartyTaxScheme
|
|
||||||
*/
|
|
||||||
public function getPartyTaxScheme(): ?PartyTaxScheme
|
|
||||||
{
|
|
||||||
return $this->partyTaxScheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PartyTaxScheme $partyTaxScheme
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setPartyTaxScheme(PartyTaxScheme $partyTaxScheme)
|
|
||||||
{
|
|
||||||
$this->partyTaxScheme = $partyTaxScheme;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Contact
|
|
||||||
*/
|
|
||||||
public function getContact(): ?Contact
|
|
||||||
{
|
|
||||||
return $this->contact;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Contact $contact
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setContact(?Contact $contact): Party
|
|
||||||
{
|
|
||||||
$this->contact = $contact;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $endpointID
|
|
||||||
* @param int|string $schemeID See list at https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
|
|
||||||
* @return Party
|
|
||||||
*/
|
|
||||||
public function setEndpointID($endpointID, $schemeID): Party
|
|
||||||
{
|
|
||||||
$this->endpointID = $endpointID;
|
|
||||||
$this->endpointID_schemeID = $schemeID;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->endpointID !== null && $this->endpointID_schemeID !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'EndpointID',
|
|
||||||
'value' => $this->endpointID,
|
|
||||||
'attributes' => [
|
|
||||||
'schemeID' => is_numeric($this->endpointID_schemeID)
|
|
||||||
? sprintf('%04d', +$this->endpointID_schemeID)
|
|
||||||
: $this->endpointID_schemeID
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->partyIdentificationId !== null) {
|
|
||||||
$partyIdentificationAttributes = [];
|
|
||||||
|
|
||||||
if (!empty($this->getPartyIdentificationSchemeId())) {
|
|
||||||
$partyIdentificationAttributes['schemeID'] = $this->getPartyIdentificationSchemeId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->getPartyIdentificationSchemeName())) {
|
|
||||||
$partyIdentificationAttributes['schemeName'] = $this->getPartyIdentificationSchemeName();
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PartyIdentification' => [
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'ID',
|
|
||||||
'value' => $this->partyIdentificationId,
|
|
||||||
'attributes' => $partyIdentificationAttributes
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->name !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PartyName' => [
|
|
||||||
Schema::CBC . 'Name' => $this->name
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PostalAddress' => $this->postalAddress
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->physicalLocation !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PhysicalLocation' => [Schema::CAC . 'Address' => $this->physicalLocation]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->partyTaxScheme !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PartyTaxScheme' => $this->partyTaxScheme
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->legalEntity !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PartyLegalEntity' => $this->legalEntity
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->contact !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'Contact' => $this->contact
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
107
vendor/num-num/ubl-invoice/src/PartyTaxScheme.php
vendored
107
vendor/num-num/ubl-invoice/src/PartyTaxScheme.php
vendored
|
|
@ -1,107 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class PartyTaxScheme implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $registrationName;
|
|
||||||
private $companyId;
|
|
||||||
private $taxScheme;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getRegistrationName(): ?string
|
|
||||||
{
|
|
||||||
return $this->registrationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $registrationName
|
|
||||||
* @return PartyTaxScheme
|
|
||||||
*/
|
|
||||||
public function setRegistrationName($registrationName): PartyTaxScheme
|
|
||||||
{
|
|
||||||
$this->registrationName = $registrationName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCompanyId(): ?string
|
|
||||||
{
|
|
||||||
return $this->companyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $companyId
|
|
||||||
* @return PartyTaxScheme
|
|
||||||
*/
|
|
||||||
public function setCompanyId($companyId): PartyTaxScheme
|
|
||||||
{
|
|
||||||
$this->companyId = $companyId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxScheme $taxScheme.
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTaxScheme(): ?TaxScheme
|
|
||||||
{
|
|
||||||
return $this->taxScheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxScheme $taxScheme
|
|
||||||
* @return PartyTaxScheme
|
|
||||||
*/
|
|
||||||
public function setTaxScheme(TaxScheme $taxScheme): PartyTaxScheme
|
|
||||||
{
|
|
||||||
$this->taxScheme = $taxScheme;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->taxScheme === null) {
|
|
||||||
throw new InvalidArgumentException('Missing TaxScheme');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->registrationName !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'RegistrationName' => $this->registrationName
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->companyId !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'CompanyID' => $this->companyId
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxScheme' => $this->taxScheme
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class PayeeFinancialAccount implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $name;
|
|
||||||
private $financialInstitutionBranch;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return PayeeFinancialAccount
|
|
||||||
*/
|
|
||||||
public function setId(?string $id): PayeeFinancialAccount
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @return PayeeFinancialAccount
|
|
||||||
*/
|
|
||||||
public function setName(?string $name): PayeeFinancialAccount
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return FinancialInstitutionBranch
|
|
||||||
*/
|
|
||||||
public function getFinancialInstitutionBranch(): ?FinancialInstitutionBranch
|
|
||||||
{
|
|
||||||
return $this->financialInstitutionBranch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FinancialInstitutionBranch $financialInstitutionBranch
|
|
||||||
* @return PayeeFinancialAccount
|
|
||||||
*/
|
|
||||||
public function setFinancialInstitutionBranch(?FinancialInstitutionBranch $financialInstitutionBranch): PayeeFinancialAccount
|
|
||||||
{
|
|
||||||
$this->financialInstitutionBranch = $financialInstitutionBranch;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'ID',
|
|
||||||
'value' => $this->id,
|
|
||||||
'attributes' => [
|
|
||||||
//'schemeID' => 'IBAN'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->getName() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Name' => $this->getName()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getFinancialInstitutionBranch() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'FinancialInstitutionBranch' => $this->getFinancialInstitutionBranch()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
172
vendor/num-num/ubl-invoice/src/PaymentMeans.php
vendored
172
vendor/num-num/ubl-invoice/src/PaymentMeans.php
vendored
|
|
@ -1,172 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
use DateTime;
|
|
||||||
|
|
||||||
class PaymentMeans implements XmlSerializable
|
|
||||||
{
|
|
||||||
public $xmlTagName = 'PaymentMeans';
|
|
||||||
private $paymentMeansCode = UNCL4461::INSTRUMENT_NOT_DEFINED;
|
|
||||||
private $paymentMeansCodeAttributes = [
|
|
||||||
'listID' => 'UN/ECE 4461',
|
|
||||||
'listName' => 'Payment Means',
|
|
||||||
'listURI' => 'http://docs.oasis-open.org/ubl/os-UBL-2.0-update/cl/gc/default/PaymentMeansCode-2.0.gc'];
|
|
||||||
private $paymentDueDate;
|
|
||||||
private $instructionId;
|
|
||||||
private $instructionNote;
|
|
||||||
private $paymentId;
|
|
||||||
private $payeeFinancialAccount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPaymentMeansCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->paymentMeansCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $paymentMeansCode
|
|
||||||
* @return PaymentMeans
|
|
||||||
*/
|
|
||||||
public function setPaymentMeansCode(?string $paymentMeansCode, $attributes = null): PaymentMeans
|
|
||||||
{
|
|
||||||
$this->paymentMeansCode = $paymentMeansCode;
|
|
||||||
if (isset($attributes)) {
|
|
||||||
$this->paymentMeansCodeAttributes = $attributes;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getPaymentDueDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->paymentDueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $paymentDueDate
|
|
||||||
* @return PaymentMeans
|
|
||||||
*/
|
|
||||||
public function setPaymentDueDate(?DateTime $paymentDueDate): PaymentMeans
|
|
||||||
{
|
|
||||||
$this->paymentDueDate = $paymentDueDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getInstructionId(): ?string
|
|
||||||
{
|
|
||||||
return $this->instructionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $instructionId
|
|
||||||
* @return PaymentMeans
|
|
||||||
*/
|
|
||||||
public function setInstructionId(?string $instructionId): PaymentMeans
|
|
||||||
{
|
|
||||||
$this->instructionId = $instructionId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getInstructionNote(): ?string
|
|
||||||
{
|
|
||||||
return $this->instructionNote;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $instructionNote
|
|
||||||
* @return PaymentMeans
|
|
||||||
*/
|
|
||||||
public function setInstructionNote(?string $instructionNote): PaymentMeans
|
|
||||||
{
|
|
||||||
$this->instructionNote = $instructionNote;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPaymentId(): ?string
|
|
||||||
{
|
|
||||||
return $this->paymentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $paymentId
|
|
||||||
* @return PaymentMeans
|
|
||||||
*/
|
|
||||||
public function setPaymentId(?string $paymentId): PaymentMeans
|
|
||||||
{
|
|
||||||
$this->paymentId = $paymentId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getPayeeFinancialAccount(): ?PayeeFinancialAccount
|
|
||||||
{
|
|
||||||
return $this->payeeFinancialAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $payeeFinancialAccount
|
|
||||||
* @return PaymentMeans
|
|
||||||
*/
|
|
||||||
public function setPayeeFinancialAccount(?PayeeFinancialAccount $payeeFinancialAccount): PaymentMeans
|
|
||||||
{
|
|
||||||
$this->payeeFinancialAccount = $payeeFinancialAccount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
'name' => Schema::CBC . 'PaymentMeansCode',
|
|
||||||
'value' => $this->paymentMeansCode,
|
|
||||||
'attributes' => $this->paymentMeansCodeAttributes
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->getPaymentDueDate() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'PaymentDueDate' => $this->getPaymentDueDate()->format('Y-m-d')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getInstructionId() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'InstructionID' => $this->getInstructionId()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getInstructionNote() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'InstructionNote' => $this->getInstructionNote()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getPaymentId() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'PaymentID' => $this->getPaymentId()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getPayeeFinancialAccount() !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'PayeeFinancialAccount' => $this->getPayeeFinancialAccount()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
113
vendor/num-num/ubl-invoice/src/PaymentTerms.php
vendored
113
vendor/num-num/ubl-invoice/src/PaymentTerms.php
vendored
|
|
@ -1,113 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class PaymentTerms implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $note;
|
|
||||||
private $settlementDiscountPercent;
|
|
||||||
private $amount;
|
|
||||||
private $settlementPeriod;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getNote(): ?string
|
|
||||||
{
|
|
||||||
return $this->note;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $note
|
|
||||||
* @return PaymentTerms
|
|
||||||
*/
|
|
||||||
public function setNote(?string $note): PaymentTerms
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getSettlementDiscountPercent(): ?float
|
|
||||||
{
|
|
||||||
return $this->settlementDiscountPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $settlementDiscountPercent
|
|
||||||
* @return PaymentTerms
|
|
||||||
*/
|
|
||||||
public function setSettlementDiscountPercent(?float $settlementDiscountPercent): PaymentTerms
|
|
||||||
{
|
|
||||||
$this->settlementDiscountPercent = $settlementDiscountPercent;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $amount
|
|
||||||
* @return PaymentTerms
|
|
||||||
*/
|
|
||||||
public function setAmount(?float $amount): PaymentTerms
|
|
||||||
{
|
|
||||||
$this->amount = $amount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return SettlementPeriod
|
|
||||||
*/
|
|
||||||
public function getSettlementPeriod(): ?SettlementPeriod
|
|
||||||
{
|
|
||||||
return $this->settlementPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param SettlementPeriod $settlementPeriod
|
|
||||||
* @return PaymentTerms
|
|
||||||
*/
|
|
||||||
public function setSettlementPeriod(?SettlementPeriod $settlementPeriod): PaymentTerms
|
|
||||||
{
|
|
||||||
$this->settlementPeriod = $settlementPeriod;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->note !== null) {
|
|
||||||
$writer->write([ Schema::CBC . 'Note' => $this->note ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->settlementDiscountPercent !== null) {
|
|
||||||
$writer->write([ Schema::CBC . 'SettlementDiscountPercent' => $this->settlementDiscountPercent ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->amount !== null) {
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'Amount',
|
|
||||||
'value' => NumberFormatter::format($this->amount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => 'EUR'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->settlementPeriod !== null) {
|
|
||||||
$writer->write([ Schema::CAC . 'SettlementPeriod' => $this->settlementPeriod ]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
145
vendor/num-num/ubl-invoice/src/Price.php
vendored
145
vendor/num-num/ubl-invoice/src/Price.php
vendored
|
|
@ -1,145 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class Price implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $priceAmount;
|
|
||||||
private $baseQuantity;
|
|
||||||
private $unitCode = UnitCode::UNIT;
|
|
||||||
private $unitCodeListId;
|
|
||||||
private $allowanceCharge;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getPriceAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->priceAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $priceAmount
|
|
||||||
* @return Price
|
|
||||||
*/
|
|
||||||
public function setPriceAmount(?float $priceAmount): Price
|
|
||||||
{
|
|
||||||
$this->priceAmount = $priceAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getBaseQuantity(): ?float
|
|
||||||
{
|
|
||||||
return $this->baseQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $baseQuantity
|
|
||||||
* @return Price
|
|
||||||
*/
|
|
||||||
public function setBaseQuantity(?float $baseQuantity): Price
|
|
||||||
{
|
|
||||||
$this->baseQuantity = $baseQuantity;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUnitCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->unitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $unitCode
|
|
||||||
* See also: src/UnitCode.php
|
|
||||||
* @return Price
|
|
||||||
*/
|
|
||||||
public function setUnitCode(?string $unitCode): Price
|
|
||||||
{
|
|
||||||
$this->unitCode = $unitCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUnitCodeListId(): ?string
|
|
||||||
{
|
|
||||||
return $this->unitCodeListId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $unitCodeListId
|
|
||||||
* @return Price
|
|
||||||
*/
|
|
||||||
public function setUnitCodeListId(?string $unitCodeListId): Price
|
|
||||||
{
|
|
||||||
$this->unitCodeListId = $unitCodeListId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return AllowanceCharge
|
|
||||||
*/
|
|
||||||
public function getAllowanceCharge(): ?AllowanceCharge
|
|
||||||
{
|
|
||||||
return $this->allowanceCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AllowanceCharge $allowanceCharge
|
|
||||||
* @return Price
|
|
||||||
*/
|
|
||||||
public function setAllowanceCharge(?AllowanceCharge $allowanceCharge): Price
|
|
||||||
{
|
|
||||||
$this->allowanceCharge = $allowanceCharge;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$baseQuantityAttributes = [
|
|
||||||
'unitCode' => $this->unitCode,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!empty($this->getUnitCodeListId())) {
|
|
||||||
$baseQuantityAttributes['unitCodeListID'] = $this->getUnitCodeListId();
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'PriceAmount',
|
|
||||||
'value' => NumberFormatter::format($this->priceAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'BaseQuantity',
|
|
||||||
'value' => NumberFormatter::format($this->baseQuantity),
|
|
||||||
'attributes' => $baseQuantityAttributes
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->allowanceCharge !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'AllowanceCharge' => $this->allowanceCharge,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class ProjectReference implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): string
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return ProjectReference
|
|
||||||
*/
|
|
||||||
public function setId(string $id): ProjectReference
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
if ($this->id !== null) {
|
|
||||||
$writer->write([Schema::CBC . 'ID' => $this->id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
9
vendor/num-num/ubl-invoice/src/Schema.php
vendored
9
vendor/num-num/ubl-invoice/src/Schema.php
vendored
|
|
@ -1,9 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
class Schema
|
|
||||||
{
|
|
||||||
const CBC = '{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}';
|
|
||||||
const CAC = '{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}';
|
|
||||||
}
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class SettlementPeriod implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $startDate;
|
|
||||||
private $endDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getStartDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $startDate
|
|
||||||
* @return SettlementPeriod
|
|
||||||
*/
|
|
||||||
public function setStartDate(DateTime $startDate): SettlementPeriod
|
|
||||||
{
|
|
||||||
$this->startDate = $startDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
public function getEndDate(): ?DateTime
|
|
||||||
{
|
|
||||||
return $this->endDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateTime $endDate
|
|
||||||
* @return SettlementPeriod
|
|
||||||
*/
|
|
||||||
public function setEndDate(DateTime $endDate): SettlementPeriod
|
|
||||||
{
|
|
||||||
$this->endDate = $endDate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->startDate === null) {
|
|
||||||
throw new InvalidArgumentException('Missing startDate');
|
|
||||||
}
|
|
||||||
if ($this->endDate === null) {
|
|
||||||
throw new InvalidArgumentException('Missing endDate');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'StartDate' => $this->startDate->format('Y-m-d'),
|
|
||||||
Schema::CBC . 'EndDate' => $this->endDate->format('Y-m-d'),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'DurationMeasure',
|
|
||||||
'value' => $this->endDate->diff($this->startDate)->format('%d'),
|
|
||||||
'attributes' => [
|
|
||||||
'unitCode' => 'DAY'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
208
vendor/num-num/ubl-invoice/src/TaxCategory.php
vendored
208
vendor/num-num/ubl-invoice/src/TaxCategory.php
vendored
|
|
@ -1,208 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class TaxCategory implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $idAttributes = [
|
|
||||||
'schemeID' => UNCL5305::UNCL5305,
|
|
||||||
'schemeName' => 'Duty or tax or fee category'
|
|
||||||
];
|
|
||||||
private $name;
|
|
||||||
private $percent;
|
|
||||||
private $taxScheme;
|
|
||||||
private $taxExemptionReason;
|
|
||||||
private $taxExemptionReasonCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId(): ?string
|
|
||||||
{
|
|
||||||
if (!empty($this->id)) {
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default behaviour, overrrule by using setId()
|
|
||||||
if ($this->getPercent() !== null) {
|
|
||||||
return ($this->getPercent() > 0)
|
|
||||||
? UNCL5305::STANDARD_RATE
|
|
||||||
: UNCL5305::ZERO_RATED_GOODS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @param array $attributes
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function setId(?string $id, $attributes = null): TaxCategory
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
if (isset($attributes)) {
|
|
||||||
$this->idAttributes = $attributes;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function setName(?string $name): TaxCategory
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPercent(): ?float
|
|
||||||
{
|
|
||||||
return $this->percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $percent
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function setPercent(?float $percent): TaxCategory
|
|
||||||
{
|
|
||||||
$this->percent = $percent;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTaxScheme(): ?TaxScheme
|
|
||||||
{
|
|
||||||
return $this->taxScheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxScheme $taxScheme
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function setTaxScheme(?TaxScheme $taxScheme): TaxCategory
|
|
||||||
{
|
|
||||||
$this->taxScheme = $taxScheme;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTaxExemptionReason(): ?string
|
|
||||||
{
|
|
||||||
return $this->taxExemptionReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $taxExemptionReason
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function setTaxExemptionReason(?string $taxExemptionReason): TaxCategory
|
|
||||||
{
|
|
||||||
$this->taxExemptionReason = $taxExemptionReason;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTaxExemptionReasonCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->taxExemptionReasonCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $taxExemptionReason
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function setTaxExemptionReasonCode(?string $taxExemptionReasonCode): TaxCategory
|
|
||||||
{
|
|
||||||
$this->taxExemptionReasonCode = $taxExemptionReasonCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->getId() === null) {
|
|
||||||
throw new InvalidArgumentException('Missing taxcategory id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'ID',
|
|
||||||
'value' => $this->getId(),
|
|
||||||
'attributes' => $this->idAttributes,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->name !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Name' => $this->name,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->percent !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Percent' => number_format($this->percent, 2, '.', ''),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxExemptionReasonCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'TaxExemptionReasonCode' => $this->taxExemptionReasonCode,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxExemptionReason !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'TaxExemptionReason' => $this->taxExemptionReason,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxScheme !== null) {
|
|
||||||
$writer->write([Schema::CAC . 'TaxScheme' => $this->taxScheme]);
|
|
||||||
} else {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxScheme' => null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
114
vendor/num-num/ubl-invoice/src/TaxScheme.php
vendored
114
vendor/num-num/ubl-invoice/src/TaxScheme.php
vendored
|
|
@ -1,114 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
class TaxScheme implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $id;
|
|
||||||
private $name;
|
|
||||||
private $taxTypeCode;
|
|
||||||
private $currencyCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return TaxScheme
|
|
||||||
*/
|
|
||||||
public function setId(string $id): TaxScheme
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): ?string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @return TaxScheme
|
|
||||||
*/
|
|
||||||
public function setName(?string $name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getTaxTypeCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->taxTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $taxTypeCode
|
|
||||||
* @return TaxScheme
|
|
||||||
*/
|
|
||||||
public function setTaxTypeCode(?string $taxTypeCode)
|
|
||||||
{
|
|
||||||
$this->taxTypeCode = $taxTypeCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCurrencyCode(): ?string
|
|
||||||
{
|
|
||||||
return $this->currencyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $currencyCode
|
|
||||||
* @return TaxScheme
|
|
||||||
*/
|
|
||||||
public function setCurrencyCode(?string $currencyCode)
|
|
||||||
{
|
|
||||||
$this->currencyCode = $currencyCode;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'ID' => $this->id
|
|
||||||
]);
|
|
||||||
if ($this->name !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Name' => $this->name
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->taxTypeCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'TaxTypeCode' => $this->taxTypeCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if ($this->currencyCode !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'CurrencyCode' => $this->currencyCode
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
146
vendor/num-num/ubl-invoice/src/TaxSubTotal.php
vendored
146
vendor/num-num/ubl-invoice/src/TaxSubTotal.php
vendored
|
|
@ -1,146 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class TaxSubTotal implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $taxableAmount;
|
|
||||||
private $taxAmount;
|
|
||||||
private $taxCategory;
|
|
||||||
private $percent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTaxableAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->taxableAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $taxableAmount
|
|
||||||
* @return TaxSubTotal
|
|
||||||
*/
|
|
||||||
public function setTaxableAmount(?float $taxableAmount): TaxSubTotal
|
|
||||||
{
|
|
||||||
$this->taxableAmount = $taxableAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTaxAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->taxAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $taxAmount
|
|
||||||
* @return TaxSubTotal
|
|
||||||
*/
|
|
||||||
public function setTaxAmount(?float $taxAmount): TaxSubTotal
|
|
||||||
{
|
|
||||||
$this->taxAmount = $taxAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return TaxCategory
|
|
||||||
*/
|
|
||||||
public function getTaxCategory(): ?TaxCategory
|
|
||||||
{
|
|
||||||
return $this->taxCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxCategory $taxCategory
|
|
||||||
* @return TaxSubTotal
|
|
||||||
*/
|
|
||||||
public function setTaxCategory(TaxCategory $taxCategory): TaxSubTotal
|
|
||||||
{
|
|
||||||
$this->taxCategory = $taxCategory;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getPercent(): ?float
|
|
||||||
{
|
|
||||||
return $this->percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param float $percent
|
|
||||||
* @return TaxSubTotal
|
|
||||||
*/
|
|
||||||
public function setPercent(?float $percent): TaxSubTotal
|
|
||||||
{
|
|
||||||
$this->percent = $percent;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->taxableAmount === null) {
|
|
||||||
throw new InvalidArgumentException('Missing taxsubtotal taxableAmount');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxAmount === null) {
|
|
||||||
throw new InvalidArgumentException('Missing taxsubtotal taxamount');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->taxCategory === null) {
|
|
||||||
throw new InvalidArgumentException('Missing taxsubtotal taxcategory');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'TaxableAmount',
|
|
||||||
'value' => NumberFormatter::format($this->taxableAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'TaxAmount',
|
|
||||||
'value' => NumberFormatter::format($this->taxAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($this->percent !== null) {
|
|
||||||
$writer->write([
|
|
||||||
Schema::CBC . 'Percent' => $this->percent
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
Schema::CAC . 'TaxCategory' => $this->taxCategory
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
87
vendor/num-num/ubl-invoice/src/TaxTotal.php
vendored
87
vendor/num-num/ubl-invoice/src/TaxTotal.php
vendored
|
|
@ -1,87 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class TaxTotal implements XmlSerializable
|
|
||||||
{
|
|
||||||
private $taxAmount;
|
|
||||||
private $taxSubTotals = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTaxAmount(): ?float
|
|
||||||
{
|
|
||||||
return $this->taxAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $taxAmount
|
|
||||||
* @return TaxTotal
|
|
||||||
*/
|
|
||||||
public function setTaxAmount(?float $taxAmount): TaxTotal
|
|
||||||
{
|
|
||||||
$this->taxAmount = $taxAmount;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getTaxSubTotals(): array
|
|
||||||
{
|
|
||||||
return $this->taxSubTotals;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TaxSubTotal $taxSubTotal
|
|
||||||
* @return TaxTotal
|
|
||||||
*/
|
|
||||||
public function addTaxSubTotal(TaxSubTotal $taxSubTotal): TaxTotal
|
|
||||||
{
|
|
||||||
$this->taxSubTotals[] = $taxSubTotal;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The validate function that is called during xml writing to valid the data of the object.
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function validate()
|
|
||||||
{
|
|
||||||
if ($this->taxAmount === null) {
|
|
||||||
throw new InvalidArgumentException('Missing taxtotal taxamount');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
* @param Writer $writer
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
$writer->write([
|
|
||||||
[
|
|
||||||
'name' => Schema::CBC . 'TaxAmount',
|
|
||||||
'value' => NumberFormatter::format($this->taxAmount, 2),
|
|
||||||
'attributes' => [
|
|
||||||
'currencyID' => Generator::$currencyID
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
foreach ($this->taxSubTotals as $taxSubTotal) {
|
|
||||||
$writer->write([Schema::CAC . 'TaxSubtotal' => $taxSubTotal]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
93
vendor/num-num/ubl-invoice/src/UNCL4461.php
vendored
93
vendor/num-num/ubl-invoice/src/UNCL4461.php
vendored
|
|
@ -1,93 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible Payment Means Codes that can be used
|
|
||||||
* To extend, see also: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL4461/
|
|
||||||
*/
|
|
||||||
class UNCL4461
|
|
||||||
{
|
|
||||||
const INSTRUMENT_NOT_DEFINED = "1";
|
|
||||||
const AUTOMATED_CLEARING_HOUSE_CREDIT = "2";
|
|
||||||
const AUTOMATED_CLEARING_HOUSE_DEBIT = "3";
|
|
||||||
const ACH_DEMAND_DEBIT_REVERSAL = "4";
|
|
||||||
const ACH_DEMAND_CREDIT_REVERSAL = "5";
|
|
||||||
const ACH_DEMAND_CREDIT = "6";
|
|
||||||
const ACH_DEMAND_DEBIT = "7";
|
|
||||||
const HOLD = "8";
|
|
||||||
const NATIONAL_OR_REGIONAL_CLEARING = "9";
|
|
||||||
const IN_CASH = "10";
|
|
||||||
const ACH_SAVINGS_CREDIT_REVERSAL = "11";
|
|
||||||
const ACH_SAVINGS_DEBIT_REVERSAL = "12";
|
|
||||||
const ACH_SAVINGS_CREDIT = "13";
|
|
||||||
const ACH_SAVINGS_DEBIT = "14";
|
|
||||||
const BOOKENTRY_CREDIT = "15";
|
|
||||||
const BOOKENTRY_DEBIT = "16";
|
|
||||||
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_CREDIT = "17";
|
|
||||||
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_DEBIT = "18";
|
|
||||||
const ACH_DEMAND_CORPORATE_TRADE_PAYMENT_CREDIT = "19";
|
|
||||||
const CHEQUE = "20";
|
|
||||||
const BANKERS_DRAFT = "21";
|
|
||||||
const CERTIFIED_BANKERS_DRAFT = "22";
|
|
||||||
const BANK_CHEQUE_ISSUED_BY_A_BANKING_OR_SIMILAR_ESTABLISHMENT = "23";
|
|
||||||
const BILL_OF_EXCHANGE_AWAITING_ACCEPTANCE = "24";
|
|
||||||
const CERTIFIED_CHEQUE = "25";
|
|
||||||
const LOCAL_CHEQUE = "26";
|
|
||||||
const ACH_DEMAND_CORPORATE_TRADE_PAYMENT_DEBIT = "27";
|
|
||||||
const ACH_DEMAND_CORPORATE_TRADE_EXCHANGE_CREDIT = "28";
|
|
||||||
const ACH_DEMAND_CORPORATE_TRADE_EXCHANGE_DEBIT = "29";
|
|
||||||
const CREDIT_TRANSFER = "30";
|
|
||||||
const DEBIT_TRANSFER = "31";
|
|
||||||
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_CREDIT = "32";
|
|
||||||
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_DEBIT = "33";
|
|
||||||
const ACH_PREARRANGED_PAYMENT_AND_DEPOSIT = "34";
|
|
||||||
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_CREDIT = "35";
|
|
||||||
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_DEBIT = "36";
|
|
||||||
const ACH_SAVINGS_CORPORATE_TRADE_PAYMENT_CREDIT = "37";
|
|
||||||
const ACH_SAVINGS_CORPORATE_TRADE_PAYMENT_DEBIT = "38";
|
|
||||||
const ACH_SAVINGS_CORPORATE_TRADE_EXCHANGE_CREDIT = "39";
|
|
||||||
const ACH_SAVINGS_CORPORATE_TRADE_EXCHANGE_DEBIT = "40";
|
|
||||||
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_CREDIT = "41";
|
|
||||||
const PAYMENT_TO_BANK_ACCOUNT = "42";
|
|
||||||
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_DEBIT = "43";
|
|
||||||
const ACCEPTED_BILL_OF_EXCHANGE = "44";
|
|
||||||
const REFERENCED_HOME_BANKING_CREDIT_TRANSFER = "45";
|
|
||||||
const INTERBANK_DEBIT_TRANSFER = "46";
|
|
||||||
const HOME_BANKING_DEBIT_TRANSFER = "47";
|
|
||||||
const BANK_CARD = "48";
|
|
||||||
const DIRECT_DEBIT = "49";
|
|
||||||
const PAYMENT_BY_POSTGIRO = "50";
|
|
||||||
const FR_NORME_6_97_TELEREGLEMENT_CFONB = "51";
|
|
||||||
const URGENT_COMMERCIAL_PAYMENT = "52";
|
|
||||||
const URGENT_TREASURY_PAYMENT = "53";
|
|
||||||
const CREDIT_CARD = "54";
|
|
||||||
const DEBIT_CARD = "55";
|
|
||||||
const BANKGIRO = "56";
|
|
||||||
const STANDING_AGREEMENT = "57";
|
|
||||||
const SEPA_CREDIT_TRANSFER = "58";
|
|
||||||
const SEPA_DIRECT_DEBIT = "59";
|
|
||||||
const PROMISSORY_NOTE = "60";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_THE_DEBTOR = "61";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_THE_DEBTOR_AND_ENDORSED_BY_A_BANK = "62";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_THE_DEBTOR_AND_ENDORSED_BY_A_THIRD_PARTY = "63";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_A_BANK = "64";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_A_BANK_AND_ENDORSED_BY_ANOTHER_BANK = "65";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_A_THIRD_PARTY = "66";
|
|
||||||
const PROMISSORY_NOTE_SIGNED_BY_A_THIRD_PARTY_AND_ENDORSED_BY_A_BANK = "67";
|
|
||||||
const ONLINE_PAYMENT_SERVICE = "68";
|
|
||||||
const BILL_DRAWN_BY_THE_CREDITOR_ON_THE_DEBTOR = "70";
|
|
||||||
const BILL_DRAWN_BY_THE_CREDITOR_ON_A_BANK = "74";
|
|
||||||
const BILL_DRAWN_BY_THE_CREDITOR_ENDORSED_BY_ANOTHER_BANK = "75";
|
|
||||||
const BILL_DRAWN_BY_THE_CREDITOR_ON_A_BANK_AND_ENDORSED_BY_A_THIRD_PARTY = "76";
|
|
||||||
const BILL_DRAWN_BY_THE_CREDITOR_ON_A_THIRD_PARTY = "77";
|
|
||||||
const BILL_DRAWN_BY_CREDITOR_ON_THIRD_PARTY_ACCEPTED_AND_ENDORSED_BY_BANK = "78";
|
|
||||||
const NOT_TRANSFERABLE_BANKERS_DRAFT = "91";
|
|
||||||
const NOT_TRANSFERABLE_LOCAL_CHEQUE = "92";
|
|
||||||
const REFERENCE_GIRO = "93";
|
|
||||||
const URGENT_GIRO = "94";
|
|
||||||
const FREE_FORMAT_GIRO = "95";
|
|
||||||
const REQUESTED_METHOD_FOR_PAYMENT_WAS_NOT_USED = "96";
|
|
||||||
const CLEARING_BETWEEN_PARTNERS = "97";
|
|
||||||
const MUTUALLY_DEFINED = "ZZZ";
|
|
||||||
}
|
|
||||||
25
vendor/num-num/ubl-invoice/src/UNCL5305.php
vendored
25
vendor/num-num/ubl-invoice/src/UNCL5305.php
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible UNCL5305 Codes that can be used
|
|
||||||
* To extend, see also:
|
|
||||||
* https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL5305/
|
|
||||||
* https://github.com/OpenPEPPOL/peppol-bis-invoice-3/blob/master/structure/codelist/UNCL5305.xml
|
|
||||||
*/
|
|
||||||
class UNCL5305
|
|
||||||
{
|
|
||||||
public const UNCL5305 = 'UNCL5305';
|
|
||||||
|
|
||||||
public const VAT_REVERSE_CHARGE = 'AE';
|
|
||||||
public const EXEMPT_FROM_TAX = 'E';
|
|
||||||
public const STANDARD_RATE = 'S';
|
|
||||||
public const ZERO_RATED_GOODS = 'Z';
|
|
||||||
public const FREE_EXPORT_ITEM = 'G';
|
|
||||||
public const OUTSIDE_TAX_SCOPE = 'O';
|
|
||||||
public const EEA_GOODS_AND_SERVICES = 'K';
|
|
||||||
public const CANARY_ISLANDS_INDIRECT_TAX = 'L';
|
|
||||||
public const CEUTA_AND_MELILLA = 'M';
|
|
||||||
public const TRANSFERRED_VAT_ITALY = 'B';
|
|
||||||
}
|
|
||||||
31
vendor/num-num/ubl-invoice/src/UnitCode.php
vendored
31
vendor/num-num/ubl-invoice/src/UnitCode.php
vendored
|
|
@ -1,31 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible Unit Codes that can be used
|
|
||||||
* To extend, see also: http://tfig.unece.org/contents/recommendation-20.htm
|
|
||||||
*/
|
|
||||||
class UnitCode
|
|
||||||
{
|
|
||||||
const UNIT = 'C62';
|
|
||||||
const PIECE = 'H87';
|
|
||||||
|
|
||||||
const ARE = 'ARE';
|
|
||||||
const HECTARE = 'HAR';
|
|
||||||
|
|
||||||
const SQUARE_METRE = 'MTK';
|
|
||||||
const SQUARE_KILOMETRE = 'KMK';
|
|
||||||
const SQUARE_FOOT = 'FTK';
|
|
||||||
const SQUARE_YARD = 'YDK';
|
|
||||||
const SQUARE_MILE = 'MIK';
|
|
||||||
|
|
||||||
const LITRE = 'LTR';
|
|
||||||
|
|
||||||
const SECOND = 'SEC';
|
|
||||||
const MINUTE = 'MIN';
|
|
||||||
const HOUR = 'HUR';
|
|
||||||
const DAY = 'DAY';
|
|
||||||
const MONTH = 'MON';
|
|
||||||
const YEAR = 'ANN';
|
|
||||||
}
|
|
||||||
353
vendor/num-num/ubl-invoice/src/VatExemptionCode.php
vendored
353
vendor/num-num/ubl-invoice/src/VatExemptionCode.php
vendored
|
|
@ -1,353 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All possible Vat Exemption Codes that can be used
|
|
||||||
* To extend, see also:
|
|
||||||
* https://docs.peppol.eu/poacc/billing/3.0/codelist/vatex/
|
|
||||||
*/
|
|
||||||
class VatExemptionCode
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Exempt based on article 79, point c of Council Directive 2006/112/EC
|
|
||||||
* Exemptions relating to repayment of expenditures. Remark, Repayment of expenditure is not an exemption in the sense of the VAT Directive but may be handled as such in the context of the EN16931.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_79_C = 'VATEX-EU-79-C';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132 of Council Directive 2006/112/EC
|
|
||||||
* Exemptions for certain activities in public interest.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132 = 'VATEX-EU-132';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (a) of Council Directive 2006/112/EC
|
|
||||||
* The supply by the public postal services of services other than passenger transport and telecommunications services, and the supply of goods incidental thereto.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1A = 'VATEX-EU-132-1A';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (b) of Council Directive 2006/112/EC
|
|
||||||
* Hospital and medical care and closely related activities undertaken by bodies governed by public law or, under social conditions comparable with those applicable to bodies governed by public law, by hospitals, centres for medical treatment or diagnosis and other duly recognised establishments of a similar nature
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1B = 'VATEX-EU-132-1B';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (c) of Council Directive 2006/112/EC
|
|
||||||
* The provision of medical care in the exercise of the medical and paramedical professions as defined by the Member State concerned.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1C = 'VATEX-EU-132-1C';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (d) of Council Directive 2006/112/EC
|
|
||||||
* The supply of human organs, blood and milk.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1D = 'VATEX-EU-132-1D';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (e) of Council Directive 2006/112/EC
|
|
||||||
* The supply of services by dental technicians in their professional capacity and the supply of dental prostheses by dentists and dental technicians.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1E = 'VATEX-EU-132-1E';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (f) of Council Directive 2006/112/EC
|
|
||||||
* The supply of services by independent groups of persons, who are carrying on an activity which is exempt from VAT or in relation to which they are not taxable persons, for the purpose of rendering their members the services directly necessary for the exercise of that activity, where those groups merely claim from their members exact reimbursement of their share of the joint expenses, provided that such exemption is not likely to cause distortion of competition.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1F = 'VATEX-EU-132-1F';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (g) of Council Directive 2006/112/EC
|
|
||||||
* The supply of services and of goods closely linked to welfare and social security work, including those supplied by old people's homes, by bodies governed by public law or by other bodies recognised by the Member State concerned as being devoted to social wellbeing.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1G = 'VATEX-EU-132-1G';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (h) of Council Directive 2006/112/EC
|
|
||||||
* "The supply of services and of goods closely linked to the protection of children and young persons by bodies governed by public law or by other organisations recognised by the Member State concerned as being devoted to social wellbeing"
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1H = 'VATEX-EU-132-1H';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (i) of Council Directive 2006/112/EC
|
|
||||||
* " The provision of children's or young people's education, school or university education, vocational training or retraining, including the supply of services and of goods closely related thereto, by bodies governed by public law having such as their aim or by other organisations recognised by the Member State concerned as having similar objects."
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1I = 'VATEX-EU-132-1I';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (j) of Council Directive 2006/112/EC
|
|
||||||
* Tuition given privately by teachers and covering school or university education.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1J = 'VATEX-EU-132-1J';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (k) of Council Directive 2006/112/EC
|
|
||||||
* The supply of staff by religious or philosophical institutions for the purpose of the activities referred to in points (b), (g), (h) and (i) and with a view to spiritual welfare.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1K = 'VATEX-EU-132-1K';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (l) of Council Directive 2006/112/EC
|
|
||||||
* The supply of services, and the supply of goods closely linked thereto, to their members in their common interest in return for a subscription fixed in accordance with their rules by non-profitmaking organisations with aims of a political, trade-union, religious, patriotic, philosophical, philanthropic or civic nature, provided that this exemption is not likely to cause distortion of competition.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1L = 'VATEX-EU-132-1L';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (m) of Council Directive 2006/112/EC
|
|
||||||
* The supply of certain services closely linked to sport or physical education by non-profit-making organisations to persons taking part in sport or physical education.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1M = 'VATEX-EU-132-1M';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (n) of Council Directive 2006/112/EC
|
|
||||||
* The supply of certain cultural services, and the supply of goods closely linked thereto, by bodies governed by public law or by other cultural bodies recognised by the Member State concerned.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1N = 'VATEX-EU-132-1N';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (o) of Council Directive 2006/112/EC
|
|
||||||
* "The supply of services and goods, by organisations whose activities are exempt pursuant to points (b), (g), (h), (i), (l), (m) and (n), in connection with fund-raising events organised exclusively for their own benefit, provided that exemption is not likely to cause distortion of competition."
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1O = 'VATEX-EU-132-1O';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (p) of Council Directive 2006/112/EC
|
|
||||||
* The supply of transport services for sick or injured persons in vehicles specially designed for the purpose, by duly authorised bodies.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1P = 'VATEX-EU-132-1P';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 132, section 1 (q) of Council Directive 2006/112/EC
|
|
||||||
* The activities, other than those of a commercial nature, carried out by public radio and television bodies.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_132_1Q = 'VATEX-EU-132-1Q';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143 of Council Directive 2006/112/EC
|
|
||||||
* Exemptions on importation.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143 = 'VATEX-EU-143';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (a) of Council Directive 2006/112/EC
|
|
||||||
* The final importation of goods of which the supply by a taxable person would in all circumstances be exempt within their respective territory.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1A = 'VATEX-EU-143-1A';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (b) of Council Directive 2006/112/EC
|
|
||||||
* The final importation of goods governed by Council Directives 69/169/EEC (1), 83/181/EEC (2) and 2006/79/EC (3).
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1B = 'VATEX-EU-143-1B';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (c) of Council Directive 2006/112/EC
|
|
||||||
* The final importation of goods, in free circulation from a third territory forming part of the Community customs territory, which would be entitled to exemption under point (b) if they had been imported within the meaning of the first paragraph of Article 30
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1C = 'VATEX-EU-143-1C';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (d) of Council Directive 2006/112/EC
|
|
||||||
* The importation of goods dispatched or transported from a third territory or a third country into a Member State other than that in which the dispatch or transport of the goods ends, where the supply of such goods by the importer designated or recognised under Article 201 as liable for payment of VAT is exempt under Article 138.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1D = 'VATEX-EU-143-1D';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (e) of Council Directive 2006/112/EC
|
|
||||||
* The reimportation, by the person who exported them, of goods in the state in which they were exported, where those goods are exempt from customs duties.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1E = 'VATEX-EU-143-1E';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (f) of Council Directive 2006/112/EC
|
|
||||||
* The importation, under diplomatic and consular arrangements, of goods which are exempt from customs duties.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1F = 'VATEX-EU-143-1F';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (fa) of Council Directive 2006/112/EC
|
|
||||||
* "The importation of goods by the European Community, the European Atomic Energy Community, the European Central Bank or the European Investment Bank, or by the bodies set up by the Communities to which the Protocol of 8 April 1965 on the privileges and immunities of the European Communities applies, within the limits and under the conditions of that Protocol and the agreements for its implementation or the headquarters agreements, in so far as it does not lead to distortion of competition"
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1FA = 'VATEX-EU-143-1FA';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (g) of Council Directive 2006/112/EC
|
|
||||||
* " The importation of goods by international bodies, other than those referred to in point (fa), recognised as such by the public authorities of the host Member State, or by members of such bodies, within the limits and under the conditions laid down by the international conventions establishing the bodies or by headquarters agreements"
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1G = 'VATEX-EU-143-1G';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (h) of Council Directive 2006/112/EC
|
|
||||||
* The importation of goods, into Member States party to the North Atlantic Treaty, by the armed forces of other States party to that Treaty for the use of those forces or the civilian staff accompanying them or for supplying their messes or canteens where such forces take part in the common defence effort.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1H = 'VATEX-EU-143-1H';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (i) of Council Directive 2006/112/EC
|
|
||||||
* The importation of goods by the armed forces of the United Kingdom stationed in the island of Cyprus pursuant to the Treaty of Establishment concerning the Republic of Cyprus, dated 16 August 1960, which are for the use of those forces or the civilian staff accompanying them or for supplying their messes or canteens.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1I = 'VATEX-EU-143-1I';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (j) of Council Directive 2006/112/EC
|
|
||||||
* The importation into ports, by sea fishing undertakings, of their catches, unprocessed or after undergoing preservation for marketing but before being supplied.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1J = 'VATEX-EU-143-1J';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (k) of Council Directive 2006/112/EC
|
|
||||||
* The importation of gold by central banks.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1K = 'VATEX-EU-143-1K';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 143, section 1 (l) of Council Directive 2006/112/EC
|
|
||||||
* The importation of gas through a natural gas system or any network connected to such a system or fed in from a vessel transporting gas into a natural gas system or any upstream pipeline network, of electricity or of heat or cooling energy through heating or cooling networks.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_143_1L = 'VATEX-EU-143-1L';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148 of Council Directive 2006/112/EC
|
|
||||||
* Exemptions related to international transport.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148 = 'VATEX-EU-148';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (a) of Council Directive 2006/112/EC
|
|
||||||
* Fuel supplies for commercial international transport vessels
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_A = 'VATEX-EU-148-A';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (b) of Council Directive 2006/112/EC
|
|
||||||
* Fuel supplies for fighting ships in international transport.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_B = 'VATEX-EU-148-B';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (c) of Council Directive 2006/112/EC
|
|
||||||
* Maintenance, modification, chartering and hiring of international transport vessels.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_C = 'VATEX-EU-148-C';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (d) of Council Directive 2006/112/EC
|
|
||||||
* Supply to of other services to commercial international transport vessels.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_D = 'VATEX-EU-148-D';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (e) of Council Directive 2006/112/EC
|
|
||||||
* Fuel supplies for aircraft on international routes.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_E = 'VATEX-EU-148-E';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (f) of Council Directive 2006/112/EC
|
|
||||||
* Maintenance, modification, chartering and hiring of aircraft on international routes.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_F = 'VATEX-EU-148-F';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 148, section (g) of Council Directive 2006/112/EC
|
|
||||||
* Supply to of other services to aircraft on international routes.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_148_G = 'VATEX-EU-148-G';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151 of Council Directive 2006/112/EC
|
|
||||||
* Exemptions relating to certain Transactions treated as exports.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151 = 'VATEX-EU-151';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151, section 1 (a) of Council Directive 2006/112/EC
|
|
||||||
* The supply of goods or services under diplomatic and consular arrangements.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151_1A = 'VATEX-EU-151-1A';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151, section 1 (aa) of Council Directive 2006/112/EC
|
|
||||||
* The supply of goods or services to the European Community, the European Atomic Energy Community, the European Central Bank or the European Investment Bank, or to the bodies set up by the Communities to which the Protocol of 8 April 1965 on the privileges and immunities of the European Communities applies, within the limits and under the conditions of that Protocol and the agreements for its implementation or the headquarters agreements, in so far as it does not lead to distortion of competition.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151_1AA = 'VATEX-EU-151-1AA';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151, section 1 (b) of Council Directive 2006/112/EC
|
|
||||||
* The supply of goods or services to international bodies, other than those referred to in point (aa), recognised as such by the public authorities of the host Member States, and to members of such bodies, within the limits and under the conditions laid down by the international conventions establishing the bodies or by headquarters agreements.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151_1B = 'VATEX-EU-151-1B';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151, section 1 (c) of Council Directive 2006/112/EC
|
|
||||||
* The supply of goods or services within a Member State which is a party to the North Atlantic Treaty, intended either for the armed forces of other States party to that Treaty for the use of those forces, or of the civilian staff accompanying them, or for supplying their messes or canteens when such forces take part in the common defence effort.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151_1C = 'VATEX-EU-151-1C';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151, section 1 (d) of Council Directive 2006/112/EC
|
|
||||||
* The supply of goods or services to another Member State, intended for the armed forces of any State which is a party to the North Atlantic Treaty, other than the Member State of destination itself, for the use of those forces, or of the civilian staff accompanying them, or for supplying their messes or canteens when such forces take part in the common defence effort.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151_1D = 'VATEX-EU-151-1D';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 151, section 1 (e) of Council Directive 2006/112/EC
|
|
||||||
* The supply of goods or services to the armed forces of the United Kingdom stationed in the island of Cyprus pursuant to the Treaty of Establishment concerning the Republic of Cyprus, dated 16 August 1960, which are for the use of those forces, or of the civilian staff accompanying them, or for supplying their messes or canteens.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_151_1E = 'VATEX-EU-151-1E';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exempt based on article 309 of Council Directive 2006/112/EC
|
|
||||||
* Travel agents performed outside of EU.
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_309 = 'VATEX-EU-309';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reverse charge
|
|
||||||
* Supports EN 16931-1 rule BR-AE-10 - Only use with VAT category code AE
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_AE = 'VATEX-EU-AE';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intra-Community acquisition from second hand means of transport
|
|
||||||
* Second-hand means of transport - Indication that VAT has been paid according to the relevant transitional arrangements - Only use with VAT category code E
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_D = 'VATEX-EU-D';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intra-Community acquisition of second hand goods
|
|
||||||
* Second-hand goods - Indication that the VAT margin scheme for second-hand goods has been applied. - Only use with VAT category code E
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_F = 'VATEX-EU-F';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Export outside the EU
|
|
||||||
* Supports EN 16931-1 rule BR-G-10 - Only use with VAT category code G
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_G = 'VATEX-EU-G';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intra-Community acquisition of works of art
|
|
||||||
* Works of art - Indication that the VAT margin scheme for works of art has been applied. - Only use with VAT category code E
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_I = 'VATEX-EU-I';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intra-Community supply
|
|
||||||
* Supports EN 16931-1 rule BR-IC-10 - Only use with VAT category code K
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_IC = 'VATEX-EU-IC';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Not subject to VAT
|
|
||||||
* Supports EN 16931-1 rule BR-O-10 - Only use with VAT category code O
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_O = 'VATEX-EU-O';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intra-Community acquisition of collectors items and antiques
|
|
||||||
* Collectors' items and antiques - Indication that the VAT margin scheme for collector’s items and antiques has been applied. - Only use with VAT category code E
|
|
||||||
*/
|
|
||||||
public const VATEX_EU_J = 'VATEX-EU-J';
|
|
||||||
}
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 credit note document
|
|
||||||
*/
|
|
||||||
class BillingReferenceCreditNoteTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-CreditNote-2.1.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID')
|
|
||||||
->setBuyersItemIdentification('BUYERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$creditNoteLine = (new \NumNum\UBL\CreditNoteLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$creditNoteLines = [$creditNoteLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
$billingReference = (new \NumNum\UBL\BillingReference())
|
|
||||||
->setInvoiceDocumentReference((new \NumNum\UBL\InvoiceDocumentReference())
|
|
||||||
->setOriginalInvoiceId(1234)
|
|
||||||
->setIssueDate(new \DateTime()));
|
|
||||||
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$creditNote = (new \NumNum\UBL\CreditNote())
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setBillingReference($billingReference)
|
|
||||||
->setCreditNoteLines($creditNoteLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::CREDIT_NOTE);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->creditNote($creditNote);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/SimpleCreditNoteTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use NumNum\UBL\InvoiceTypeCode;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.2 invoice document
|
|
||||||
*/
|
|
||||||
class ContractDocumentReferenceTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines = [$invoiceLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
$contractDocumentReference = (new \NumNum\UBL\ContractDocumentReference())
|
|
||||||
->setId("123Test");
|
|
||||||
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime('-31 days'))
|
|
||||||
->setEndDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setUBLVersionID('2.2')
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE)
|
|
||||||
->setDueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setContractDocumentReference($contractDocumentReference)
|
|
||||||
->setBuyerReference("SomeReference")
|
|
||||||
->setInvoicePeriod($invoicePeriod);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/ContractDocumentReferenceTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class DocumentTypeTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client contact node
|
|
||||||
$clientContact = (new \NumNum\UBL\Contact())
|
|
||||||
->setName('Client name')
|
|
||||||
->setElectronicMail('email@client.com')
|
|
||||||
->setTelephone('0032 472 123 456')
|
|
||||||
->setTelefax('0032 9 1234 567');
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setContact($clientContact);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLines = [];
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCost('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCostCode('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Attachment
|
|
||||||
$attachment = (new \NumNum\UBL\Attachment())
|
|
||||||
->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf');
|
|
||||||
|
|
||||||
$additionalDocumentReference = new \NumNum\UBL\AdditionalDocumentReference();
|
|
||||||
$additionalDocumentReference->setId('SomeID');
|
|
||||||
$additionalDocumentReference->setDocumentType("CommercialInvoice");
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setSupplierAssignedAccountID('10001')
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setAdditionalDocumentReference($additionalDocumentReference);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/EmptyAttachmentTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
118
vendor/num-num/ubl-invoice/tests/DueDateTest.php
vendored
118
vendor/num-num/ubl-invoice/tests/DueDateTest.php
vendored
|
|
@ -1,118 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use NumNum\UBL\InvoiceTypeCode;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.2 invoice document
|
|
||||||
*/
|
|
||||||
class DueDateTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines = [$invoiceLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setUBLVersionID('2.2')
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE)
|
|
||||||
->setDueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/DueDateTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
202
vendor/num-num/ubl-invoice/tests/EN16931Test.php
vendored
202
vendor/num-num/ubl-invoice/tests/EN16931Test.php
vendored
|
|
@ -1,202 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use NumNum\UBL\UNCL4461;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class EN16931Test extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
|
|
||||||
private $xslfile = 'vendor/num-num/ubl-invoice/tests/EN16931-UBL-validation.xslt';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId('VAT');
|
|
||||||
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt 1')
|
|
||||||
->setAdditionalStreetName('Building A')
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
$financialInstitutionBranch = (new \NumNum\UBL\FinancialInstitutionBranch())
|
|
||||||
->setId('RABONL2U');
|
|
||||||
|
|
||||||
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount())
|
|
||||||
->setFinancialInstitutionBranch($financialInstitutionBranch)
|
|
||||||
->setName('Customer Account Holder')
|
|
||||||
->setId('NL00RABO0000000000');
|
|
||||||
|
|
||||||
$paymentMeans = (new \NumNum\UBL\PaymentMeans())
|
|
||||||
->setPayeeFinancialAccount($payeeFinancialAccount)
|
|
||||||
->setPaymentMeansCode(UNCL4461::DEBIT_TRANSFER, [])
|
|
||||||
->setPaymentId('our invoice 1234');
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierLegalEntity = (new \NumNum\UBL\LegalEntity())
|
|
||||||
->setRegistrationName('Supplier Company Name')
|
|
||||||
->setCompanyId('BE123456789');
|
|
||||||
|
|
||||||
$supplierPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
|
|
||||||
->setTaxScheme($taxScheme)
|
|
||||||
->setCompanyId('BE123456789');
|
|
||||||
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setLegalEntity($supplierLegalEntity)
|
|
||||||
->setPartyTaxScheme($supplierPartyTaxScheme)
|
|
||||||
->setPartyIdentificationId('BE123456789')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientLegalEntity = (new \NumNum\UBL\LegalEntity())
|
|
||||||
->setRegistrationName('Client Company Name')
|
|
||||||
->setCompanyId('Client Company Registration');
|
|
||||||
|
|
||||||
$clientPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
|
|
||||||
->setTaxScheme($taxScheme)
|
|
||||||
->setCompanyId('BE123456789');
|
|
||||||
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Client Company Name')
|
|
||||||
->setLegalEntity($clientLegalEntity)
|
|
||||||
->setPartyTaxScheme($clientPartyTaxScheme)
|
|
||||||
->setPartyIdentificationId('BE123456789')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2.1)
|
|
||||||
->setPayableRoundingAmount(0)
|
|
||||||
->setTaxInclusiveAmount(10 + 2.1)
|
|
||||||
->setLineExtensionAmount(10)
|
|
||||||
->setTaxExclusiveAmount(10);
|
|
||||||
|
|
||||||
$classifiedTaxCategory = (new \NumNum\UBL\ClassifiedTaxCategory())
|
|
||||||
->setId('S')
|
|
||||||
->setPercent(21.00)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setClassifiedTaxCategory($classifiedTaxCategory)
|
|
||||||
->setDescription('Product Description');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setLineExtensionAmount(10)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines = [$invoiceLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId('S', [])
|
|
||||||
->setPercent(21.00)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Payment Terms
|
|
||||||
$paymentTerms = (new \NumNum\UBL\PaymentTerms())
|
|
||||||
->setNote('30 days net');
|
|
||||||
|
|
||||||
// Delivery
|
|
||||||
$deliveryLocation = (new \NumNum\UBL\Address())
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
$delivery = (new \NumNum\UBL\Delivery())
|
|
||||||
->setActualDeliveryDate(new \DateTime())
|
|
||||||
->setDeliveryLocation($deliveryLocation);
|
|
||||||
|
|
||||||
$orderReference = (new \NumNum\UBL\OrderReference())
|
|
||||||
->setId('5009567')
|
|
||||||
->setSalesOrderId('tRST-tKhM');
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setCustomizationID('urn:cen.eu:en16931:2017')
|
|
||||||
->setId(1234)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setNote('invoice note')
|
|
||||||
->setDelivery($delivery)
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setPaymentTerms($paymentTerms)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPaymentMeans([$paymentMeans])
|
|
||||||
->setBuyerReference('BUYER_REF')
|
|
||||||
->setOrderReference($orderReference)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/EN16931Test.xml');
|
|
||||||
|
|
||||||
// $this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
|
|
||||||
// Use webservice at peppol.helger.com to verify the result
|
|
||||||
$wsdl = "http://peppol.helger.com/wsdvs?wsdl=1";
|
|
||||||
$client = new \SoapClient($wsdl);
|
|
||||||
$response = $client->validate(['XML' => $outputXMLString, 'VESID' => 'eu.cen.en16931:ubl:1.3.1']);
|
|
||||||
|
|
||||||
// Output validation warnings if present
|
|
||||||
if ($response->mostSevereErrorLevel == 'WARN' && isset($response->Result[1]->Item)) {
|
|
||||||
foreach ($response->Result[1]->Item as $responseWarning) {
|
|
||||||
// fwrite(STDERR, '*** '.$responseWarning->errorText."\n");
|
|
||||||
fwrite(STDERR, '*** '.json_encode($responseWarning)."\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertEquals('SUCCESS', $response->mostSevereErrorLevel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,161 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class EmptyAttachmentTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client contact node
|
|
||||||
$clientContact = (new \NumNum\UBL\Contact())
|
|
||||||
->setName('Client name')
|
|
||||||
->setElectronicMail('email@client.com')
|
|
||||||
->setTelephone('0032 472 123 456')
|
|
||||||
->setTelefax('0032 9 1234 567');
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setContact($clientContact);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLines = [];
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCost('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCostCode('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Attachment
|
|
||||||
$attachment = (new \NumNum\UBL\Attachment())
|
|
||||||
->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf');
|
|
||||||
|
|
||||||
$additionalDocumentReference = new \NumNum\UBL\AdditionalDocumentReference();
|
|
||||||
$additionalDocumentReference->setId('SomeID');
|
|
||||||
$additionalDocumentReference->setDocumentTypeCode(130);
|
|
||||||
|
|
||||||
// Not adding an attachment to AdditionalDocumentReference should not trigger an error
|
|
||||||
// $additionalDocumentReference->setAttachment($attachment);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setSupplierAssignedAccountID('10001')
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setAdditionalDocumentReference($additionalDocumentReference);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/EmptyAttachmentTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,171 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class MultiplePaymentMeansTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client contact node
|
|
||||||
$clientContact = (new \NumNum\UBL\Contact())
|
|
||||||
->setName('Client name')
|
|
||||||
->setElectronicMail('email@client.com')
|
|
||||||
->setTelephone('0032 472 123 456')
|
|
||||||
->setTelefax('0032 9 1234 567');
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setContact($clientContact);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
$commodityClassification = (new \NumNum\UBL\CommodityClassification())
|
|
||||||
->setItemClassificationCode('123456')
|
|
||||||
->setItemClassificationListId('urn:ean.ucc:eanucc:2:2')
|
|
||||||
->setItemClassificationListVersionId('16');
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID')
|
|
||||||
->setCommodityClassification($commodityClassification);
|
|
||||||
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLines = [];
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCost('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCostCode('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
$paymentMeans = [];
|
|
||||||
|
|
||||||
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount)->setId('RO123456789012345');
|
|
||||||
$paymentMeans[] = (new \NumNum\UBL\PaymentMeans())
|
|
||||||
->setPaymentMeansCode(31)
|
|
||||||
->setPaymentDueDate(new \DateTime())
|
|
||||||
->setPayeeFinancialAccount($payeeFinancialAccount);
|
|
||||||
|
|
||||||
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount)->setId('RO544456789067890');
|
|
||||||
$paymentMeans[] = (new \NumNum\UBL\PaymentMeans())
|
|
||||||
->setPaymentMeansCode(31)
|
|
||||||
->setPaymentDueDate(new \DateTime())
|
|
||||||
->setPayeeFinancialAccount($payeeFinancialAccount);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setSupplierAssignedAccountID('10001')
|
|
||||||
->setPaymentMeans($paymentMeans)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/MultiplePaymentMeansTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use NumNum\UBL\NumberFormatter;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the NumberFormatter class
|
|
||||||
*/
|
|
||||||
class NumberFormatterTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @dataProvider formattedNumbersProvider
|
|
||||||
*/
|
|
||||||
public function testNumberFormatterRounding($number, string $formattedNumber, ?int $decimals)
|
|
||||||
{
|
|
||||||
$result = NumberFormatter::format($number, $decimals);
|
|
||||||
return $this->assertEqualsCanonicalizing($formattedNumber, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function formattedNumbersProvider(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[0.0, '0', null],
|
|
||||||
[0.1, '0.1', null],
|
|
||||||
[0.1200500, '0.12005', null],
|
|
||||||
[1.2345678, '1.2345678', null],
|
|
||||||
[1.236789, '1.236789', null],
|
|
||||||
[1.236789, '1.24', 2],
|
|
||||||
[1, '1.00', 2],
|
|
||||||
[1.000, '1', null],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.2 invoice document
|
|
||||||
*/
|
|
||||||
class PartyIdentificationSchemeNameTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setPartyIdentificationSchemeName("SomeScheme");
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines = [$invoiceLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
$contractDocumentReference = (new \NumNum\UBL\ContractDocumentReference())
|
|
||||||
->setId("123Test");
|
|
||||||
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime('-31 days'))
|
|
||||||
->setEndDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setUBLVersionID('2.2')
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE)
|
|
||||||
->setDueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setContractDocumentReference($contractDocumentReference)
|
|
||||||
->setBuyerReference("SomeReference")
|
|
||||||
->setInvoicePeriod($invoicePeriod);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/PartyIdentificationSchemeNameTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,192 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use NumNum\UBL\UNCL4461;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class ProjectReferenceTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
|
|
||||||
private $xslfile = 'vendor/num-num/ubl-invoice/tests/EN16931-UBL-validation.xslt';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId('VAT');
|
|
||||||
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt 1')
|
|
||||||
->setAdditionalStreetName('Building A')
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
$financialInstitutionBranch = (new \NumNum\UBL\FinancialInstitutionBranch())
|
|
||||||
->setId('RABONL2U');
|
|
||||||
|
|
||||||
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount())
|
|
||||||
->setFinancialInstitutionBranch($financialInstitutionBranch)
|
|
||||||
->setName('Customer Account Holder')
|
|
||||||
->setId('NL00RABO0000000000');
|
|
||||||
|
|
||||||
$paymentMeans = (new \NumNum\UBL\PaymentMeans())
|
|
||||||
->setPayeeFinancialAccount($payeeFinancialAccount)
|
|
||||||
->setPaymentMeansCode(UNCL4461::DEBIT_TRANSFER, [])
|
|
||||||
->setPaymentId('our invoice 1234');
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierLegalEntity = (new \NumNum\UBL\LegalEntity())
|
|
||||||
->setRegistrationName('Supplier Company Name')
|
|
||||||
->setCompanyId('BE123456789');
|
|
||||||
|
|
||||||
$supplierPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
|
|
||||||
->setTaxScheme($taxScheme)
|
|
||||||
->setCompanyId('BE123456789');
|
|
||||||
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setLegalEntity($supplierLegalEntity)
|
|
||||||
->setPartyTaxScheme($supplierPartyTaxScheme)
|
|
||||||
->setPartyIdentificationId('BE123456789')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientLegalEntity = (new \NumNum\UBL\LegalEntity())
|
|
||||||
->setRegistrationName('Client Company Name')
|
|
||||||
->setCompanyId('Client Company Registration');
|
|
||||||
|
|
||||||
$clientPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
|
|
||||||
->setTaxScheme($taxScheme)
|
|
||||||
->setCompanyId('BE123456789');
|
|
||||||
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Client Company Name')
|
|
||||||
->setLegalEntity($clientLegalEntity)
|
|
||||||
->setPartyTaxScheme($clientPartyTaxScheme)
|
|
||||||
->setPartyIdentificationId('BE123456789')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2.1)
|
|
||||||
->setAllowanceTotalAmount(0)
|
|
||||||
->setTaxInclusiveAmount(10 + 2.1)
|
|
||||||
->setLineExtensionAmount(10)
|
|
||||||
->setTaxExclusiveAmount(10);
|
|
||||||
|
|
||||||
$classifiedTaxCategory = (new \NumNum\UBL\ClassifiedTaxCategory())
|
|
||||||
->setId('S')
|
|
||||||
->setPercent(21.00)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setClassifiedTaxCategory($classifiedTaxCategory)
|
|
||||||
->setDescription('Product Description');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setLineExtensionAmount(10)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines = [$invoiceLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId('S', [])
|
|
||||||
->setPercent(21.00)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Payment Terms
|
|
||||||
$paymentTerms = (new \NumNum\UBL\PaymentTerms())
|
|
||||||
->setNote('30 days net');
|
|
||||||
|
|
||||||
// Delivery
|
|
||||||
$deliveryLocation = (new \NumNum\UBL\Address())
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
$delivery = (new \NumNum\UBL\Delivery())
|
|
||||||
->setActualDeliveryDate(new \DateTime())
|
|
||||||
->setDeliveryLocation($deliveryLocation);
|
|
||||||
|
|
||||||
$orderReference = (new \NumNum\UBL\OrderReference())
|
|
||||||
->setId('5009567')
|
|
||||||
->setSalesOrderId('tRST-tKhM');
|
|
||||||
|
|
||||||
// Test Project Reference
|
|
||||||
$projectReference = (new \NumNum\UBL\ProjectReference())
|
|
||||||
->setId('Project1234');
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setCustomizationID('urn:cen.eu:en16931:2017')
|
|
||||||
->setId(1234)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setNote('invoice note')
|
|
||||||
->setDelivery($delivery)
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setPaymentTerms($paymentTerms)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPaymentMeans([$paymentMeans])
|
|
||||||
->setBuyerReference('BUYER_REF')
|
|
||||||
->setOrderReference($orderReference)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setProjectReference($projectReference);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/ProjectReferenceTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BIN
vendor/num-num/ubl-invoice/tests/SampleInvoice.pdf
vendored
BIN
vendor/num-num/ubl-invoice/tests/SampleInvoice.pdf
vendored
Binary file not shown.
|
|
@ -1,117 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 credit note document
|
|
||||||
*/
|
|
||||||
class SimpleCreditNoteTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-CreditNote-2.1.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID')
|
|
||||||
->setBuyersItemIdentification('BUYERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$creditNoteLine = (new \NumNum\UBL\CreditNoteLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$creditNoteLines = [$creditNoteLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$creditNote = (new \NumNum\UBL\CreditNote())
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setCreditNoteLines($creditNoteLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal)
|
|
||||||
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::CREDIT_NOTE);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->creditNote($creditNote);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/SimpleCreditNoteTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,155 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class SimpleInvoiceTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client contact node
|
|
||||||
$clientContact = (new \NumNum\UBL\Contact())
|
|
||||||
->setName('Client name')
|
|
||||||
->setElectronicMail('email@client.com')
|
|
||||||
->setTelephone('0032 472 123 456')
|
|
||||||
->setTelefax('0032 9 1234 567');
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setContact($clientContact);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLines = [];
|
|
||||||
|
|
||||||
$orderLineReference = (new \NumNum\UBL\OrderLineReference)
|
|
||||||
->setLineId('#ABC123');
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCost('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCostCode('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setSupplierAssignedAccountID('10001')
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/SimpleInvoiceTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,162 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class SimpleInvoiceWithFilePathPdfTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client contact node
|
|
||||||
$clientContact = (new \NumNum\UBL\Contact())
|
|
||||||
->setName('Client name')
|
|
||||||
->setElectronicMail('email@client.com')
|
|
||||||
->setTelephone('0032 472 123 456')
|
|
||||||
->setTelefax('0032 9 1234 567');
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setContact($clientContact);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLines = [];
|
|
||||||
|
|
||||||
$orderLineReference = (new \NumNum\UBL\OrderLineReference)
|
|
||||||
->setLineId('#ABC123');
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCost('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCostCode('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
$attachment = (new \NumNum\UBL\Attachment())
|
|
||||||
->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf');
|
|
||||||
|
|
||||||
$additionalDocumentReference = (new \NumNum\UBL\AdditionalDocumentReference())
|
|
||||||
->setAttachment($attachment);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setId(1234)
|
|
||||||
->setAdditionalDocumentReference($additionalDocumentReference)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setSupplierAssignedAccountID('10001')
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/SimpleInvoiceWithFilePathPdfTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.1 invoice document
|
|
||||||
*/
|
|
||||||
class SimpleInvoiceWithInlinePdfTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client contact node
|
|
||||||
$clientContact = (new \NumNum\UBL\Contact())
|
|
||||||
->setName('Client name')
|
|
||||||
->setElectronicMail('email@client.com')
|
|
||||||
->setTelephone('0032 472 123 456')
|
|
||||||
->setTelefax('0032 9 1234 567');
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address)
|
|
||||||
->setContact($clientContact);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description')
|
|
||||||
->setSellersItemIdentification('SELLERID');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// InvoicePeriod
|
|
||||||
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
|
|
||||||
->setStartDate(new \DateTime());
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLines = [];
|
|
||||||
|
|
||||||
$orderLineReference = (new \NumNum\UBL\OrderLineReference)
|
|
||||||
->setLineId('#ABC123');
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCost('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setInvoicePeriod($invoicePeriod)
|
|
||||||
->setPrice($price)
|
|
||||||
->setAccountingCostCode('Product 123')
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1)
|
|
||||||
->setOrderLineReference($orderLineReference);
|
|
||||||
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Example if you have some inline or in-memory filestream/file contents
|
|
||||||
$fileStream = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf'); // this would be your file contents
|
|
||||||
|
|
||||||
$base64EncodedFileStream = base64_encode($fileStream);
|
|
||||||
|
|
||||||
$attachment = (new \NumNum\UBL\Attachment())
|
|
||||||
->setFileStream($base64EncodedFileStream, 'Invoice.pdf', 'application/pdf');
|
|
||||||
|
|
||||||
$additionalDocumentReference = (new \NumNum\UBL\AdditionalDocumentReference())
|
|
||||||
->setAttachment($attachment);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setId(1234)
|
|
||||||
->setAdditionalDocumentReference($additionalDocumentReference)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setSupplierAssignedAccountID('10001')
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/SimpleInvoiceWithInlinePdfTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace NumNum\UBL\Tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test an UBL2.2 invoice document
|
|
||||||
*/
|
|
||||||
class SimpleUBL22InvoiceTest extends TestCase
|
|
||||||
{
|
|
||||||
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
|
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function testIfXMLIsValid()
|
|
||||||
{
|
|
||||||
// Address country
|
|
||||||
$country = (new \NumNum\UBL\Country())
|
|
||||||
->setIdentificationCode('BE')
|
|
||||||
->setListId('ISO3166-1:Alpha2');
|
|
||||||
|
|
||||||
// Full address
|
|
||||||
$address = (new \NumNum\UBL\Address())
|
|
||||||
->setStreetName('Korenmarkt')
|
|
||||||
->setBuildingNumber(1)
|
|
||||||
->setCityName('Gent')
|
|
||||||
->setPostalZone('9000')
|
|
||||||
->setCountry($country);
|
|
||||||
|
|
||||||
// Supplier company node
|
|
||||||
$supplierCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('Supplier Company Name')
|
|
||||||
->setPhysicalLocation($address)
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
// Client company node
|
|
||||||
$clientCompany = (new \NumNum\UBL\Party())
|
|
||||||
->setName('My client')
|
|
||||||
->setPostalAddress($address);
|
|
||||||
|
|
||||||
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
|
|
||||||
->setPayableAmount(10 + 2)
|
|
||||||
->setAllowanceTotalAmount(0);
|
|
||||||
|
|
||||||
// Tax scheme
|
|
||||||
$taxScheme = (new \NumNum\UBL\TaxScheme())
|
|
||||||
->setId(0);
|
|
||||||
|
|
||||||
// Product
|
|
||||||
$productItem = (new \NumNum\UBL\Item())
|
|
||||||
->setName('Product Name')
|
|
||||||
->setDescription('Product Description');
|
|
||||||
|
|
||||||
// Price
|
|
||||||
$price = (new \NumNum\UBL\Price())
|
|
||||||
->setBaseQuantity(1)
|
|
||||||
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
|
|
||||||
->setUnitCodeListId('UNECERec20')
|
|
||||||
->setPriceAmount(10);
|
|
||||||
|
|
||||||
// Invoice Line tax totals
|
|
||||||
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice Line(s)
|
|
||||||
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
|
|
||||||
->setId(0)
|
|
||||||
->setItem($productItem)
|
|
||||||
->setUnitCode('C62')
|
|
||||||
->setUnitCodeListID('UNECERec20')
|
|
||||||
->setPrice($price)
|
|
||||||
->setTaxTotal($lineTaxTotal)
|
|
||||||
->setInvoicedQuantity(1);
|
|
||||||
|
|
||||||
$invoiceLines = [$invoiceLine];
|
|
||||||
|
|
||||||
// Total Taxes
|
|
||||||
$taxCategory = (new \NumNum\UBL\TaxCategory())
|
|
||||||
->setId(0)
|
|
||||||
->setName('VAT21%')
|
|
||||||
->setPercent(.21)
|
|
||||||
->setTaxScheme($taxScheme);
|
|
||||||
|
|
||||||
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
|
|
||||||
->setTaxableAmount(10)
|
|
||||||
->setTaxAmount(2.1)
|
|
||||||
->setTaxCategory($taxCategory);
|
|
||||||
|
|
||||||
$taxTotal = (new \NumNum\UBL\TaxTotal())
|
|
||||||
->addTaxSubTotal($taxSubTotal)
|
|
||||||
->setTaxAmount(2.1);
|
|
||||||
|
|
||||||
// Invoice object
|
|
||||||
$invoice = (new \NumNum\UBL\Invoice())
|
|
||||||
->setUBLVersionID('2.2')
|
|
||||||
->setId(1234)
|
|
||||||
->setCopyIndicator(false)
|
|
||||||
->setIssueDate(new \DateTime())
|
|
||||||
->setAccountingSupplierParty($supplierCompany)
|
|
||||||
->setAccountingCustomerParty($clientCompany)
|
|
||||||
->setInvoiceLines($invoiceLines)
|
|
||||||
->setLegalMonetaryTotal($legalMonetaryTotal)
|
|
||||||
->setTaxTotal($taxTotal);
|
|
||||||
|
|
||||||
// Test created object
|
|
||||||
// Use \NumNum\UBL\Generator to generate an XML string
|
|
||||||
$generator = new \NumNum\UBL\Generator();
|
|
||||||
$outputXMLString = $generator->invoice($invoice);
|
|
||||||
|
|
||||||
// Create PHP Native DomDocument object, that can be
|
|
||||||
// used to validate the generate XML
|
|
||||||
$dom = new \DOMDocument;
|
|
||||||
$dom->loadXML($outputXMLString);
|
|
||||||
|
|
||||||
$dom->save('./tests/SimpleUBL22InvoiceTest.xml');
|
|
||||||
|
|
||||||
$this->assertEquals(true, $dom->schemaValidate($this->schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
27
vendor/sabre/uri/LICENSE
vendored
27
vendor/sabre/uri/LICENSE
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
Copyright (C) 2014-2019 fruux GmbH (https://fruux.com/)
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name Sabre nor the names of its contributors
|
|
||||||
may be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
68
vendor/sabre/uri/composer.json
vendored
68
vendor/sabre/uri/composer.json
vendored
|
|
@ -1,68 +0,0 @@
|
||||||
{
|
|
||||||
"name": "sabre/uri",
|
|
||||||
"description": "Functions for making sense out of URIs.",
|
|
||||||
"keywords": [
|
|
||||||
"URI",
|
|
||||||
"URL",
|
|
||||||
"rfc3986"
|
|
||||||
],
|
|
||||||
"homepage": "http://sabre.io/uri/",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"require": {
|
|
||||||
"php": "^7.4 || ^8.0"
|
|
||||||
},
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Evert Pot",
|
|
||||||
"email": "me@evertpot.com",
|
|
||||||
"homepage": "http://evertpot.com/",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"forum": "https://groups.google.com/group/sabredav-discuss",
|
|
||||||
"source": "https://github.com/fruux/sabre-uri"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"files" : [
|
|
||||||
"lib/functions.php"
|
|
||||||
],
|
|
||||||
"psr-4" : {
|
|
||||||
"Sabre\\Uri\\" : "lib/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"Sabre\\Uri\\": "tests/Uri"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.64",
|
|
||||||
"phpstan/phpstan": "^1.12",
|
|
||||||
"phpstan/phpstan-phpunit": "^1.4",
|
|
||||||
"phpstan/phpstan-strict-rules": "^1.6",
|
|
||||||
"phpstan/extension-installer": "^1.4",
|
|
||||||
"phpunit/phpunit" : "^9.6"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"phpstan": [
|
|
||||||
"phpstan analyse lib tests"
|
|
||||||
],
|
|
||||||
"cs-fixer": [
|
|
||||||
"php-cs-fixer fix"
|
|
||||||
],
|
|
||||||
"phpunit": [
|
|
||||||
"phpunit --configuration tests/phpunit.xml"
|
|
||||||
],
|
|
||||||
"test": [
|
|
||||||
"composer phpstan",
|
|
||||||
"composer cs-fixer",
|
|
||||||
"composer phpunit"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"allow-plugins": {
|
|
||||||
"phpstan/extension-installer": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
19
vendor/sabre/uri/lib/InvalidUriException.php
vendored
19
vendor/sabre/uri/lib/InvalidUriException.php
vendored
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Uri;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalid Uri.
|
|
||||||
*
|
|
||||||
* This is thrown when an attempt was made to use Sabre\Uri parse a uri that
|
|
||||||
* it could not.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
|
||||||
* @author Evert Pot (https://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/
|
|
||||||
*/
|
|
||||||
class InvalidUriException extends \Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
20
vendor/sabre/uri/lib/Version.php
vendored
20
vendor/sabre/uri/lib/Version.php
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Uri;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class contains the version number for this package.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/
|
|
||||||
*/
|
|
||||||
class Version
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Full version number.
|
|
||||||
*/
|
|
||||||
public const VERSION = '3.0.2';
|
|
||||||
}
|
|
||||||
425
vendor/sabre/uri/lib/functions.php
vendored
425
vendor/sabre/uri/lib/functions.php
vendored
|
|
@ -1,425 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Uri;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file contains all the uri handling functions.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves relative urls, like a browser would.
|
|
||||||
*
|
|
||||||
* This function takes a basePath, which itself _may_ also be relative, and
|
|
||||||
* then applies the relative path on top of it.
|
|
||||||
*
|
|
||||||
* @throws InvalidUriException
|
|
||||||
*/
|
|
||||||
function resolve(string $basePath, string $newPath): string
|
|
||||||
{
|
|
||||||
$delta = parse($newPath);
|
|
||||||
|
|
||||||
// If the new path defines a scheme, it's absolute and we can just return
|
|
||||||
// that.
|
|
||||||
if (null !== $delta['scheme']) {
|
|
||||||
return build($delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
$base = parse($basePath);
|
|
||||||
$pick = function ($part) use ($base, $delta) {
|
|
||||||
if (null !== $delta[$part]) {
|
|
||||||
return $delta[$part];
|
|
||||||
} elseif (null !== $base[$part]) {
|
|
||||||
return $base[$part];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
$newParts = [];
|
|
||||||
|
|
||||||
$newParts['scheme'] = $pick('scheme');
|
|
||||||
$newParts['host'] = $pick('host');
|
|
||||||
$newParts['port'] = $pick('port');
|
|
||||||
|
|
||||||
if (is_string($delta['path']) and strlen($delta['path']) > 0) {
|
|
||||||
// If the path starts with a slash
|
|
||||||
if ('/' === $delta['path'][0]) {
|
|
||||||
$path = $delta['path'];
|
|
||||||
} else {
|
|
||||||
// Removing last component from base path.
|
|
||||||
$path = (string) $base['path'];
|
|
||||||
$length = strrpos($path, '/');
|
|
||||||
if (false !== $length) {
|
|
||||||
$path = substr($path, 0, $length);
|
|
||||||
}
|
|
||||||
$path .= '/'.$delta['path'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$path = $base['path'] ?? '/';
|
|
||||||
if ('' === $path) {
|
|
||||||
$path = '/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Removing .. and .
|
|
||||||
$pathParts = explode('/', $path);
|
|
||||||
$newPathParts = [];
|
|
||||||
foreach ($pathParts as $pathPart) {
|
|
||||||
switch ($pathPart) {
|
|
||||||
// case '' :
|
|
||||||
case '.':
|
|
||||||
break;
|
|
||||||
case '..':
|
|
||||||
array_pop($newPathParts);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$newPathParts[] = $pathPart;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = implode('/', $newPathParts);
|
|
||||||
|
|
||||||
// If the source url ended with a /, we want to preserve that.
|
|
||||||
$newParts['path'] = 0 === strpos($path, '/') ? $path : '/'.$path;
|
|
||||||
// From PHP 8, no "?" query at all causes 'query' to be null.
|
|
||||||
// An empty query "http://example.com/foo?" causes 'query' to be the empty string
|
|
||||||
if (null !== $delta['query'] && '' !== $delta['query']) {
|
|
||||||
$newParts['query'] = $delta['query'];
|
|
||||||
} elseif (isset($base['query']) && null === $delta['host'] && null === $delta['path']) {
|
|
||||||
// Keep the old query if host and path didn't change
|
|
||||||
$newParts['query'] = $base['query'];
|
|
||||||
}
|
|
||||||
// From PHP 8, no "#" fragment at all causes 'fragment' to be null.
|
|
||||||
// An empty fragment "http://example.com/foo#" causes 'fragment' to be the empty string
|
|
||||||
if (null !== $delta['fragment'] && '' !== $delta['fragment']) {
|
|
||||||
$newParts['fragment'] = $delta['fragment'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return build($newParts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes a URI or partial URI as its argument, and normalizes it.
|
|
||||||
*
|
|
||||||
* After normalizing a URI, you can safely compare it to other URIs.
|
|
||||||
* This function will for instance convert a %7E into a tilde, according to
|
|
||||||
* rfc3986.
|
|
||||||
*
|
|
||||||
* It will also change a %3a into a %3A.
|
|
||||||
*
|
|
||||||
* @throws InvalidUriException
|
|
||||||
*/
|
|
||||||
function normalize(string $uri): string
|
|
||||||
{
|
|
||||||
$parts = parse($uri);
|
|
||||||
|
|
||||||
if (null !== $parts['path']) {
|
|
||||||
$pathParts = explode('/', ltrim($parts['path'], '/'));
|
|
||||||
$newPathParts = [];
|
|
||||||
foreach ($pathParts as $pathPart) {
|
|
||||||
switch ($pathPart) {
|
|
||||||
case '.':
|
|
||||||
// skip
|
|
||||||
break;
|
|
||||||
case '..':
|
|
||||||
// One level up in the hierarchy
|
|
||||||
array_pop($newPathParts);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Ensuring that everything is correctly percent-encoded.
|
|
||||||
$newPathParts[] = rawurlencode(rawurldecode($pathPart));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$parts['path'] = '/'.implode('/', $newPathParts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $parts['scheme']) {
|
|
||||||
$parts['scheme'] = strtolower($parts['scheme']);
|
|
||||||
$defaultPorts = [
|
|
||||||
'http' => '80',
|
|
||||||
'https' => '443',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (null !== $parts['port'] && isset($defaultPorts[$parts['scheme']]) && $defaultPorts[$parts['scheme']] == $parts['port']) {
|
|
||||||
// Removing default ports.
|
|
||||||
unset($parts['port']);
|
|
||||||
}
|
|
||||||
// A few HTTP specific rules.
|
|
||||||
switch ($parts['scheme']) {
|
|
||||||
case 'http':
|
|
||||||
case 'https':
|
|
||||||
if (null === $parts['path']) {
|
|
||||||
// An empty path is equivalent to / in http.
|
|
||||||
$parts['path'] = '/';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $parts['host']) {
|
|
||||||
$parts['host'] = strtolower($parts['host']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return build($parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a URI and returns its individual components.
|
|
||||||
*
|
|
||||||
* This method largely behaves the same as PHP's parse_url, except that it will
|
|
||||||
* return an array with all the array keys, including the ones that are not
|
|
||||||
* set by parse_url, which makes it a bit easier to work with.
|
|
||||||
*
|
|
||||||
* Unlike PHP's parse_url, it will also convert any non-ascii characters to
|
|
||||||
* percent-encoded strings. PHP's parse_url corrupts these characters on OS X.
|
|
||||||
*
|
|
||||||
* In the return array, key "port" is an int value. Other keys have a string value.
|
|
||||||
* "Unused" keys have value null.
|
|
||||||
*
|
|
||||||
* @return array{scheme: string|null, host: string|null, path: string|null, port: positive-int|null, user: string|null, query: string|null, fragment: string|null}
|
|
||||||
*
|
|
||||||
* @throws InvalidUriException
|
|
||||||
*/
|
|
||||||
function parse(string $uri): array
|
|
||||||
{
|
|
||||||
// Normally a URI must be ASCII. However, often it's not and
|
|
||||||
// parse_url might corrupt these strings.
|
|
||||||
//
|
|
||||||
// For that reason we take any non-ascii characters from the uri and
|
|
||||||
// uriencode them first.
|
|
||||||
$uri = preg_replace_callback(
|
|
||||||
'/[^[:ascii:]]/u',
|
|
||||||
function ($matches) {
|
|
||||||
return rawurlencode($matches[0]);
|
|
||||||
},
|
|
||||||
$uri
|
|
||||||
);
|
|
||||||
|
|
||||||
if (null === $uri) {
|
|
||||||
throw new InvalidUriException('Invalid, or could not parse URI');
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = parse_url($uri);
|
|
||||||
if (false === $result) {
|
|
||||||
$result = _parse_fallback($uri);
|
|
||||||
} else {
|
|
||||||
// Add empty host and leading slash to Windows file paths
|
|
||||||
// file:///C:/path or file:///C:\path
|
|
||||||
// Note: the regex fragment [a-zA-Z]:[\/\\\\].* end up being
|
|
||||||
// [a-zA-Z]:[\/\\].*
|
|
||||||
// The 4 backslash in a row are the way to get 2 backslash into the actual string
|
|
||||||
// that is used as the regex. The 2 backslash are then the way to get 1 backslash
|
|
||||||
// character into the character set "a forward slash or a backslash"
|
|
||||||
if (isset($result['scheme']) && 'file' === $result['scheme'] && isset($result['path'])
|
|
||||||
&& 1 === preg_match('/^(?<windows_path> [a-zA-Z]:([\/\\\\].*)?)$/x', $result['path'])) {
|
|
||||||
$result['path'] = '/'.$result['path'];
|
|
||||||
$result['host'] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* phpstan is not able to process all the things that happen while this function
|
|
||||||
* constructs the result array. It only understands the $result is
|
|
||||||
* non-empty-array<string, mixed>
|
|
||||||
*
|
|
||||||
* But the detail of the returned array is correctly specified in the PHPdoc
|
|
||||||
* above the function call.
|
|
||||||
*
|
|
||||||
* @phpstan-ignore-next-line
|
|
||||||
*/
|
|
||||||
return
|
|
||||||
$result + [
|
|
||||||
'scheme' => null,
|
|
||||||
'host' => null,
|
|
||||||
'path' => null,
|
|
||||||
'port' => null,
|
|
||||||
'user' => null,
|
|
||||||
'query' => null,
|
|
||||||
'fragment' => null,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function takes the components returned from PHP's parse_url, and uses
|
|
||||||
* it to generate a new uri.
|
|
||||||
*
|
|
||||||
* @param array<string, int|string|null> $parts
|
|
||||||
*/
|
|
||||||
function build(array $parts): string
|
|
||||||
{
|
|
||||||
$uri = '';
|
|
||||||
|
|
||||||
$authority = '';
|
|
||||||
if (isset($parts['host'])) {
|
|
||||||
$authority = $parts['host'];
|
|
||||||
if (isset($parts['user'])) {
|
|
||||||
$authority = $parts['user'].'@'.$authority;
|
|
||||||
}
|
|
||||||
if (isset($parts['port'])) {
|
|
||||||
$authority = $authority.':'.$parts['port'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($parts['scheme'])) {
|
|
||||||
// If there's a scheme, there's also a host.
|
|
||||||
$uri = $parts['scheme'].':';
|
|
||||||
}
|
|
||||||
if ('' !== $authority || (isset($parts['scheme']) && 'file' === $parts['scheme'])) {
|
|
||||||
// No scheme, but there is a host.
|
|
||||||
$uri .= '//'.$authority;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($parts['path'])) {
|
|
||||||
$uri .= $parts['path'];
|
|
||||||
}
|
|
||||||
if (isset($parts['query'])) {
|
|
||||||
$uri .= '?'.$parts['query'];
|
|
||||||
}
|
|
||||||
if (isset($parts['fragment'])) {
|
|
||||||
$uri .= '#'.$parts['fragment'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the 'dirname' and 'basename' for a path.
|
|
||||||
*
|
|
||||||
* The reason there is a custom function for this purpose, is because
|
|
||||||
* basename() is locale aware (behaviour changes if C locale or a UTF-8 locale
|
|
||||||
* is used) and we need a method that just operates on UTF-8 characters.
|
|
||||||
*
|
|
||||||
* In addition basename and dirname are platform aware, and will treat
|
|
||||||
* backslash (\) as a directory separator on Windows.
|
|
||||||
*
|
|
||||||
* This method returns the 2 components as an array.
|
|
||||||
*
|
|
||||||
* If there is no dirname, it will return an empty string. Any / appearing at
|
|
||||||
* the end of the string is stripped off.
|
|
||||||
*
|
|
||||||
* @return list<mixed>
|
|
||||||
*/
|
|
||||||
function split(string $path): array
|
|
||||||
{
|
|
||||||
$matches = [];
|
|
||||||
if (1 === preg_match('/^(?:(?:(.*)(?:\/+))?([^\/]+))(?:\/?)$/u', $path, $matches)) {
|
|
||||||
return [$matches[1], $matches[2]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [null, null];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is another implementation of parse_url, except this one is
|
|
||||||
* fully written in PHP.
|
|
||||||
*
|
|
||||||
* The reason is that the PHP bug team is not willing to admit that there are
|
|
||||||
* bugs in the parse_url implementation.
|
|
||||||
*
|
|
||||||
* This function is only called if the main parse method fails. It's pretty
|
|
||||||
* crude and probably slow, so the original parse_url is usually preferred.
|
|
||||||
*
|
|
||||||
* @return array{scheme: string|null, host: string|null, path: string|null, port: positive-int|null, user: string|null, query: string|null, fragment: string|null}
|
|
||||||
*
|
|
||||||
* @throws InvalidUriException
|
|
||||||
*/
|
|
||||||
function _parse_fallback(string $uri): array
|
|
||||||
{
|
|
||||||
// Normally a URI must be ASCII, however. However, often it's not and
|
|
||||||
// parse_url might corrupt these strings.
|
|
||||||
//
|
|
||||||
// For that reason we take any non-ascii characters from the uri and
|
|
||||||
// uriencode them first.
|
|
||||||
$uri = preg_replace_callback(
|
|
||||||
'/[^[:ascii:]]/u',
|
|
||||||
function ($matches) {
|
|
||||||
return rawurlencode($matches[0]);
|
|
||||||
},
|
|
||||||
$uri
|
|
||||||
);
|
|
||||||
|
|
||||||
if (null === $uri) {
|
|
||||||
throw new InvalidUriException('Invalid, or could not parse URI');
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = [
|
|
||||||
'scheme' => null,
|
|
||||||
'host' => null,
|
|
||||||
'port' => null,
|
|
||||||
'user' => null,
|
|
||||||
'path' => null,
|
|
||||||
'fragment' => null,
|
|
||||||
'query' => null,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (1 === preg_match('% ^([A-Za-z][A-Za-z0-9+-\.]+): %x', $uri, $matches)) {
|
|
||||||
$result['scheme'] = $matches[1];
|
|
||||||
// Take what's left.
|
|
||||||
$uri = substr($uri, strlen($result['scheme']) + 1);
|
|
||||||
if (false === $uri) {
|
|
||||||
// There was nothing left.
|
|
||||||
$uri = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Taking off a fragment part
|
|
||||||
if (false !== strpos($uri, '#')) {
|
|
||||||
list($uri, $result['fragment']) = explode('#', $uri, 2);
|
|
||||||
}
|
|
||||||
// Taking off the query part
|
|
||||||
if (false !== strpos($uri, '?')) {
|
|
||||||
list($uri, $result['query']) = explode('?', $uri, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('///' === substr($uri, 0, 3)) {
|
|
||||||
// The triple slash uris are a bit unusual, but we have special handling
|
|
||||||
// for them.
|
|
||||||
$path = substr($uri, 2);
|
|
||||||
if (false === $path) {
|
|
||||||
throw new \RuntimeException('The string cannot be false');
|
|
||||||
}
|
|
||||||
$result['path'] = $path;
|
|
||||||
$result['host'] = '';
|
|
||||||
} elseif ('//' === substr($uri, 0, 2)) {
|
|
||||||
// Uris that have an authority part.
|
|
||||||
$regex = '%^
|
|
||||||
//
|
|
||||||
(?: (?<user> [^:@]+) (: (?<pass> [^@]+)) @)?
|
|
||||||
(?<host> ( [^:/]* | \[ [^\]]+ \] ))
|
|
||||||
(?: : (?<port> [0-9]+))?
|
|
||||||
(?<path> / .*)?
|
|
||||||
$%x';
|
|
||||||
if (1 !== preg_match($regex, $uri, $matches)) {
|
|
||||||
throw new InvalidUriException('Invalid, or could not parse URI');
|
|
||||||
}
|
|
||||||
if (isset($matches['host']) && '' !== $matches['host']) {
|
|
||||||
$result['host'] = $matches['host'];
|
|
||||||
}
|
|
||||||
if (isset($matches['port'])) {
|
|
||||||
$port = (int) $matches['port'];
|
|
||||||
if ($port > 0) {
|
|
||||||
$result['port'] = $port;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($matches['path'])) {
|
|
||||||
$result['path'] = $matches['path'];
|
|
||||||
}
|
|
||||||
if (isset($matches['user']) && '' !== $matches['user']) {
|
|
||||||
$result['user'] = $matches['user'];
|
|
||||||
}
|
|
||||||
if (isset($matches['pass']) && '' !== $matches['pass']) {
|
|
||||||
$result['pass'] = $matches['pass'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result['path'] = $uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
27
vendor/sabre/xml/LICENSE
vendored
27
vendor/sabre/xml/LICENSE
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/)
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name Sabre nor the names of its contributors
|
|
||||||
may be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
26
vendor/sabre/xml/README.md
vendored
26
vendor/sabre/xml/README.md
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
sabre/xml
|
|
||||||
=========
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The sabre/xml library is a specialized XML reader and writer.
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
* [Introduction](http://sabre.io/xml/).
|
|
||||||
* [Installation](http://sabre.io/xml/install/).
|
|
||||||
* [Reading XML](http://sabre.io/xml/reading/).
|
|
||||||
* [Writing XML](http://sabre.io/xml/writing/).
|
|
||||||
|
|
||||||
Major version 3 implements type declarations for input parameters, function returns, variables etc. It supports PHP 7.4 and PHP 8. When you upgrade to major version 3, if you extend classes etc., then you will need to make similar type declarations in your code.
|
|
||||||
|
|
||||||
Support
|
|
||||||
-------
|
|
||||||
|
|
||||||
Head over to the [SabreDAV mailing list](http://groups.google.com/group/sabredav-discuss) for any questions.
|
|
||||||
|
|
||||||
Made at fruux
|
|
||||||
-------------
|
|
||||||
|
|
||||||
This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support.
|
|
||||||
70
vendor/sabre/xml/composer.json
vendored
70
vendor/sabre/xml/composer.json
vendored
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
"name": "sabre/xml",
|
|
||||||
"description" : "sabre/xml is an XML library that you may not hate.",
|
|
||||||
"keywords" : [ "XML", "XMLReader", "XMLWriter", "DOM" ],
|
|
||||||
"homepage" : "https://sabre.io/xml/",
|
|
||||||
"license" : "BSD-3-Clause",
|
|
||||||
"require" : {
|
|
||||||
"php" : "^7.4 || ^8.0",
|
|
||||||
"ext-xmlwriter" : "*",
|
|
||||||
"ext-xmlreader" : "*",
|
|
||||||
"ext-dom" : "*",
|
|
||||||
"lib-libxml" : ">=2.6.20",
|
|
||||||
"sabre/uri" : ">=2.0,<4.0.0"
|
|
||||||
},
|
|
||||||
"authors" : [
|
|
||||||
{
|
|
||||||
"name" : "Evert Pot",
|
|
||||||
"email" : "me@evertpot.com",
|
|
||||||
"homepage" : "http://evertpot.com/",
|
|
||||||
"role" : "Developer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Markus Staab",
|
|
||||||
"email": "markus.staab@redaxo.de",
|
|
||||||
"role" : "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"support" : {
|
|
||||||
"forum" : "https://groups.google.com/group/sabredav-discuss",
|
|
||||||
"source" : "https://github.com/fruux/sabre-xml"
|
|
||||||
},
|
|
||||||
"autoload" : {
|
|
||||||
"psr-4" : {
|
|
||||||
"Sabre\\Xml\\" : "lib/"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib/Deserializer/functions.php",
|
|
||||||
"lib/Serializer/functions.php"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"autoload-dev" : {
|
|
||||||
"psr-4" : {
|
|
||||||
"Sabre\\Xml\\" : "tests/Sabre/Xml/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.64",
|
|
||||||
"phpstan/phpstan": "^1.12",
|
|
||||||
"phpunit/phpunit" : "^9.6"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"phpstan": [
|
|
||||||
"phpstan analyse"
|
|
||||||
],
|
|
||||||
"phpstan-baseline": [
|
|
||||||
"phpstan analyse --generate-baseline phpstan-baseline.neon"
|
|
||||||
],
|
|
||||||
"cs-fixer": [
|
|
||||||
"PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix"
|
|
||||||
],
|
|
||||||
"phpunit": [
|
|
||||||
"phpunit --configuration tests/phpunit.xml"
|
|
||||||
],
|
|
||||||
"test": [
|
|
||||||
"composer phpstan",
|
|
||||||
"composer cs-fixer",
|
|
||||||
"composer phpunit"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
116
vendor/sabre/xml/lib/ContextStackTrait.php
vendored
116
vendor/sabre/xml/lib/ContextStackTrait.php
vendored
|
|
@ -1,116 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Context Stack.
|
|
||||||
*
|
|
||||||
* The Context maintains information about a document during either reading or
|
|
||||||
* writing.
|
|
||||||
*
|
|
||||||
* During this process, it may be necessary to override this context
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* This trait allows easy access to the context, and allows the end-user to
|
|
||||||
* override its settings for document fragments, and easily restore it again
|
|
||||||
* later.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
trait ContextStackTrait
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* This is the element map. It contains a list of XML elements (in clark
|
|
||||||
* notation) as keys and PHP class names as values.
|
|
||||||
*
|
|
||||||
* The PHP class names must implement Sabre\Xml\Element.
|
|
||||||
*
|
|
||||||
* Values may also be a callable. In that case the function will be called
|
|
||||||
* directly.
|
|
||||||
*
|
|
||||||
* @phpstan-var array<string, class-string|callable|object>
|
|
||||||
*/
|
|
||||||
public array $elementMap = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A contextUri pointing to the document being parsed / written.
|
|
||||||
* This uri may be used to resolve relative urls that may appear in the
|
|
||||||
* document.
|
|
||||||
*
|
|
||||||
* The reader and writer don't use this property, but as it's an extremely
|
|
||||||
* common use-case for parsing XML documents, it's added here as a
|
|
||||||
* convenience.
|
|
||||||
*/
|
|
||||||
public ?string $contextUri = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a list of namespaces that you want to give default prefixes.
|
|
||||||
*
|
|
||||||
* You must make sure you create this entire list before starting to write.
|
|
||||||
* They should be registered on the root element.
|
|
||||||
*
|
|
||||||
* @phpstan-var array<string, class-string|string|null>
|
|
||||||
*/
|
|
||||||
public array $namespaceMap = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a list of custom serializers for specific classes.
|
|
||||||
*
|
|
||||||
* The writer may use this if you attempt to serialize an object with a
|
|
||||||
* class that does not implement XmlSerializable.
|
|
||||||
*
|
|
||||||
* Instead, it will look at this classmap to see if there is a custom
|
|
||||||
* serializer here. This is useful if you don't want your value objects
|
|
||||||
* to be responsible for serializing themselves.
|
|
||||||
*
|
|
||||||
* The keys in this classmap need to be fully qualified PHP class names,
|
|
||||||
* the values must be callbacks. The callbacks take two arguments. The
|
|
||||||
* writer class, and the value that must be written.
|
|
||||||
*
|
|
||||||
* function (Writer $writer, object $value)
|
|
||||||
*
|
|
||||||
* @phpstan-var array<class-string, callable(Writer, object):mixed>
|
|
||||||
*/
|
|
||||||
public array $classMap = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Backups of previous contexts.
|
|
||||||
*
|
|
||||||
* @var list<mixed>
|
|
||||||
*/
|
|
||||||
protected array $contextStack = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new "context".
|
|
||||||
*
|
|
||||||
* This allows you to safely modify the elementMap, contextUri or
|
|
||||||
* namespaceMap. After you're done, you can restore the old data again
|
|
||||||
* with popContext.
|
|
||||||
*/
|
|
||||||
public function pushContext(): void
|
|
||||||
{
|
|
||||||
$this->contextStack[] = [
|
|
||||||
$this->elementMap,
|
|
||||||
$this->contextUri,
|
|
||||||
$this->namespaceMap,
|
|
||||||
$this->classMap,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restore the previous "context".
|
|
||||||
*/
|
|
||||||
public function popContext(): void
|
|
||||||
{
|
|
||||||
list(
|
|
||||||
$this->elementMap,
|
|
||||||
$this->contextUri,
|
|
||||||
$this->namespaceMap,
|
|
||||||
$this->classMap,
|
|
||||||
) = array_pop($this->contextStack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
388
vendor/sabre/xml/lib/Deserializer/functions.php
vendored
388
vendor/sabre/xml/lib/Deserializer/functions.php
vendored
|
|
@ -1,388 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Deserializer;
|
|
||||||
|
|
||||||
use Sabre\Xml\Reader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class provides a number of 'deserializer' helper functions.
|
|
||||||
* These can be used to easily specify custom deserializers for specific
|
|
||||||
* XML elements.
|
|
||||||
*
|
|
||||||
* You can either use these functions from within the $elementMap in the
|
|
||||||
* Service or Reader class, or you can call them from within your own
|
|
||||||
* deserializer functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 'keyValue' deserializer parses all child elements, and outputs them as
|
|
||||||
* a "key=>value" array.
|
|
||||||
*
|
|
||||||
* For example, keyvalue will parse:
|
|
||||||
*
|
|
||||||
* <?xml version="1.0"?>
|
|
||||||
* <s:root xmlns:s="http://sabredav.org/ns">
|
|
||||||
* <s:elem1>value1</s:elem1>
|
|
||||||
* <s:elem2>value2</s:elem2>
|
|
||||||
* <s:elem3 />
|
|
||||||
* </s:root>
|
|
||||||
*
|
|
||||||
* Into:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* "{http://sabredav.org/ns}elem1" => "value1",
|
|
||||||
* "{http://sabredav.org/ns}elem2" => "value2",
|
|
||||||
* "{http://sabredav.org/ns}elem3" => null,
|
|
||||||
* ];
|
|
||||||
*
|
|
||||||
* If you specify the 'namespace' argument, the deserializer will remove
|
|
||||||
* the namespaces of the keys that match that namespace.
|
|
||||||
*
|
|
||||||
* For example, if you call keyValue like this:
|
|
||||||
*
|
|
||||||
* keyValue($reader, 'http://sabredav.org/ns')
|
|
||||||
*
|
|
||||||
* it's output will instead be:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* "elem1" => "value1",
|
|
||||||
* "elem2" => "value2",
|
|
||||||
* "elem3" => null,
|
|
||||||
* ];
|
|
||||||
*
|
|
||||||
* Attributes will be removed from the top-level elements. If elements with
|
|
||||||
* the same name appear twice in the list, only the last one will be kept.
|
|
||||||
*
|
|
||||||
* @phpstan-return array<string, mixed>
|
|
||||||
*/
|
|
||||||
function keyValue(Reader $reader, ?string $namespace = null): array
|
|
||||||
{
|
|
||||||
// If there's no children, we don't do anything.
|
|
||||||
if ($reader->isEmptyElement) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$reader->read()) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Reader::END_ELEMENT === $reader->nodeType) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = [];
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (Reader::ELEMENT === $reader->nodeType) {
|
|
||||||
if (null !== $namespace && $reader->namespaceURI === $namespace) {
|
|
||||||
$values[$reader->localName] = $reader->parseCurrentElement()['value'];
|
|
||||||
} else {
|
|
||||||
$clark = $reader->getClark();
|
|
||||||
$values[$clark] = $reader->parseCurrentElement()['value'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!$reader->read()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (Reader::END_ELEMENT !== $reader->nodeType);
|
|
||||||
|
|
||||||
$reader->read();
|
|
||||||
|
|
||||||
return $values;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 'enum' deserializer parses elements into a simple list
|
|
||||||
* without values or attributes.
|
|
||||||
*
|
|
||||||
* For example, Elements will parse:
|
|
||||||
*
|
|
||||||
* <?xml version="1.0"? >
|
|
||||||
* <s:root xmlns:s="http://sabredav.org/ns">
|
|
||||||
* <s:elem1 />
|
|
||||||
* <s:elem2 />
|
|
||||||
* <s:elem3 />
|
|
||||||
* <s:elem4>content</s:elem4>
|
|
||||||
* <s:elem5 attr="val" />
|
|
||||||
* </s:root>
|
|
||||||
*
|
|
||||||
* Into:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* "{http://sabredav.org/ns}elem1",
|
|
||||||
* "{http://sabredav.org/ns}elem2",
|
|
||||||
* "{http://sabredav.org/ns}elem3",
|
|
||||||
* "{http://sabredav.org/ns}elem4",
|
|
||||||
* "{http://sabredav.org/ns}elem5",
|
|
||||||
* ];
|
|
||||||
*
|
|
||||||
* This is useful for 'enum'-like structures.
|
|
||||||
*
|
|
||||||
* If the $namespace argument is specified, it will strip the namespace
|
|
||||||
* for all elements that match that.
|
|
||||||
*
|
|
||||||
* For example,
|
|
||||||
*
|
|
||||||
* enum($reader, 'http://sabredav.org/ns')
|
|
||||||
*
|
|
||||||
* would return:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* "elem1",
|
|
||||||
* "elem2",
|
|
||||||
* "elem3",
|
|
||||||
* "elem4",
|
|
||||||
* "elem5",
|
|
||||||
* ];
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
*
|
|
||||||
* @phpstan-return list<string>
|
|
||||||
*/
|
|
||||||
function enum(Reader $reader, ?string $namespace = null): array
|
|
||||||
{
|
|
||||||
// If there's no children, we don't do anything.
|
|
||||||
if ($reader->isEmptyElement) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
if (!$reader->read()) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Reader::END_ELEMENT === $reader->nodeType) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
$currentDepth = $reader->depth;
|
|
||||||
|
|
||||||
$values = [];
|
|
||||||
do {
|
|
||||||
if (Reader::ELEMENT !== $reader->nodeType) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!is_null($namespace) && $namespace === $reader->namespaceURI) {
|
|
||||||
$values[] = $reader->localName;
|
|
||||||
} else {
|
|
||||||
$values[] = (string) $reader->getClark();
|
|
||||||
}
|
|
||||||
} while ($reader->depth >= $currentDepth && $reader->next());
|
|
||||||
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return $values;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The valueObject deserializer turns an XML element into a PHP object of
|
|
||||||
* a specific class.
|
|
||||||
*
|
|
||||||
* This is primarily used by the mapValueObject function from the Service
|
|
||||||
* class, but it can also easily be used for more specific situations.
|
|
||||||
*
|
|
||||||
* @template C of object
|
|
||||||
*
|
|
||||||
* @param class-string<C> $className
|
|
||||||
*
|
|
||||||
* @phpstan-return C
|
|
||||||
*/
|
|
||||||
function valueObject(Reader $reader, string $className, string $namespace): object
|
|
||||||
{
|
|
||||||
$valueObject = new $className();
|
|
||||||
if ($reader->isEmptyElement) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return $valueObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
$defaultProperties = get_class_vars($className);
|
|
||||||
|
|
||||||
$reader->read();
|
|
||||||
do {
|
|
||||||
if (Reader::ELEMENT === $reader->nodeType && $reader->namespaceURI == $namespace) {
|
|
||||||
if (property_exists($valueObject, $reader->localName)) {
|
|
||||||
if (is_array($defaultProperties[$reader->localName])) {
|
|
||||||
$valueObject->{$reader->localName}[] = $reader->parseCurrentElement()['value'];
|
|
||||||
} else {
|
|
||||||
$valueObject->{$reader->localName} = $reader->parseCurrentElement()['value'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Ignore property
|
|
||||||
$reader->next();
|
|
||||||
}
|
|
||||||
} elseif (Reader::ELEMENT === $reader->nodeType) {
|
|
||||||
// Skipping element from different namespace
|
|
||||||
$reader->next();
|
|
||||||
} else {
|
|
||||||
if (Reader::END_ELEMENT !== $reader->nodeType && !$reader->read()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (Reader::END_ELEMENT !== $reader->nodeType);
|
|
||||||
|
|
||||||
$reader->read();
|
|
||||||
|
|
||||||
return $valueObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This deserializer helps you deserialize xml structures that look like
|
|
||||||
* this:.
|
|
||||||
*
|
|
||||||
* <collection>
|
|
||||||
* <item>...</item>
|
|
||||||
* <item>...</item>
|
|
||||||
* <item>...</item>
|
|
||||||
* </collection>
|
|
||||||
*
|
|
||||||
* Many XML documents use patterns like that, and this deserializer
|
|
||||||
* allow you to get all the 'items' as an array.
|
|
||||||
*
|
|
||||||
* In that previous example, you would register the deserializer as such:
|
|
||||||
*
|
|
||||||
* $reader->elementMap['{}collection'] = function($reader) {
|
|
||||||
* return repeatingElements($reader, '{}item');
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The repeatingElements deserializer simply returns everything as an array.
|
|
||||||
*
|
|
||||||
* $childElementName must either be a clark-notation element name, or if no
|
|
||||||
* namespace is used, the bare element name.
|
|
||||||
*
|
|
||||||
* @phpstan-return list<mixed>
|
|
||||||
*/
|
|
||||||
function repeatingElements(Reader $reader, string $childElementName): array
|
|
||||||
{
|
|
||||||
if ('{' !== $childElementName[0]) {
|
|
||||||
$childElementName = '{}'.$childElementName;
|
|
||||||
}
|
|
||||||
$result = [];
|
|
||||||
|
|
||||||
foreach ($reader->parseGetElements() as $element) {
|
|
||||||
if ($element['name'] === $childElementName) {
|
|
||||||
$result[] = $element['value'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This deserializer helps you to deserialize structures which contain mixed content.
|
|
||||||
*
|
|
||||||
* <p>some text <extref>and an inline tag</extref>and even more text</p>
|
|
||||||
*
|
|
||||||
* The above example will return
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* 'some text',
|
|
||||||
* [
|
|
||||||
* 'name' => '{}extref',
|
|
||||||
* 'value' => 'and an inline tag',
|
|
||||||
* 'attributes' => []
|
|
||||||
* ],
|
|
||||||
* 'and even more text'
|
|
||||||
* ]
|
|
||||||
*
|
|
||||||
* In strict XML documents you won't find this kind of markup but in html this is a quite common pattern.
|
|
||||||
*
|
|
||||||
* @return array<mixed>
|
|
||||||
*/
|
|
||||||
function mixedContent(Reader $reader): array
|
|
||||||
{
|
|
||||||
// If there's no children, we don't do anything.
|
|
||||||
if ($reader->isEmptyElement) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$previousDepth = $reader->depth;
|
|
||||||
|
|
||||||
$content = [];
|
|
||||||
$reader->read();
|
|
||||||
while (true) {
|
|
||||||
if (Reader::ELEMENT == $reader->nodeType) {
|
|
||||||
$content[] = $reader->parseCurrentElement();
|
|
||||||
} elseif ($reader->depth >= $previousDepth && in_array($reader->nodeType, [Reader::TEXT, Reader::CDATA, Reader::WHITESPACE])) {
|
|
||||||
$content[] = $reader->value;
|
|
||||||
$reader->read();
|
|
||||||
} elseif (Reader::END_ELEMENT == $reader->nodeType) {
|
|
||||||
// Ensuring we are moving the cursor after the end element.
|
|
||||||
$reader->read();
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
$reader->read();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The functionCaller deserializer turns an XML element into whatever your callable returns.
|
|
||||||
*
|
|
||||||
* You can use, e.g., a named constructor (factory method) to create an object using
|
|
||||||
* this function.
|
|
||||||
*
|
|
||||||
* @return mixed whatever the 'func' callable returns
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException|\ReflectionException
|
|
||||||
*/
|
|
||||||
function functionCaller(Reader $reader, callable $func, string $namespace)
|
|
||||||
{
|
|
||||||
if ($reader->isEmptyElement) {
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$funcArgs = [];
|
|
||||||
if (is_array($func)) {
|
|
||||||
$ref = new \ReflectionMethod($func[0], $func[1]);
|
|
||||||
} elseif (is_string($func) && false !== strpos($func, '::')) {
|
|
||||||
// We have a string that should refer to a method that exists, like "MyClass::someMethod"
|
|
||||||
// ReflectionMethod knows how to handle that as-is
|
|
||||||
$ref = new \ReflectionMethod($func);
|
|
||||||
} elseif ($func instanceof \Closure || is_string($func)) {
|
|
||||||
// We have an actual Closure (a real function) or a string that is the name of a function
|
|
||||||
// ReflectionFunction can take either of those
|
|
||||||
$ref = new \ReflectionFunction($func);
|
|
||||||
} else {
|
|
||||||
throw new \InvalidArgumentException(__METHOD__.' unable to use func parameter with ReflectionMethod or ReflectionFunction.');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($ref->getParameters() as $parameter) {
|
|
||||||
$funcArgs[$parameter->getName()] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$reader->read();
|
|
||||||
do {
|
|
||||||
if (Reader::ELEMENT === $reader->nodeType && $reader->namespaceURI == $namespace) {
|
|
||||||
if (array_key_exists($reader->localName, $funcArgs)) {
|
|
||||||
$funcArgs[$reader->localName] = $reader->parseCurrentElement()['value'];
|
|
||||||
} else {
|
|
||||||
// Ignore property
|
|
||||||
$reader->next();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$reader->read();
|
|
||||||
}
|
|
||||||
} while (Reader::END_ELEMENT !== $reader->nodeType);
|
|
||||||
$reader->read();
|
|
||||||
|
|
||||||
return $func(...array_values($funcArgs));
|
|
||||||
}
|
|
||||||
22
vendor/sabre/xml/lib/Element.php
vendored
22
vendor/sabre/xml/lib/Element.php
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the XML element interface.
|
|
||||||
*
|
|
||||||
* Elements are responsible for serializing and deserializing part of an XML
|
|
||||||
* document into PHP values.
|
|
||||||
*
|
|
||||||
* It combines XmlSerializable and XmlDeserializable into one logical class
|
|
||||||
* that does both.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
interface Element extends XmlSerializable, XmlDeserializable
|
|
||||||
{
|
|
||||||
}
|
|
||||||
84
vendor/sabre/xml/lib/Element/Base.php
vendored
84
vendor/sabre/xml/lib/Element/Base.php
vendored
|
|
@ -1,84 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Element;
|
|
||||||
|
|
||||||
use Sabre\Xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Base XML element is the standard parser & generator that's used by the
|
|
||||||
* XML reader and writer.
|
|
||||||
*
|
|
||||||
* It spits out a simple PHP array structure during deserialization, that can
|
|
||||||
* also be directly injected back into Writer::write.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class Base implements Xml\Element
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var mixed PHP value to serialize
|
|
||||||
*/
|
|
||||||
protected $value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param mixed $value PHP value to serialize
|
|
||||||
*/
|
|
||||||
public function __construct($value = null)
|
|
||||||
{
|
|
||||||
$this->value = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* Use the $writer argument to write its own xml serialization.
|
|
||||||
*
|
|
||||||
* An important note: do _not_ create a parent element. Any element
|
|
||||||
* implementing XmlSerializable should only ever write what's considered
|
|
||||||
* its 'inner xml'.
|
|
||||||
*
|
|
||||||
* The parent of the current element is responsible for writing a
|
|
||||||
* containing element.
|
|
||||||
*
|
|
||||||
* This allows serializers to be re-used for different element names.
|
|
||||||
*
|
|
||||||
* If you are opening new elements, you must also close them again.
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Xml\Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write($this->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The deserialize method is called during xml parsing.
|
|
||||||
*
|
|
||||||
* This method is called statically, this is because in theory this method
|
|
||||||
* may be used as a type of constructor, or factory method.
|
|
||||||
*
|
|
||||||
* Often you want to return an instance of the current class, but you are
|
|
||||||
* free to return other data as well.
|
|
||||||
*
|
|
||||||
* Important note 2: You are responsible for advancing the reader to the
|
|
||||||
* next element. Not doing anything will result in a never-ending loop.
|
|
||||||
*
|
|
||||||
* If you just want to skip parsing for this element altogether, you can
|
|
||||||
* just call $reader->next();
|
|
||||||
*
|
|
||||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
|
||||||
* the next element.
|
|
||||||
*
|
|
||||||
* @return array<int,array<string, mixed>>|string|null
|
|
||||||
*/
|
|
||||||
public static function xmlDeserialize(Xml\Reader $reader)
|
|
||||||
{
|
|
||||||
$subTree = $reader->parseInnerTree();
|
|
||||||
|
|
||||||
return $subTree;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
57
vendor/sabre/xml/lib/Element/Cdata.php
vendored
57
vendor/sabre/xml/lib/Element/Cdata.php
vendored
|
|
@ -1,57 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Element;
|
|
||||||
|
|
||||||
use Sabre\Xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CDATA element.
|
|
||||||
*
|
|
||||||
* This element allows you to easily inject CDATA.
|
|
||||||
*
|
|
||||||
* Note that we strongly recommend avoiding CDATA nodes, unless you definitely
|
|
||||||
* know what you're doing, or you're working with unchangeable systems that
|
|
||||||
* require CDATA.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class Cdata implements Xml\XmlSerializable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* CDATA element value.
|
|
||||||
*/
|
|
||||||
protected string $value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct(string $value)
|
|
||||||
{
|
|
||||||
$this->value = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* Use the $writer argument to write its own xml serialization.
|
|
||||||
*
|
|
||||||
* An important note: do _not_ create a parent element. Any element
|
|
||||||
* implementing XmlSerializable should only ever write what's considered
|
|
||||||
* its 'inner xml'.
|
|
||||||
*
|
|
||||||
* The parent of the current element is responsible for writing a
|
|
||||||
* containing element.
|
|
||||||
*
|
|
||||||
* This allows serializers to be re-used for different element names.
|
|
||||||
*
|
|
||||||
* If you are opening new elements, you must also close them again.
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Xml\Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->writeCData($this->value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
102
vendor/sabre/xml/lib/Element/Elements.php
vendored
102
vendor/sabre/xml/lib/Element/Elements.php
vendored
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Element;
|
|
||||||
|
|
||||||
use Sabre\Xml;
|
|
||||||
use Sabre\Xml\Deserializer;
|
|
||||||
use Sabre\Xml\Serializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 'Elements' is a simple list of elements, without values or attributes.
|
|
||||||
* For example, Elements will parse:.
|
|
||||||
*
|
|
||||||
* <?xml version="1.0"?>
|
|
||||||
* <s:root xmlns:s="http://sabredav.org/ns">
|
|
||||||
* <s:elem1 />
|
|
||||||
* <s:elem2 />
|
|
||||||
* <s:elem3 />
|
|
||||||
* <s:elem4>content</s:elem4>
|
|
||||||
* <s:elem5 attr="val" />
|
|
||||||
* </s:root>
|
|
||||||
*
|
|
||||||
* Into:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* "{http://sabredav.org/ns}elem1",
|
|
||||||
* "{http://sabredav.org/ns}elem2",
|
|
||||||
* "{http://sabredav.org/ns}elem3",
|
|
||||||
* "{http://sabredav.org/ns}elem4",
|
|
||||||
* "{http://sabredav.org/ns}elem5",
|
|
||||||
* ];
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class Elements implements Xml\Element
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Value to serialize.
|
|
||||||
*
|
|
||||||
* @var array<int, mixed>
|
|
||||||
*/
|
|
||||||
protected array $value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param array<int, mixed> $value
|
|
||||||
*/
|
|
||||||
public function __construct(array $value = [])
|
|
||||||
{
|
|
||||||
$this->value = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* Use the $writer argument to write its own xml serialization.
|
|
||||||
*
|
|
||||||
* An important note: do _not_ create a parent element. Any element
|
|
||||||
* implementing XmlSerializable should only ever write what's considered
|
|
||||||
* its 'inner xml'.
|
|
||||||
*
|
|
||||||
* The parent of the current element is responsible for writing a
|
|
||||||
* containing element.
|
|
||||||
*
|
|
||||||
* This allows serializers to be re-used for different element names.
|
|
||||||
*
|
|
||||||
* If you are opening new elements, you must also close them again.
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Xml\Writer $writer): void
|
|
||||||
{
|
|
||||||
Serializer\enum($writer, $this->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The deserialize method is called during xml parsing.
|
|
||||||
*
|
|
||||||
* This method is called statically, this is because in theory this method
|
|
||||||
* may be used as a type of constructor, or factory method.
|
|
||||||
*
|
|
||||||
* Often you want to return an instance of the current class, but you are
|
|
||||||
* free to return other data as well.
|
|
||||||
*
|
|
||||||
* Important note 2: You are responsible for advancing the reader to the
|
|
||||||
* next element. Not doing anything will result in a never-ending loop.
|
|
||||||
*
|
|
||||||
* If you just want to skip parsing for this element altogether, you can
|
|
||||||
* just call $reader->next();
|
|
||||||
*
|
|
||||||
* $reader->parseSubTree() will parse the entire sub-tree, and advance to
|
|
||||||
* the next element.
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
*/
|
|
||||||
public static function xmlDeserialize(Xml\Reader $reader)
|
|
||||||
{
|
|
||||||
return Deserializer\enum($reader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
102
vendor/sabre/xml/lib/Element/KeyValue.php
vendored
102
vendor/sabre/xml/lib/Element/KeyValue.php
vendored
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Element;
|
|
||||||
|
|
||||||
use Sabre\Xml;
|
|
||||||
use Sabre\Xml\Deserializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 'KeyValue' parses out all child elements from a single node, and outputs a
|
|
||||||
* key=>value struct.
|
|
||||||
*
|
|
||||||
* Attributes will be removed, and duplicate child elements are discarded.
|
|
||||||
* Complex values within the elements will be parsed by the 'standard' parser.
|
|
||||||
*
|
|
||||||
* For example, KeyValue will parse:
|
|
||||||
*
|
|
||||||
* <?xml version="1.0"?>
|
|
||||||
* <s:root xmlns:s="http://sabredav.org/ns">
|
|
||||||
* <s:elem1>value1</s:elem1>
|
|
||||||
* <s:elem2>value2</s:elem2>
|
|
||||||
* <s:elem3 />
|
|
||||||
* </s:root>
|
|
||||||
*
|
|
||||||
* Into:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* "{http://sabredav.org/ns}elem1" => "value1",
|
|
||||||
* "{http://sabredav.org/ns}elem2" => "value2",
|
|
||||||
* "{http://sabredav.org/ns}elem3" => null,
|
|
||||||
* ];
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class KeyValue implements Xml\Element
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Value to serialize.
|
|
||||||
*
|
|
||||||
* @var array<string, mixed>
|
|
||||||
*/
|
|
||||||
protected array $value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param array<string, mixed> $value
|
|
||||||
*/
|
|
||||||
public function __construct(array $value = [])
|
|
||||||
{
|
|
||||||
$this->value = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* Use the $writer argument to write its own xml serialization.
|
|
||||||
*
|
|
||||||
* An important note: do _not_ create a parent element. Any element
|
|
||||||
* implementing XmlSerializable should only ever write what's considered
|
|
||||||
* its 'inner xml'.
|
|
||||||
*
|
|
||||||
* The parent of the current element is responsible for writing a
|
|
||||||
* containing element.
|
|
||||||
*
|
|
||||||
* This allows serializers to be re-used for different element names.
|
|
||||||
*
|
|
||||||
* If you are opening new elements, you must also close them again.
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Xml\Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->write($this->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The deserialize method is called during xml parsing.
|
|
||||||
*
|
|
||||||
* This method is called statically, this is because in theory this method
|
|
||||||
* may be used as a type of constructor, or factory method.
|
|
||||||
*
|
|
||||||
* Often you want to return an instance of the current class, but you are
|
|
||||||
* free to return other data as well.
|
|
||||||
*
|
|
||||||
* Important note 2: You are responsible for advancing the reader to the
|
|
||||||
* next element. Not doing anything will result in a never-ending loop.
|
|
||||||
*
|
|
||||||
* If you just want to skip parsing for this element altogether, you can
|
|
||||||
* just call $reader->next();
|
|
||||||
*
|
|
||||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
|
||||||
* the next element.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public static function xmlDeserialize(Xml\Reader $reader)
|
|
||||||
{
|
|
||||||
return Deserializer\keyValue($reader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
95
vendor/sabre/xml/lib/Element/Uri.php
vendored
95
vendor/sabre/xml/lib/Element/Uri.php
vendored
|
|
@ -1,95 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Element;
|
|
||||||
|
|
||||||
use Sabre\Xml;
|
|
||||||
|
|
||||||
use function Sabre\Uri\resolve;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uri element.
|
|
||||||
*
|
|
||||||
* This represents a single uri. An example of how this may be encoded:
|
|
||||||
*
|
|
||||||
* <link>/foo/bar</link>
|
|
||||||
* <d:href xmlns:d="DAV:">http://example.org/hi</d:href>
|
|
||||||
*
|
|
||||||
* If the uri is relative, it will be automatically expanded to an absolute
|
|
||||||
* url during writing and reading, if the contextUri property is set on the
|
|
||||||
* reader and/or writer.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class Uri implements Xml\Element
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Uri element value.
|
|
||||||
*/
|
|
||||||
protected string $value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct(string $value)
|
|
||||||
{
|
|
||||||
$this->value = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* Use the $writer argument to write its own xml serialization.
|
|
||||||
*
|
|
||||||
* An important note: do _not_ create a parent element. Any element
|
|
||||||
* implementing XmlSerializable should only ever write what's considered
|
|
||||||
* its 'inner xml'.
|
|
||||||
*
|
|
||||||
* The parent of the current element is responsible for writing a
|
|
||||||
* containing element.
|
|
||||||
*
|
|
||||||
* This allows serializers to be re-used for different element names.
|
|
||||||
*
|
|
||||||
* If you are opening new elements, you must also close them again.
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Xml\Writer $writer): void
|
|
||||||
{
|
|
||||||
$writer->text(
|
|
||||||
resolve(
|
|
||||||
$writer->contextUri ?? '',
|
|
||||||
$this->value
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called during xml parsing.
|
|
||||||
*
|
|
||||||
* This method is called statically, this is because in theory this method
|
|
||||||
* may be used as a type of constructor, or factory method.
|
|
||||||
*
|
|
||||||
* Often you want to return an instance of the current class, but you are
|
|
||||||
* free to return other data as well.
|
|
||||||
*
|
|
||||||
* Important note 2: You are responsible for advancing the reader to the
|
|
||||||
* next element. Not doing anything will result in a never-ending loop.
|
|
||||||
*
|
|
||||||
* If you just want to skip parsing for this element altogether, you can
|
|
||||||
* just call $reader->next();
|
|
||||||
*
|
|
||||||
* $reader->parseSubTree() will parse the entire sub-tree, and advance to
|
|
||||||
* the next element.
|
|
||||||
*/
|
|
||||||
public static function xmlDeserialize(Xml\Reader $reader)
|
|
||||||
{
|
|
||||||
return new self(
|
|
||||||
resolve(
|
|
||||||
(string) $reader->contextUri,
|
|
||||||
$reader->readText()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
144
vendor/sabre/xml/lib/Element/XmlFragment.php
vendored
144
vendor/sabre/xml/lib/Element/XmlFragment.php
vendored
|
|
@ -1,144 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Element;
|
|
||||||
|
|
||||||
use Sabre\Xml\Element;
|
|
||||||
use Sabre\Xml\Reader;
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The XmlFragment element allows you to extract a portion of your xml tree,
|
|
||||||
* and get a well-formed xml string.
|
|
||||||
*
|
|
||||||
* This goes a bit beyond `innerXml` and friends, as we'll also match all the
|
|
||||||
* correct namespaces.
|
|
||||||
*
|
|
||||||
* Please note that the XML fragment:
|
|
||||||
*
|
|
||||||
* 1. Will not have an <?xml declaration.
|
|
||||||
* 2. Or a DTD
|
|
||||||
* 3. It will have all the relevant xmlns attributes.
|
|
||||||
* 4. It may not have a root element.
|
|
||||||
*/
|
|
||||||
class XmlFragment implements Element
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The inner XML value.
|
|
||||||
*/
|
|
||||||
protected string $xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct(string $xml)
|
|
||||||
{
|
|
||||||
$this->xml = $xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the inner XML document.
|
|
||||||
*/
|
|
||||||
public function getXml(): string
|
|
||||||
{
|
|
||||||
return $this->xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The xmlSerialize method is called during xml writing.
|
|
||||||
*
|
|
||||||
* Use the $writer argument to write its own xml serialization.
|
|
||||||
*
|
|
||||||
* An important note: do _not_ create a parent element. Any element
|
|
||||||
* implementing XmlSerializable should only ever write what's considered
|
|
||||||
* its 'inner xml'.
|
|
||||||
*
|
|
||||||
* The parent of the current element is responsible for writing a
|
|
||||||
* containing element.
|
|
||||||
*
|
|
||||||
* This allows serializers to be re-used for different element names.
|
|
||||||
*
|
|
||||||
* If you are opening new elements, you must also close them again.
|
|
||||||
*/
|
|
||||||
public function xmlSerialize(Writer $writer): void
|
|
||||||
{
|
|
||||||
$reader = new Reader();
|
|
||||||
|
|
||||||
// Wrapping the xml in a container, so root-less values can still be
|
|
||||||
// parsed.
|
|
||||||
$xml = <<<XML
|
|
||||||
<?xml version="1.0"?>
|
|
||||||
<xml-fragment xmlns="http://sabre.io/ns">{$this->getXml()}</xml-fragment>
|
|
||||||
XML;
|
|
||||||
|
|
||||||
$reader->xml($xml);
|
|
||||||
|
|
||||||
while ($reader->read()) {
|
|
||||||
if ($reader->depth < 1) {
|
|
||||||
// Skipping the root node.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($reader->nodeType) {
|
|
||||||
case Reader::ELEMENT:
|
|
||||||
$writer->startElement(
|
|
||||||
(string) $reader->getClark()
|
|
||||||
);
|
|
||||||
$empty = $reader->isEmptyElement;
|
|
||||||
while ($reader->moveToNextAttribute()) {
|
|
||||||
switch ($reader->namespaceURI) {
|
|
||||||
case '':
|
|
||||||
$writer->writeAttribute($reader->localName, $reader->value);
|
|
||||||
break;
|
|
||||||
case 'http://www.w3.org/2000/xmlns/':
|
|
||||||
// Skip namespace declarations
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$writer->writeAttribute((string) $reader->getClark(), $reader->value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($empty) {
|
|
||||||
$writer->endElement();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Reader::CDATA:
|
|
||||||
case Reader::TEXT:
|
|
||||||
$writer->text(
|
|
||||||
$reader->value
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case Reader::END_ELEMENT:
|
|
||||||
$writer->endElement();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The deserialize method is called during xml parsing.
|
|
||||||
*
|
|
||||||
* This method is called statically, this is because in theory this method
|
|
||||||
* may be used as a type of constructor, or factory method.
|
|
||||||
*
|
|
||||||
* Often you want to return an instance of the current class, but you are
|
|
||||||
* free to return other data as well.
|
|
||||||
*
|
|
||||||
* You are responsible for advancing the reader to the next element. Not
|
|
||||||
* doing anything will result in a never-ending loop.
|
|
||||||
*
|
|
||||||
* If you just want to skip parsing for this element altogether, you can
|
|
||||||
* just call $reader->next();
|
|
||||||
*
|
|
||||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
|
||||||
* the next element.
|
|
||||||
*/
|
|
||||||
public static function xmlDeserialize(Reader $reader)
|
|
||||||
{
|
|
||||||
$result = new self($reader->readInnerXml());
|
|
||||||
$reader->next();
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
49
vendor/sabre/xml/lib/LibXMLException.php
vendored
49
vendor/sabre/xml/lib/LibXMLException.php
vendored
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml;
|
|
||||||
|
|
||||||
use LibXMLError;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This exception is thrown when the Reader runs into a parsing error.
|
|
||||||
*
|
|
||||||
* This exception effectively wraps 1 or more LibXMLError objects.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class LibXMLException extends ParseException
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The error list.
|
|
||||||
*
|
|
||||||
* @var \LibXMLError[]
|
|
||||||
*/
|
|
||||||
protected array $errors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the exception.
|
|
||||||
*
|
|
||||||
* You should pass a list of LibXMLError objects in its constructor.
|
|
||||||
*
|
|
||||||
* @param \LibXMLError[] $errors
|
|
||||||
*/
|
|
||||||
public function __construct(array $errors, int $code = 0, ?\Throwable $previousException = null)
|
|
||||||
{
|
|
||||||
$this->errors = $errors;
|
|
||||||
parent::__construct($errors[0]->message.' on line '.$errors[0]->line.', column '.$errors[0]->column, $code, $previousException);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the LibXML errors.
|
|
||||||
*
|
|
||||||
* @return \LibXMLError[]
|
|
||||||
*/
|
|
||||||
public function getErrors(): array
|
|
||||||
{
|
|
||||||
return $this->errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
16
vendor/sabre/xml/lib/ParseException.php
vendored
16
vendor/sabre/xml/lib/ParseException.php
vendored
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a base exception for any exception related to parsing xml files.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class ParseException extends \Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
317
vendor/sabre/xml/lib/Reader.php
vendored
317
vendor/sabre/xml/lib/Reader.php
vendored
|
|
@ -1,317 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml;
|
|
||||||
|
|
||||||
use XMLReader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Reader class expands upon PHP's built-in XMLReader.
|
|
||||||
*
|
|
||||||
* The intended usage, is to assign certain XML elements to PHP classes. These
|
|
||||||
* need to be registered using the $elementMap public property.
|
|
||||||
*
|
|
||||||
* After this is done, a single call to parse() will parse the entire document,
|
|
||||||
* and delegate sub-sections of the document to element classes.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class Reader extends \XMLReader
|
|
||||||
{
|
|
||||||
use ContextStackTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current nodename in clark-notation.
|
|
||||||
*
|
|
||||||
* For example: "{http://www.w3.org/2005/Atom}feed".
|
|
||||||
* Or if no namespace is defined: "{}feed".
|
|
||||||
*
|
|
||||||
* This method returns null if we're not currently on an element.
|
|
||||||
*/
|
|
||||||
public function getClark(): ?string
|
|
||||||
{
|
|
||||||
if (!$this->localName) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '{'.$this->namespaceURI.'}'.$this->localName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the entire document.
|
|
||||||
*
|
|
||||||
* This function returns an array with the following three elements:
|
|
||||||
* * name - The root element name.
|
|
||||||
* * value - The value for the root element.
|
|
||||||
* * attributes - An array of attributes.
|
|
||||||
*
|
|
||||||
* This function will also disable the standard libxml error handler (which
|
|
||||||
* usually just results in PHP errors), and throw exceptions instead.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function parse(): array
|
|
||||||
{
|
|
||||||
$previousEntityState = null;
|
|
||||||
$shouldCallLibxmlDisableEntityLoader = (\LIBXML_VERSION < 20900);
|
|
||||||
if ($shouldCallLibxmlDisableEntityLoader) {
|
|
||||||
$previousEntityState = libxml_disable_entity_loader(true);
|
|
||||||
}
|
|
||||||
$previousSetting = libxml_use_internal_errors(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (self::ELEMENT !== $this->nodeType) {
|
|
||||||
if (!$this->read()) {
|
|
||||||
$errors = libxml_get_errors();
|
|
||||||
libxml_clear_errors();
|
|
||||||
if ($errors) {
|
|
||||||
throw new LibXMLException($errors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$result = $this->parseCurrentElement();
|
|
||||||
|
|
||||||
// last line of defense in case errors did occur above
|
|
||||||
$errors = libxml_get_errors();
|
|
||||||
libxml_clear_errors();
|
|
||||||
if ($errors) {
|
|
||||||
throw new LibXMLException($errors);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
libxml_use_internal_errors($previousSetting);
|
|
||||||
if ($shouldCallLibxmlDisableEntityLoader) {
|
|
||||||
libxml_disable_entity_loader($previousEntityState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parseGetElements parses everything in the current sub-tree,
|
|
||||||
* and returns an array of elements.
|
|
||||||
*
|
|
||||||
* Each element has a 'name', 'value' and 'attributes' key.
|
|
||||||
*
|
|
||||||
* If the element didn't contain sub-elements, an empty array is always
|
|
||||||
* returned. If there was any text inside the element, it will be
|
|
||||||
* discarded.
|
|
||||||
*
|
|
||||||
* If the $elementMap argument is specified, the existing elementMap will
|
|
||||||
* be overridden while parsing the tree, and restored after this process.
|
|
||||||
*
|
|
||||||
* @param array<string, mixed>|null $elementMap
|
|
||||||
*
|
|
||||||
* @return array<int,array<string, mixed>>
|
|
||||||
*/
|
|
||||||
public function parseGetElements(?array $elementMap = null): array
|
|
||||||
{
|
|
||||||
$result = $this->parseInnerTree($elementMap);
|
|
||||||
if (!is_array($result)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses all elements below the current element.
|
|
||||||
*
|
|
||||||
* This method will return a string if this was a text-node, or an array if
|
|
||||||
* there were sub-elements.
|
|
||||||
*
|
|
||||||
* If there's both text and sub-elements, the text will be discarded.
|
|
||||||
*
|
|
||||||
* If the $elementMap argument is specified, the existing elementMap will
|
|
||||||
* be overridden while parsing the tree, and restored after this process.
|
|
||||||
*
|
|
||||||
* @param array<string, mixed>|null $elementMap
|
|
||||||
*
|
|
||||||
* @return array<int,array<string, mixed>>|string|null
|
|
||||||
*/
|
|
||||||
public function parseInnerTree(?array $elementMap = null)
|
|
||||||
{
|
|
||||||
$text = null;
|
|
||||||
$elements = [];
|
|
||||||
|
|
||||||
if (self::ELEMENT === $this->nodeType && $this->isEmptyElement) {
|
|
||||||
// Easy!
|
|
||||||
$this->next();
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_null($elementMap)) {
|
|
||||||
$this->pushContext();
|
|
||||||
$this->elementMap = $elementMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (!$this->read()) {
|
|
||||||
$errors = libxml_get_errors();
|
|
||||||
libxml_clear_errors();
|
|
||||||
if ($errors) {
|
|
||||||
throw new LibXMLException($errors);
|
|
||||||
}
|
|
||||||
throw new ParseException('This should never happen (famous last words)');
|
|
||||||
}
|
|
||||||
|
|
||||||
$keepOnParsing = true;
|
|
||||||
|
|
||||||
while ($keepOnParsing) {
|
|
||||||
if (!$this->isValid()) {
|
|
||||||
$errors = libxml_get_errors();
|
|
||||||
|
|
||||||
if ($errors) {
|
|
||||||
libxml_clear_errors();
|
|
||||||
throw new LibXMLException($errors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($this->nodeType) {
|
|
||||||
case self::ELEMENT:
|
|
||||||
$elements[] = $this->parseCurrentElement();
|
|
||||||
break;
|
|
||||||
case self::TEXT:
|
|
||||||
case self::CDATA:
|
|
||||||
$text .= $this->value;
|
|
||||||
$this->read();
|
|
||||||
break;
|
|
||||||
case self::END_ELEMENT:
|
|
||||||
// Ensuring we are moving the cursor after the end element.
|
|
||||||
$this->read();
|
|
||||||
$keepOnParsing = false;
|
|
||||||
break;
|
|
||||||
case self::NONE:
|
|
||||||
throw new ParseException('We hit the end of the document prematurely. This likely means that some parser "eats" too many elements. Do not attempt to continue parsing.');
|
|
||||||
default:
|
|
||||||
// Advance to the next element
|
|
||||||
$this->read();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (!is_null($elementMap)) {
|
|
||||||
$this->popContext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $elements ?: $text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads all text below the current element, and returns this as a string.
|
|
||||||
*/
|
|
||||||
public function readText(): string
|
|
||||||
{
|
|
||||||
$result = '';
|
|
||||||
$previousDepth = $this->depth;
|
|
||||||
|
|
||||||
while ($this->read() && $this->depth != $previousDepth) {
|
|
||||||
if (in_array($this->nodeType, [\XMLReader::TEXT, \XMLReader::CDATA, \XMLReader::WHITESPACE])) {
|
|
||||||
$result .= $this->value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses the current XML element.
|
|
||||||
*
|
|
||||||
* This method returns arn array with 3 properties:
|
|
||||||
* * name - A clark-notation XML element name.
|
|
||||||
* * value - The parsed value.
|
|
||||||
* * attributes - A key-value list of attributes.
|
|
||||||
*
|
|
||||||
* @return array <string, mixed>
|
|
||||||
*/
|
|
||||||
public function parseCurrentElement(): array
|
|
||||||
{
|
|
||||||
$name = $this->getClark();
|
|
||||||
|
|
||||||
$attributes = [];
|
|
||||||
|
|
||||||
if ($this->hasAttributes) {
|
|
||||||
$attributes = $this->parseAttributes();
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = call_user_func(
|
|
||||||
$this->getDeserializerForElementName((string) $name),
|
|
||||||
$this
|
|
||||||
);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'name' => $name,
|
|
||||||
'value' => $value,
|
|
||||||
'attributes' => $attributes,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs all the attributes from the current element, and returns them as a
|
|
||||||
* key-value array.
|
|
||||||
*
|
|
||||||
* If the attributes are part of the same namespace, they will simply be
|
|
||||||
* short keys. If they are defined on a different namespace, the attribute
|
|
||||||
* name will be returned in clark-notation.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function parseAttributes(): array
|
|
||||||
{
|
|
||||||
$attributes = [];
|
|
||||||
|
|
||||||
while ($this->moveToNextAttribute()) {
|
|
||||||
if ($this->namespaceURI) {
|
|
||||||
// Ignoring 'xmlns', it doesn't make any sense.
|
|
||||||
if ('http://www.w3.org/2000/xmlns/' === $this->namespaceURI) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$name = $this->getClark();
|
|
||||||
$attributes[$name] = $this->value;
|
|
||||||
} else {
|
|
||||||
$attributes[$this->localName] = $this->value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->moveToElement();
|
|
||||||
|
|
||||||
return $attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the function that should be used to parse the element identified
|
|
||||||
* by its clark-notation name.
|
|
||||||
*/
|
|
||||||
public function getDeserializerForElementName(string $name): callable
|
|
||||||
{
|
|
||||||
if (!array_key_exists($name, $this->elementMap)) {
|
|
||||||
if ('{}' == substr($name, 0, 2) && array_key_exists(substr($name, 2), $this->elementMap)) {
|
|
||||||
$name = substr($name, 2);
|
|
||||||
} else {
|
|
||||||
return ['Sabre\\Xml\\Element\\Base', 'xmlDeserialize'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$deserializer = $this->elementMap[$name];
|
|
||||||
if (is_callable($deserializer)) {
|
|
||||||
return $deserializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) {
|
|
||||||
return [$deserializer, 'xmlDeserialize'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = gettype($deserializer);
|
|
||||||
if (is_string($deserializer)) {
|
|
||||||
$type .= ' ('.$deserializer.')';
|
|
||||||
} elseif (is_object($deserializer)) {
|
|
||||||
$type .= ' ('.get_class($deserializer).')';
|
|
||||||
}
|
|
||||||
throw new \LogicException('Could not use this type as a deserializer: '.$type.' for element: '.$name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
207
vendor/sabre/xml/lib/Serializer/functions.php
vendored
207
vendor/sabre/xml/lib/Serializer/functions.php
vendored
|
|
@ -1,207 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml\Serializer;
|
|
||||||
|
|
||||||
use Sabre\Xml\Writer;
|
|
||||||
use Sabre\Xml\XmlSerializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file provides a number of 'serializer' helper functions.
|
|
||||||
*
|
|
||||||
* These helper functions can be used to easily xml-encode common PHP
|
|
||||||
* data structures, or can be placed in the $classMap.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 'enum' serializer writes simple list of elements.
|
|
||||||
*
|
|
||||||
* For example, calling:
|
|
||||||
*
|
|
||||||
* enum($writer, [
|
|
||||||
* "{http://sabredav.org/ns}elem1",
|
|
||||||
* "{http://sabredav.org/ns}elem2",
|
|
||||||
* "{http://sabredav.org/ns}elem3",
|
|
||||||
* "{http://sabredav.org/ns}elem4",
|
|
||||||
* "{http://sabredav.org/ns}elem5",
|
|
||||||
* ]);
|
|
||||||
*
|
|
||||||
* Will generate something like this (if the correct namespace is declared):
|
|
||||||
*
|
|
||||||
* <s:elem1 />
|
|
||||||
* <s:elem2 />
|
|
||||||
* <s:elem3 />
|
|
||||||
* <s:elem4>content</s:elem4>
|
|
||||||
* <s:elem5 attr="val" />
|
|
||||||
*
|
|
||||||
* @param string[] $values
|
|
||||||
*/
|
|
||||||
function enum(Writer $writer, array $values): void
|
|
||||||
{
|
|
||||||
foreach ($values as $value) {
|
|
||||||
$writer->writeElement($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The valueObject serializer turns a simple PHP object into a classname.
|
|
||||||
*
|
|
||||||
* Every public property will be encoded as an XML element with the same
|
|
||||||
* name, in the XML namespace as specified.
|
|
||||||
*
|
|
||||||
* Values that are set to null or an empty array are not serialized. To
|
|
||||||
* serialize empty properties, you must specify them as an empty string.
|
|
||||||
*/
|
|
||||||
function valueObject(Writer $writer, object $valueObject, string $namespace): void
|
|
||||||
{
|
|
||||||
foreach (get_object_vars($valueObject) as $key => $val) {
|
|
||||||
if (is_array($val)) {
|
|
||||||
// If $val is an array, it has a special meaning. We need to
|
|
||||||
// generate one child element for each item in $val
|
|
||||||
foreach ($val as $child) {
|
|
||||||
$writer->writeElement('{'.$namespace.'}'.$key, $child);
|
|
||||||
}
|
|
||||||
} elseif (null !== $val) {
|
|
||||||
$writer->writeElement('{'.$namespace.'}'.$key, $val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This serializer helps you serialize xml structures that look like
|
|
||||||
* this:.
|
|
||||||
*
|
|
||||||
* <collection>
|
|
||||||
* <item>...</item>
|
|
||||||
* <item>...</item>
|
|
||||||
* <item>...</item>
|
|
||||||
* </collection>
|
|
||||||
*
|
|
||||||
* In that previous example, this serializer just serializes the item element,
|
|
||||||
* and this could be called like this:
|
|
||||||
*
|
|
||||||
* repeatingElements($writer, $items, '{}item');
|
|
||||||
*
|
|
||||||
* @param array<int,mixed> $items
|
|
||||||
*/
|
|
||||||
function repeatingElements(Writer $writer, array $items, string $childElementName): void
|
|
||||||
{
|
|
||||||
foreach ($items as $item) {
|
|
||||||
$writer->writeElement($childElementName, $item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is the 'default' serializer that is able to serialize most
|
|
||||||
* things, and delegates to other serializers if needed.
|
|
||||||
*
|
|
||||||
* The standardSerializer supports a wide-array of values.
|
|
||||||
*
|
|
||||||
* $value may be a string or integer, it will just write out the string as text.
|
|
||||||
* $value may be an instance of XmlSerializable or Element, in which case it
|
|
||||||
* calls it's xmlSerialize() method.
|
|
||||||
* $value may be a PHP callback/function/closure, in case we call the callback
|
|
||||||
* and give it the Writer as an argument.
|
|
||||||
* $value may be an object, and if it's in the classMap we automatically call
|
|
||||||
* the correct serializer for it.
|
|
||||||
* $value may be null, in which case we do nothing.
|
|
||||||
*
|
|
||||||
* If $value is an array, the array must look like this:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* [
|
|
||||||
* 'name' => '{namespaceUri}element-name',
|
|
||||||
* 'value' => '...',
|
|
||||||
* 'attributes' => [ 'attName' => 'attValue' ]
|
|
||||||
* ]
|
|
||||||
* [,
|
|
||||||
* 'name' => '{namespaceUri}element-name2',
|
|
||||||
* 'value' => '...',
|
|
||||||
* ]
|
|
||||||
* ]
|
|
||||||
*
|
|
||||||
* This would result in xml like:
|
|
||||||
*
|
|
||||||
* <element-name xmlns="namespaceUri" attName="attValue">
|
|
||||||
* ...
|
|
||||||
* </element-name>
|
|
||||||
* <element-name2>
|
|
||||||
* ...
|
|
||||||
* </element-name2>
|
|
||||||
*
|
|
||||||
* The value property may be any value standardSerializer supports, so you can
|
|
||||||
* nest data-structures this way. Both value and attributes are optional.
|
|
||||||
*
|
|
||||||
* Alternatively, you can also specify the array using this syntax:
|
|
||||||
*
|
|
||||||
* [
|
|
||||||
* [
|
|
||||||
* '{namespaceUri}element-name' => '...',
|
|
||||||
* '{namespaceUri}element-name2' => '...',
|
|
||||||
* ]
|
|
||||||
* ]
|
|
||||||
*
|
|
||||||
* This is excellent for simple key->value structures, and here you can also
|
|
||||||
* specify anything for the value.
|
|
||||||
*
|
|
||||||
* You can even mix the two array syntaxes.
|
|
||||||
*
|
|
||||||
* @param string|int|float|bool|array<int|string, mixed>|object $value
|
|
||||||
*/
|
|
||||||
function standardSerializer(Writer $writer, $value): void
|
|
||||||
{
|
|
||||||
if (is_scalar($value)) {
|
|
||||||
// String, integer, float, boolean
|
|
||||||
$writer->text((string) $value);
|
|
||||||
} elseif ($value instanceof XmlSerializable) {
|
|
||||||
// XmlSerializable classes or Element classes.
|
|
||||||
$value->xmlSerialize($writer);
|
|
||||||
} elseif (is_object($value) && isset($writer->classMap[get_class($value)])) {
|
|
||||||
// It's an object which class appears in the classmap.
|
|
||||||
$writer->classMap[get_class($value)]($writer, $value);
|
|
||||||
} elseif (is_callable($value)) {
|
|
||||||
// A callback
|
|
||||||
$value($writer);
|
|
||||||
} elseif (is_array($value) && array_key_exists('name', $value)) {
|
|
||||||
// if the array had a 'name' element, we assume that this array
|
|
||||||
// describes a 'name' and optionally 'attributes' and 'value'.
|
|
||||||
|
|
||||||
$name = $value['name'];
|
|
||||||
$attributes = isset($value['attributes']) ? $value['attributes'] : [];
|
|
||||||
$value = isset($value['value']) ? $value['value'] : null;
|
|
||||||
|
|
||||||
$writer->startElement($name);
|
|
||||||
$writer->writeAttributes($attributes);
|
|
||||||
$writer->write($value);
|
|
||||||
$writer->endElement();
|
|
||||||
} elseif (is_array($value)) {
|
|
||||||
foreach ($value as $name => $item) {
|
|
||||||
if (is_int($name)) {
|
|
||||||
// This item has a numeric index. We just loop through the
|
|
||||||
// array and throw it back in the writer.
|
|
||||||
standardSerializer($writer, $item);
|
|
||||||
} elseif (is_string($name) && is_array($item) && isset($item['attributes'])) {
|
|
||||||
// The key is used for a name, but $item has 'attributes' and
|
|
||||||
// possibly 'value'
|
|
||||||
$writer->startElement($name);
|
|
||||||
$writer->writeAttributes($item['attributes']);
|
|
||||||
if (isset($item['value'])) {
|
|
||||||
$writer->write($item['value']);
|
|
||||||
}
|
|
||||||
$writer->endElement();
|
|
||||||
} elseif (is_string($name)) {
|
|
||||||
// This was a plain key-value array.
|
|
||||||
$writer->startElement($name);
|
|
||||||
$writer->write($item);
|
|
||||||
$writer->endElement();
|
|
||||||
} else {
|
|
||||||
throw new \InvalidArgumentException('The writer does not know how to serialize arrays with keys of type: '.gettype($name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif (is_object($value)) {
|
|
||||||
throw new \InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value));
|
|
||||||
} elseif (!is_null($value)) {
|
|
||||||
throw new \InvalidArgumentException('The writer cannot serialize values of type: '.gettype($value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
326
vendor/sabre/xml/lib/Service.php
vendored
326
vendor/sabre/xml/lib/Service.php
vendored
|
|
@ -1,326 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Sabre\Xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* XML parsing and writing service.
|
|
||||||
*
|
|
||||||
* You are encouraged to make an instance of this for your application and
|
|
||||||
* potentially extend it, as a central API point for dealing with xml and
|
|
||||||
* configuring the reader and writer.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
|
|
||||||
* @author Evert Pot (http://evertpot.com/)
|
|
||||||
* @license http://sabre.io/license/ Modified BSD License
|
|
||||||
*/
|
|
||||||
class Service
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* This is the element map. It contains a list of XML elements (in clark
|
|
||||||
* notation) as keys and PHP class names as values.
|
|
||||||
*
|
|
||||||
* The PHP class names must implement Sabre\Xml\Element.
|
|
||||||
*
|
|
||||||
* Values may also be a callable. In that case the function will be called
|
|
||||||
* directly.
|
|
||||||
*
|
|
||||||
* @phpstan-var array<string, class-string|callable|object>
|
|
||||||
*/
|
|
||||||
public array $elementMap = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a list of namespaces that you want to give default prefixes.
|
|
||||||
*
|
|
||||||
* You must make sure you create this entire list before starting to write.
|
|
||||||
* They should be registered on the root element.
|
|
||||||
*
|
|
||||||
* @phpstan-var array<string, class-string|string|null>
|
|
||||||
*/
|
|
||||||
public array $namespaceMap = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a list of custom serializers for specific classes.
|
|
||||||
*
|
|
||||||
* The writer may use this if you attempt to serialize an object with a
|
|
||||||
* class that does not implement XmlSerializable.
|
|
||||||
*
|
|
||||||
* Instead, it will look at this classmap to see if there is a custom
|
|
||||||
* serializer here. This is useful if you don't want your value objects
|
|
||||||
* to be responsible for serializing themselves.
|
|
||||||
*
|
|
||||||
* The keys in this classmap need to be fully qualified PHP class names,
|
|
||||||
* the values must be callbacks. The callbacks take two arguments. The
|
|
||||||
* writer class, and the value that must be written.
|
|
||||||
*
|
|
||||||
* function (Writer $writer, object $value)
|
|
||||||
*
|
|
||||||
* @phpstan-var array<class-string, callable(Writer, object):mixed>
|
|
||||||
*/
|
|
||||||
public array $classMap = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A bitmask of the LIBXML_* constants.
|
|
||||||
*/
|
|
||||||
public int $options = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a fresh XML Reader.
|
|
||||||
*/
|
|
||||||
public function getReader(): Reader
|
|
||||||
{
|
|
||||||
$r = new Reader();
|
|
||||||
$r->elementMap = $this->elementMap;
|
|
||||||
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a fresh xml writer.
|
|
||||||
*/
|
|
||||||
public function getWriter(): Writer
|
|
||||||
{
|
|
||||||
$w = new Writer();
|
|
||||||
$w->namespaceMap = $this->namespaceMap;
|
|
||||||
$w->classMap = $this->classMap;
|
|
||||||
|
|
||||||
return $w;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a document in full.
|
|
||||||
*
|
|
||||||
* Input may be specified as a string or readable stream resource.
|
|
||||||
* The returned value is the value of the root document.
|
|
||||||
*
|
|
||||||
* Specifying the $contextUri allows the parser to figure out what the URI
|
|
||||||
* of the document was. This allows relative URIs within the document to be
|
|
||||||
* expanded easily.
|
|
||||||
*
|
|
||||||
* The $rootElementName is specified by reference and will be populated
|
|
||||||
* with the root element name of the document.
|
|
||||||
*
|
|
||||||
* @param string|resource $input
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>|object|string
|
|
||||||
*
|
|
||||||
* @throws ParseException
|
|
||||||
*/
|
|
||||||
public function parse($input, ?string $contextUri = null, ?string &$rootElementName = null)
|
|
||||||
{
|
|
||||||
if (!is_string($input)) {
|
|
||||||
// Unfortunately the XMLReader doesn't support streams. When it
|
|
||||||
// does, we can optimize this.
|
|
||||||
if (is_resource($input)) {
|
|
||||||
$input = (string) stream_get_contents($input);
|
|
||||||
} else {
|
|
||||||
// Input is not a string and not a resource.
|
|
||||||
// Therefore, it has to be a closed resource.
|
|
||||||
// Effectively empty input has been passed in.
|
|
||||||
$input = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If input is empty, then it's safe to throw an exception
|
|
||||||
if (empty($input)) {
|
|
||||||
throw new ParseException('The input element to parse is empty. Do not attempt to parse');
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = $this->getReader();
|
|
||||||
$r->contextUri = $contextUri;
|
|
||||||
$r->XML($input, null, $this->options);
|
|
||||||
|
|
||||||
$result = $r->parse();
|
|
||||||
$rootElementName = $result['name'];
|
|
||||||
|
|
||||||
return $result['value'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a document in full, and specify what the expected root element
|
|
||||||
* name is.
|
|
||||||
*
|
|
||||||
* This function works similar to parse, but the difference is that the
|
|
||||||
* user can specify what the expected name of the root element should be,
|
|
||||||
* in clark notation.
|
|
||||||
*
|
|
||||||
* This is useful in cases where you expected a specific document to be
|
|
||||||
* passed, and reduces the amount of if statements.
|
|
||||||
*
|
|
||||||
* It's also possible to pass an array of expected rootElements if your
|
|
||||||
* code may expect more than one document type.
|
|
||||||
*
|
|
||||||
* @param string|string[] $rootElementName
|
|
||||||
* @param string|resource $input
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>|object|string
|
|
||||||
*
|
|
||||||
* @throws ParseException
|
|
||||||
*/
|
|
||||||
public function expect($rootElementName, $input, ?string $contextUri = null)
|
|
||||||
{
|
|
||||||
if (!is_string($input)) {
|
|
||||||
// Unfortunately the XMLReader doesn't support streams. When it
|
|
||||||
// does, we can optimize this.
|
|
||||||
if (is_resource($input)) {
|
|
||||||
$input = (string) stream_get_contents($input);
|
|
||||||
} else {
|
|
||||||
// Input is not a string and not a resource.
|
|
||||||
// Therefore, it has to be a closed resource.
|
|
||||||
// Effectively empty input has been passed in.
|
|
||||||
$input = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If input is empty, then it's safe to throw an exception
|
|
||||||
if (empty($input)) {
|
|
||||||
throw new ParseException('The input element to parse is empty. Do not attempt to parse');
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = $this->getReader();
|
|
||||||
$r->contextUri = $contextUri;
|
|
||||||
$r->XML($input, null, $this->options);
|
|
||||||
|
|
||||||
$rootElementName = (array) $rootElementName;
|
|
||||||
|
|
||||||
foreach ($rootElementName as &$rEl) {
|
|
||||||
if ('{' !== $rEl[0]) {
|
|
||||||
$rEl = '{}'.$rEl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $r->parse();
|
|
||||||
if (!in_array($result['name'], $rootElementName, true)) {
|
|
||||||
throw new ParseException('Expected '.implode(' or ', $rootElementName).' but received '.$result['name'].' as the root element');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result['value'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates an XML document in one go.
|
|
||||||
*
|
|
||||||
* The $rootElement must be specified in clark notation.
|
|
||||||
* The value must be a string, an array or an object implementing
|
|
||||||
* XmlSerializable. Basically, anything that's supported by the Writer
|
|
||||||
* object.
|
|
||||||
*
|
|
||||||
* $contextUri can be used to specify a sort of 'root' of the PHP application,
|
|
||||||
* in case the xml document is used as a http response.
|
|
||||||
*
|
|
||||||
* This allows an implementor to easily create URI's relative to the root
|
|
||||||
* of the domain.
|
|
||||||
*
|
|
||||||
* @param string|array<int|string, mixed>|object|XmlSerializable $value
|
|
||||||
*/
|
|
||||||
public function write(string $rootElementName, $value, ?string $contextUri = null): string
|
|
||||||
{
|
|
||||||
$w = $this->getWriter();
|
|
||||||
$w->openMemory();
|
|
||||||
$w->contextUri = $contextUri;
|
|
||||||
$w->setIndent(true);
|
|
||||||
$w->startDocument();
|
|
||||||
$w->writeElement($rootElementName, $value);
|
|
||||||
|
|
||||||
return $w->outputMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map an XML element to a PHP class.
|
|
||||||
*
|
|
||||||
* Calling this function will automatically set up the Reader and Writer
|
|
||||||
* classes to turn a specific XML element to a PHP class.
|
|
||||||
*
|
|
||||||
* For example, given a class such as :
|
|
||||||
*
|
|
||||||
* class Author {
|
|
||||||
* public $firstName;
|
|
||||||
* public $lastName;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* and an XML element such as:
|
|
||||||
*
|
|
||||||
* <author xmlns="http://example.org/ns">
|
|
||||||
* <firstName>...</firstName>
|
|
||||||
* <lastName>...</lastName>
|
|
||||||
* </author>
|
|
||||||
*
|
|
||||||
* These can easily be mapped by calling:
|
|
||||||
*
|
|
||||||
* $service->mapValueObject('{http://example.org}author', 'Author');
|
|
||||||
*
|
|
||||||
* @param class-string $className
|
|
||||||
*/
|
|
||||||
public function mapValueObject(string $elementName, string $className): void
|
|
||||||
{
|
|
||||||
list($namespace) = self::parseClarkNotation($elementName);
|
|
||||||
|
|
||||||
$this->elementMap[$elementName] = function (Reader $reader) use ($className, $namespace) {
|
|
||||||
return \Sabre\Xml\Deserializer\valueObject($reader, $className, $namespace);
|
|
||||||
};
|
|
||||||
$this->classMap[$className] = function (Writer $writer, $valueObject) use ($namespace) {
|
|
||||||
\Sabre\Xml\Serializer\valueObject($writer, $valueObject, $namespace);
|
|
||||||
};
|
|
||||||
$this->valueObjectMap[$className] = $elementName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a value object.
|
|
||||||
*
|
|
||||||
* This function largely behaves similar to write(), except that it's
|
|
||||||
* intended specifically to serialize a Value Object into an XML document.
|
|
||||||
*
|
|
||||||
* The ValueObject must have been previously registered using
|
|
||||||
* mapValueObject().
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function writeValueObject(object $object, ?string $contextUri = null): string
|
|
||||||
{
|
|
||||||
if (!isset($this->valueObjectMap[get_class($object)])) {
|
|
||||||
throw new \InvalidArgumentException('"'.get_class($object).'" is not a registered value object class. Register your class with mapValueObject.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->write(
|
|
||||||
$this->valueObjectMap[get_class($object)],
|
|
||||||
$object,
|
|
||||||
$contextUri
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a clark-notation string, and returns the namespace and element
|
|
||||||
* name components.
|
|
||||||
*
|
|
||||||
* If the string was invalid, it will throw an InvalidArgumentException.
|
|
||||||
*
|
|
||||||
* @return array{string, string}
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public static function parseClarkNotation(string $str): array
|
|
||||||
{
|
|
||||||
static $cache = [];
|
|
||||||
|
|
||||||
if (!isset($cache[$str])) {
|
|
||||||
if (!preg_match('/^{([^}]*)}(.*)$/', $str, $matches)) {
|
|
||||||
throw new \InvalidArgumentException('\''.$str.'\' is not a valid clark-notation formatted string');
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache[$str] = [
|
|
||||||
$matches[1],
|
|
||||||
$matches[2],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $cache[$str];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of classes and which XML elements they map to.
|
|
||||||
*
|
|
||||||
* @var array<class-string, string>
|
|
||||||
*/
|
|
||||||
protected array $valueObjectMap = [];
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue