Skip to content

Commit 9d6fca3

Browse files
authored
Merge pull request #66 from bzbislawski/master
Upgrade to php7 and psr-4
2 parents f6abd68 + 7f062d9 commit 9d6fca3

File tree

9 files changed

+76
-130
lines changed

9 files changed

+76
-130
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
composer.phar
33
composer.lock
44
.DS_Store
5+
.idea

composer.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=5.3.0"
13+
"php": "^7.0"
1414
},
15-
"require-dev":{
16-
"phpunit/phpunit": "3.7.*@stable"
15+
"require-dev": {
16+
"phpunit/phpunit": "^6.1"
1717
},
1818
"autoload": {
19-
"psr-0": {
20-
"Alaouy\\Youtube\\": "src/"
19+
"psr-4": {
20+
"Alaouy\\Youtube\\": "src"
21+
}
22+
},
23+
"autoload-dev": {
24+
"psr-4": {
25+
"Alaouy\\Youtube\\Tests\\": "tests"
2126
}
2227
},
2328
"minimum-stability": "dev"

src/Alaouy/Youtube/YoutubeServiceProvider.php

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/YoutubeServiceProvider.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Alaouy\Youtube;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class YoutubeServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* Bootstrap the application events.
11+
*
12+
* @return void
13+
*/
14+
public function boot()
15+
{
16+
$this->publishes(array(__DIR__ . '/config/youtube.php' => config_path('youtube.php')));
17+
}
18+
19+
/**
20+
* Register the service provider.
21+
*
22+
* @return void
23+
*/
24+
public function register()
25+
{
26+
$this->app->bind('youtube', function () {
27+
return new Youtube(config('youtube.key'));
28+
});
29+
}
30+
31+
/**
32+
* Get the services provided by the provider.
33+
*
34+
* @return array
35+
*/
36+
public function provides()
37+
{
38+
return [Youtube::class];
39+
}
40+
}

src/config/config.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/config/youtube.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
<?php
1+
<?php
22

3+
/*
4+
|--------------------------------------------------------------------------
5+
| Laravel PHP Facade/Wrapper for the Youtube Data API v3
6+
|--------------------------------------------------------------------------
7+
|
8+
| Here is where you can set your key for Youtube API. In case you do not
9+
| have it, it can be acquired from: https://console.developers.google.com
10+
*/
311

4-
// You can find the keys here : https://console.developers.google.com
5-
6-
return array(
7-
'KEY' => 'YOUR API KEY'
8-
);
12+
return [
13+
'key' => 'YOUR_API_KEY'
14+
];

tests/YoutubeTest.php

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,36 @@
11
<?php
22

3-
namespace Alaouy\Tests;
4-
5-
require_once __DIR__ . '/../vendor/autoload.php';
3+
namespace Alaouy\Youtube\Tests;
64

75
use Alaouy\Youtube\Youtube;
6+
use PHPUnit\Framework\TestCase;
87

9-
class YoutubeTest extends \PHPUnit_Framework_TestCase
8+
class YoutubeTest extends TestCase
109
{
11-
/**
12-
*
13-
*
14-
* @var Youtube
15-
*/
10+
const TEST_API_KEY = 'AIzaSyBPmiEELU0YEH90N2wU2sYeDvrJIoB1tqc';
11+
12+
/** @var Youtube */
1613
public $youtube;
1714

1815
public function setUp()
1916
{
20-
$TEST_API_KEY = 'AIzaSyDDefsgXEZu57wYgABF7xEURClu4UAzyB8';
21-
$this->youtube = new Youtube($TEST_API_KEY);
17+
$this->youtube = new Youtube(self::TEST_API_KEY);
2218
}
2319

2420
public function tearDown()
2521
{
2622
$this->youtube = null;
2723
}
2824

29-
public function MalFormURLProvider()
25+
public function urlProvider()
3026
{
31-
return array(
32-
array('https://'),
33-
array('http://www.yuotube.com'),
34-
);
27+
return [
28+
['https://'],
29+
['http://www.yuotube.com'],
30+
];
3531
}
3632

3733
/**
38-
*
39-
*
4034
* @expectedException \Exception
4135
*/
4236
public function testConstructorFail()
@@ -45,8 +39,6 @@ public function testConstructorFail()
4539
}
4640

4741
/**
48-
*
49-
*
5042
* @expectedException \Exception
5143
*/
5244
public function testConstructorFail2()
@@ -55,8 +47,6 @@ public function testConstructorFail2()
5547
}
5648

5749
/**
58-
*
59-
*
6050
* @expectedException \Exception
6151
*/
6252
public function testInvalidApiKey()
@@ -244,9 +234,7 @@ public function testParseVIdFromEmbedURL()
244234
}
245235

246236
/**
247-
*
248-
*
249-
* @dataProvider MalFormURLProvider
237+
* @dataProvider urlProvider
250238
* @expectedException \Exception
251239
*/
252240
public function testParseVIdFromURLException($url)
@@ -255,8 +243,6 @@ public function testParseVIdFromURLException($url)
255243
}
256244

257245
/**
258-
*
259-
*
260246
* @expectedException \Exception
261247
*/
262248
public function testParseVIdException()

0 commit comments

Comments
 (0)