Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CWD
powerdns-client
Commits
40396500
Commit
40396500
authored
Mar 31, 2019
by
Ludwig Ruderstaller
Browse files
Merge branch 'develop' into 'master'
Develop See merge request
!5
parents
7b709ebb
98aa553a
Pipeline
#19600
failed with stage
in 1 minute and 32 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Client.php
View file @
40396500
...
...
@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace
Cwd\PowerDNSClient
;
use
Doctrine\Common\Annotations\AnnotationReader
;
use
Doctrine\Common\Annotations\Reader
;
use
GuzzleHttp\Psr7\Request
;
use
Http\Discovery\HttpClientDiscovery
;
use
Symfony\Component\PropertyAccess\PropertyAccessor
;
...
...
@@ -42,7 +43,7 @@ class Client
/** @var Serializer */
private
$serializer
;
public
function
__construct
(
$apiHost
,
$apiKey
,
?GuzzleClient
$client
=
null
)
public
function
__construct
(
$apiHost
,
$apiKey
,
?GuzzleClient
$client
=
null
,
Reader
$annotationReader
)
{
$this
->
apiKey
=
$apiKey
;
$this
->
apiUri
=
sprintf
(
'%s/%s'
,
$apiHost
,
$this
->
basePath
);
...
...
@@ -51,7 +52,7 @@ class Client
$this
->
client
=
HttpClientDiscovery
::
find
();
}
$classMetadataFactory
=
new
ClassMetadataFactory
(
new
AnnotationLoader
(
new
A
nnotationReader
()
));
$classMetadataFactory
=
new
ClassMetadataFactory
(
new
AnnotationLoader
(
$a
nnotationReader
));
$discriminator
=
new
ClassDiscriminatorFromClassMetadata
(
$classMetadataFactory
);
$normalizer
=
new
ObjectNormalizer
(
$classMetadataFactory
,
new
CamelCaseToSnakeCaseNameConverter
(),
new
PropertyAccessor
(),
new
ReflectionExtractor
(),
$discriminator
);
...
...
PowerDNSClientFactory.php
View file @
40396500
...
...
@@ -12,11 +12,13 @@ declare(strict_types=1);
namespace
Cwd\PowerDNSClient
;
use
Doctrine\Common\Annotations\Reader
;
class
PowerDNSClientFactory
{
static
public
function
createClient
(
string
$uri
,
string
$apiKey
,
?string
$defaultServer
=
null
):
PowerDNSClient
static
public
function
createClient
(
string
$uri
,
string
$apiKey
,
?string
$defaultServer
=
null
,
Reader
$reader
):
PowerDNSClient
{
$client
=
new
Client
(
$uri
,
$apiKey
);
$client
=
new
Client
(
$uri
,
$apiKey
,
null
,
$reader
);
$pdns
=
new
PowerDNSClient
(
$client
);
if
(
$defaultServer
!==
null
)
{
$pdns
->
setDefaultServerId
(
$defaultServer
);
...
...
Resources/config/services.yaml
View file @
40396500
...
...
@@ -8,3 +8,4 @@ services:
-
'
%cwd_power_dns_client.uri%'
-
'
%cwd_power_dns_client.api_key%'
-
'
%cwd_power_dns_client.default_server%'
-
'
@annotation_reader'
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment