Skip to content

Commit

Permalink
IBX-2306: Dropped useless code (#102)
Browse files Browse the repository at this point in the history
* Dropped ContentTypeController

* Dropped run export action
  • Loading branch information
ciastektk authored Feb 15, 2022
1 parent aaef250 commit a94d9c5
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 462 deletions.
65 changes: 0 additions & 65 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,6 @@ parameters:
count: 1
path: src/bundle/Controller/ContentController.php

-
message: "#^Method EzSystems\\\\EzRecommendationClientBundle\\\\Controller\\\\ContentTypeController\\:\\:prepareContentByContentTypeIds\\(\\) has parameter \\$contentTypeIds with no value type specified in iterable type array\\.$#"
count: 1
path: src/bundle/Controller/ContentTypeController.php

-
message: "#^Method EzSystems\\\\EzRecommendationClientBundle\\\\Controller\\\\ContentTypeController\\:\\:prepareContentByContentTypeIds\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/bundle/Controller/ContentTypeController.php

-
message: "#^Property EzSystems\\\\EzRecommendationClientBundle\\\\Controller\\\\ContentTypeController\\:\\:\\$locationService \\(eZ\\\\Publish\\\\Core\\\\Repository\\\\LocationService\\) does not accept eZ\\\\Publish\\\\API\\\\Repository\\\\LocationService\\.$#"
count: 1
path: src/bundle/Controller/ContentTypeController.php

-
message: "#^Property EzSystems\\\\EzRecommendationClientBundle\\\\Controller\\\\ContentTypeController\\:\\:\\$searchService \\(eZ\\\\Publish\\\\Core\\\\Repository\\\\SearchService\\) does not accept eZ\\\\Publish\\\\API\\\\Repository\\\\SearchService\\.$#"
count: 1
path: src/bundle/Controller/ContentTypeController.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\SPI\\\\Content\\:\\:\\$fields \\(array\\<string\\>\\) does not accept bool\\|float\\|int\\|string\\|null\\.$#"
count: 1
path: src/bundle/Controller/ContentTypeController.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\SPI\\\\Content\\:\\:\\$lang \\(string\\|null\\) does not accept bool\\|float\\|int\\|string\\|null\\.$#"
count: 1
path: src/bundle/Controller/ContentTypeController.php

-
message: "#^Call to an undefined method EzSystems\\\\EzRecommendationClient\\\\Authentication\\\\AuthenticatorInterface\\:\\:authenticateByFile\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -840,36 +810,6 @@ parameters:
count: 1
path: src/lib/Helper/SiteAccessHelper.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\SPI\\\\Content\\:\\:\\$fields \\(array\\<string\\>\\) does not accept string\\|null\\.$#"
count: 1
path: src/lib/Mapper/ExportRequestMapper.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\Value\\\\ExportParameters\\:\\:\\$customerId \\(int\\) does not accept string\\|null\\.$#"
count: 1
path: src/lib/Mapper/ExportRequestMapper.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\Value\\\\ExportParameters\\:\\:\\$hidden \\(string\\|null\\) does not accept int\\.$#"
count: 1
path: src/lib/Mapper/ExportRequestMapper.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\Value\\\\ExportParameters\\:\\:\\$languages \\(array\\<string\\>\\) does not accept string\\.$#"
count: 1
path: src/lib/Mapper/ExportRequestMapper.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\Value\\\\ExportParameters\\:\\:\\$licenseKey \\(string\\) does not accept string\\|null\\.$#"
count: 1
path: src/lib/Mapper/ExportRequestMapper.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\Value\\\\ExportParameters\\:\\:\\$webHook \\(string\\) does not accept string\\|null\\.$#"
count: 1
path: src/lib/Mapper/ExportRequestMapper.php

-
message: "#^Method EzSystems\\\\EzRecommendationClient\\\\Mapper\\\\RelationMapper\\:\\:__construct\\(\\) has parameter \\$fieldMappings with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -1220,11 +1160,6 @@ parameters:
count: 1
path: src/lib/Value/ContentDataVisitor.php

-
message: "#^Method EzSystems\\\\EzRecommendationClient\\\\Value\\\\ExportRequest\\:\\:getExportRequestParameters\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Value/ExportRequest.php

-
message: "#^Property EzSystems\\\\EzRecommendationClient\\\\Value\\\\IdList\\:\\:\\$list type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
152 changes: 0 additions & 152 deletions src/bundle/Controller/ContentTypeController.php

This file was deleted.

44 changes: 1 addition & 43 deletions src/bundle/Controller/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@

use EzSystems\EzPlatformRest\Server\Controller;
use EzSystems\EzRecommendationClient\Authentication\AuthenticatorInterface;
use EzSystems\EzRecommendationClient\Exception\ExportInProgressException;
use EzSystems\EzRecommendationClient\File\FileManagerInterface;
use EzSystems\EzRecommendationClient\Helper\ExportProcessRunnerHelper;
use EzSystems\EzRecommendationClient\Value\ExportRequest;
use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

final class ExportController extends Controller
Expand All @@ -27,22 +21,12 @@ final class ExportController extends Controller
/** @var \EzSystems\EzRecommendationClient\File\FileManagerInterface */
private $fileManager;

/** @var \EzSystems\EzRecommendationClient\Helper\ExportProcessRunnerHelper */
private $exportProcessRunner;

/** @var \Psr\Log\LoggerInterface */
private $logger;

public function __construct(
AuthenticatorInterface $authenticator,
FileManagerInterface $fileManager,
ExportProcessRunnerHelper $exportProcessRunner,
LoggerInterface $logger
FileManagerInterface $fileManager
) {
$this->authenticator = $authenticator;
$this->fileManager = $fileManager;
$this->exportProcessRunner = $exportProcessRunner;
$this->logger = $logger;
}

/**
Expand All @@ -66,30 +50,4 @@ public function downloadAction(string $filePath): Response

return $response;
}

/**
* @ParamConverter("export_request_converter")
*
* @throws \EzSystems\EzRecommendationClient\Exception\ExportInProgressException
*/
public function exportAction(ExportRequest $request): JsonResponse
{
$response = new JsonResponse();

if (!$this->authenticator->authenticate()) {
return $response->setStatusCode(Response::HTTP_UNAUTHORIZED);
}

if ($this->fileManager->isLocked()) {
$this->logger->warning('Export is running.');
throw new ExportInProgressException('Export is running');
}

$this->exportProcessRunner->run($request->getExportRequestParameters());

return $response->setData([sprintf(
'Export started at %s',
date('Y-m-d H:i:s')
)]);
}
}
54 changes: 0 additions & 54 deletions src/bundle/ParamConverter/ExportRequestParamConverter.php

This file was deleted.

13 changes: 0 additions & 13 deletions src/bundle/Resources/config/routing_rest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@ ez_recommendation.content_type.get_content:
_controller: 'EzSystems\EzRecommendationClientBundle\Controller\ContentController::getContentAction'
methods: [GET]

ez_recommendation.content_type.get_content_type:
path: /ez_recommendation/v1/contenttypes/{idList}
defaults:
_controller: 'EzSystems\EzRecommendationClientBundle\Controller\ContentTypeController::getContentTypeAction'
methods: [GET]

ez_recommendation.export.download:
path: /ez_recommendation/v1/exportDownload/{filePath}
defaults:
_controller: 'EzSystems\EzRecommendationClientBundle\Controller\ExportController::downloadAction'
requirements:
filePath: '[a-zA-Z0-9\_\-\/]+'

ez_recommendation.export.export:
path: /ez_recommendation/v1/runExport/{idList}
defaults:
_controller: 'EzSystems\EzRecommendationClientBundle\Controller\ExportController::exportAction'
methods: [GET]
prefix: '%ezpublish_rest.path_prefix%'
4 changes: 0 additions & 4 deletions src/bundle/Resources/config/services/controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ services:
arguments:
$authenticator: '@EzSystems\EzRecommendationClient\Authentication\ExportAuthenticator'

EzSystems\EzRecommendationClientBundle\Controller\ContentTypeController:
arguments:
$authenticator: '@EzSystems\EzRecommendationClient\Authentication\ExportAuthenticator'

EzSystems\EzRecommendationClientBundle\Controller\ExportController:
arguments:
$authenticator: '@EzSystems\EzRecommendationClient\Authentication\ExportAuthenticator'
Expand Down
Loading

0 comments on commit a94d9c5

Please sign in to comment.