before refactoring BindAPI/CLIController/RequestController

This commit is contained in:
tracer 2022-07-19 18:53:35 +02:00
parent 8168b41b8c
commit 838c571d75
10 changed files with 206 additions and 160 deletions

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" autoUpload="Always" serverName="executor.24unix.net" autoUploadExternalChanges="true">
<component name="PublishConfigData" autoUpload="On explicit save action" serverName="shadow.24unix.net" autoUploadExternalChanges="true">
<serverData>
<paths name="executor.24unix.net">
<paths name="shadow.24unix.net">
<serverdata>
<mappings>
<mapping deploy="/home/users/tfunix/www" local="$PROJECT_DIR$" web="/public" />
<mapping deploy="/bindAPI" local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
<option name="myAutoUpload" value="ALWAYS" />
<option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
</component>
</project>

View File

@ -3,7 +3,7 @@
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="115" name="PHP" />
<language minSize="116" name="PHP" />
</Languages>
</inspection_tool>
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />

View File

@ -1,7 +1,6 @@
#!/usr/bin/keyhelp-php81
<?php declare(strict_types=1);
namespace App\Controller;
// #!/usr/bin/keyhelp-php81
// & ~E_DEPRECATED is needed because of a bug in PhpStorm
use DI\DependencyException;
@ -42,8 +41,8 @@ if (!$config = json_decode(json: $configJSON, associative: true)) {
echo $configJSON;
}
$shortOpts = 'v::'; // version
$shortOpts .= "V::"; // verbose
$shortOpts = 'V::'; // version
$shortOpts .= "v::"; // verbose
$shortOpts .= "h::"; // help
$longOpts = [
@ -54,7 +53,7 @@ $longOpts = [
$options = getopt(short_options: $shortOpts, long_options: $longOpts, rest_index: $restIndex);
if (array_key_exists(key: 'v', array: $options) || array_key_exists(key: 'version', array: $options) ) {
if (array_key_exists(key: 'V', array: $options) || array_key_exists(key: 'version', array: $options) ) {
print("bindAPI version: $version" . PHP_EOL);
exit(0);
}
@ -64,7 +63,7 @@ if (array_key_exists(key: 'h', array: $options) || array_key_exists(key: 'help',
exit(0);
}
if (array_key_exists(key: 'V', array: $options) || array_key_exists(key: 'verbose', array: $options) ) {
if (array_key_exists(key: 'v', array: $options) || array_key_exists(key: 'verbose', array: $options) ) {
$config['verbose'] = true;
} else {
$config['verbose'] = false;

235
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "29f60ed5cd4cce6bb3bcf49c51498e79",
"content-hash": "f7096254eb316738d722dfff777682ef",
"packages": [
{
"name": "arubacao/tld-checker",
"version": "1.2.112",
"version": "1.2.122",
"source": {
"type": "git",
"url": "https://github.com/arubacao/tld-checker.git",
"reference": "031048e4d136bc15d573f0d625e92a58de23d956"
"reference": "99864e877ffac46e02fc2054a9659a97909d470a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/arubacao/tld-checker/zipball/031048e4d136bc15d573f0d625e92a58de23d956",
"reference": "031048e4d136bc15d573f0d625e92a58de23d956",
"url": "https://api.github.com/repos/arubacao/tld-checker/zipball/99864e877ffac46e02fc2054a9659a97909d470a",
"reference": "99864e877ffac46e02fc2054a9659a97909d470a",
"shasum": ""
},
"require": {
@ -65,9 +65,9 @@
],
"support": {
"issues": "https://github.com/arubacao/tld-checker/issues",
"source": "https://github.com/arubacao/tld-checker/tree/1.2.112"
"source": "https://github.com/arubacao/tld-checker/tree/1.2.122"
},
"time": "2022-01-23T04:01:20+00:00"
"time": "2022-04-03T04:01:19+00:00"
},
{
"name": "doctrine/annotations",
@ -143,16 +143,16 @@
},
{
"name": "doctrine/lexer",
"version": "1.2.2",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c"
"reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c",
"reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229",
"reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229",
"shasum": ""
},
"require": {
@ -160,7 +160,7 @@
},
"require-dev": {
"doctrine/coding-standard": "^9.0",
"phpstan/phpstan": "1.3",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.11"
},
@ -199,7 +199,7 @@
],
"support": {
"issues": "https://github.com/doctrine/lexer/issues",
"source": "https://github.com/doctrine/lexer/tree/1.2.2"
"source": "https://github.com/doctrine/lexer/tree/1.2.3"
},
"funding": [
{
@ -215,20 +215,20 @@
"type": "tidelift"
}
],
"time": "2022-01-12T08:27:12+00:00"
"time": "2022-02-28T11:07:21+00:00"
},
{
"name": "monolog/monolog",
"version": "2.3.5",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9"
"reference": "d7fd7450628561ba697b7097d86db72662f54aef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef",
"reference": "d7fd7450628561ba697b7097d86db72662f54aef",
"shasum": ""
},
"require": {
@ -250,7 +250,7 @@
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
@ -302,7 +302,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.3.5"
"source": "https://github.com/Seldaek/monolog/tree/2.4.0"
},
"funding": [
{
@ -314,7 +314,7 @@
"type": "tidelift"
}
],
"time": "2021-10-01T21:08:31+00:00"
"time": "2022-03-14T12:44:37+00:00"
},
{
"name": "opis/closure",
@ -344,12 +344,12 @@
}
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": [
"functions.php"
]
],
"psr-4": {
"Opis\\Closure\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -474,12 +474,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"DI\\": "src/"
},
"files": [
"src/functions.php"
]
],
"psr-4": {
"DI\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -808,7 +808,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@ -840,12 +840,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -870,7 +870,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
},
"funding": [
{
@ -964,16 +964,16 @@
},
{
"name": "zircote/swagger-php",
"version": "4.2.5",
"version": "4.2.14",
"source": {
"type": "git",
"url": "https://github.com/zircote/swagger-php.git",
"reference": "e87cec1ec79926e0de6e920a93fb6142f837a750"
"reference": "975c598084a1f8e7acccaa68aed12c803cebbd6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/e87cec1ec79926e0de6e920a93fb6142f837a750",
"reference": "e87cec1ec79926e0de6e920a93fb6142f837a750",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/975c598084a1f8e7acccaa68aed12c803cebbd6a",
"reference": "975c598084a1f8e7acccaa68aed12c803cebbd6a",
"shasum": ""
},
"require": {
@ -1033,37 +1033,38 @@
],
"support": {
"issues": "https://github.com/zircote/swagger-php/issues",
"source": "https://github.com/zircote/swagger-php/tree/4.2.5"
"source": "https://github.com/zircote/swagger-php/tree/4.2.14"
},
"time": "2022-01-31T00:21:28+00:00"
"time": "2022-04-01T08:53:53+00:00"
}
],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.4.0",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b"
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"doctrine/coding-standard": "^9",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13 || 1.0.0-alpha2",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
"phpbench/phpbench": "^0.16 || ^1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.22"
},
"type": "library",
"autoload": {
@ -1090,7 +1091,7 @@
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.4.0"
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
},
"funding": [
{
@ -1106,38 +1107,42 @@
"type": "tidelift"
}
],
"time": "2020-11-10T18:47:58+00:00"
"time": "2022-03-03T08:28:38+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.10.2",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220"
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -1153,7 +1158,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.10.2"
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.0"
},
"funding": [
{
@ -1161,7 +1166,7 @@
"type": "tidelift"
}
],
"time": "2020-11-13T09:40:50+00:00"
"time": "2022-03-03T13:19:32+00:00"
},
{
"name": "nikic/php-parser",
@ -1281,16 +1286,16 @@
},
{
"name": "phar-io/version",
"version": "3.1.0",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "bae7c545bef187884426f042434e561ab1ddb182"
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182",
"reference": "bae7c545bef187884426f042434e561ab1ddb182",
"url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"shasum": ""
},
"require": {
@ -1326,9 +1331,9 @@
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.1.0"
"source": "https://github.com/phar-io/version/tree/3.2.1"
},
"time": "2021-02-23T14:00:09+00:00"
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "phpdocumentor/reflection-common",
@ -1442,16 +1447,16 @@
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.6.0",
"version": "1.6.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706"
"reference": "77a32518733312af16a44300404e945338981de3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706",
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3",
"reference": "77a32518733312af16a44300404e945338981de3",
"shasum": ""
},
"require": {
@ -1486,9 +1491,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1"
},
"time": "2022-01-04T19:58:01+00:00"
"time": "2022-03-15T21:29:03+00:00"
},
{
"name": "phpspec/prophecy",
@ -1559,16 +1564,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.10",
"version": "9.2.15",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "d5850aaf931743067f4bfc1ae4cbd06468400687"
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687",
"reference": "d5850aaf931743067f4bfc1ae4cbd06468400687",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"shasum": ""
},
"require": {
@ -1624,7 +1629,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15"
},
"funding": [
{
@ -1632,7 +1637,7 @@
"type": "github"
}
],
"time": "2021-12-05T09:12:13+00:00"
"time": "2022-03-07T09:28:20+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -1877,16 +1882,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.11",
"version": "9.5.20",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2406855036db1102126125537adb1406f7242fdd"
"reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd",
"reference": "2406855036db1102126125537adb1406f7242fdd",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba",
"reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba",
"shasum": ""
},
"require": {
@ -1902,7 +1907,7 @@
"phar-io/version": "^3.0.2",
"php": ">=7.3",
"phpspec/prophecy": "^1.12.1",
"phpunit/php-code-coverage": "^9.2.7",
"phpunit/php-code-coverage": "^9.2.13",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3",
@ -1916,7 +1921,7 @@
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3.4",
"sebastian/type": "^3.0",
"sebastian/version": "^3.0.2"
},
"require-dev": {
@ -1937,11 +1942,11 @@
}
},
"autoload": {
"classmap": [
"src/"
],
"files": [
"src/Framework/Assert/Functions.php"
],
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
@ -1964,7 +1969,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.11"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20"
},
"funding": [
{
@ -1976,7 +1981,7 @@
"type": "github"
}
],
"time": "2021-12-25T07:07:57+00:00"
"time": "2022-04-01T12:37:26+00:00"
},
{
"name": "sebastian/cli-parser",
@ -2344,16 +2349,16 @@
},
{
"name": "sebastian/environment",
"version": "5.1.3",
"version": "5.1.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "388b6ced16caa751030f6a69e588299fa09200ac"
"reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac",
"reference": "388b6ced16caa751030f6a69e588299fa09200ac",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7",
"reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7",
"shasum": ""
},
"require": {
@ -2395,7 +2400,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/5.1.3"
"source": "https://github.com/sebastianbergmann/environment/tree/5.1.4"
},
"funding": [
{
@ -2403,7 +2408,7 @@
"type": "github"
}
],
"time": "2020-09-28T05:52:38+00:00"
"time": "2022-04-03T09:37:03+00:00"
},
{
"name": "sebastian/exporter",
@ -2484,16 +2489,16 @@
},
{
"name": "sebastian/global-state",
"version": "5.0.3",
"version": "5.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49"
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49",
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"shasum": ""
},
"require": {
@ -2536,7 +2541,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3"
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5"
},
"funding": [
{
@ -2544,7 +2549,7 @@
"type": "github"
}
],
"time": "2021-06-11T13:31:12+00:00"
"time": "2022-02-14T08:28:10+00:00"
},
{
"name": "sebastian/lines-of-code",
@ -2835,28 +2840,28 @@
},
{
"name": "sebastian/type",
"version": "2.3.4",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914"
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -2879,7 +2884,7 @@
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/2.3.4"
"source": "https://github.com/sebastianbergmann/type/tree/3.0.0"
},
"funding": [
{
@ -2887,7 +2892,7 @@
"type": "github"
}
],
"time": "2021-06-15T12:49:02+00:00"
"time": "2022-03-15T09:54:48+00:00"
},
{
"name": "sebastian/version",
@ -3063,5 +3068,5 @@
"ext-pdo": "*"
},
"platform-dev": [],
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.3.0"
}

View File

@ -1 +0,0 @@

View File

@ -57,7 +57,7 @@ class BindAPI
* @throws \DI\NotFoundException
* @throws \Exception
*/
public function __construct(private array $config, private int $argumentsCount, private array $arguments)
public function __construct(private readonly array $config, private readonly int $argumentsCount, private readonly array $arguments)
{
$dateFormat = "Y:m:d H:i:s";
$output = "%datetime% %channel%.%level_name% %message%\n"; // %context% %extra%
@ -125,6 +125,7 @@ class BindAPI
}
}
/**
* @return void
*/
@ -1359,36 +1360,44 @@ class BindAPI
* @throws \DI\NotFoundException
* @throws \DI\DependencyException
*/
private function handleDomainsDynDns()
private function handleDomainsDynDns(): void
{
$hostname = $this->arguments[1] ?? '';
$hostName = $this->arguments[1] ?? '';
if (empty($hostname)) {
if (empty($hostName)) {
echo 'You need to supply at least the hostname' . PHP_EOL;
exit(1);
}
if ($this->config['verbose']) {
echo "Updating DynDNS host: $hostname" . PHP_EOL;
echo "Updating DynDNS host: $hostName" . PHP_EOL;
}
$nameserver = $this->nameserverRepository->findFirst();
echo 'here';
$domain = $this->domainRepository->findByHost(host: $hostName);
print_r(value: $domain);
echo 'there';
// we need the panel who is master for zone
$panel = $this->panelRepository->findByName(name: $domain->getPanel());
if (!empty($nameserver->getAaaa())) {
// which NS belongs to that panel
if (!empty($panel->getAaaa())) {
$result = $this->apiController->sendCommand(
requestType: 'POST',
serverName : $nameserver->getName(),
serverName : $panel->getName(),
versionIP : 6,
apiKey : $nameserver->getApikey(),
command : 'dyndns/' . $hostname,
apiKey : $panel->getApikey(),
command : 'dyndns/' . $hostName,
serverType : 'nameserver');
} else {
$result = $this->apiController->sendCommand(
requestType: 'POST',
serverName : $nameserver->getName(),
serverName : $panel->getName(),
versionIP : 4,
apiKey : $nameserver->getApikey(),
command : 'dyndns/' . $hostname,
apiKey : $panel->getApikey(),
command : 'dyndns/' . $hostName,
serverType : 'nameserver');
}

View File

@ -269,4 +269,5 @@ class DomainController
return false;
}
}
}

View File

@ -503,25 +503,6 @@ class RequestController
}
/**
* @param String $host
*
* @return string
*/
private function getDomain(string $host): string
{
$host = strtolower(string: trim(string: $host));
$count = substr_count(haystack: $host, needle: '.');
if ($count == 2) {
if (strlen(string: explode(separator: '.', string: $host)[1]) > 3) {
$host = explode(separator: '.', string: $host, limit: 2)[1];
}
} elseif ($count > 2) {
$host = $this->getDomain(host: explode(separator: '.', string: $host, limit: 2)[1]);
}
return $host;
}
private function handleDynDNS()
{
@ -712,4 +693,25 @@ class RequestController
}
}
/**
* @param String $host
*
* @return string
*/
private function getDomain(string $host): string
{
$host = strtolower(string: trim(string: $host));
$count = substr_count(haystack: $host, needle: '.');
if ($count == 2) {
if (strlen(string: explode(separator: '.', string: $host)[1]) > 3) {
$host = explode(separator: '.', string: $host, limit: 2)[1];
}
} elseif ($count > 2) {
$host = $this->getDomain(host: explode(separator: '.', string: $host, limit: 2)[1]);
}
return $host;
}
}

View File

@ -113,6 +113,37 @@ class DomainRepository
}
/**
* @param String $name
*
* @return \App\Entity\Domain|bool
*/
public function findByHost(string $host): Domain|bool
{
if ($this->config['debug']) {
$this->log->debug(message: "findByHost($host)");
}
$host = strtolower(string: trim(string: $host));
$count = substr_count(haystack: $host, needle: '.');
if ($count == 2) {
if (strlen(string: explode(separator: '.', string: $host)[1]) > 3) {
$host = explode(separator: '.', string: $host, limit: 2)[1];
}
} elseif ($count > 2) {
$host = $this->findByHost(host: explode(separator: '.', string: $host, limit: 2)[1]);
}
if ($domain = $this->findByName(name: $host)) {
return $domain;
} else {
return false;
}
}
/**
* @param \App\Entity\Domain $domain
*

View File

@ -94,7 +94,7 @@ class DomainRepositoryTest extends TestCase
{
$domain = new Domain(name: 'inserttest.org', a: '1.2.3.4', aaaa: '1bad::babe');
$this->domainRepository->insert(domain: $domain);
$this->domainController->createZoneFile(domain: $domain);
$this->domainController->createSlaveZoneFile(domain: $domain);
// now get the persisted domain with id
$domainTest = $this->domainRepository->findByName(name: 'inserttest.org');
@ -132,7 +132,7 @@ class DomainRepositoryTest extends TestCase
{
$domain = new Domain(name: 'inserttest.org', a: '1.2.3.4', aaaa: '1bad::babe');
$this->domainRepository->insert(domain: $domain);
$this->domainController->createZoneFile(domain: $domain);
$this->domainController->createSlaveZoneFile(domain: $domain);
$domainTest = $this->domainRepository->findByName(name: 'inserttest.org');
$this->assertIsNotBool(actual: $domainTest);