public const URI = 'recent';
- private RecentContactMapper $mapper;
- private IL10N $l10n;
- private string $principalUri;
-
- public function __construct(RecentContactMapper $mapper,
- IL10N $l10n,
- string $principalUri) {
+ public function __construct(
+ private RecentContactMapper $mapper,
+ private IL10N $l10n,
+ private string $principalUri,
+ ) {
parent::__construct(Application::APP_ID, self::URI);
-
- $this->mapper = $mapper;
- $this->l10n = $l10n;
- $this->principalUri = $principalUri;
}
/**
* @inheritDoc
+ * @throws Exception
*/
public function delete(): void {
throw new Exception("This addressbook is immutable");
/**
* @inheritDoc
+ * @throws Exception
*/
public function createFile($name, $data = null) {
throw new Exception("This addressbook is immutable");
/**
* @inheritDoc
+ * @throws Exception
*/
public function propPatch(PropPatch $propPatch) {
throw new Exception("This addressbook is immutable");
/**
* @inheritDoc
*/
- public function getProperties($properties) {
+ public function getProperties($properties): array {
return [
'principaluri' => $this->principalUri,
'{DAV:}displayname' => $this->l10n->t('Recently contacted'),
class AddressBookProvider implements IAddressBookProvider {
- /** @var RecentContactMapper */
- private $mapper;
-
- /** @var IL10N */
- private $l10n;
-
- public function __construct(RecentContactMapper $mapper, IL10N $l10n) {
- $this->mapper = $mapper;
- $this->l10n = $l10n;
+ public function __construct(
+ private RecentContactMapper $mapper,
+ private IL10N $l10n,
+ ) {
}
/**
use OCP\BackgroundJob\TimedJob;
class CleanupJob extends TimedJob {
- private RecentContactMapper $mapper;
- public function __construct(ITimeFactory $time,
- RecentContactMapper $mapper) {
+ public function __construct(
+ ITimeFactory $time,
+ private RecentContactMapper $mapper,
+ ) {
parent::__construct($time);
$this->setInterval(24 * 60 * 60);
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
- $this->mapper = $mapper;
}
- protected function run($argument) {
+ protected function run($argument): void {
$time = $this->time->getDateTime();
$time->modify('-7days');
$this->mapper->cleanUp($time->getTimestamp());
class Card implements ICard, IACL {
use ACLTrait;
- private RecentContact $contact;
- private string $principal;
- private array $acls;
-
- public function __construct(RecentContact $contact, string $principal, array $acls) {
- $this->contact = $contact;
- $this->principal = $principal;
- $this->acls = $acls;
+ public function __construct(
+ private RecentContact $contact,
+ private string $principal,
+ private array $acls,
+ ) {
}
/**
/**
* @inheritDoc
*/
- public function get() {
+ public function get(): string {
return $this->contact->getCard();
}
use TTransactional;
- private RecentContactMapper $mapper;
- private CardSearchDao $cardSearchDao;
- private IUserManager $userManager;
- private IDBConnection $dbConnection;
- private ITimeFactory $timeFactory;
- private IL10N $l10n;
- private LoggerInterface $logger;
-
- public function __construct(RecentContactMapper $mapper,
- CardSearchDao $cardSearchDao,
- IUserManager $userManager,
- IDBConnection $connection,
- ITimeFactory $timeFactory,
- IL10N $l10nFactory,
- LoggerInterface $logger) {
- $this->mapper = $mapper;
- $this->cardSearchDao = $cardSearchDao;
- $this->userManager = $userManager;
- $this->dbConnection = $connection;
- $this->timeFactory = $timeFactory;
- $this->l10n = $l10nFactory;
- $this->logger = $logger;
+ public function __construct(
+ private RecentContactMapper $mapper,
+ private CardSearchDao $cardSearchDao,
+ private IUserManager $userManager,
+ private IDBConnection $dbConnection,
+ private ITimeFactory $timeFactory,
+ private IL10N $l10n,
+ private LoggerInterface $logger,
+ ) {
}
public function handle(Event $event): void {