forked from php-tmdb/api
-
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.
- Loading branch information
0 parents
commit 710fa72
Showing
5 changed files
with
109 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor/ | ||
/composer.lock | ||
/*.php | ||
/.idea/ |
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,19 @@ | ||
<?php | ||
/** | ||
* This file is part of the Wrike PHP API created by B-Found IM&S. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Wrike | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, B-Found Internet Marketing & Services | ||
* @version 0.0.1 | ||
*/ | ||
|
||
namespace Tmdb\Api; | ||
|
||
|
||
interface ApiInterface { | ||
|
||
} |
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,19 @@ | ||
<?php | ||
/** | ||
* This file is part of the Wrike PHP API created by B-Found IM&S. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Wrike | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, B-Found Internet Marketing & Services | ||
* @version 0.0.1 | ||
*/ | ||
|
||
namespace Tmdb\Api; | ||
|
||
|
||
class Movies { | ||
|
||
} |
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,48 @@ | ||
<?php | ||
/** | ||
* This file is part of the Wrike PHP API created by B-Found IM&S. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Wrike | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, B-Found Internet Marketing & Services | ||
* @version 0.0.1 | ||
*/ | ||
|
||
namespace Tmdb\HttpClient\Plugin; | ||
|
||
use Guzzle\Common\Event; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Tmdb\ApiToken; | ||
|
||
class ApiTokenPlugin implements EventSubscriberInterface | ||
{ | ||
/** | ||
* @var \Tmdb\ApiToken | ||
*/ | ||
private $token; | ||
|
||
public function __construct(ApiToken $token) | ||
{ | ||
$this->token = $token; | ||
} | ||
|
||
public static function getSubscribedEvents() | ||
{ | ||
return array('request.before_send' => 'onBeforeSend'); | ||
} | ||
|
||
public function onBeforeSend(Event $event) | ||
{ | ||
$url = $event['request']->getUrl(true); | ||
|
||
$origionalQuery = $url->getQuery(); | ||
$newQuery = clone $origionalQuery; | ||
|
||
$newQuery->set('api_key', $this->token->getApiToken()); | ||
|
||
$event['request']->setUrl($url->setQuery($newQuery)); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
/** | ||
* This file is part of the Wrike PHP API created by B-Found IM&S. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Wrike | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, B-Found Internet Marketing & Services | ||
* @version 0.0.1 | ||
*/ | ||
|
||
namespace Tmdb\HttpClient\Plugin; | ||
|
||
|
||
class ApiTokenPlugin { | ||
|
||
} |