-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
145 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* This file is part of NovaPoshta PHP library. | ||
* | ||
* @author Anton Karpov <[email protected]> | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT | ||
* @link https://github.com/awd-studio/novaposhta | ||
*/ | ||
|
||
declare(strict_types=1); // strict mode | ||
|
||
|
||
namespace NP\Mock\Common; | ||
|
||
use NP\Common\Config; | ||
|
||
|
||
/** | ||
* Class MockConfig | ||
* @package Mock\Common | ||
*/ | ||
class MockConfig extends Config | ||
{ | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $ignoredDriver = []; | ||
|
||
|
||
/** | ||
* MockConfig constructor. | ||
* @param $config | ||
* @param array $ignoredDriver | ||
*/ | ||
public function __construct($config, array $ignoredDriver) | ||
{ | ||
$this->ignoredDriver = $ignoredDriver; | ||
|
||
parent::__construct($config); | ||
} | ||
|
||
|
||
/** | ||
* @param string $needle | ||
* @return bool | ||
*/ | ||
protected function inArray(string $needle) | ||
{ | ||
return in_array($needle, $this->ignoredDriver); | ||
} | ||
|
||
|
||
/** | ||
* Check Guzzle availability. | ||
* | ||
* @return bool | ||
*/ | ||
public function isGuzzle(): bool | ||
{ | ||
return $this->inArray('GuzzleDriver') ? false : parent::isGuzzle(); | ||
} | ||
|
||
|
||
/** | ||
* Check CURL availability. | ||
* | ||
* @return bool | ||
*/ | ||
public function isCurl(): bool | ||
{ | ||
return $this->inArray('CurlDriver') ? false : parent::isCurl(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters