earmark
earmark copied to clipboard
null passed to construct, assumes config values
$earmark = new Earmark(null, null, null, 20000, null); // Start with 20000
Running $earmark->get()
returns ECHO00020000 instead of 20000 as I have set it in the config to prefix with ECHO with a padding of 8. Is there a better way to handle this? As the extension is an integer value in the database it will not accept it.
This is caused by the construct()
prioritizing values
from the config
when null
are passed to the method()
.
Part of the fix, requires passing the config values to the singleton
in EarmarkServiceProvider.php
.
Need to impliment and test, but the fix will probably be:
// @codeCoverageIgnoreStart
//Poing\Earmark\Http\Controllers
$this->app->singleton('earmark', function () {
- return new Serial;
+ return new Serial(CONFIG VALUES);
});
Passing the configuration values to the singleton
-and-
removing null
handling from the construct()
.