Skip to content

Commit

Permalink
Added $path of '.env' file to ChainFactory::api() and WalletFactory::…
Browse files Browse the repository at this point in the history
…api()
  • Loading branch information
alienzin committed Aug 28, 2018
1 parent 867536f commit 6576ee7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/Adapter/Settings/DotenvAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class DotenvAdapter implements SettingsInterface
/**
* DotenvAdapter constructor
*
* @param Dotenv $client
* @param Dotenv $client
* @param bool $ifLoad
* @throws SettingsException
* @throws SettingsNotFoundException
*/
public function __construct(Dotenv $settings)
{
Expand Down
15 changes: 10 additions & 5 deletions src/ChainFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ class ChainFactory
/**
* Simple convenience factory which can be overloaded or used with defaults
*
* @param string $env
* @param SettingsInterface|null $settings
* @param HttpInterface|null $http
* @param string|null $path
* @param string $env
* @param SettingsInterface|null $settings
* @param HttpInterface|null $http
*
* @return ChainController
* @throws Exception\SettingsException
* @throws Exception\SettingsNotFoundException
* @throws \ErrorException
*/
public function api(string $env = '.env', SettingsInterface $settings = null, HttpInterface $http = null): ChainController
public function api(string $path = null, string $env = '.env', SettingsInterface $settings = null, HttpInterface $http = null): ChainController
{
$settings = $settings ?? new DotenvAdapter(new Dotenv(dirname(__DIR__), $env));
$path = $path ?? dirname(__DIR__);
$settings = $settings ?? new DotenvAdapter(new Dotenv($path, $env));
$http = $http ?? new CurlAdapter(new Curl);

return new ChainController(
Expand Down
15 changes: 10 additions & 5 deletions src/WalletFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ class WalletFactory
/**
* Simple convenience factory which can be overloaded or used with defaults
*
* @param string $env
* @param SettingsInterface|null $settings
* @param HttpInterface|null $http
* @param string|null $path
* @param string $env
* @param SettingsInterface|null $settings
* @param HttpInterface|null $http
*
* @return WalletController
* @throws Exception\SettingsException
* @throws Exception\SettingsNotFoundException
* @throws \ErrorException
*/
public function api(string $env = '.env', SettingsInterface $settings = null, HttpInterface $http = null): WalletController
public function api(string $path = null, string $env = '.env', SettingsInterface $settings = null, HttpInterface $http = null): WalletController
{
$settings = $settings ?? new DotenvAdapter(new Dotenv(dirname(__DIR__), $env));
$path = $path ?? dirname(__DIR__);
$settings = $settings ?? new DotenvAdapter(new Dotenv($path, $env));
$http = $http ?? new CurlAdapter(new Curl);

return new WalletController(
Expand Down

0 comments on commit 6576ee7

Please sign in to comment.