Skip to content

Commit

Permalink
Fixinf formatting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fizk committed Jun 26, 2024
1 parent 596e01d commit e2b9e08
Show file tree
Hide file tree
Showing 159 changed files with 453 additions and 325 deletions.
28 changes: 20 additions & 8 deletions config/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
->setCommitteeService($container->get(Service\Committee::class));
},
Controller\CommitteeDocumentController::class => function (ContainerInterface $container) {
return (new Controller\CommitteeDocumentController)
return (new Controller\CommitteeDocumentController())
->setCommitteeDocumentService($container->get(Service\CommitteeDocument::class))
->setRouter($container->get(RouteInterface::class))
;
Expand Down Expand Up @@ -518,7 +518,8 @@
[
PDO::MYSQL_ATTR_INIT_COMMAND =>
"SET NAMES 'utf8', " .
"sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';",
"sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO," .
"NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';",
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
]
Expand All @@ -541,23 +542,35 @@
});

$provider->subscribeTo(AddEvent::class, function (AddEvent $event) use ($logger, $container) {
$result = (new Add($container->get(MessageBrokerInterface::class), strtolower(getenv('QUEUE_FORCED')) === 'true'))(
(new Add(
$container->get(MessageBrokerInterface::class),
strtolower(getenv('QUEUE_FORCED')) === 'true'
)
)(
$event->getPresenter(),
$event->getParams()
);
$logger->debug((string) $event);
});

$provider->subscribeTo(UpdateEvent::class, function (UpdateEvent $event) use ($logger, $container) {
$result = (new Update($container->get(MessageBrokerInterface::class), strtolower(getenv('QUEUE_FORCED')) === 'true'))(
(new Update(
$container->get(MessageBrokerInterface::class),
strtolower(getenv('QUEUE_FORCED')) === 'true'
)
)(
$event->getPresenter(),
$event->getParams()
);
$logger->debug((string) $event);
});

$provider->subscribeTo(DeleteEvent::class, function (DeleteEvent $event) use ($logger, $container) {
$result = (new Delete($container->get(MessageBrokerInterface::class), strtolower(getenv('QUEUE_FORCED')) === 'true'))(
(new Delete(
$container->get(MessageBrokerInterface::class),
strtolower(getenv('QUEUE_FORCED')) === 'true'
)
)(
$event->getPresenter(),
$event->getParams()
);
Expand All @@ -570,12 +583,11 @@
Psr\Log\LoggerInterface::class => function (ContainerInterface $container) {
return (new Logger('source'))
->pushHandler((new StreamHandler('php://stdout', Logger::DEBUG))
->setFormatter(new LineFormatter("[%datetime%] %level_name% %message%\n"))
);
->setFormatter(new LineFormatter("[%datetime%] %level_name% %message%\n")));
},

MessageBrokerInterface::class => function (ContainerInterface $container) {
switch(strtolower(getenv('BROKER'))) {
switch (strtolower(getenv('BROKER'))) {
case 'kafka':
return new KafkaMessageBroker(
$container->get(KafkaProducer::class)
Expand Down
1 change: 1 addition & 0 deletions src/Controller/AssemblyCommitteeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AssemblyCommitteeController implements
ServiceCommitteeAwareInterface
{
use RestControllerTrait;

private Committee $committeeService;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Controller/AssemblyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class AssemblyController implements
ServiceAssemblyAwareInterface
{
use RestControllerTrait;

private Assembly $assemblyService;

/**
Expand Down Expand Up @@ -59,7 +60,7 @@ public function getList(ServerRequest $request): ResponseInterface
public function optionsList(ServerRequest $request): ResponseInterface
{
return new EmptyResponse(200, [
'Allow' =>'GET, OPTIONS'
'Allow' => 'GET, OPTIONS'
]);
}

Expand Down
1 change: 1 addition & 0 deletions src/Controller/CabinetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CabinetController implements
ServiceAssemblyAwareInterface
{
use RestControllerTrait;

private Cabinet $cabinetService;
private Assembly $assemblyService;

Expand Down
1 change: 1 addition & 0 deletions src/Controller/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CategoryController implements
ServiceCategoryAwareInterface
{
use RestControllerTrait;

private Service\Category $categoryService;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexController
{
use EventService;

private Assembly $assemblyService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerAssemblyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerAssemblyController implements ServiceAssemblyAwareInterface, EventsAwareInterface
{
use EventService;

private Assembly $assemblyService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerCabinetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCabinetController implements ServiceCabinetAwareInterface, EventsAwareInterface
{
use EventService;

private Cabinet $cabinetService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerCategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCategoryController implements
Expand All @@ -24,6 +23,7 @@ class IndexerCategoryController implements
EventsAwareInterface
{
use EventService;

private Category $categoryService;
private SuperCategory $superCategory;

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerCommitteeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCommitteeController implements ServiceCommitteeAwareInterface, EventsAwareInterface
{
use EventService;

private Committee $committeeService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
14 changes: 8 additions & 6 deletions src/Controller/Cli/IndexerCommitteeDocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCommitteeDocumentController implements ServiceCommitteeDocumentAwareInterface, EventsAwareInterface
{
use EventService;

private CommitteeDocument $serviceCommitteeDocument;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand All @@ -29,11 +29,13 @@ public function handle(ServerRequestInterface $request): ResponseInterface
$documentId = $request->getAttribute('document_id', null);

/** @var \Althingi\Model\CommitteeDocument $model */
foreach ($this->serviceCommitteeDocument->fetchAllGenerator(
$congressmanId,
$assemblyId,
$documentId
) as $model) {
foreach (
$this->serviceCommitteeDocument->fetchAllGenerator(
$congressmanId,
$assemblyId,
$documentId
) as $model
) {
$this->getEventDispatcher()->dispatch(
new AddEvent(new IndexableCommitteeDocumentPresenter($model), ['rows' => 1]),
);
Expand Down
14 changes: 8 additions & 6 deletions src/Controller/Cli/IndexerCommitteeSittingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCommitteeSittingController implements ServiceCommitteeSittingAwareInterface, EventsAwareInterface
{
use EventService;

private CommitteeSitting $committeeSittingService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand All @@ -29,11 +29,13 @@ public function handle(ServerRequestInterface $request): ResponseInterface
$committeeId = $request->getAttribute('committee_id', null);

/** @var \Althingi\Model\CommitteeSitting $model */
foreach ($this->committeeSittingService->fetchAllGenerator(
$assemblyId,
$congressmanId,
$committeeId
) as $model) {
foreach (
$this->committeeSittingService->fetchAllGenerator(
$assemblyId,
$congressmanId,
$committeeId
) as $model
) {
$this->getEventDispatcher()->dispatch(
new AddEvent(new IndexableCommitteeSittingPresenter($model), ['rows' => 1]),
);
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerCongressmanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCongressmanController implements ServiceCongressmanAwareInterface, EventsAwareInterface
{
use EventService;

private Congressman $congressman;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerCongressmanDocumentController implements ServiceCongressmanDocumentAwareInterface, EventsAwareInterface
{
use EventService;

private CongressmanDocument $congressmanDocument;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerConstituencyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerConstituencyController implements ServiceConstituencyAwareInterface, EventsAwareInterface
{
use EventService;

private Constituency $constituencyService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerDocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;
use Althingi\Service\Document;

class IndexerDocumentController implements ServiceDocumentAwareInterface, EventsAwareInterface
{
use EventService;

private Document $documentService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerDocumentVoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;
use Althingi\Service\Vote;

class IndexerDocumentVoteController implements ServiceVoteAwareInterface, EventsAwareInterface
{
use EventService;

private Vote $voteService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerDocumentVoteItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;
use Althingi\Service\VoteItem;

class IndexerDocumentVoteItemController implements ServiceVoteItemAwareInterface, EventsAwareInterface
{
use EventService;

private VoteItem $voteItemService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerInflationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerInflationController implements ServiceInflationAwareInterface, EventsAwareInterface
{
use EventService;

private Inflation $inflationService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerIssueCategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;
use Althingi\Service\IssueCategory;

class IndexerIssueCategoryController implements ServiceIssueCategoryAwareInterface, EventsAwareInterface
{
use EventService;

private IssueCategory $issueCategoryService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerIssueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerIssueController implements ServiceIssueAwareInterface, EventsAwareInterface
{
use EventService;

private Issue $issueService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Cli/IndexerMinisterSittingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
ServerRequestInterface,
ResponseInterface
};

use Althingi\Service\EventService;

class IndexerMinisterSittingController implements ServiceMinisterSittingAwareInterface, EventsAwareInterface
{
use EventService;

private MinisterSitting $ministerSittingService;

public function handle(ServerRequestInterface $request): ResponseInterface
Expand Down
Loading

0 comments on commit e2b9e08

Please sign in to comment.