-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #627 from tienvx/add-custom-provider-headers
feat: Allow add custom provider headers
- Loading branch information
Showing
11 changed files
with
129 additions
and
2 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
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
39 changes: 39 additions & 0 deletions
39
src/PhpPact/Standalone/ProviderVerifier/Model/Config/CustomHeaders.php
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,39 @@ | ||
<?php | ||
|
||
namespace PhpPact\Standalone\ProviderVerifier\Model\Config; | ||
|
||
class CustomHeaders implements CustomHeadersInterface | ||
{ | ||
/** | ||
* @var array<string, string> | ||
*/ | ||
private array $headers = []; | ||
|
||
/** | ||
* @param array<string, string> $headers | ||
*/ | ||
public function setHeaders(array $headers): self | ||
{ | ||
$this->headers = []; | ||
foreach ($headers as $name => $value) { | ||
$this->addHeader($name, $value); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
public function addHeader(string $name, string $value): self | ||
{ | ||
$this->headers[$name] = $value; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return array<string, string> | ||
*/ | ||
public function getHeaders(): array | ||
{ | ||
return $this->headers; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/PhpPact/Standalone/ProviderVerifier/Model/Config/CustomHeadersInterface.php
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,18 @@ | ||
<?php | ||
|
||
namespace PhpPact\Standalone\ProviderVerifier\Model\Config; | ||
|
||
interface CustomHeadersInterface | ||
{ | ||
/** | ||
* @param array<string, string> $headers | ||
*/ | ||
public function setHeaders(array $headers): self; | ||
|
||
public function addHeader(string $name, string $value): self; | ||
|
||
/** | ||
* @return array<string, string> | ||
*/ | ||
public function getHeaders(): array; | ||
} |
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
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
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