Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change visibility of handler classes to protected #1934

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PillFall
Copy link

@PillFall PillFall commented Jan 13, 2025

Some properties and methods of the handler classes are set to private and some others to protected.

I change the visibility of all of them to protected. I believe this is a better practice, as it allows us to extend the handler.

If there are any security concerns of why this is the way it is, please do let me know.

Example

The MongoDBHandler stores the configuration private as shown:

private \MongoDB\Collection $collection;
private Client|Manager $manager;
private string|null $namespace = null;

But the DynamoDBHandler stores the configuration protected as shown:

protected DynamoDbClient $client;
protected string $table;
protected Marshaler $marshaler;

With how is the code right now, I can extend the DynamoDbHandler to add querying functionality, all without having to create a new configuration object (aka Aws\DynamoDb\DynamoDbClient).

But with MongoDBHandler, I have to redo the argument parsing in its construct function to include this functionality, creating also two copies of the same exact object in memory (aka MongoDB\Driver\Manager or \MongoDB\Collection).

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.

1 participant