Skip to content

construct function without parameters obliterates pre-set clientId, clientSecret and accessToken #1

@pinzler

Description

@pinzler

The construct function defaults the parameters clientId, clientSecret and accessToken to null so doing this:

$btlObj = new Bitly;

... wipes out any pre-set keys/tokens. There probably is a much cleaner way too fix this (hence why I'm doing this as an issue and not a pull request) but I did quickly this way for the user who needed help:

public function __construct($clientId=null, $clientSecret=null,
$accessToken=null)
{

    if ($clientId!==null)
        $this->clientId = $clientId;
    if ($clientSecret!==null)
        $this->clientSecret = $clientSecret;
    if ($accessToken!==null)
        $this->accessToken = $accessToken;

    $this->userAgent = 'PHP/' . phpversion() . ' bitly_api/0.1.0';

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions