Skip to content

refactor: move to ITimeFactory#1392

Open
solracsf wants to merge 1 commit intomainfrom
moveToITimeFactory
Open

refactor: move to ITimeFactory#1392
solracsf wants to merge 1 commit intomainfrom
moveToITimeFactory

Conversation

@solracsf
Copy link
Copy Markdown
Member

No description provided.

@solracsf solracsf force-pushed the moveToITimeFactory branch from c6fd933 to 34b80fc Compare March 27, 2026 06:59
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf solracsf force-pushed the moveToITimeFactory branch from 34b80fc to 04f9b43 Compare March 27, 2026 07:02
public function __construct(array $tokenData) {
public function __construct(
array $tokenData,
private ITimeFactory $timeFactory,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could inject ITimeFactory in the constructor (and store it as a class attr as well) with OCP\Server::get to avoid having to pass it when instanciating tokens.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would work, but have a trade-off: it makes Token harder to test since you can't inject a mock ITimeFactory without having the full Nextcloud DI container available. WDYT?

@julien-nc julien-nc self-requested a review March 30, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants