Init: add code scaffolding
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
/vendor/
 | 
			
		||||
.php-cs-fixer.cache
 | 
			
		||||
							
								
								
									
										39
									
								
								.php-cs-fixer.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								.php-cs-fixer.php
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										31
									
								
								Dockerfile
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										26
									
								
								Taskfile.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										17
									
								
								composer.json
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										1942
									
								
								composer.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										11
									
								
								console.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								console.php
									
									
									
									
									
										Normal 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();
 | 
			
		||||
							
								
								
									
										22
									
								
								src/ExchangeCardsCommand.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/ExchangeCardsCommand.php
									
									
									
									
									
										Normal 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)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user