Skip to content

Commit fded7db

Browse files
committed
Changed namespace to hmerritt on all files
1 parent 33cdedc commit fded7db

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"autoload": {
2222
"psr-4": {
23-
"hmerritt\\Imdb\\": "src/"
23+
"hmerritt\\": "src/"
2424
}
2525
}
2626
}

src/Dom.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
2-
namespace hmerritt\Dom;
2+
namespace hmerritt;
33

44
/**
5-
* Class Imdb
5+
* Class Dom
66
*
77
*
88
* @package hmerritt/imdb-api
@@ -16,11 +16,11 @@ class Dom
1616
*
1717
* @param string $url
1818
*
19-
* @return Dom
19+
* @return \PHPHtmlParser\Dom
2020
*/
21-
public function fetch(string $url, array $options): Dom
21+
public function fetch(string $url, array $options)
2222
{
23-
$dom = new Dom;
23+
$dom = new \PHPHtmlParser\Dom;
2424
$dom->loadFromUrl($url, [
2525
"curlHeaders" => $options["curlHeaders"]
2626
]);
@@ -35,7 +35,7 @@ public function fetch(string $url, array $options): Dom
3535
*
3636
* @return array
3737
*/
38-
public function find(object $dom, string $selection): array
38+
public function find(object $dom, string $selection)
3939
{
4040
$found = $dom->find($selection);
4141
if (count($found) > 0) {
@@ -51,7 +51,7 @@ public function find(object $dom, string $selection): array
5151
*
5252
* @return Dom
5353
*/
54-
private function emptyElement(): Dom
54+
private function emptyElement()
5555
{
5656
$dom = new Dom;
5757
$dom->load('<a src="" href="" data-video=""></a>');

src/Response.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
namespace hmerritt;
3+
4+
/**
5+
* Class Response
6+
*
7+
*
8+
* @package hmerritt/imdb-api
9+
* @author Harry Merritt
10+
*/
11+
class Response
12+
{
13+
14+
}

src/imdb.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
2-
namespace hmerritt\Imdb;
3-
4-
use PHPHtmlParser\Dom;
2+
namespace hmerritt;
53

64
/**
75
* Class Imdb
@@ -31,7 +29,7 @@ private function populateOptions(array $options = []): array
3129
// Default options
3230
$defaults = [
3331
'cache' => true,
34-
'curlHeaders' => [],
32+
'curlHeaders' => ['Accept-Language: en-US,en;q=0.5'],
3533
'techSpecs' => true,
3634
];
3735

@@ -56,6 +54,13 @@ public function film(string $film, array $options = []): array
5654
// Combine user options with default ones
5755
$options = $this->populateOptions($options);
5856

57+
// Initiate response object
58+
// -> handles what the api returns
59+
$response = new Response;
60+
61+
$dom = new Dom;
62+
$page = $dom->fetch("https://www.imdb.com/title/tt0816692/", $options);
63+
5964
return [
6065
"id" => "tt0816692",
6166
"title" => "Interstellar",

tests/ImdbTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
use PHPUnit\Framework\TestCase;
4-
use hmerritt\Imdb\Imdb;
4+
use hmerritt\Imdb;
55

66
class ImdbTest extends TestCase {
77

tests/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// Import libs
77
require "../vendor/autoload.php";
8-
use hmerritt\Imdb\Imdb;
8+
use hmerritt\Imdb;
99

1010

1111
// Get url search param

0 commit comments

Comments
 (0)