1
0

Init: add code scaffolding

This commit is contained in:
Anton Vakhrushev 2023-10-17 16:12:04 +03:00
commit 1ef176f3f7
Signed by: av
GPG Key ID: 581F7473F7A21FA2
8 changed files with 2090 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/vendor/
.php-cs-fixer.cache

39
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,39 @@
<?php
$finder = PhpCsFixer\Finder::create()
->notName('phpstan-baseline.php')
->in(__DIR__);
$config = new PhpCsFixer\Config();
$config
->setRules([
'@Symfony' => true,
'@PSR2' => true,
'@PhpCsFixer' => true,
'@PHP81Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => false,
'blank_line_before_statement' => ['statements' => ['declare', 'try']],
'blank_line_between_import_groups' => false,
'cast_spaces' => false,
'concat_space' => ['spacing' => 'one'],
'echo_tag_syntax' => ['format' => 'long'],
'global_namespace_import' => true,
'increment_style' => ['style' => 'post'],
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'no_whitespace_in_blank_line' => false,
'ordered_class_elements' => false,
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_separation' => false,
'phpdoc_summary' => false,
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
'single_line_comment_style' => ['comment_types' => ['hash']],
'yoda_style' => false,
])
->setIndent(' ')
->setLineEnding("\n")
->setFinder($finder);
return $config;

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM php:8.2
# ------------------------------------------------------------------
# PACKAGES AND DEPENDENCIES
# ------------------------------------------------------------------
RUN apt-get update -y && apt-get install -y \
ca-certificates \
curl \
git \
gnupg \
gzip \
zip \
$PHPIZE_DEPS \
;
# ------------------------------------------------------------------
# DEVELOPMENT TOOLS
# ------------------------------------------------------------------
# Composer and required tools
RUN curl -sLO https://getcomposer.org/download/2.6.5/composer.phar \
&& mv composer.phar /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer
# PHP-CS-Fixer
RUN curl -sLO https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.35.1/php-cs-fixer.phar \
&& mv php-cs-fixer.phar /usr/local/bin/php-cs-fixer \
&& chmod +x /usr/local/bin/php-cs-fixer
WORKDIR /app

26
Taskfile.yml Normal file
View File

@ -0,0 +1,26 @@
# https://taskfile.dev
version: '3'
env: {}
vars:
DOCKER_IMAGE: 'the-tale-ca-php'
tasks:
default:
cmds:
- echo "{{.GREETING}}"
silent: true
build-docker-image:
cmds:
- docker build -t "{{.DOCKER_IMAGE}}" .
run-shell:
cmds:
- docker run -it --rm -u 1000:1000 -v ${PWD}:/app -w /app {{.DOCKER_IMAGE}} bash
format:
cmds:
- docker run -it --rm -u 1000:1000 -v ${PWD}:/app -w /app {{.DOCKER_IMAGE}} php-cs-fixer fix

17
composer.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "root/app",
"type": "project",
"require": {
"php": "^8.2",
"guzzlehttp/guzzle": "^7.8",
"symfony/console": "^6.3"
},
"require-dev": {
"roave/security-advisories": "dev-latest"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
}
}

1942
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

11
console.php Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Console\Application;
$application = new Application();
$application->add(new \App\ExchangeCardsCommand());
$application->run();

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(
name: 'cards:exchange',
description: 'Get and exchange cards',
)]
class ExchangeCardsCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output)
{
}
}