src/UserAttribution.php
public function get($sourceId, $targetId = null)
    {
        $url = self::IDP_ATTRIBUTIONS_API . '/' . $sourceId;
        if ($targetId) {
            $url .= '?target=' . urlencode($targetId);
        }

        $request = (new RequestDescriptor())
            ->setUrl($this->buildUrl($url))
            ->setMethod('GET');

        try {
            return json_decode($this->send($request)->getBody(), true);
        } catch (\Exception $e) {
            $previous = $e->getPrevious();

            if ($previous instanceof BadResponseException) {
                $error = json_decode($previous->getResponse()->getBody(), true);

                throw new UserAttributionException($error['error'], $error['code'], $previous);
            }

            throw new UserAttributionException($e->getMessage(), $e->getCode(), $e->getPrevious());
        }
    }
public function get($sourceId, $targetId = null)
    {
        $url = self::IDP_ATTRIBUTIONS_API . '/' . $sourceId;
        if ($targetId) {
            $url .= '?target=' . urlencode($targetId);
        }

        $request = (new RequestDescriptor())
            ->setUrl($this->buildUrl($url))
            ->setMethod('GET');

        try {
            return json_decode($this->send($request)->getBody(), true);
        } catch (\Exception $e) {
            $previous = $e->getPrevious();

            if ($previous instanceof BadResponseException) {
                $error = json_decode($previous->getResponse()->getBody(), true);

                throw new UserAttributionException($error['error'], $error['code'], $previous);
            }

            throw new UserAttributionException($e->getMessage(), $e->getCode(), $e->getPrevious());
        }
    }
public function get ( $ sourceId , $ targetId = null ) { $ url = self :: IDP_ATTRIBUTIONS_API . '/' . $ sourceId ; if ( $ targetId ) { $ url .= '?target=' . urlencode ( $ targetId ) ; } $ request = ( new RequestDescriptor ( ) ) -> setUrl ( $ this -> buildUrl ( $ url ) ) -> setMethod ( 'GET' ) ; try { return json_decode ( $ this -> send ( $ request ) -> getBody ( ) , true ) ; } catch ( \ Exception $ e ) { $ previous = $ e -> getPrevious ( ) ; if ( $ previous instanceof BadResponseException ) { $ error = json_decode ( $ previous -> getResponse ( ) -> getBody ( ) , true ) ; throw new UserAttributionException ( $ error [ 'error' ] , $ error [ 'code' ] , $ previous ) ; } throw new UserAttributionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } }
Get an User Attributions

@param int $sourceId
@param int|null $targetId

@return Attribution[]
Get an User Attributions