Skip to content

Commit 75fc792

Browse files
authored
Merge pull request #5 from PackageFactory/release-1.0
Release 1.0
2 parents ac2c1ab + e767782 commit 75fc792

95 files changed

Lines changed: 6309 additions & 239 deletions

File tree

Some content is hidden

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

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{yaml,yml}]
12+
indent_size = 2
13+
14+
[{package.json,.babelrc,.eslintrc,.stylelintrc}]
15+
indent_size = 2
16+
17+
[*.{css,js,ts}]
18+
indent_style = tab
19+
20+
[Makefile]
21+
indent_style = tab
22+
23+
[*.makefile]
24+
indent_style = tab
25+
26+
[*.md]
27+
trim_trailing_whitespace = false

.github/workflows/qa.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
coding-standard:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
12+
- name: Setup PHP
13+
uses: shivammathur/setup-php@v2
14+
with:
15+
php-version: '7.4'
16+
extensions: mbstring, intl
17+
tools: phpcs
18+
19+
- name: Run PHP Code Sniffer
20+
run: |
21+
phpcs \
22+
--standard=PSR2 \
23+
--extensions=php \
24+
--exclude=Generic.Files.LineLength \
25+
Classes/ Tests/
26+
27+
static-analysis:
28+
runs-on: ubuntu-20.04
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
33+
- name: Setup PHP
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: '7.4'
37+
extensions: mbstring, intl
38+
39+
- name: Get composer cache directory
40+
id: composercache
41+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
43+
- name: Cache dependencies
44+
uses: actions/cache@v2
45+
with:
46+
path: ${{ steps.composercache.outputs.dir }}
47+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
48+
restore-keys: ${{ runner.os }}-composer-
49+
50+
- name: Install composer dependencies
51+
run: |
52+
composer install
53+
54+
- name: Run phpstan on Tests/
55+
run: |
56+
bin/phpstan analyse \
57+
--autoload-file Build/BuildEssentials/PhpUnit/UnitTestBootstrap.php \
58+
--level 8 \
59+
Tests/Unit
60+
61+
- name: Run phpstan on Classes/
62+
run: |
63+
bin/phpstan analyse --level 8 Classes
64+
65+
unit-tests:
66+
runs-on: ubuntu-20.04
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v2
70+
71+
- name: Setup PHP
72+
uses: shivammathur/setup-php@v2
73+
with:
74+
php-version: '7.4'
75+
extensions: mbstring, intl
76+
coverage: xdebug
77+
78+
- name: Get composer cache directory
79+
id: composercache
80+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
81+
82+
- name: Cache dependencies
83+
uses: actions/cache@v2
84+
with:
85+
path: ${{ steps.composercache.outputs.dir }}
86+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
87+
restore-keys: ${{ runner.os }}-composer-
88+
89+
- name: Install composer dependencies
90+
run: |
91+
composer install
92+
93+
- name: Run unit tests
94+
run: |
95+
bin/phpunit -c phpunit.xml \
96+
--enforce-time-limit \
97+
--coverage-text \
98+
Tests

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bin/
2+
Build/
3+
Packages/
4+
Web/
5+
Data/
6+
vendor/
7+
composer.lock
8+
.phpunit.result.cache
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php declare(strict_types=1);
2+
namespace PackageFactory\AtomicFusion\PresentationObjects\Command;
3+
4+
/*
5+
* This file is part of the PackageFactory.AtomicFusion.PresentationObjects package
6+
*/
7+
8+
use Neos\Flow\Annotations as Flow;
9+
use Neos\Flow\Cli\CommandController;
10+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentGenerator;
11+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Value\ValueGenerator;
12+
13+
/**
14+
* The command controller for kickstarting PresentationObject components
15+
*/
16+
class ComponentCommandController extends CommandController
17+
{
18+
/**
19+
* @Flow\Inject
20+
* @var ComponentGenerator
21+
*/
22+
protected $componentGenerator;
23+
24+
/**
25+
* @Flow\Inject
26+
* @var ValueGenerator
27+
*/
28+
protected $valueGenerator;
29+
30+
/**
31+
* Create a new PresentationObject component and factory
32+
*
33+
* This command will create an <b>interface</b>, a <b>value object</b> and a
34+
* <b>factory</b> under in the chosen component namespace. It'll also register
35+
* the factory for later use in Fusion.
36+
*
37+
* The remaining arguments of this command are interpreted as a list of
38+
* <b>property descriptors</b> which consist of a property name and a type name
39+
* separated by a colon (e.g.: "title:string").
40+
*
41+
* The following values are allowed for types:
42+
*
43+
* * string, int, float, bool
44+
* * Value class names created with <u>component:kickstartvalue</u> in the same
45+
* component namespace
46+
* * Component class names created with <u>component:kickstart</u> in the same
47+
* package
48+
* * ImageSource
49+
* * Uri
50+
*
51+
* @param string $name The name of the new component
52+
* @param null|string $packageKey Package key of an optional target package, if not set the configured default package or the first available site package will be used
53+
* @return void
54+
*/
55+
public function kickStartCommand(string $name, ?string $packageKey = null): void
56+
{
57+
$this->componentGenerator->generateComponent($name, $this->request->getExceedingArguments(), $packageKey);
58+
}
59+
60+
/**
61+
* Create a new pseudo-enum value object
62+
*
63+
* This command will create a <b>value object</b> for a pseudo-enum under in the
64+
* chosen component namespace and under the provided name. It'll also create a
65+
* co-located <b>exception</b> class that will be used when validation for the
66+
* pseudo-enum fails.
67+
*
68+
* Additionally, a <b>datasource</b> for use in SelectBoxEditors will be created
69+
* in the Application namespace of your chosen package.
70+
*
71+
* @param string $componentName The name of the component the new pseudo-enum belongs to
72+
* @param string $name The name of the new pseudo-enum
73+
* @param string $type The type of the new pseudo-enum (must be one of: "string", "int")
74+
* @param array|string[] $values A comma-separated list of values for the new pseudo-enum
75+
* @param null|string $packageKey Package key of an optional target package, if not set the configured default package or the first available site package will be used
76+
* @return void
77+
*/
78+
public function kickStartValueCommand(string $componentName, string $name, string $type, array $values = [], ?string $packageKey = null): void
79+
{
80+
$this->valueGenerator->generateValue($componentName, $name, $type, $values, $packageKey);
81+
}
82+
}

0 commit comments

Comments
 (0)