-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from sitegeist/task/refactorForLessAssumptions
TASK: Refactor for fewer assumptions
- Loading branch information
Showing
49 changed files
with
1,678 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
test: | ||
name: "Test (PHP ${{ matrix.php-versions }}, Flow ${{ matrix.flow-versions }})" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-versions: ["8.2"] | ||
flow-versions: ["8.3"] | ||
include: | ||
- php-versions: '8.3' | ||
flow-versions: '8.3' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ${{ env.FLOW_FOLDER }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite | ||
ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on | ||
|
||
- name: Set Neos Version | ||
run: composer require neos/flow ^${{ matrix.flow-versions }} --no-progress --no-interaction | ||
|
||
- name: Run Linter | ||
run: composer lint | ||
|
||
- name: Run Test | ||
run: composer test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sitegeist\SchemeOnYou\Command; | ||
|
||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Flow\Cli\CommandController; | ||
use Sitegeist\SchemeOnYou\Domain\OpenApiDocumentRepository; | ||
|
||
#[Flow\Scope('singleton')] | ||
final class OpenApiDocumentCommandController extends CommandController | ||
{ | ||
#[Flow\Inject] | ||
protected OpenApiDocumentRepository $documentRepository; | ||
|
||
/** | ||
* @param string $name the name of the api document to render | ||
*/ | ||
public function renderCommand(string $name): void | ||
{ | ||
$schema = $this->documentRepository->findDocumentByName($name); | ||
$this->output->output( | ||
\json_encode( | ||
$schema, | ||
JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | ||
) . PHP_EOL | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sitegeist\SchemeOnYou\Controller; | ||
|
||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Flow\Mvc\Controller\ActionController; | ||
use Neos\Flow\Mvc\View\JsonView; | ||
use Sitegeist\SchemeOnYou\Domain\OpenApiDocumentRepository; | ||
|
||
class OpenApiDocumentController extends ActionController | ||
{ | ||
protected $defaultViewObjectName = JsonView::class; | ||
|
||
#[Flow\Inject] | ||
protected OpenApiDocumentRepository $documentRepository; | ||
|
||
public function renderAction(string $name): string | ||
{ | ||
$schema = $this->documentRepository->findDocumentByName($name); | ||
$this->response->setContentType('application\json'); | ||
$this->response->addHttpHeader('Access-Control-Allow-Origin', '*'); | ||
return \json_encode( | ||
$schema, | ||
JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.