Skip to content

Commit

Permalink
Merge branch 'release/4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Jul 11, 2023
2 parents ef39472 + a1d2967 commit 26d2355
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.1.2
Make Configuration parser SF 5 compatible

# 4.1.1
Abandon the messagebird-api-client-bundle #17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,41 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder;
$treeBuilder = new TreeBuilder('surfnet_message_bird_api_client');

$treeBuilder
->root('surfnet_message_bird_api_client')
->children()
->scalarNode('base_url')
->defaultValue('https://rest.messagebird.com')
->validate()
->ifTrue(function ($url) {
if (!is_string($url)) {
return true;
}
$rootNode = $treeBuilder->getRootNode();

$parts = parse_url($url);
$rootNode
->children()
->scalarNode('base_url')
->defaultValue('https://rest.messagebird.com')
->validate()
->ifTrue(function ($url) {
if (!is_string($url)) {
return true;
}

return $parts === false
|| empty($parts['scheme'])
|| empty($parts['host']);
})
->thenInvalid("Invalid base URL '%s': scheme and host are required.")
->end()
->end()
->scalarNode('authorization')
->validate()
->ifTrue(function ($headerValue) {
return strpos($headerValue, 'AccessKey ') !== 0;
})
->thenInvalid(
"Authorization value '%s' should be in the format 'AccessKey your_access_key_here'."
)
->end()
->isRequired()
$parts = parse_url($url);

return $parts === false
|| empty($parts['scheme'])
|| empty($parts['host']);
})
->thenInvalid("Invalid base URL '%s': scheme and host are required.")
->end()
->end();
->end()
->scalarNode('authorization')
->validate()
->ifTrue(function ($headerValue) {
return strpos($headerValue, 'AccessKey ') !== 0;
})
->thenInvalid(
"Authorization value '%s' should be in the format 'AccessKey your_access_key_here'."
)
->end()
->isRequired()
->end()
->end();

return $treeBuilder;
}
Expand Down

0 comments on commit 26d2355

Please sign in to comment.