Skip to content

Commit 6035d94

Browse files
authored
Merge pull request #3 from sadikoff/access_to_data
Give access to response Person data
2 parents aa51a7c + 121c470 commit 6035d94

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Provider/SymfonyConnectResourceOwner.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public function getProfilePicture()
6666
return $this->getLinkNodeHref('./atom:link[@rel="foaf:depiction"]', $this->data);
6767
}
6868

69+
public function getData()
70+
{
71+
return $this->data;
72+
}
73+
6974
public function toArray(): array
7075
{
7176
return [
@@ -76,15 +81,15 @@ public function toArray(): array
7681
];
7782
}
7883

79-
protected function getNodeValue($query, \DOMElement $element = null, $index = 0)
84+
protected function getNodeValue($query, \DOMNode $element = null, $index = 0)
8085
{
8186
$nodeList = $this->xpath->query($query, $element);
8287
if ($nodeList->length > 0 && $index <= $nodeList->length) {
8388
return $this->sanitizeValue($nodeList->item($index)->nodeValue);
8489
}
8590
}
8691

87-
protected function getLinkNodeHref($query, \DOMElement $element = null, $position = 0)
92+
protected function getLinkNodeHref($query, \DOMNode $element = null, $position = 0)
8893
{
8994
$nodeList = $this->xpath->query($query, $element);
9095
if ($nodeList && $nodeList->length > 0 && $nodeList->item($position)) {

tests/src/Provider/SymfonyConnectTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Qdequippe\OAuth2\Client\Provider\SymfonyConnect;
88
use PHPUnit\Framework\TestCase;
99
use Mockery as m;
10+
use Qdequippe\OAuth2\Client\Provider\SymfonyConnectResourceOwner;
1011

1112
class SymfonyConnectTest extends TestCase
1213
{
@@ -90,6 +91,7 @@ public function testUserData()
9091

9192
$user = $this->provider->getResourceOwner($token);
9293

94+
$this->assertInstanceOf(SymfonyConnectResourceOwner::class, $user);
9395
$this->assertEquals('39c049bb-9261-4d85-922c-15730d6fa8b1', $user->getId());
9496
$this->assertEquals('[email protected]', $user->getEmail());
9597

@@ -102,6 +104,7 @@ public function testUserData()
102104
],
103105
$user->toArray()
104106
);
107+
$this->assertInstanceOf(\DOMElement::class, $user->getData());
105108
}
106109

107110
public function testExceptionThrownWhenErrorObjectReceived()

0 commit comments

Comments
 (0)