1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-15 22:52:32 +01:00
flox/backend/app/Services/IMDB.php
Viktor Geringer 619e407bcd subpage design (#64)
* 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
2017-04-11 08:45:08 +02:00

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;
}
}