Skip to content

Commit 1355c0a

Browse files
committed
WIP
1 parent 6f1f0b7 commit 1355c0a

10 files changed

Lines changed: 47 additions & 77 deletions

File tree

lib/Tmdb/Event/RequestSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ public function send(RequestEvent $event)
5656
*/
5757
public function sendRequest(RequestEvent $event)
5858
{
59-
$response = null;
60-
6159
switch ($event->getMethod()) {
6260
case 'GET':
6361
$response = $this->getHttpClient()->getAdapter()->get($event->getRequest());

lib/Tmdb/Factory/Common/VideoFactory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ private function resolveVideoType($data)
6262
switch ($site) {
6363
case 'youtube':
6464
return new Video\Youtube();
65-
break;
6665
default:
6766
return new Video();
68-
break;
6967
}
7068
}
7169
}

lib/Tmdb/Factory/FindFactory.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ class FindFactory extends AbstractFactory
3636
*/
3737
private $tvFactory;
3838

39+
/**
40+
* @var TvSeasonFactory
41+
*/
42+
private $tvSeasonFactory;
43+
44+
/**
45+
* @var TvEpisodeFactory
46+
*/
47+
private $tvEpisodeFactory;
48+
3949
/**
4050
* Constructor
4151
*

lib/Tmdb/Factory/People/CastFactory.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Tmdb\Factory\People;
1414

1515
use Tmdb\Factory\PeopleFactory;
16-
use Tmdb\HttpClient\HttpClient;
1716
use Tmdb\Model\Collection\People\Cast;
1817

1918
/**
@@ -22,24 +21,6 @@
2221
*/
2322
class CastFactory extends PeopleFactory
2423
{
25-
/**
26-
* Constructor
27-
*
28-
* @param HttpClient $httpClient
29-
*/
30-
public function __construct(HttpClient $httpClient)
31-
{
32-
parent::__construct($httpClient);
33-
}
34-
35-
/**
36-
* {@inheritdoc}
37-
*/
38-
public function create(array $data = [], $person = null)
39-
{
40-
return parent::create($data, $person);
41-
}
42-
4324
/**
4425
* {@inheritdoc}
4526
* @param \Tmdb\Model\Person\CastMember $person

lib/Tmdb/Factory/People/CrewFactory.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Tmdb\Factory\People;
1414

1515
use Tmdb\Factory\PeopleFactory;
16-
use Tmdb\HttpClient\HttpClient;
1716
use Tmdb\Model\Collection\People\Crew;
1817

1918
/**
@@ -22,24 +21,6 @@
2221
*/
2322
class CrewFactory extends PeopleFactory
2423
{
25-
/**
26-
* Constructor
27-
*
28-
* @param HttpClient $httpClient
29-
*/
30-
public function __construct(HttpClient $httpClient)
31-
{
32-
parent::__construct($httpClient);
33-
}
34-
35-
/**
36-
* {@inheritdoc}
37-
*/
38-
public function create(array $data = [], $person = null)
39-
{
40-
return parent::create($data, $person);
41-
}
42-
4324
/**
4425
* {@inheritdoc}
4526
* @param \Tmdb\Model\Person\CrewMember $person

lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class GuzzleAdapter extends AbstractAdapter
2727
{
2828
/**
29-
* @var Client
29+
* @var ClientInterface
3030
*/
3131
private $client;
3232

@@ -88,9 +88,11 @@ private function createResponse(ResponseInterface $adapterResponse = null)
8888
{
8989
$response = new Response();
9090

91-
$response->setCode($adapterResponse->getStatusCode());
92-
$response->setHeaders(new ParameterBag($adapterResponse->getHeaders()));
93-
$response->setBody((string) $adapterResponse->getBody());
91+
if ($adapterResponse !== null) {
92+
$response->setCode($adapterResponse->getStatusCode());
93+
$response->setHeaders(new ParameterBag($adapterResponse->getHeaders()));
94+
$response->setBody((string) $adapterResponse->getBody());
95+
}
9496

9597
return $response;
9698
}
@@ -102,9 +104,9 @@ private function createResponse(ResponseInterface $adapterResponse = null)
102104
* @param RequestException|null $previousException
103105
* @throws \Tmdb\Exception\TmdbApiException
104106
*/
105-
protected function handleRequestException(Request $request, RequestException $previousException = null)
107+
protected function handleRequestException(Request $request, RequestException $previousException)
106108
{
107-
if (null !== $previousException && null == $response = $previousException->getResponse()) {
109+
if (null !== $previousException && null == $previousException->getResponse()) {
108110
throw new NullResponseException($this->request, $previousException);
109111
}
110112

lib/Tmdb/HttpClient/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class HttpClient
5656
private $eventDispatcher;
5757

5858
/**
59-
* @var ParameterBag
59+
* @var array
6060
*/
6161
protected $options;
6262

lib/Tmdb/Model/Common/AccountStates.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getId()
9393
}
9494

9595
/**
96-
* @param \Tmdb\Model\Movie\Rating $rated
96+
* @param Rating $rated
9797
* @return $this
9898
*/
9999
public function setRated($rated)
@@ -104,7 +104,7 @@ public function setRated($rated)
104104
}
105105

106106
/**
107-
* @return \Tmdb\Model\Movie\Rating
107+
* @return Rating
108108
*/
109109
public function getRated()
110110
{

lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ protected function with($with = null, $mode = self::MODE_OR)
441441
/**
442442
* Creates an and query to combine an AND or an OR expression.
443443
*
444-
* @param array $with
445-
* @param int $mode
446-
* @return $this
444+
* @param array $with
445+
* @param int $mode
446+
* @return string
447447
*/
448448
protected function andWith(array $with, $mode)
449449
{
@@ -471,12 +471,12 @@ protected function normalize($mixed)
471471
}
472472

473473
/**
474-
* @param \DateTime|string $year
475-
* @param string $format
474+
* @param \DateTime|string|integer $year
475+
* @param string $format
476476
* @return int
477477
*/
478478
protected function getDate($year, $format = 'Y-m-d')
479479
{
480-
return ($year instanceof \DateTime) ? $year->format($format) : $year;
480+
return ($year instanceof \DateTime) ? $year->format($format) : (string) $year;
481481
}
482482
}

lib/Tmdb/Model/Tv.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,19 @@ class Tv extends AbstractModel
239239
*/
240240
public function __construct()
241241
{
242-
$this->genres = new Genres();
243-
$this->networks = new GenericCollection();
244-
$this->originCountry = new GenericCollection();
245-
$this->seasons = new GenericCollection();
242+
$this->genres = new Genres();
243+
$this->networks = new GenericCollection();
244+
$this->originCountry = new GenericCollection();
245+
$this->seasons = new GenericCollection();
246246

247-
$this->credits = new CreditsCollection();
248-
$this->externalIds = new ExternalIds();
249-
$this->images = new Images();
250-
$this->translations = new GenericCollection();
251-
$this->videos = new Videos();
252-
$this->changes = new GenericCollection();
253-
$this->keywords = new GenericCollection();
254-
$this->similar = new GenericCollection();
247+
$this->credits = new CreditsCollection();
248+
$this->externalIds = new ExternalIds();
249+
$this->images = new Images();
250+
$this->translations = new GenericCollection();
251+
$this->videos = new Videos();
252+
$this->changes = new GenericCollection();
253+
$this->keywords = new GenericCollection();
254+
$this->similar = new GenericCollection();
255255
}
256256

257257
/**
@@ -274,7 +274,7 @@ public function getBackdropPath()
274274
}
275275

276276
/**
277-
* @param \Tmdb\Model\Common\Collection $createdBy
277+
* @param GenericCollection $createdBy
278278
* @return $this
279279
*/
280280
public function setCreatedBy($createdBy)
@@ -529,7 +529,7 @@ public function getNumberOfSeasons()
529529
}
530530

531531
/**
532-
* @param \Tmdb\Model\Common\Collection $originCountry
532+
* @param GenericCollection $originCountry
533533
* @return $this
534534
*/
535535
public function setOriginCountry($originCountry)
@@ -833,7 +833,7 @@ public function getVideos()
833833
}
834834

835835
/**
836-
* @param \Tmdb\Model\GenericCollection $changes
836+
* @param GenericCollection $changes
837837
* @return $this
838838
*/
839839
public function setChanges($changes)
@@ -844,15 +844,15 @@ public function setChanges($changes)
844844
}
845845

846846
/**
847-
* @return \Tmdb\Model\GenericCollection
847+
* @return GenericCollection
848848
*/
849849
public function getChanges()
850850
{
851851
return $this->changes;
852852
}
853853

854854
/**
855-
* @param \Tmdb\Model\GenericCollection $keywords
855+
* @param GenericCollection $keywords
856856
* @return $this
857857
*/
858858
public function setKeywords($keywords)
@@ -863,15 +863,15 @@ public function setKeywords($keywords)
863863
}
864864

865865
/**
866-
* @return \Tmdb\Model\GenericCollection
866+
* @return GenericCollection
867867
*/
868868
public function getKeywords()
869869
{
870870
return $this->keywords;
871871
}
872872

873873
/**
874-
* @param \Tmdb\Model\GenericCollection $similar
874+
* @param GenericCollection $similar
875875
* @return $this
876876
*/
877877
public function setSimilar($similar)
@@ -882,7 +882,7 @@ public function setSimilar($similar)
882882
}
883883

884884
/**
885-
* @return \Tmdb\Model\GenericCollection
885+
* @return GenericCollection
886886
*/
887887
public function getSimilar()
888888
{

0 commit comments

Comments
 (0)