forked from php-tmdb/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extending more models and creating some more "logical" approaches to …
…different type of people (person). - Updated Genres, added a filter capability.
- Loading branch information
1 parent
14a13d3
commit 02693b1
Showing
15 changed files
with
1,685 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/composer.lock | ||
/*.php | ||
/.idea/ | ||
/examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model\Common; | ||
|
||
class Images extends Collection { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model\Common; | ||
|
||
use Guzzle\Common\Collection as GuzzleCollection; | ||
|
||
class Collection extends GuzzleCollection { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model\Common; | ||
|
||
use Tmdb\Model\Genre; | ||
|
||
class Genres extends Collection { | ||
|
||
/** | ||
* Returns all genres | ||
* | ||
* @return array | ||
*/ | ||
public function getGenres() | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* Retrieve a genre from the collection | ||
* | ||
* @param $id | ||
* @return null | ||
*/ | ||
public function getGenre($id) { | ||
foreach($this->data as $genre) { | ||
if ($id === $genre->getId()) { | ||
return $genre; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* Add a genre to the collection | ||
* | ||
* @param Genre $genre | ||
*/ | ||
public function addGenre(Genre $genre) | ||
{ | ||
$this->data[] = $genre; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model\Common; | ||
|
||
use Tmdb\Model\Image; | ||
|
||
class Images extends Collection { | ||
|
||
/** | ||
* Returns all images | ||
* | ||
* @return array | ||
*/ | ||
public function getImages() | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* Retrieve a image from the collection | ||
* | ||
* @param $id | ||
* @return null | ||
*/ | ||
public function getImage($id) { | ||
foreach($this->data as $image) { | ||
if ($id === $image->getId()) { | ||
return $image; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* Add a image to the collection | ||
* | ||
* @param Image $image | ||
*/ | ||
public function addImage(Image $image) | ||
{ | ||
$this->data[] = $image; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model\Common; | ||
|
||
use Tmdb\Model\Person; | ||
|
||
class People extends Collection { | ||
|
||
/** | ||
* Returns all people | ||
* | ||
* @return array | ||
*/ | ||
public function getPeople() | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* Retrieve a person from the collection | ||
* | ||
* @param $id | ||
* @return null | ||
*/ | ||
public function getPerson($id) { | ||
foreach($this->data as $person) { | ||
if ($id === $person->getId()) { | ||
return $person; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* Add a person to the collection | ||
* | ||
* @param Person $person | ||
*/ | ||
public function addPerson(Person $person) | ||
{ | ||
$this->data[] = $person; | ||
} | ||
} |
Oops, something went wrong.