Skip to content

Instantly share code, notes, and snippets.

@YOzaz
Last active October 30, 2015 10:53
Show Gist options
  • Save YOzaz/ef0baebc3a9d29a1a652 to your computer and use it in GitHub Desktop.
Save YOzaz/ef0baebc3a9d29a1a652 to your computer and use it in GitHub Desktop.
<?php namespace App\Services;
use \Pest;
class Yourls
{
/** @var Pest Our connection handler **/
protected $library = null;
/** @var string $oken **/
protected $token = null;
/**
* Sets service, authentication if provided.
*
* @param string $service url
* @param string $token
*/
function __construct( $service = null, $token = null )
{
if ( $service )
{
$this->init( $service, $token );
}
}
/**
* Initializes connection
*
* @param string $service
* @param string $token
*/
protected function init( $service, $token )
{
$this->library = new Pest( $service );
$this->token = $token;
}
/**
* Connects to a service API
*
* @param string $service
* @param string $token
*/
public static function connect( $service, $token )
{
return new static( $service, $token );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment