Reduced complexity of constructor

This commit is contained in:
Kevin Frantz 2019-02-13 15:29:29 +01:00
parent 0ab4cee064
commit 54b0d98ef3
9 changed files with 22 additions and 23 deletions

View File

@ -391,7 +391,7 @@
</symbol>
</g>
</defs>
<g id="surface24365">
<g id="surface32884">
<rect x="0" y="0" width="1931" height="1702" style="fill:rgb(100%,100%,100%);fill-opacity:1;stroke:none;"/>
<path style="fill-rule:evenodd;fill:rgb(11.764706%,56.470591%,100%);fill-opacity:1;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 5.195272 -0.106433 L 80.888241 -0.106433 L 80.888241 71.575598 L 5.195272 71.575598 Z M 5.195272 -0.106433 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style="fill-rule:evenodd;fill:rgb(11.764706%,56.470591%,100%);fill-opacity:1;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 5.195272 -1.106433 L 7.705233 -1.106433 L 7.705233 -0.106433 L 5.195272 -0.106433 Z M 5.195272 -1.106433 " transform="matrix(20,0,0,20,311.868,269.156)"/>
@ -2068,10 +2068,10 @@
<path style="fill:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 28.108944 34.31095 L 22.281795 34.31095 L 22.281795 53.407044 L 26.754061 53.407044 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 761.503906 1143.136719 L 761.503906 1135.136719 L 769.503906 1139.136719 Z M 761.503906 1143.136719 "/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-24" x="862.351562" y="952.181749"/>
<use xlink:href="#glyph0-39" x="862.351562" y="952.181749"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-39" x="835.253906" y="1334.103624"/>
<use xlink:href="#glyph0-24" x="835.253906" y="1334.103624"/>
</g>
<path style="fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 28.274959 63.649036 L 40.952498 63.649036 L 40.952498 65.049036 L 28.274959 65.049036 Z M 28.274959 63.649036 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
@ -2206,8 +2206,14 @@
<path style="fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 17.573592 61.285559 L 17.173592 60.485559 L 16.773592 61.285559 Z M 17.573592 61.285559 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style="fill:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-dasharray:0.4,0.4;stroke-miterlimit:10;" d="M 26.487655 64.346106 L 27.300155 64.346106 L 27.300155 64.349036 L 28.224569 64.349036 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style="fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 26.487655 63.946106 L 25.687655 64.346106 L 26.487655 64.746106 Z M 26.487655 63.946106 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style="fill:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 41.002694 64.349036 L 42.427694 64.349036 L 42.427694 32.519153 L 43.852694 32.519153 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 1164.421875 1234.636719 L 1164.421875 1226.636719 L 1172.421875 1230.636719 Z M 1164.421875 1234.636719 "/>
<path style="fill:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 41.002694 64.349036 L 42.452889 64.349036 L 42.452889 33.219153 L 43.903084 33.219153 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 1164.925781 1241.636719 L 1164.925781 1233.636719 L 1172.925781 1237.636719 Z M 1164.925781 1241.636719 "/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-24" x="1135.921875" y="1552.943468"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-39" x="1178.234375" y="930.345812"/>
</g>
<path style="fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 48.270077 53.325208 L 63.835116 53.325208 L 63.835116 55.425208 L 48.270077 55.425208 Z M 48.270077 53.325208 " transform="matrix(20,0,0,20,311.868,269.156)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph1-27" x="1292.433594" y="1354.668023"/>

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 296 KiB

View File

@ -7,7 +7,6 @@ use App\DBAL\Types\ActionType;
use App\DBAL\Types\Meta\Right\CRUDType;
use App\Domain\RequestManagement\User\RequestedUser;
use App\Domain\RequestManagement\User\RequestedUserInterface;
use App\Domain\UserManagement\UserSourceDirectorInterface;
/**
* @author kevinfrantz
@ -28,14 +27,11 @@ class RequestedAction extends RequestedUser implements RequestedActionInterface
];
/**
* @todo Optimize this constructor! The UserSourceDirector is not used in this class!
* {@inheritdoc}
*
* @see \App\Domain\RequestManagement\User\RequestedUser::__construct()
* @param RequestedUserInterface $requestedUser
*/
public function __construct(UserSourceDirectorInterface $userSourceDirector, RequestedUserInterface $requestedUser)
public function __construct(RequestedUserInterface $requestedUser)
{
parent::__construct($userSourceDirector, $requestedUser);
parent::__construct($requestedUser->getUserSourceDirector(), $requestedUser);
}
/**

View File

@ -3,7 +3,6 @@
namespace App\Domain\RequestManagement\Action;
use App\Domain\RequestManagement\User\RequestedUserServiceInterface;
use App\Domain\UserManagement\UserSourceDirectorInterface;
/**
* @author kevinfrantz
@ -11,13 +10,10 @@ use App\Domain\UserManagement\UserSourceDirectorInterface;
final class RequestedActionService extends RequestedAction implements RequestedActionServiceInterface
{
/**
* @todo Optimize this constructor! The UserSourceDirector is not used in this class!
*
* @param UserSourceDirectorInterface $userSourceDirector
* @param RequestedUserServiceInterface $requestedUserService
*/
public function __construct(UserSourceDirectorInterface $userSourceDirector, RequestedUserServiceInterface $requestedUserService)
public function __construct(RequestedUserServiceInterface $requestedUserService)
{
parent::__construct($userSourceDirector, $requestedUserService);
parent::__construct($requestedUserService);
}
}

View File

@ -52,7 +52,7 @@ class CreateSourceActionIntegrationTest extends KernelTestCase
$userSourceDirectorService = new UserSourceDirectorService($entityManager, $security);
$requestedRightService = new RequestedRightService();
$requestedUserService = new RequestedUserService($userSourceDirectorService, $requestedRightService);
$this->requestedActionService = new RequestedActionService($userSourceDirectorService, $requestedUserService);
$this->requestedActionService = new RequestedActionService($requestedUserService);
$this->requestedActionService->setActionType(ActionType::CREATE);
$entityFormBuilderService = $this->createMock(RequestedActionFormBuilderServiceInterface::class);
$requestStack = $this->createMock(RequestStack::class);

View File

@ -57,7 +57,7 @@ class RequestedActionFormBuilderServiceIntegrationTest extends KernelTestCase
$requestedRightService = new RequestedRightService();
$requestedRightService->setRequestedEntity($this->requestedEntity);
$requestedUserService = new RequestedUserService($userSourceDirectorService, $requestedRightService);
$this->requestedActionService = new RequestedActionService($userSourceDirectorService, $requestedUserService);
$this->requestedActionService = new RequestedActionService($requestedUserService);
$this->requestedActionService->setActionType(ActionType::CREATE);
$this->requestedActionFormBuilderService = new RequestedActionFormBuilderService($formFactory, $formClassNameService, $this->requestedActionService);
}

View File

@ -39,7 +39,7 @@ class ActionFactoryServiceTest extends TestCase
$requestedRight = new RequestedRight();
$userSourceDirector = $this->createMock(UserSourceDirectorInterface::class);
$requestedUser = new RequestedUser($userSourceDirector, $requestedRight);
$this->requestedAction = new RequestedAction($userSourceDirector, $requestedUser);
$this->requestedAction = new RequestedAction($requestedUser);
$this->actionService = $this->createMock(ActionServiceInterface::class);
$this->actionService->method('getRequestedAction')->willReturn($this->requestedAction);
$this->actionFactoryService = new ActionFactoryService($this->actionService);

View File

@ -17,7 +17,8 @@ class RequestedActionServiceTest extends TestCase
{
$userSourceDirector = $this->createMock(UserSourceDirectorInterface::class);
$requestedUserService = $this->createMock(RequestedUserServiceInterface::class);
$service = new RequestedActionService($userSourceDirector, $requestedUserService);
$requestedUserService->method('getUserSourceDirector')->willReturn($userSourceDirector);
$service = new RequestedActionService($requestedUserService);
$this->assertInstanceOf(RequestedActionServiceInterface::class, $service);
}
}

View File

@ -44,7 +44,7 @@ class RequestedActionTest extends TestCase
$userSourceDirector = new UserSourceDirector($sourceRepository, $user);
$requestedRight = new RequestedRight();
$this->requestedRight = new RequestedUser($userSourceDirector, $requestedRight);
$this->action = new RequestedAction($userSourceDirector, $this->requestedRight);
$this->action = new RequestedAction($this->requestedRight);
}
public function testList(): void