Skip to content

Commit

Permalink
Merge pull request #4718 from fsamapoor/constructor_property_promotio…
Browse files Browse the repository at this point in the history
…n_in_controllers
  • Loading branch information
juliushaertl authored Jul 14, 2023
2 parents 90d051f + 559579f commit c4a826b
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 139 deletions.
9 changes: 5 additions & 4 deletions lib/Controller/AttachmentApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
use OCP\IRequest;

class AttachmentApiController extends ApiController {
private $attachmentService;

public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {
public function __construct(
$appName,
IRequest $request,
private AttachmentService $attachmentService,
) {
parent::__construct($appName, $request);
$this->attachmentService = $attachmentService;
}

/**
Expand Down
11 changes: 5 additions & 6 deletions lib/Controller/AttachmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
use OCP\IRequest;

class AttachmentController extends Controller {

/** @var AttachmentService */
private $attachmentService;

public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {
public function __construct(
$appName,
IRequest $request,
private AttachmentService $attachmentService,
) {
parent::__construct($appName, $request);
$this->attachmentService = $attachmentService;
}

/**
Expand Down
14 changes: 6 additions & 8 deletions lib/Controller/BoardApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,16 @@
* @package OCA\Deck\Controller
*/
class BoardApiController extends ApiController {
private $boardService;

/**
* @param string $appName
* @param IRequest $request
* @param BoardService $service
* @param $userId
*/
public function __construct($appName, IRequest $request, BoardService $service, $userId) {
public function __construct(
$appName,
IRequest $request,
private BoardService $boardService,
private $userId,
) {
parent::__construct($appName, $request);
$this->boardService = $service;
$this->userId = $userId;
}

/**
Expand Down
17 changes: 8 additions & 9 deletions lib/Controller/BoardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
use OCP\IRequest;

class BoardController extends ApiController {
private $userId;
private $boardService;
private $permissionService;

public function __construct($appName, IRequest $request, BoardService $boardService, PermissionService $permissionService, $userId) {
public function __construct(
$appName,
IRequest $request,
private BoardService $boardService,
private PermissionService $permissionService,
private $userId,
) {
parent::__construct($appName, $request);
$this->userId = $userId;
$this->boardService = $boardService;
$this->permissionService = $permissionService;
}

/**
Expand Down Expand Up @@ -144,7 +143,7 @@ public function updateAcl($id, $permissionEdit, $permissionShare, $permissionMan
/**
* @NoAdminRequired
* @param $aclId
* @return \OCP\AppFramework\Db\Entity
* @return \OCP\AppFramework\Db\Entity|null
*/
public function deleteAcl($aclId) {
return $this->boardService->deleteAcl($aclId);
Expand Down
11 changes: 2 additions & 9 deletions lib/Controller/BoardImportApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,13 @@
use OCP\IRequest;

class BoardImportApiController extends OCSController {
/** @var BoardImportService */
private $boardImportService;
/** @var string */
private $userId;

public function __construct(
string $appName,
IRequest $request,
BoardImportService $boardImportService,
string $userId
private BoardImportService $boardImportService,
private string $userId,
) {
parent::__construct($appName, $request);
$this->boardImportService = $boardImportService;
$this->userId = $userId;
}

/**
Expand Down
15 changes: 8 additions & 7 deletions lib/Controller/CardApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,22 @@
* @package OCA\Deck\Controller
*/
class CardApiController extends ApiController {
private $cardService;
private $userId;
private $assignmentService;

/**
* @param string $appName
* @param IRequest $request
* @param CardService $cardService
* @param AssignmentService $assignmentService
* @param $userId
*/
public function __construct($appName, IRequest $request, CardService $cardService, AssignmentService $assignmentService, $userId) {
public function __construct(
string $appName,
IRequest $request,
private CardService $cardService,
private AssignmentService $assignmentService,
private $userId,
) {
parent::__construct($appName, $request);
$this->cardService = $cardService;
$this->userId = $userId;
$this->assignmentService = $assignmentService;
}

/**
Expand Down
15 changes: 7 additions & 8 deletions lib/Controller/CardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
use OCP\IRequest;

class CardController extends Controller {
private $userId;
private $cardService;
private $assignmentService;

public function __construct($appName, IRequest $request, CardService $cardService, AssignmentService $assignmentService, $userId) {
public function __construct(
$appName,
IRequest $request,
private CardService $cardService,
private AssignmentService $assignmentService,
private $userId,
) {
parent::__construct($appName, $request);
$this->userId = $userId;
$this->cardService = $cardService;
$this->assignmentService = $assignmentService;
}

/**
Expand Down
11 changes: 4 additions & 7 deletions lib/Controller/CommentsApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@
use OCP\IRequest;

class CommentsApiController extends OCSController {

/** @var CommentService */
private $commentService;

public function __construct(
string $appName,
IRequest $request,
CommentService $commentService,
string $corsMethods = 'PUT, POST, GET, DELETE, PATCH', string $corsAllowedHeaders = 'Authorization, Content-Type, Accept', int $corsMaxAge = 1728000
private CommentService $commentService,
string $corsMethods = 'PUT, POST, GET, DELETE, PATCH',
string $corsAllowedHeaders = 'Authorization, Content-Type, Accept',
int $corsMaxAge = 1728000,
) {
parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge);
$this->commentService = $commentService;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@
use OCP\IRequest;

class ConfigController extends OCSController {
private $configService;

public function __construct(
$AppName,
IRequest $request,
ConfigService $configService
private ConfigService $configService,
) {
parent::__construct($AppName, $request);

$this->configService = $configService;
}

/**
Expand Down
17 changes: 7 additions & 10 deletions lib/Controller/LabelApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,18 @@
* @package OCA\Deck\Controller
*/
class LabelApiController extends ApiController {
private $labelService;
private $userId;

/**
* @param string $appName
* @param IRequest $request
* @param LabelService $labelService
* @param $userId
*/
public function __construct($appName, IRequest $request, LabelService $labelService, $userId) {
public function __construct(
$appName,
IRequest $request,
private LabelService $labelService,
private $userId,
) {
parent::__construct($appName, $request);
$this->labelService = $labelService;
$this->userId = $userId;
}

/**
* @NoAdminRequired
* @CORS
Expand Down
9 changes: 5 additions & 4 deletions lib/Controller/LabelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
use OCP\IRequest;

class LabelController extends Controller {
private $labelService;

public function __construct($appName, IRequest $request, LabelService $labelService) {
public function __construct(
$appName,
IRequest $request,
private LabelService $labelService,
) {
parent::__construct($appName, $request);
$this->labelService = $labelService;
}

/**
Expand Down
16 changes: 6 additions & 10 deletions lib/Controller/OverviewApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@
use OCP\IRequest;

class OverviewApiController extends OCSController {

/** @var OverviewService */
private $dashboardService;

/** @var string */
private $userId;

public function __construct($appName, IRequest $request, OverviewService $dashboardService, $userId) {
public function __construct(
$appName,
IRequest $request,
private OverviewService $dashboardService,
private $userId,
) {
parent::__construct($appName, $request);
$this->dashboardService = $dashboardService;
$this->userId = $userId;
}

/**
Expand Down
28 changes: 7 additions & 21 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,23 @@
use OCP\IURLGenerator;

class PageController extends Controller {
private PermissionService $permissionService;
private IInitialStateService $initialState;
private ConfigService $configService;
private IEventDispatcher $eventDispatcher;
private CardMapper $cardMapper;
private IURLGenerator $urlGenerator;
private CardService $cardService;
private IConfig $config;

public function __construct(
string $AppName,
IRequest $request,
PermissionService $permissionService,
private PermissionService $permissionService,
IInitialStateService $initialStateService,
ConfigService $configService,
IEventDispatcher $eventDispatcher,
CardMapper $cardMapper,
IURLGenerator $urlGenerator,
CardService $cardService,
IConfig $config
private ConfigService $configService,
private IEventDispatcher $eventDispatcher,
private CardMapper $cardMapper,
private IURLGenerator $urlGenerator,
private CardService $cardService,
private IConfig $config,
) {
parent::__construct($AppName, $request);

$this->permissionService = $permissionService;
$this->initialState = $initialStateService;
$this->configService = $configService;
$this->eventDispatcher = $eventDispatcher;
$this->cardMapper = $cardMapper;
$this->urlGenerator = $urlGenerator;
$this->cardService = $cardService;
$this->config = $config;
}

/**
Expand Down
13 changes: 5 additions & 8 deletions lib/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@
use OCP\IRequest;

class SearchController extends OCSController {

/**
* @var SearchService
*/
private $searchService;

public function __construct(string $appName, IRequest $request, SearchService $searchService) {
public function __construct(
string $appName,
IRequest $request,
private SearchService $searchService,
) {
parent::__construct($appName, $request);
$this->searchService = $searchService;
}

/**
Expand Down
13 changes: 3 additions & 10 deletions lib/Controller/SessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,13 @@
use OCP\IRequest;

class SessionController extends OCSController {
private SessionService $sessionService;
private PermissionService $permissionService;
private BoardMapper $boardMapper;

public function __construct($appName,
IRequest $request,
SessionService $sessionService,
PermissionService $permissionService,
BoardMapper $boardMapper
private SessionService $sessionService,
private PermissionService $permissionService,
private BoardMapper $boardMapper,
) {
parent::__construct($appName, $request);
$this->sessionService = $sessionService;
$this->permissionService = $permissionService;
$this->boardMapper = $boardMapper;
}

/**
Expand Down
14 changes: 6 additions & 8 deletions lib/Controller/StackApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,16 @@
* @package OCA\Deck\Controller
*/
class StackApiController extends ApiController {
private $boardService;
private $stackService;

/**
* @param string $appName
* @param IRequest $request
* @param StackService $stackService
*/
public function __construct($appName, IRequest $request, StackService $stackService, BoardService $boardService) {
public function __construct(
$appName,
IRequest $request,
private StackService $stackService,
private BoardService $boardService,
) {
parent::__construct($appName, $request);
$this->stackService = $stackService;
$this->boardService = $boardService;
}

/**
Expand Down
Loading

0 comments on commit c4a826b

Please sign in to comment.