From 02989dc6fd8b80614a61b007c84bb2fd877cce0b Mon Sep 17 00:00:00 2001 From: Simon Hatt Date: Wed, 11 Dec 2024 21:53:47 +0100 Subject: [PATCH] Change frame path, php-cs-fixer --- .env | 4 +- .github/workflows/ci-staging.yml | 9 +- .gitignore | 7 +- .php_cs_config.php | 38 + Deploy.php | 5 +- composer.json | 5 + composer.lock | 1369 ++++++++++++++++- src/Command/RegenerateAppSecretCommand.php | 29 + src/Flatastic/Controller/BotController.php | 11 +- src/Flatastic/Controller/ChoresController.php | 21 +- src/Flatastic/Controller/FlatController.php | 11 +- .../Controller/FlatmatesController.php | 9 +- src/Flatastic/Controller/IndexController.php | 87 +- .../Controller/ShoppingListController.php | 11 +- src/Flatastic/Controller/ShoutController.php | 11 +- src/Flatastic/Service/FlatasticApi.php | 18 +- src/Flatastic/Service/ImagePainter.php | 19 +- src/Frame/Controller/IndexController.php | 67 +- src/HattStyle/Controller/IndexController.php | 17 +- src/Kernel.php | 3 +- symfony.lock | 12 + 21 files changed, 1608 insertions(+), 155 deletions(-) create mode 100644 .php_cs_config.php create mode 100644 src/Command/RegenerateAppSecretCommand.php diff --git a/.env b/.env index b920129..91f4ab1 100644 --- a/.env +++ b/.env @@ -16,5 +16,7 @@ ###> symfony/framework-bundle ### APP_ENV=dev -APP_SECRET=27ece57ba8aa437809ed5e6ef26e4636 +APP_SECRET=dccfd2bb9b2a23fe2abef3a0214c2d67 + +PRIVATE_PATH=private/ ###< symfony/framework-bundle ### diff --git a/.github/workflows/ci-staging.yml b/.github/workflows/ci-staging.yml index 1bc1960..417c7a1 100644 --- a/.github/workflows/ci-staging.yml +++ b/.github/workflows/ci-staging.yml @@ -23,7 +23,7 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --no-dev --prefer-dist + run: composer install --prefer-dist # - name: Get npm cache directory # id: npm-cache # run: | @@ -36,8 +36,5 @@ jobs: # ${{ runner.os }}-node- # - name: Install JavaScript dependencies # run: npm install - - name: Deploy over FTPS - env: - USERNAME: ${{ secrets.DEPLOY_USERNAME }} - PASSWORD: ${{ secrets.DEPLOY_PASSWORD }} - run: php ./Deploy.php --target=cyon --environment=prod --username="$USERNAME" + - name: PHP Code style check + run: composer fixdiff diff --git a/.gitignore b/.gitignore index 77acfda..362e303 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ node_modules/ -public/frame/ +private/ var/ vendor/ + +###> friendsofphp/php-cs-fixer ### +/.php-cs-fixer.php +/.php-cs-fixer.cache +###< friendsofphp/php-cs-fixer ### diff --git a/.php_cs_config.php b/.php_cs_config.php new file mode 100644 index 0000000..c36bc44 --- /dev/null +++ b/.php_cs_config.php @@ -0,0 +1,38 @@ +in(__DIR__.'/') + ->exclude('_/library/') + ->exclude('deploy/') + ->exclude('node_modules/') + ->exclude('var/') +; + +$config = new PhpCsFixer\Config(); +return $config + ->setRules([ + '@DoctrineAnnotation' => true, + '@PSR1' => true, + '@PSR2' => true, + '@PSR12' => true, + '@PhpCsFixer' => true, + '@Symfony' => true, + '@PHP82Migration' => true, + 'blank_line_before_statement' => false, + 'braces_position' => [ + 'functions_opening_brace' => 'same_line', + 'classes_opening_brace' => 'same_line', + ], + 'increment_style' => [ + 'style' => 'post', + ], + 'single_quote' => false, + 'yoda_style' => [ + 'always_move_variable' => false, + 'equal' => false, + 'identical' => false, + 'less_and_greater' => false, + ], + ]) + ->setFinder($finder) +; diff --git a/Deploy.php b/Deploy.php index 840f971..26494b1 100644 --- a/Deploy.php +++ b/Deploy.php @@ -45,6 +45,9 @@ public function getRemotePrivatePath(): string { /** @return array */ public function install(string $public_path): array { + $fs = new Symfony\Component\Filesystem\Filesystem(); + $fs->copy(__DIR__.'/../../.env.local', __DIR__.'/.env.local'); + $getPublicPathForSubdomain = function (string $subdomain) use ($public_path): string { return str_replace($this->getRemotePublicPath(), "public_html/{$subdomain}", $public_path); }; @@ -85,4 +88,4 @@ protected function installForSubdomain(string $public_path): void { $logger->pushHandler(new ErrorLogHandler()); $deploy->setLogger($logger); $deploy->cli(); -} \ No newline at end of file +} diff --git a/composer.json b/composer.json index 5e4ed84..dc23315 100644 --- a/composer.json +++ b/composer.json @@ -59,6 +59,8 @@ "symfony/polyfill-php80": "*" }, "scripts": { + "fix": "php-cs-fixer fix --config=./.php_cs_config.php -v", + "fixdiff": "php-cs-fixer fix --config=./.php_cs_config.php -v --dry-run --diff", "auto-scripts": { "cache:clear": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd" @@ -78,5 +80,8 @@ "allow-contrib": false, "require": "7.1.*" } + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.65" } } diff --git a/composer.lock b/composer.lock index 084553e..2811e46 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "18a8df2c62181f355d6745df0af253a3", + "content-hash": "a7acd17931e3b8754e5fd451d4aa3617", "packages": [ { "name": "allestuetsmerweh/php-deploy", @@ -3339,7 +3339,1372 @@ "time": "2024-09-25T14:20:29+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-09-19T14:15:21+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00" + }, + { + "name": "evenement/evenement", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "8520451a140d3f46ac33042715115e290cf5785f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2024-08-06T10:04:20+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.65.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "shasum": "" + }, + "require": { + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.2", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3.1 || ^2.4", + "infection/infection": "^0.29.8", + "justinrainbow/json-schema": "^5.3 || ^6.0", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3", + "symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8", + "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2024-11-25T00:39:24+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.5", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:53:05+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v7.1.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "0f4099f5306a92487d13b2a4589068c36a93c447" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/0f4099f5306a92487d13b2a4589068c36a93c447", + "reference": "0f4099f5306a92487d13b2a4589068c36a93c447", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v7.1.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-20T11:08:58+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/process", + "version": "v7.1.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v7.1.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T14:23:19+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v7.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "8b4a434e6e7faf6adedffb48783a5c75409a1a05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/8b4a434e6e7faf6adedffb48783a5c75409a1a05", + "reference": "8b4a434e6e7faf6adedffb48783a5c75409a1a05", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": {}, diff --git a/src/Command/RegenerateAppSecretCommand.php b/src/Command/RegenerateAppSecretCommand.php new file mode 100644 index 0000000..a23ef37 --- /dev/null +++ b/src/Command/RegenerateAppSecretCommand.php @@ -0,0 +1,29 @@ +success('New APP_SECRET was generated: '.$secret); + + return Command::SUCCESS; + } +} diff --git a/src/Flatastic/Controller/BotController.php b/src/Flatastic/Controller/BotController.php index 7392a71..37e55c8 100644 --- a/src/Flatastic/Controller/BotController.php +++ b/src/Flatastic/Controller/BotController.php @@ -5,14 +5,13 @@ use App\Flatastic\Service\FlatasticApi; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; -class BotController extends AbstractController -{ - #[Route('/bot', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/bot', host:'localhost')] +class BotController extends AbstractController { + #[Route('/bot', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/bot', host: 'localhost')] public function list( Request $request, FlatasticApi $api, @@ -26,4 +25,4 @@ public function list( 'bot' => $bot, ]); } -} \ No newline at end of file +} diff --git a/src/Flatastic/Controller/ChoresController.php b/src/Flatastic/Controller/ChoresController.php index 183c056..51500ba 100644 --- a/src/Flatastic/Controller/ChoresController.php +++ b/src/Flatastic/Controller/ChoresController.php @@ -6,16 +6,14 @@ use App\Flatastic\Service\ImagePainter; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; -class ChoresController extends AbstractController -{ - #[Route('/chores', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/chores', host:'localhost')] +class ChoresController extends AbstractController { + #[Route('/chores', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/chores', host: 'localhost')] public function list( Request $request, FlatasticApi $api, @@ -27,13 +25,13 @@ public function list( $chores = $api->getChores(); return new JsonResponse([ - 'flatmates'=> $flatmates, - 'chores'=> $chores, + 'flatmates' => $flatmates, + 'chores' => $chores, ]); } - #[Route('/chores/table/{frequency}.{format}', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/chores/table/{frequency}.{format}', host:'localhost')] + #[Route('/chores/table/{frequency}.{format}', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/chores/table/{frequency}.{format}', host: 'localhost')] public function table( Request $request, FlatasticApi $api, @@ -44,7 +42,8 @@ public function table( ): Response { $rotation_time = $this->parseFrequency($frequency); $table = $this->getTableForChores( - $request, $api, + $request, + $api, function ($chore) use ($rotation_time) { return $chore['rotationTime'] == $rotation_time; }, diff --git a/src/Flatastic/Controller/FlatController.php b/src/Flatastic/Controller/FlatController.php index bd94e7f..1dced5c 100644 --- a/src/Flatastic/Controller/FlatController.php +++ b/src/Flatastic/Controller/FlatController.php @@ -5,14 +5,13 @@ use App\Flatastic\Service\FlatasticApi; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; -class FlatController extends AbstractController -{ - #[Route('/flat', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/flat', host:'localhost')] +class FlatController extends AbstractController { + #[Route('/flat', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/flat', host: 'localhost')] public function list( Request $request, FlatasticApi $api, @@ -26,4 +25,4 @@ public function list( 'flat' => $flat, ]); } -} \ No newline at end of file +} diff --git a/src/Flatastic/Controller/FlatmatesController.php b/src/Flatastic/Controller/FlatmatesController.php index 2defe09..4e6677c 100644 --- a/src/Flatastic/Controller/FlatmatesController.php +++ b/src/Flatastic/Controller/FlatmatesController.php @@ -5,14 +5,13 @@ use App\Flatastic\Service\FlatasticApi; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; -class FlatmatesController extends AbstractController -{ - #[Route('/flatmates', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/flatmates', host:'localhost')] +class FlatmatesController extends AbstractController { + #[Route('/flatmates', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/flatmates', host: 'localhost')] public function index( Request $request, FlatasticApi $api, diff --git a/src/Flatastic/Controller/IndexController.php b/src/Flatastic/Controller/IndexController.php index 1b3d357..c9fb484 100644 --- a/src/Flatastic/Controller/IndexController.php +++ b/src/Flatastic/Controller/IndexController.php @@ -2,57 +2,54 @@ namespace App\Flatastic\Controller; -use App\Flatastic\Service\FlatasticApi; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -class IndexController extends AbstractController -{ - #[Route('/', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style', host:'localhost')] +class IndexController extends AbstractController { + #[Route('/', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style', host: 'localhost')] public function get( LoggerInterface $logger, ): Response { - $text = <<Hassio: -

configuration.yml

-
-
-        template:
-          - sensor:
-
-            # Flatastic chore stats
-            - name: Flatmate's chore stats
-                state: "{{ state_attr('sensor.flatastic_flatmates', '%%% user-id %%%')['choreStats'] | int }}"
-                unit_of_measurement: "❤️"
-
-        # deprecated, use UI to configure accordingly.
-        camera:
-          - platform: generic
-            name: Chores
-            username: !secret flatastic_username
-            password: !secret flatastic_password
-            auhentication: basic
-            still_image_url: https://flatastic.hatt.style/chores/table/weekly
-            scan_interval: 5
-        
-        # Shout on flatastic
-        rest_command:
-          flatastic_shout:
-            url: "https://flatastic.hatt.style/shouts/create?shout={{ shout | urlencode }}"
-            username: !secret flatastic_username
-            password: !secret flatastic_password
-        
- -

secrets.yml

-
-        username: "%%% USERNAME %%%"
-        password: "%%% PASSWORD %%%"
-        
- ZZZZZZZZZZ; - return new Response("$text"); + $text = <<<'ZZZZZZZZZZ' +

Hassio:

+

configuration.yml

+
+
+            template:
+              - sensor:
+
+                # Flatastic chore stats
+                - name: Flatmate's chore stats
+                    state: "{{ state_attr('sensor.flatastic_flatmates', '%%% user-id %%%')['choreStats'] | int }}"
+                    unit_of_measurement: "❤️"
+
+            # deprecated, use UI to configure accordingly.
+            camera:
+              - platform: generic
+                name: Chores
+                username: !secret flatastic_username
+                password: !secret flatastic_password
+                auhentication: basic
+                still_image_url: https://flatastic.hatt.style/chores/table/weekly
+                scan_interval: 5
+
+            # Shout on flatastic
+            rest_command:
+              flatastic_shout:
+                url: "https://flatastic.hatt.style/shouts/create?shout={{ shout | urlencode }}"
+                username: !secret flatastic_username
+                password: !secret flatastic_password
+            
+ +

secrets.yml

+
+            username: "%%% USERNAME %%%"
+            password: "%%% PASSWORD %%%"
+            
+ ZZZZZZZZZZ; + return new Response("{$text}"); } -} \ No newline at end of file +} diff --git a/src/Flatastic/Controller/ShoppingListController.php b/src/Flatastic/Controller/ShoppingListController.php index e835767..c15e198 100644 --- a/src/Flatastic/Controller/ShoppingListController.php +++ b/src/Flatastic/Controller/ShoppingListController.php @@ -5,14 +5,13 @@ use App\Flatastic\Service\FlatasticApi; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; -class ShoppingListController extends AbstractController -{ - #[Route('/shopping_list', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/shopping_list', host:'localhost')] +class ShoppingListController extends AbstractController { + #[Route('/shopping_list', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/shopping_list', host: 'localhost')] public function list( Request $request, FlatasticApi $api, @@ -28,4 +27,4 @@ public function list( 'shopping_list' => $shopping_list, ]); } -} \ No newline at end of file +} diff --git a/src/Flatastic/Controller/ShoutController.php b/src/Flatastic/Controller/ShoutController.php index 34d64f1..adac4b2 100644 --- a/src/Flatastic/Controller/ShoutController.php +++ b/src/Flatastic/Controller/ShoutController.php @@ -5,14 +5,13 @@ use App\Flatastic\Service\FlatasticApi; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; -class ShoutController extends AbstractController -{ - #[Route('/shouts/create', host:'flatastic.hatt.style')] - #[Route('/flatastic.hatt.style/shouts/create', host:'localhost')] +class ShoutController extends AbstractController { + #[Route('/shouts/create', host: 'flatastic.hatt.style')] + #[Route('/flatastic.hatt.style/shouts/create', host: 'localhost')] public function create( Request $request, FlatasticApi $api, @@ -31,4 +30,4 @@ public function create( 'shout' => $shout, ]); } -} \ No newline at end of file +} diff --git a/src/Flatastic/Service/FlatasticApi.php b/src/Flatastic/Service/FlatasticApi.php index 8009b38..74a95d7 100644 --- a/src/Flatastic/Service/FlatasticApi.php +++ b/src/Flatastic/Service/FlatasticApi.php @@ -10,8 +10,7 @@ class FlatasticApi { private $client; private $authData; - public function __construct(HttpClientInterface $client) - { + public function __construct(HttpClientInterface $client) { $this->client = $client; } @@ -39,7 +38,6 @@ public function getShoutsUrl(): string { return "{$this->baseUrl}/shouts"; } - public function authenticateFromRequest($request) { $basic_username = $request->headers->get('php-auth-user'); $basic_password = $request->headers->get('php-auth-pw'); @@ -122,8 +120,7 @@ public function getChoresStats() { ], ], ); - $chores_stats = $response->toArray() ?? []; - return $chores_stats; + return $response->toArray() ?? []; } public function getShoppingList() { @@ -137,8 +134,7 @@ public function getShoppingList() { ], ], ); - $shopping_list = $response->toArray() ?? []; - return $shopping_list; + return $response->toArray() ?? []; } public function getFlat() { @@ -160,8 +156,7 @@ public function forceGetFlat() { ], ], ); - $flat = $response->toArray() ?? []; - return $flat; + return $response->toArray() ?? []; } public function createShout($text) { @@ -178,7 +173,6 @@ public function createShout($text) { ], ], ); - $shout = $response->toArray() ?? []; - return $shout; + return $response->toArray() ?? []; } -} \ No newline at end of file +} diff --git a/src/Flatastic/Service/ImagePainter.php b/src/Flatastic/Service/ImagePainter.php index 5897d46..02f654f 100644 --- a/src/Flatastic/Service/ImagePainter.php +++ b/src/Flatastic/Service/ImagePainter.php @@ -4,7 +4,8 @@ use Symfony\Component\HttpFoundation\Response; -class InvalidFormatException {} +class InvalidFormatException { +} class ImagePainter { public function getImageResponse($image, $format) { @@ -89,13 +90,17 @@ private function paintPng($image) { private function getPhpFont($font_size) { if ($font_size < 10) { return 1; - } else if ($font_size < 12) { + } + if ($font_size < 12) { return 2; - } else if ($font_size < 14) { + } + if ($font_size < 14) { return 3; - } else if ($font_size < 16) { + } + if ($font_size < 16) { return 4; - } else if ($font_size < 18) { + } + if ($font_size < 18) { return 5; } return 1; @@ -145,7 +150,7 @@ public function planSimpleTable($table_data) { $width += $col_width * $width_per_char + $width_per_column; } $height = count($table_data) * $height_per_row; - + $instructions = []; $y = $y_offset; foreach ($table_data as $row_index => $row) { @@ -169,4 +174,4 @@ public function planSimpleTable($table_data) { 'instructions' => $instructions, ]; } -} \ No newline at end of file +} diff --git a/src/Frame/Controller/IndexController.php b/src/Frame/Controller/IndexController.php index 544d43c..91e2432 100644 --- a/src/Frame/Controller/IndexController.php +++ b/src/Frame/Controller/IndexController.php @@ -9,56 +9,54 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -class IndexController extends AbstractController -{ - public $frame_path = __DIR__.'/../../../public/frame/'; - - #[Route('/', host:'frame.hatt.style')] - #[Route('/frame.hatt.style', host:'localhost')] +class IndexController extends AbstractController { + #[Route('/', host: 'frame.hatt.style')] + #[Route('/frame.hatt.style', host: 'localhost')] public function index( Request $request, LoggerInterface $logger, ): Response { - $query = $request->getPathInfo(); + $href = $this->getHref($request); if (isset($_FILES['picture'])) { $this->setupFilesystem(); $img = new \Imagick(); $img->readImage($_FILES['picture']['tmp_name']); + $img->setImageCompressionQuality(100); $img->resizeImage(800, 480, \Imagick::FILTER_LANCZOS, 1); $hash = hash('sha256', \openssl_random_pseudo_bytes(4)); - $img->writeImage("{$this->frame_path}{$hash}.jpg"); - $img->destroy(); + $img->writeImage("{$this->getFramePath()}{$hash}.jpg"); + $img->destroy(); } $pictures = $this->getPictures(); $pictures_html = ''; foreach ($pictures as $picture) { - $pictures_html .= "
(None)
"; + $pictures_html .= "
(None)
"; } $text = <<frame.hatt.style - {$pictures_html} -
-
-
-
- ZZZZZZZZZZ; - return new Response("$text"); +

frame.hatt.style

+ {$pictures_html} +
+
+
+
+ ZZZZZZZZZZ; + return new Response("{$text}"); } - #[Route('/frame/{picture}.jpg', host:'frame.hatt.style')] - #[Route('/frame.hatt.style/frame/{picture}.jpg', host:'localhost')] + #[Route('/frame/{picture}.jpg', host: 'frame.hatt.style')] + #[Route('/frame.hatt.style/frame/{picture}.jpg', host: 'localhost')] public function specific( Request $request, LoggerInterface $logger, string $picture, ): BinaryFileResponse { $this->setupFilesystem(); - return new BinaryFileResponse("{$this->frame_path}{$picture}.jpg"); + return new BinaryFileResponse("{$this->getFramePath()}{$picture}.jpg"); } - #[Route('/frame.jpg', host:'frame.hatt.style')] - #[Route('/frame.hatt.style/frame.jpg', host:'localhost')] + #[Route('/frame.jpg', host: 'frame.hatt.style')] + #[Route('/frame.hatt.style/frame.jpg', host: 'localhost')] public function random( Request $request, LoggerInterface $logger, @@ -66,17 +64,18 @@ public function random( $pictures = $this->getPictures(); $index = random_int(0, count($pictures) - 1); $picture = $pictures[$index]; - $img = new \Imagick("{$this->frame_path}{$picture}"); + $img = new \Imagick("{$this->getFramePath()}{$picture}"); + $img->setImageCompressionQuality(100); $img->modulateImage(100.0, 150.0, 100.0); $blob = $img->getImageBlob(); - $img->destroy(); + $img->destroy(); return new Response($blob, 200, ['Content-Type' => 'image/jpeg']); } /** @return array */ protected function getPictures(): array { $this->setupFilesystem(); - $entries = scandir($this->frame_path); + $entries = scandir($this->getFramePath()); $pictures = []; foreach ($entries as $entry) { if (substr($entry, 0, 1) !== '.') { @@ -87,8 +86,18 @@ protected function getPictures(): array { } protected function setupFilesystem(): void { - if (!is_dir($this->frame_path)) { - mkdir($this->frame_path); + if (!is_dir($this->getFramePath())) { + mkdir($this->getFramePath()); } } -} \ No newline at end of file + + protected function getFramePath(): string { + $private_path = $_ENV['PRIVATE_PATH']; + return __DIR__."/../../../{$private_path}frame/"; + } + + protected function getHref(Request $request): string { + preg_match('/(.*)\/?/', $request->getPathInfo(), $matches); + return $matches[1]; + } +} diff --git a/src/HattStyle/Controller/IndexController.php b/src/HattStyle/Controller/IndexController.php index b1058d9..bf602a1 100644 --- a/src/HattStyle/Controller/IndexController.php +++ b/src/HattStyle/Controller/IndexController.php @@ -8,17 +8,16 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -class IndexController extends AbstractController -{ - #[Route('/', host:'hatt.style')] - #[Route('/hatt.style', host:'localhost')] +class IndexController extends AbstractController { + #[Route('/', host: 'hatt.style')] + #[Route('/hatt.style', host: 'localhost')] public function index( Request $request, LoggerInterface $logger, ): Response { - $text = <<hatt.style - ZZZZZZZZZZ; - return new Response("$text"); + $text = <<<'ZZZZZZZZZZ' +

hatt.style

+ ZZZZZZZZZZ; + return new Response("{$text}"); } -} \ No newline at end of file +} diff --git a/src/Kernel.php b/src/Kernel.php index 779cd1f..80d04e8 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -5,7 +5,6 @@ use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -class Kernel extends BaseKernel -{ +class Kernel extends BaseKernel { use MicroKernelTrait; } diff --git a/symfony.lock b/symfony.lock index 1caca3a..12ef26a 100644 --- a/symfony.lock +++ b/symfony.lock @@ -2,6 +2,18 @@ "allestuetsmerweh/php-deploy": { "version": "1.0.5" }, + "friendsofphp/php-cs-fixer": { + "version": "3.65", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.0", + "ref": "be2103eb4a20942e28a6dd87736669b757132435" + }, + "files": [ + ".php-cs-fixer.dist.php" + ] + }, "league/flysystem": { "version": "2.4.5" },