Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
],

////////// A T T A C H M E N T S //////////

[
'name' => 'notes#getAttachment',
'url' => '/notes/{noteid}/attachment',
Expand Down
7 changes: 3 additions & 4 deletions lib/Controller/ETagDoesNotMatchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
use OCA\Notes\Service\Note;

class ETagDoesNotMatchException extends Exception {
public Note $note;

public function __construct(Note $note) {
$this->note = $note;
public function __construct(
public Note $note,
) {
}
}
17 changes: 4 additions & 13 deletions lib/Controller/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,12 @@
use Psr\Log\LoggerInterface;

class Helper {
private NotesService $notesService;
private MetaService $metaService;
public LoggerInterface $logger;
private IUserSession $userSession;

public function __construct(
NotesService $notesService,
MetaService $metaService,
IUserSession $userSession,
LoggerInterface $logger,
private NotesService $notesService,
private MetaService $metaService,
private IUserSession $userSession,
public LoggerInterface $logger,
) {
$this->notesService = $notesService;
$this->metaService = $metaService;
$this->userSession = $userSession;
$this->logger = $logger;
}

public function getUID() : string {
Expand Down
22 changes: 5 additions & 17 deletions lib/Controller/NotesApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,16 @@
use OCP\IRequest;

class NotesApiController extends ApiController {
private NotesService $service;
private MetaService $metaService;
private SettingsService $settingsService;
private Helper $helper;
private IMimeTypeDetector $mimeTypeDetector;

public function __construct(
string $AppName,
IRequest $request,
NotesService $service,
MetaService $metaService,
SettingsService $settingsService,
Helper $helper,
IMimeTypeDetector $mimeTypeDetector,
private NotesService $service,
private MetaService $metaService,
private SettingsService $settingsService,
private Helper $helper,
private IMimeTypeDetector $mimeTypeDetector,
) {
parent::__construct($AppName, $request);
$this->service = $service;
$this->metaService = $metaService;
$this->settingsService = $settingsService;
$this->helper = $helper;
$this->mimeTypeDetector = $mimeTypeDetector;
}

/**
Expand Down Expand Up @@ -316,5 +305,4 @@ public function uploadFile(int $noteid): JSONResponse {
);
});
}

}
29 changes: 7 additions & 22 deletions lib/Controller/NotesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,18 @@
use OCP\IRequest;

class NotesController extends Controller {
private NotesService $notesService;
private SettingsService $settingsService;
private ILockManager $lockManager;
private Helper $helper;
private IConfig $settings;
private IL10N $l10n;
private IMimeTypeDetector $mimeTypeDetector;

public function __construct(
string $AppName,
IRequest $request,
NotesService $notesService,
ILockManager $lockManager,
SettingsService $settingsService,
Helper $helper,
IConfig $settings,
IL10N $l10n,
IMimeTypeDetector $mimeTypeDetector,
private NotesService $notesService,
private ILockManager $lockManager,
private SettingsService $settingsService,
private Helper $helper,
private IConfig $settings,
private IL10N $l10n,
private IMimeTypeDetector $mimeTypeDetector,
) {
parent::__construct($AppName, $request);
$this->notesService = $notesService;
$this->settingsService = $settingsService;
$this->lockManager = $lockManager;
$this->helper = $helper;
$this->settings = $settings;
$this->l10n = $l10n;
$this->mimeTypeDetector = $mimeTypeDetector;
}

/**
Expand Down
29 changes: 7 additions & 22 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,18 @@
use Psr\Log\LoggerInterface;

class PageController extends Controller {
private NotesService $notesService;
private IConfig $config;
private IUserSession $userSession;
private IURLGenerator $urlGenerator;
private IEventDispatcher $eventDispatcher;
private IInitialState $initialState;
private LoggerInterface $logger;

public function __construct(
string $AppName,
IRequest $request,
NotesService $notesService,
IConfig $config,
IUserSession $userSession,
IURLGenerator $urlGenerator,
IEventDispatcher $eventDispatcher,
IInitialState $initialState,
LoggerInterface $logger,
private NotesService $notesService,
private IConfig $config,
private IUserSession $userSession,
private IURLGenerator $urlGenerator,
private IEventDispatcher $eventDispatcher,
private IInitialState $initialState,
private LoggerInterface $logger,
) {
parent::__construct($AppName, $request);
$this->notesService = $notesService;
$this->config = $config;
$this->userSession = $userSession;
$this->urlGenerator = $urlGenerator;
$this->eventDispatcher = $eventDispatcher;
$this->initialState = $initialState;
$this->logger = $logger;
}

/**
Expand Down
9 changes: 2 additions & 7 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@
use OCP\IUserSession;

class SettingsController extends Controller {
private SettingsService $service;
private IUserSession $userSession;

public function __construct(
string $appName,
IRequest $request,
SettingsService $service,
IUserSession $userSession,
private SettingsService $service,
private IUserSession $userSession,
) {
parent::__construct($appName, $request);
$this->service = $service;
$this->userSession = $userSession;
}

private function getUID(): string {
Expand Down
7 changes: 3 additions & 4 deletions lib/Migration/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
use OCP\Migration\IRepairStep;

class Cleanup implements IRepairStep {
private MetaMapper $metaMapper;

public function __construct(MetaMapper $metaMapper) {
$this->metaMapper = $metaMapper;
public function __construct(
private MetaMapper $metaMapper,
) {
}

/*
Expand Down
9 changes: 4 additions & 5 deletions lib/Migration/EditorHint.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
use OCP\Migration\IRepairStep;

class EditorHint implements IRepairStep {
private IConfig $config;
private IUserManager $userManager;
public function __construct(IConfig $config, IUserManager $userManager) {
$this->config = $config;
$this->userManager = $userManager;
public function __construct(
private IConfig $config,
private IUserManager $userManager,
) {
}

public function getName() {
Expand Down
15 changes: 5 additions & 10 deletions lib/Service/NotesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@
use OCP\Files\NotPermittedException;

class NotesService {
private MetaService $metaService;
private SettingsService $settings;
private NoteUtil $noteUtil;

public function __construct(
MetaService $metaService,
SettingsService $settings,
NoteUtil $noteUtil,
private MetaService $metaService,
private SettingsService $settings,
private NoteUtil $noteUtil,
) {
$this->metaService = $metaService;
$this->settings = $settings;
$this->noteUtil = $noteUtil;
}

public function getAll(string $userId, bool $autoCreateNotesFolder = false) : array {
Expand Down Expand Up @@ -94,6 +87,7 @@ function (Note $note) use ($terms) : bool {
}
));
}

private function searchTermsInNote(Note $note, array $terms) : bool {
try {
$d = $note->getData();
Expand All @@ -108,6 +102,7 @@ private function searchTermsInNote(Note $note, array $terms) : bool {
return false;
}
}

private function searchTermInData(array $strings, string $term) : bool {
foreach ($strings as $str) {
if (stripos($str, $term) !== false) {
Expand Down
9 changes: 2 additions & 7 deletions lib/Service/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@
use Psr\Log\LoggerInterface;

class Util {
public IL10N $l10n;
public LoggerInterface $logger;

public function __construct(
IL10N $l10n,
LoggerInterface $logger,
public IL10N $l10n,
public LoggerInterface $logger,
) {
$this->l10n = $l10n;
$this->logger = $logger;
}

public static function retryIfLocked(callable $f, int $maxRetries = 5, int $sleep = 1) {
Expand Down
Loading