-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(location): Relocate twitter client in twitter lib
This commit adds classes previously located in twitter-stream in this lib
- Loading branch information
Showing
34 changed files
with
3,399 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Twitter\API\Exception; | ||
|
||
class TwitterException extends \Exception | ||
{ | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Twitter\API\Exception; | ||
|
||
use Twitter\API\REST\Response\ApiRate; | ||
|
||
class TwitterRateLimitException extends TwitterException | ||
{ | ||
/** @var string */ | ||
private $category; | ||
|
||
/** @var ApiRate */ | ||
private $rate; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCategory() | ||
{ | ||
return $this->category; | ||
} | ||
|
||
/** | ||
* @return \DateTimeInterface | ||
*/ | ||
public function nextWindow() | ||
{ | ||
return $this->rate->nextWindow(); | ||
} | ||
|
||
/** | ||
* @param string $category | ||
* @param ApiRate $rate | ||
* | ||
* @return TwitterRateLimitException | ||
*/ | ||
public static function create($category, ApiRate $rate) | ||
{ | ||
$exception = new self('You have reached rate limit. You cannot make an API call yet.'); | ||
$exception->category = $category; | ||
$exception->rate = $rate; | ||
|
||
return $exception; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Twitter\API\REST; | ||
|
||
interface ApiParameters | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function toArray(); | ||
} |
Oops, something went wrong.