Skip to content

Commit

Permalink
refactor(location): Relocate twitter client in twitter lib
Browse files Browse the repository at this point in the history
This commit adds classes previously located in twitter-stream in this lib
  • Loading branch information
remi-san committed Jul 8, 2017
1 parent d83f326 commit d4821eb
Show file tree
Hide file tree
Showing 34 changed files with 3,399 additions and 3 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}
],
"require-dev": {
"jublonet/codebird-php": "~3.0",
"phpunit/phpunit": "~4.5",
"Mockery/Mockery": "~0.9",
"friendsofphp/php-cs-fixer": "^1.10",
Expand All @@ -23,7 +24,8 @@
"fzaninotto/faker": "^1.6"
},
"suggest": {
"doctrine/orm": "Use the twitter types in doctrine"
"doctrine/orm": "Use the twitter types in doctrine",
"jublonet/codebird-php": "To get the codebird implementation to access the twitter API"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions src/API/Exception/TwitterException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Twitter\API\Exception;

class TwitterException extends \Exception
{
}
45 changes: 45 additions & 0 deletions src/API/Exception/TwitterRateLimitException.php
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;
}
}
11 changes: 11 additions & 0 deletions src/API/REST/ApiParameters.php
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();
}

0 comments on commit d4821eb

Please sign in to comment.