mirror of
https://github.com/devfake/flox.git
synced 2024-11-15 14:42:31 +01:00
619e407bcd
* start with subpage design * transitions * transitions * transitions, stuff * modal for trailer * english fallback for trailers * slugs in url * bit refactor * tests and fixtures * travis * update production files * move time limit to config and display error message to user * fix import * fix review
27 lines
548 B
PHP
27 lines
548 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use DiDom\Document;
|
|
|
|
class IMDB {
|
|
|
|
private $document;
|
|
|
|
public function __construct(Document $document)
|
|
{
|
|
$this->document = $document;
|
|
}
|
|
|
|
public function parseRating($id = null)
|
|
{
|
|
$document = $this->document->loadHtmlFile(config('services.imdb.url') . $id);
|
|
|
|
// We don't need to check if we found a result if we loop over them.
|
|
foreach($document->find('.ratingValue strong span') as $rating) {
|
|
return $rating->text();
|
|
}
|
|
|
|
return null;
|
|
}
|
|
} |