Skip to content

Commit 1ab94f3

Browse files
committed
feat(initial): extract client from docker-hostsfile-sync
0 parents  commit 1ab94f3

File tree

854 files changed

+163074
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

854 files changed

+163074
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
.git
3+
vendor
4+
.php-version

.github/workflows/php-tests.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on: [ push, pull_request ]
2+
name: "Tests"
3+
4+
jobs:
5+
php-tests:
6+
name: "Run codeception tests"
7+
runs-on: "ubuntu-latest"
8+
continue-on-error: ${{ matrix.allow-fail }}
9+
env:
10+
PHP_CS_FIXER_IGNORE_ENV: true
11+
strategy:
12+
matrix:
13+
include:
14+
- { php-version: 8.3, dependencies: locked, coverage: pcov, with_coverage: true, allow-fail: false }
15+
- { php-version: 8.3, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: false }
16+
17+
- { php-version: 8.4, dependencies: locked, coverage: pcov, with_coverage: false, allow-fail: true }
18+
- { php-version: 8.4, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
19+
steps:
20+
- name: "Checkout"
21+
uses: "actions/[email protected]"
22+
23+
- name: "Install PHP"
24+
uses: "shivammathur/[email protected]"
25+
with:
26+
coverage: "${{ matrix.coverage }}"
27+
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
28+
php-version: "${{ matrix.php-version }}"
29+
30+
- name: "Set up problem matchers for PHP"
31+
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
32+
33+
- name: "Set up problem matchers for phpunit/phpunit"
34+
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
35+
36+
- name: "Validate composer.json and composer.lock"
37+
run: "composer validate --ansi --strict"
38+
39+
- name: "Determine composer cache directory"
40+
uses: "ergebnis/.github/actions/composer/[email protected]"
41+
42+
- name: "Cache dependencies installed with composer"
43+
uses: "actions/[email protected]"
44+
with:
45+
path: "${{ env.COMPOSER_CACHE_DIR }}"
46+
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
47+
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
48+
49+
- name: "Install ${{ matrix.dependencies }} dependencies with composer"
50+
uses: "ergebnis/.github/actions/composer/[email protected]"
51+
with:
52+
dependencies: "${{ matrix.dependencies }}"
53+
54+
- name: "Run Tests"
55+
run: |
56+
vendor/bin/codecept build -c .
57+
vendor/bin/codecept run -c . -vvv --coverage --coverage-xml=coverage.xml --xml

.gitignore

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
### Linux template
3+
*~
4+
5+
# temporary files which can be created if a process still has a handle open of a deleted file
6+
.fuse_hidden*
7+
8+
# KDE directory preferences
9+
.directory
10+
11+
# Linux trash folder which might appear on any partition or disk
12+
.Trash-*
13+
14+
# .nfs files are created when an open file is removed but is still being accessed
15+
.nfs*
16+
### Composer template
17+
bin/composer.phar
18+
/vendor/
19+
20+
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
21+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
22+
# composer.lock
23+
### JetBrains template
24+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
25+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
26+
27+
# User-specific stuff:
28+
.idea/
29+
.idea/**/workspace.xml
30+
.idea/**/tasks.xml
31+
.idea/dictionaries
32+
33+
# Sensitive or high-churn files:
34+
.idea/**/dataSources/
35+
.idea/**/dataSources.ids
36+
.idea/**/dataSources.xml
37+
.idea/**/dataSources.local.xml
38+
.idea/**/sqlDataSources.xml
39+
.idea/**/dynamic.xml
40+
.idea/**/uiDesigner.xml
41+
42+
# Gradle:
43+
.idea/**/gradle.xml
44+
.idea/**/libraries
45+
46+
# CMake
47+
cmake-build-debug/
48+
49+
# Mongo Explorer plugin:
50+
.idea/**/mongoSettings.xml
51+
52+
## File-based project format:
53+
*.iws
54+
55+
## Plugin-specific files:
56+
57+
# IntelliJ
58+
out/
59+
60+
# mpeltonen/sbt-idea plugin
61+
.idea_modules/
62+
63+
# JIRA plugin
64+
atlassian-ide-plugin.xml
65+
66+
# Cursive Clojure plugin
67+
.idea/replstate.xml
68+
69+
# Crashlytics plugin (for Android Studio and IntelliJ)
70+
com_crashlytics_export_strings.xml
71+
crashlytics.properties
72+
crashlytics-build.properties
73+
fabric.properties
74+
75+
76+
.php_cs.cache
77+
.php-cs-fixer.cache
78+
/tests/_data/example.php
79+
coverage/*
80+
!coverage/.gitkeep
81+
composer.phar
82+
tests/Support/_generated/*
83+
!tests/Support/_generated/.gitkeep
84+
tmp-hosts

.jane-openapi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
return [
5+
'openapi-file' => __DIR__ . '/spec/docker-v1.48-patched.yaml',
6+
'namespace' => 'WebProject\DockerApi\Library\Generated',
7+
'directory' => __DIR__ . '/generated',
8+
'strict' => true,
9+
'use-fixer' => true,
10+
'fixer-config-file' => __DIR__ . '/.php-cs-fixer.php',
11+
'clean-generated' => true,
12+
'reference' => true,
13+
'use-cacheable-supports-method' => true,
14+
'validation' => false,
15+
];

.php-cs-fixer.php

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
5+
6+
$finder = PhpCsFixer\Finder::create()
7+
->in(
8+
[
9+
__DIR__ . '/src',
10+
__DIR__ . '/tests',
11+
__DIR__ . '/generated',
12+
__DIR__ . '/examples',
13+
]
14+
)
15+
->append(
16+
[
17+
__FILE__,
18+
]
19+
)
20+
->notContains([
21+
'_generated',
22+
])
23+
;
24+
$rules = [
25+
/** symfony set @see \PhpCsFixer\RuleSet\Sets\PSR12Set */
26+
'@PSR12' => true,
27+
/** symfony set @see \PhpCsFixer\RuleSet\Sets\SymfonySet */
28+
'@Symfony' => true,
29+
/** symfony set @see \PhpCsFixer\RuleSet\Sets\SymfonyRiskySet */
30+
'@Symfony:risky' => true,
31+
'@PhpCsFixer:risky' => true,
32+
'@PHP83Migration' => true,
33+
'@DoctrineAnnotation' => true,
34+
// OEG Set:
35+
'binary_operator_spaces' => [
36+
'default' => 'align',
37+
'operators' => [
38+
'??' => 'single_space',
39+
],
40+
],
41+
'concat_space' => ['spacing' => 'one'],
42+
43+
'encoding' => true,
44+
'blank_lines_before_namespace' => true,
45+
'blank_line_after_opening_tag' => false, // psr 12 = true
46+
'strict_param' => true,
47+
'no_useless_else' => true,
48+
'no_useless_return' => true,
49+
'modernize_types_casting' => true,
50+
'declare_strict_types' => true,
51+
'dir_constant' => true,
52+
53+
'php_unit_dedicate_assert' => ['target' => 'newest'],
54+
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
55+
'fopen_flags' => false,
56+
'combine_nested_dirname' => true,
57+
58+
'ordered_imports' => [
59+
'imports_order' => [
60+
// symfony order: Class Function Const
61+
// OEG:
62+
'const',
63+
'class',
64+
'function',
65+
],
66+
'sort_algorithm' => 'alpha',
67+
],
68+
69+
'global_namespace_import' => [
70+
'import_classes' => true,
71+
'import_functions' => true,
72+
'import_constants' => true,
73+
],
74+
75+
// if this is true, phpstan checks will fail
76+
'phpdoc_to_comment' => false,
77+
'nullable_type_declaration_for_default_null_value' => true,
78+
'no_superfluous_phpdoc_tags' => false, // symfony -> true löscht aber mixed return was phpstan aggro macht
79+
// prevent mega diff
80+
'blank_line_between_import_groups' => false, // PSR 12 = true
81+
82+
// new stuff that fails to much:
83+
'ordered_types' => [
84+
// default symfony "always_last"
85+
'null_adjustment' => 'always_first',
86+
],
87+
];
88+
89+
$config = new PhpCsFixer\Config('webproject-style');
90+
$config->setRules($rules);
91+
$config->setUsingCache(true);
92+
$config->setLineEnding("\n");
93+
$config->setRiskyAllowed(true);
94+
$config->setParallelConfig(ParallelConfigFactory::detect());
95+
$config->setFinder($finder);
96+
97+
return $config;

.php-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.3

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 WebProject.xyz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# php-docker-api-client - A PHP docker API client
2+
3+
4+
## Based on Docker API Version spec [docker-v1.48.yaml](spec/docker-v1.48.yaml)
5+
> patched types from real world [docker-v1.48-patched.yaml](spec/docker-v1.48-patched.yaml) responses and minor code patches (WIP)
6+
7+
## Example
8+
```shell
9+
bin/docker-api --help
10+
```
11+
12+
#### Generated with [janephp/janephp](https://github.com/janephp/janephp)

bin/docker-api

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env php
2+
<?php
3+
declare(strict_types=1);
4+
5+
use Symfony\Component\Console\Application;
6+
use WebProject\DockerApiClient\Command\ListContainersCommand;
7+
8+
if (!is_dir(dirname(__DIR__) . '/vendor')) {
9+
throw new LogicException('Dependencies are missing. Try running "composer install".');
10+
}
11+
12+
if (!is_file(dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
13+
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
14+
}
15+
16+
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
17+
18+
return static function (array $context) {
19+
$application = new Application('Docker API', '@package_version@');
20+
$application->add(new ListContainersCommand());
21+
$application->setDefaultCommand('synchronize-hosts');
22+
23+
return $application;
24+
};

codeception.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace: WebProject\DockerApiClient\Tests
2+
support_namespace: Support
3+
paths:
4+
tests: tests
5+
output: tests/_output
6+
data: tests/Support/Data
7+
support: tests/Support
8+
envs: tests/_envs
9+
actor_suffix: Tester
10+
extensions:
11+
enabled:
12+
- Codeception\Extension\RunFailed

0 commit comments

Comments
 (0)