for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Stevenmaguire\OAuth2\Client\Provider;
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
class SalesforceResourceOwner implements ResourceOwnerInterface
{
/**
* Raw response
*
* @var array
*/
protected $response;
* Creates new resource owner.
* @param array $response
public function __construct(array $response = array())
$this->response = $response;
}
* Get user id
* @return string|null
public function getId()
return $this->getResponseData('user_id');
* Get user first name
public function getFirstName()
return $this->getResponseData('first_name');
* Get user last name
public function getLastName()
return $this->getResponseData('last_name');
* Get user email
public function getEmail()
return $this->getResponseData('email');
* Get user title
public function getTitle()
return $this->getResponseData('custom_attributes.title');
* Attempts to pull value from array using dot notation.
* @param string $path
* @param string $default
* @return mixed
protected function getResponseData($path, $default = null)
$array = $this->response;
if (!empty($path)) {
$keys = explode('.', $path);
foreach ($keys as $key) {
if (isset($array[$key])) {
$array = $array[$key];
} else {
return $default;
return $array;
* Return all of the owner details available as an array.
* @return array
public function toArray()
return $this->response;