Skip to content

Commit 4415bc4

Browse files
authored
Merge pull request #201 from aiham/use-guzzle-6
Upgrade to Guzzle 6
2 parents 6002a27 + c3d4921 commit 4415bc4

File tree

37 files changed

+985
-910
lines changed

37 files changed

+985
-910
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
},
3030
"require": {
3131
"php": ">=5.6.0",
32-
"guzzle/guzzle": "~3.7",
3332
"johnstevenson/json-works": "~1.1",
34-
"firebase/php-jwt": "^5.0"
33+
"firebase/php-jwt": "^5.0",
34+
"guzzlehttp/guzzle": "~6.0"
3535
},
3636
"require-dev": {
3737
"phpunit/phpunit": "~5.7",

sample/Archiving/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ is sent to the <http://localhost:8080/stop/:archiveId> URL where `:archiveId` re
9898
client receives in the 'archiveStarted' event. The route handler for this request is shown below:
9999

100100
```php
101-
$app->get('/stop/:archiveId', function($archiveId) use ($app) {
101+
$app->get('/stop/:archiveId', function ($archiveId) use ($app) {
102102
$archive = $app->opentok->stopArchive($archiveId);
103103
$app->response->headers->set('Content-Type', 'application/json');
104104
echo $archive->toJson();
@@ -168,7 +168,7 @@ $app->get('/history', function () use ($app) {
168168

169169
$archives = $app->opentok->listArchives($offset, 5);
170170

171-
$toArray = function($archive) {
171+
$toArray = function ($archive) {
172172
return $archive->toArray();
173173
};
174174

@@ -214,7 +214,7 @@ from the URL. Lastly, we send a redirect response back to the browser so the dow
214214
The code for the delete route handler is shown below:
215215

216216
```php
217-
$app->get('/delete/:archiveId', function($archiveId) use ($app) {
217+
$app->get('/delete/:archiveId', function ($archiveId) use ($app) {
218218
$app->opentok->deleteArchive($archiveId);
219219
$app->redirect('/history');
220220
});

sample/Archiving/web/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
));
3434

3535
// Intialize a cache, store it in the app container
36-
$app->container->singleton('cache', function() {
36+
$app->container->singleton('cache', function () {
3737
return new Cache;
3838
});
3939

@@ -45,7 +45,7 @@
4545
$app->apiKey = getenv('API_KEY');
4646

4747
// If a sessionId has already been created, retrieve it from the cache
48-
$sessionId = $app->cache->getOrCreate('sessionId', array(), function() use ($app) {
48+
$sessionId = $app->cache->getOrCreate('sessionId', array(), function () use ($app) {
4949
// If the sessionId hasn't been created, create it now and store it
5050
$session = $app->opentok->createSession(array(
5151
'mediaMode' => MediaMode::ROUTED
@@ -94,7 +94,7 @@
9494

9595
$archives = $app->opentok->listArchives($offset, 5);
9696

97-
$toArray = function($archive) {
97+
$toArray = function ($archive) {
9898
return $archive->toArray();
9999
};
100100

@@ -123,13 +123,13 @@
123123
echo $archive->toJson();
124124
});
125125

126-
$app->get('/stop/:archiveId', function($archiveId) use ($app) {
126+
$app->get('/stop/:archiveId', function ($archiveId) use ($app) {
127127
$archive = $app->opentok->stopArchive($archiveId);
128128
$app->response->headers->set('Content-Type', 'application/json');
129129
echo $archive->toJson();
130130
});
131131

132-
$app->get('/delete/:archiveId', function($archiveId) use ($app) {
132+
$app->get('/delete/:archiveId', function ($archiveId) use ($app) {
133133
$app->opentok->deleteArchive($archiveId);
134134
$app->redirect('/history');
135135
});

sample/HelloWorld/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ stored in the cache for later use.
8080

8181
```php
8282
// If a sessionId has already been created, retrieve it from the cache
83-
$sessionId = $app->cache->getOrCreate('sessionId', array(), function() use ($app) {
83+
$sessionId = $app->cache->getOrCreate('sessionId', array(), function () use ($app) {
8484
// If the sessionId hasn't been created, create it now and store it
8585
$session = $app->opentok->createSession();
8686
return $session->getSessionId();

sample/HelloWorld/web/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
));
3030

3131
// Intialize a cache, store it in the app container
32-
$app->container->singleton('cache', function() {
32+
$app->container->singleton('cache', function () {
3333
return new Cache;
3434
});
3535

@@ -44,7 +44,7 @@
4444
$app->get('/', function () use ($app) {
4545

4646
// If a sessionId has already been created, retrieve it from the cache
47-
$sessionId = $app->cache->getOrCreate('sessionId', array(), function() use ($app) {
47+
$sessionId = $app->cache->getOrCreate('sessionId', array(), function () use ($app) {
4848
// If the sessionId hasn't been created, create it now and store it
4949
$session = $app->opentok->createSession();
5050
return $session->getSessionId();

sample/SipCall/web/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
));
3535

3636
// Intialize a cache, store it in the app container
37-
$app->container->singleton('cache', function() {
37+
$app->container->singleton('cache', function () {
3838
return new Cache;
3939
});
4040

@@ -56,7 +56,7 @@
5656
// Configure routes
5757
$app->get('/', function () use ($app) {
5858
// If a sessionId has already been created, retrieve it from the cache
59-
$sessionId = $app->cache->getOrCreate('sessionId', array(), function() use ($app) {
59+
$sessionId = $app->cache->getOrCreate('sessionId', array(), function () use ($app) {
6060
// If the sessionId hasn't been created, create it now and store it
6161
$session = $app->opentok->createSession(array('mediaMode' => MediaMode::ROUTED));
6262
return $session->getSessionId();

src/OpenTok/Broadcast.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class Broadcast {
1515
private $isStopped = false;
1616
private $client;
1717

18-
public function __construct($broadcastData, $options = array()) {
18+
public function __construct($broadcastData, $options = array())
19+
{
1920
// unpack optional arguments (merging with default values) into named variables
2021
$defaults = array(
2122
'apiKey' => null,

src/OpenTok/Layout.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ private function __construct($type, $stylesheet = null)
7979
$this->stylesheet = $stylesheet;
8080
}
8181

82-
public function jsonSerialize() {
82+
public function jsonSerialize()
83+
{
8384
$data = array(
8485
'type' => $this->type
8586
);

src/OpenTok/OpenTok.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public function __construct($apiKey, $apiSecret, $options = array())
5050
Validators::validateClient($client);
5151

5252
$this->client = isset($client) ? $client : new Client();
53-
$this->client->configure($apiKey, $apiSecret, $apiUrl);
53+
if (!$this->client->isConfigured()) {
54+
$this->client->configure($apiKey, $apiSecret, $apiUrl);
55+
}
5456
$this->apiKey = $apiKey;
5557
$this->apiSecret = $apiSecret;
5658
}
@@ -282,7 +284,7 @@ public function startArchive($sessionId, $options=array())
282284
{
283285
// support for deprecated method signature, remove in v3.0.0 (not before)
284286
if (!is_array($options)) {
285-
$options = array('name' => $options);
287+
$options = array('name' => $options);
286288
}
287289

288290
// unpack optional arguments (merging with default values) into named variables

src/OpenTok/Util/BasicEnum.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
abstract class BasicEnum {
99
private static $constCacheArray = null;
1010

11-
private static function getConstants() {
11+
private static function getConstants()
12+
{
1213
if (self::$constCacheArray === null) self::$constCacheArray = array();
1314

1415
$calledClass = get_called_class();
@@ -20,7 +21,8 @@ private static function getConstants() {
2021
return self::$constCacheArray[$calledClass];
2122
}
2223

23-
public static function isValidName($name, $strict = false) {
24+
public static function isValidName($name, $strict = false)
25+
{
2426
$constants = self::getConstants();
2527

2628
if ($strict) {
@@ -31,7 +33,8 @@ public static function isValidName($name, $strict = false) {
3133
return in_array(strtolower($name), $keys);
3234
}
3335

34-
public static function isValidValue($value) {
36+
public static function isValidValue($value)
37+
{
3538
$values = array_values(self::getConstants());
3639
return in_array($value, $values, $strict = true);
3740
}

0 commit comments

Comments
 (0)