Skip to content

Conversation

rotdrop
Copy link
Contributor

@rotdrop rotdrop commented Sep 23, 2025

This PR displays the configuration of the gateways providers (phone numbers etc.) if the "-v" is passed to the occ invocation.

@rotdrop rotdrop force-pushed the feature/verbose-status-command branch 2 times, most recently from ec6d121 to e695f76 Compare September 23, 2025 15:10
}

#[\Override]
public function getConfiguration(array $schema = []): array {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Already have a similar method called getSettings. Isn't this the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I thought it was but that "getSettings()" only returns the name and and instructions, see here:

public function getSettings(): array {

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm thinking about replace the constant SCHEMA that is returned by settings by specific methods to return the values as the constant SCHEMA property provide. Maybe making this will be more clear to developers about what need to override. The schema is a bit fragile considering that haven't a contract that says what's necessary. I also thought about get back with a config class to each provider but this approach also will get back with a lot of files to implement a provider. That do you think about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed the public const SCHEMA = [ ... ] is rather "magic" or obscured. Having documented interface methods is preferable over the current state. So we are talking here about something like (?)

public function getName():string;
public function getInstructions():string;
public function getConfigurationKeys: array;
// and what else is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can also convert this PR to a draft. Shall I? I'd like to see a status command which also displays the current configuration, but there is no hurry. Clearly, if you replace the SCHEMA property by something cleaner then this PR needs to be rewritten anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

replace the SCHEMA property by something cleaner

I wish to do this but I think that don't will affect this PR. Let's think more about.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Starting to check this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you check again your PR after the last changes at main branch? I replaced the SCHEMA by a setting class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also implemented some tests covering the status command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, seems to work again. I should probably augment the test to cover also the output with the "-v / --verbose" flag in action.

I have also added a new method to the TConfigurable trait

private static function keyFromFieldName(string $id, string $fieldName):string {
                return $id . '_' . $fieldName;
}

in order to have just one place where the config keys are formed. I also saw that the handling of the provider id is slightly different in AGateway::isConfigured() and in the TConfigurable trait (the latter always ever only uses configuration->id, where AGateway looks at self::getProviderId().

@rotdrop rotdrop force-pushed the feature/verbose-status-command branch 3 times, most recently from 19884cc to b9961ab Compare September 30, 2025 07:50
…verbose.

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
@rotdrop rotdrop force-pushed the feature/verbose-status-command branch from b9961ab to 0a3d918 Compare September 30, 2025 08:02
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