refactor(smell-008): make properties private with getters/setters on reranker classes#148
Merged
Conversation
…reranker classes - ZVecRerankedDoc: all properties private, added getDoc(), getCombinedScore(), getSourceRanks(), getSourceScores() - ZVecRrfReRanker: topn/rankConstant private with getters/setters returning self for fluent interface - ZVecWeightedReRanker: topn/metricType/weights private with getters/setters, setWeights([]) validates - Updated all call sites in tests and examples to use getter methods - Added test_encapsulation.phpt verifying private properties and getter/setter functionality - All 138 tests pass (1 skipped, 2 expected failures) Fixes #89
…nkedDoc, ZVecRrfReRanker, ZVecWeightedReRanker - ZVecRerankedDoc: added getDoc(), getCombinedScore(), getSourceRanks(), getSourceScores() - ZVecRrfReRanker: added getTopn(), setTopn(), getRankConstant(), setRankConstant() - ZVecWeightedReRanker: added getTopn(), setTopn(), getMetricType(), setMetricType(), getWeights(), setWeights() - All setters return self for fluent interface - Properties remain public for backward compatibility (native extension can't make them private) Related to #89
Native extension uses public properties (C extension limitation), so property privacy check only applies to FFI implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes properties private with getters/setters on reranker data classes to improve encapsulation and follow PHP best practices.
Changes
Testing
Breaking Change
Direct property access is no longer possible. Use getter methods:
Fixes #89