hkulekci / qdrant-php

Qdrant is a vector similarity engine & vector database. It deploys as an API service providing search for the nearest high-dimensional vectors. With Qdrant, embeddings or neural network encoders can be turned into full-fledged applications for matching, searching, recommending, and much more!
MIT License
93 stars 21 forks source link

Introduce ProtectedPropertyAccessor #22

Closed gregpriday closed 1 year ago

gregpriday commented 1 year ago

Make it possible to access the protected properties of Struct classes.

gregpriday commented 1 year ago

@hkulekci Everything is tested and ready for review if you'd like to add this. Again, there are workarounds, but I'd personally find this very useful in my library.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.15 :tada:

Comparison is base (8597e2e) 86.45% compared to head (bae5773) 86.61%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #22 +/- ## ============================================ + Coverage 86.45% 86.61% +0.15% - Complexity 248 252 +4 ============================================ Files 54 55 +1 Lines 864 874 +10 ============================================ + Hits 747 757 +10 Misses 117 117 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `86.61% <100.00%> (+0.15%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | Coverage Δ | | |---|---|---| | [src/Models/PointStruct.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9Qb2ludFN0cnVjdC5waHA=) | `100.00% <ø> (ø)` | | | [src/Models/PointsStruct.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9Qb2ludHNTdHJ1Y3QucGhw) | `80.00% <ø> (ø)` | | | [src/Models/Request/RecommendRequest.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9SZXF1ZXN0L1JlY29tbWVuZFJlcXVlc3QucGhw) | `100.00% <ø> (ø)` | | | [src/Models/Request/SearchRequest.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9SZXF1ZXN0L1NlYXJjaFJlcXVlc3QucGhw) | `100.00% <ø> (ø)` | | | [src/Models/VectorStruct.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9WZWN0b3JTdHJ1Y3QucGhw) | `94.44% <ø> (ø)` | | | [src/Models/Traits/ProtectedPropertyAccessor.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9UcmFpdHMvUHJvdGVjdGVkUHJvcGVydHlBY2Nlc3Nvci5waHA=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

gregpriday commented 1 year ago

I switched to using magic functions instead. Accessing protected properties, even though the trait would handle them, was causing IDE notices. These are a little annoying. Magic functions don't have the same issues.

hkulekci commented 1 year ago

Thanks. ✌️