Last active
October 30, 2015 10:53
-
-
Save YOzaz/ef0baebc3a9d29a1a652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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