Comments (4)
The objects are intentionally immutable. A reset method would be contrary to that. The with*()
calls do not change the underlying object but create a new one. As such, if you want to reuse the object created by the constructor, i.e., when you call new MinFraud(...)
, between calls, you can. You just need to save it to a different variable.
from minfraud-api-php.
@oschwald yeah, i know, but that does not work in most modern frameworks that use dependency injection. Also if i'm creating an instance of MinFraud that leaves my service untestable as it no longer uses DI and that dependency can't be mocked. We then have to resort to hacks like setters that replace dependencies when testing.
I would argue that both cons outweigh the pros.
from minfraud-api-php.
I am a bit confused. Why can't you inject the object created by new MinFraud(...)
? It is immutable and can be reused multiple times.
from minfraud-api-php.
never mind, didn't notice that it was $new->content that is being written to, miss-took it for $this->content as it was private
from minfraud-api-php.
Related Issues (20)
- $insightsResponse->riskScore returns 12,6 instead of 12.6 HOT 6
- Deprecation notices appeared after switch to php 8.2 from php 7.4 HOT 1
- How to tell the API to use Sandbox? HOT 3
- ca cert - SSL: certificate verification failed HOT 10
- Have a cleaner documentation about client's optional parameters (connectTimeout for example) HOT 3
- Can't bypass validation HOT 1
- PermissionRequiredException HOT 1
- Docs are more explicit about request object immutability (was: Unusual implementation of fluent interface breaks expected behavior) HOT 5
- Documentation needs more examples HOT 6
- Shopping Cart Item HOT 1
- Kosovo supported in API? HOT 1
- Connection is not re-used HOT 3
- php 7 Fatal error HOT 1
- Memory Leak / Allocation Issue? HOT 2
- withBilling() validating region as ISO 3166-2 subdivision code HOT 1
- Validation Issue with Order and Shopping Cart Item Amount HOT 3
- Report Transactions API in stable version HOT 1
- JSON encode HOT 4
- Type errors on reportTransaction HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minfraud-api-php.