Skip to content

Commit 36986dc

Browse files
authored
Merge pull request #20 from flownative/task/cleanup
Modernize codebase, update CLI help
2 parents 8bf8761 + ba3bf1a commit 36986dc

File tree

6 files changed

+93
-250
lines changed

6 files changed

+93
-250
lines changed

Classes/Command/TradosCommandController.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flownative\Neos\Trados\Command;
35

46
/*
@@ -23,7 +25,6 @@
2325
*/
2426
class TradosCommandController extends CommandController
2527
{
26-
2728
/**
2829
* @Flow\Inject
2930
* @var ExportService
@@ -37,21 +38,21 @@ class TradosCommandController extends CommandController
3738
protected $importService;
3839

3940
/**
40-
* Export sites content (e.g. trados:export --filename "acme.com.xml" --source-language "en" --target-language "cz")
41+
* Export sites content (e.g. trados:export --filename acme.com.xml --target-language cz amecom en)
4142
*
4243
* This command exports a specific site including all content into an XML format.
4344
*
4445
* @param string $startingPoint The node with which to start the export: as identifier or the path relative to the site node.
4546
* @param string $sourceLanguage The language to use as base for the export.
4647
* @param string|null $targetLanguage The target language for the translation, optional.
4748
* @param string|null $filename Path and filename to the XML file to create.
48-
* @param string|null $modifiedAfter
49-
* @param boolean $ignoreHidden
50-
* @param boolean $excludeChildDocuments
49+
* @param string|null $modifiedAfter A date/time to filter for nodes by modification time; anything PHP can parse in the DateTime constructor.
50+
* @param bool $ignoreHidden If set to false, hidden nodes will be exported, too.
51+
* @param bool $excludeChildDocuments If set to true, child documents will not be exported; use to export a single document's content.
5152
* @return void
5253
* @throws \Exception
5354
*/
54-
public function exportCommand(string $startingPoint, string $sourceLanguage, string $targetLanguage = null, string $filename = null, string $modifiedAfter = null, bool $ignoreHidden = true, bool $excludeChildDocuments = false)
55+
public function exportCommand(string $startingPoint, string $sourceLanguage, string $targetLanguage = null, string $filename = null, string $modifiedAfter = null, bool $ignoreHidden = true, bool $excludeChildDocuments = false): void
5556
{
5657
if ($modifiedAfter !== null) {
5758
$modifiedAfter = new \DateTime($modifiedAfter);
@@ -81,7 +82,7 @@ public function exportCommand(string $startingPoint, string $sourceLanguage, str
8182
* @param string|null $targetLanguage The target language for the translation, optional if included in XML.
8283
* @param string $workspace A workspace to import into, optional but recommended
8384
*/
84-
public function importCommand(string $filename, string $targetLanguage = null, string $workspace = 'live')
85+
public function importCommand(string $filename, string $targetLanguage = null, string $workspace = 'live'): void
8586
{
8687
try {
8788
$importedLanguage = $this->importService->importFromFile($filename, $workspace, $targetLanguage);

Classes/Service/AbstractService.php

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flownative\Neos\Trados\Service;
35

46
/*
@@ -11,14 +13,15 @@
1113
* source code.
1214
*/
1315

16+
use Neos\ContentRepository\Domain\Repository\WorkspaceRepository;
1417
use Neos\Flow\Annotations as Flow;
18+
use Neos\Flow\Security\Context as SecurityContext;
19+
use Neos\Neos\Domain\Repository\SiteRepository;
20+
use Neos\Neos\Domain\Service\ContentContextFactory;
1521

1622
class AbstractService
1723
{
18-
/**
19-
* @var string
20-
*/
21-
const SUPPORTED_FORMAT_VERSION = '1.0';
24+
protected const SUPPORTED_FORMAT_VERSION = '1.0';
2225

2326
/**
2427
* @Flow\InjectConfiguration(path = "languageDimension")
@@ -28,25 +31,25 @@ class AbstractService
2831

2932
/**
3033
* @Flow\Inject
31-
* @var \Neos\Neos\Domain\Service\ContentContextFactory
34+
* @var ContentContextFactory
3235
*/
3336
protected $contentContextFactory;
3437

3538
/**
3639
* @Flow\Inject
37-
* @var \Neos\Flow\Security\Context
40+
* @var SecurityContext
3841
*/
3942
protected $securityContext;
4043

4144
/**
4245
* @Flow\Inject
43-
* @var \Neos\Neos\Domain\Repository\SiteRepository
46+
* @var SiteRepository
4447
*/
4548
protected $siteRepository;
4649

4750
/**
4851
* @Flow\Inject
49-
* @var \Neos\ContentRepository\Domain\Repository\WorkspaceRepository
52+
* @var WorkspaceRepository
5053
*/
5154
protected $workspaceRepository;
5255
}

0 commit comments

Comments
 (0)