-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81813f6
commit 5145fa1
Showing
10 changed files
with
364 additions
and
9 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 @@ | ||
label: Bootstrap Package |
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 @@ | ||
label: Fluid Styled Content |
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,67 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the package t3o/get.typo3.org. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace App\Command; | ||
|
||
use App\Entity\Sitepackage\BasePackageVersion; | ||
use App\Service\SitepackageBaseService; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Helper\Table; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class BasePackagesCommand extends Command | ||
{ | ||
protected static $defaultName = 'app:sitepackagegenerator:basepackage-list'; | ||
|
||
public function __construct(private readonly SitepackageBaseService $sitepackageBaseService) | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
$this->setDescription('Display all available BasePackages.'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$packages = $this->sitepackageBaseService->getPackages(); | ||
|
||
$rows = []; | ||
foreach ($packages as $package) { | ||
$rows[] = [ | ||
$package->getIdentifier(), | ||
$package->getLabel(), | ||
implode(', ', array_map(static fn(BasePackageVersion $version): float => $version->getVersion(), $package->getVersions()->toArray())), | ||
]; | ||
} | ||
|
||
$table = new Table($output); | ||
$table->setHeaders(['Identifier', 'Label', 'Versions']); | ||
$table->setRows($rows); | ||
$table->render(); | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
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,93 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the package t3o/get.typo3.org. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace App\Entity\Sitepackage; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Criteria; | ||
|
||
class BasePackage | ||
{ | ||
protected string $identifier; | ||
protected string $label; | ||
|
||
/** | ||
* @var ArrayCollection<int, BasePackageVersion> | ||
*/ | ||
protected ArrayCollection $versions; | ||
|
||
public function __construct() | ||
{ | ||
$this->versions = new ArrayCollection(); | ||
} | ||
|
||
public function getIdentifier(): string | ||
{ | ||
return $this->identifier; | ||
} | ||
|
||
public function setIdentifier(string $identifier): self | ||
{ | ||
$this->identifier = $identifier; | ||
|
||
return $this; | ||
} | ||
|
||
public function getLabel(): string | ||
{ | ||
return $this->label; | ||
} | ||
|
||
public function setLabel(string $label): self | ||
{ | ||
$this->label = $label; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return ArrayCollection<int, BasePackageVersion> | ||
*/ | ||
public function getVersions(): ArrayCollection | ||
{ | ||
return $this->versions->matching(new Criteria(null, ['version' => Criteria::DESC])); | ||
} | ||
|
||
public function addVersion(BasePackageVersion $version): self | ||
{ | ||
if (!$this->versions->contains($version)) { | ||
$this->versions[] = $version; | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
public function removeVersion(BasePackageVersion $version): static | ||
{ | ||
if ($this->versions->contains($version)) { | ||
$this->versions->removeElement($version); | ||
} | ||
|
||
return $this; | ||
} | ||
} |
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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the package t3o/get.typo3.org. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace App\Entity\Sitepackage; | ||
|
||
class BasePackageVersion | ||
{ | ||
protected float $version; | ||
|
||
public function getVersion(): float | ||
{ | ||
return $this->version; | ||
} | ||
|
||
public function setVersion(float $version): self | ||
{ | ||
$this->version = $version; | ||
|
||
return $this; | ||
} | ||
} |
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.