Like `IBufferingStatsdDataFactory`, we need an interface that can be used to type-hint and provide the contract to various StatsFactory objects that can be passed around in live code and tests.
`IBufferingStatsdDataFactory` is implemented by `NullStatsdDataFactory` and `BufferingStatsdDataFactory` which can be used depending on the scenario at hand. When we're dealing with real metrics that we want to buffer and send over the wire, we get an instance of `BufferingStatsdDataFactory`. But sometimes consumer code just needs something to deal with (not a hard requirement) and we don't want to pass in a full stats data factory, we just provide a NULL object (`NullStatsdDataFactory`) especially in tests etc.
This task is to provide an interface (proposed name: `IStatsFactory`) that can be implemented by various concrete use cases for the afore mentioned purpose. BagOStuff for example needs a StatsFactory object injected:
```
public function __construct( array $params = [] ) {
$this->keyspace = $params['keyspace'] ?? 'local';
$this->stats = $params['stats'] ?? new NullStatsFactory();
$this->setLogger( $params['logger'] ?? new NullLogger() );
$asyncHandler = $params['asyncHandler'] ?? null;
if ( is_callable( $asyncHandler ) ) {
$this->asyncHandler = $asyncHandler;
}
}
```
when creating the various caching backends but if not specified in `$params`, fallback back to a NULL object but we don't yet have this in StatsLib and the `NullEmitter` won't do the trick or will it? So I propose we introduce an interface for this and have various concrete cases implement it including the null case.