Browse Source

More refactoring, fix snapshot tests

Timothy J. Warren 4 months ago
parent
commit
3b3156e78a
31 changed files with 547 additions and 317 deletions
  1. 1
    1
      app/views/manga/cover.php
  2. 4
    4
      app/views/manga/edit.php
  3. 1
    1
      app/views/manga/list.php
  4. 6
    3
      index.php
  5. 1
    1
      public/css.js
  6. 6
    5
      public/js.php
  7. 0
    0
      public/js/cache/.gitkeep
  8. 10
    8
      src/API/Kitsu/Model.php
  9. 24
    17
      src/API/Kitsu/Transformer/MangaListTransformer.php
  10. 8
    6
      src/API/Kitsu/Transformer/MangaTransformer.php
  11. 3
    3
      src/API/MAL/Model.php
  12. 1
    1
      src/Model/Anime.php
  13. 21
    13
      src/Model/Manga.php
  14. 11
    0
      src/Types/AbstractType.php
  15. 1
    5
      src/Types/AnimeFormItem.php
  16. 1
    9
      src/Types/AnimeFormItemData.php
  17. 27
    0
      src/Types/FormItem.php
  18. 30
    0
      src/Types/FormItemData.php
  19. 23
    0
      src/Types/MangaFormItem.php
  20. 19
    0
      src/Types/MangaFormItemData.php
  21. 40
    0
      src/Types/MangaListItem.php
  22. 31
    0
      src/Types/MangaListItemDetail.php
  23. 35
    0
      src/Types/MangaPage.php
  24. 8
    4
      tests/API/Kitsu/Transformer/MangaListTransformerTest.php
  25. 36
    29
      tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testTransform__1.php
  26. 14
    14
      tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testUntransform with data set #0__1.php
  27. 14
    14
      tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testUntransform with data set #1__1.php
  28. 14
    13
      tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testUntransform with data set #2__1.php
  29. 21
    21
      tests/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.php
  30. 121
    126
      tests/API/Kitsu/Transformer/__snapshots__/MangaListTransformerTest__testTransform__1.php
  31. 15
    19
      tests/API/Kitsu/Transformer/__snapshots__/MangaTransformerTest__testTransform__1.php

+ 1
- 1
app/views/manga/cover.php View File

@@ -26,7 +26,7 @@
26 26
 					<img src="<?= $urlGenerator->assetUrl('images/manga', "{$item['manga']['id']}.jpg") ?>" />
27 27
 					<div class="name">
28 28
 						<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
29
-						<?= $escape->html(array_shift($item['manga']['titles'])) ?>
29
+						<?= $escape->html($item['manga']['title']) ?>
30 30
                         <?php foreach($item['manga']['titles'] as $title): ?>
31 31
                             <br /><small><?= $title ?></small>
32 32
                         <?php endforeach ?>

+ 4
- 4
app/views/manga/edit.php View File

@@ -8,7 +8,7 @@
8 8
 			<thead>
9 9
 				<tr>
10 10
                     <th>
11
-                        <h3><?= $escape->html(array_shift($item['manga']['titles'])) ?></h3>
11
+                        <h3><?= $escape->html($item['manga']['title']) ?></h3>
12 12
 						<?php foreach($item['manga']['titles'] as $title): ?>
13 13
                             <h4><?= $escape->html($title) ?></h4>
14 14
 						<?php endforeach ?>
@@ -44,12 +44,12 @@
44 44
 						<input type="number" min="0" name="chapters_read" id="chapters_read" value="<?= $item['chapters']['read'] ?>" /> / <?= $item['chapters']['total'] ?>
45 45
 					</td>
46 46
 				</tr>
47
-				<? /*<tr>
47
+				<tr>
48 48
 					<td><label for="volumes_read">Volumes Read</label></td>
49 49
 					<td>
50
-						<input type="number" min="0" name="volumes_read" id="volumes_read" value="<?= $item['volumes']['read'] ?>" /> / <?= $item['volumes']['total'] ?>
50
+						<input type="text" disabled="disabled" min="0" name="volumes_read" id="volumes_read" value="-" /> / <?= $item['volumes']['total'] ?>
51 51
 					</td>
52
-				</tr> */ ?>
52
+				</tr>
53 53
 				<tr>
54 54
 					<td><label for="rereading_flag">Rereading?</label></td>
55 55
 					<td>

+ 1
- 1
app/views/manga/list.php View File

@@ -39,7 +39,7 @@
39 39
 					<?php endif ?>
40 40
 					<td class="align_left">
41 41
 						<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
42
-							<?= array_shift($item['manga']['titles']) ?>
42
+							<?= $item['manga']['title'] ?>
43 43
 						</a>
44 44
 						<?php foreach($item['manga']['titles'] as $title): ?>
45 45
 	                        <br /><?= $title ?>

+ 6
- 3
index.php View File

@@ -28,9 +28,12 @@ if ($timezone === '' || $timezone === FALSE)
28 28
 // Load composer autoloader
29 29
 require_once __DIR__ . '/vendor/autoload.php';
30 30
 
31
-$whoops = new \Whoops\Run;
32
-$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
33
-$whoops->register();
31
+// if (array_key_exists('ENV', $_ENV) && $_ENV['ENV'] === 'development')
32
+{
33
+	$whoops = new \Whoops\Run;
34
+	$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
35
+	$whoops->register();
36
+}
34 37
 
35 38
 // Define base directories
36 39
 $APP_DIR = _dir(__DIR__, 'app');

+ 1
- 1
public/css.js View File

@@ -7,7 +7,7 @@ const atImport = require('postcss-import');
7 7
 const cssNext = require('postcss-cssnext');
8 8
 const cssNano = require('cssnano');
9 9
 
10
-const css = fs.readFileSync('css/base.css', 'utf8');
10
+const css = fs.readFileSync('css/base.css', 'utf-8');
11 11
 
12 12
 postcss()
13 13
 	.use(atImport())

+ 6
- 5
public/js.php View File

@@ -22,7 +22,7 @@ use Aviat\AnimeClient\API\HummingbirdClient;
22 22
 use Aviat\Ion\{Json, JsonException};
23 23
 
24 24
 // Include Amp and Artax
25
-require_once('../vendor/autoload.php');
25
+require_once '../vendor/autoload.php';
26 26
 
27 27
 //Creative rewriting of /g/groupname to ?g=groupname
28 28
 $pi = $_SERVER['PATH_INFO'];
@@ -318,10 +318,11 @@ class JSMin {
318 318
 		$lastModifiedDate = gmdate('D, d M Y H:i:s', $lastModified);
319 319
 		$expiresDate = gmdate('D, d M Y H:i:s', $expires);
320 320
 
321
-		header("Content-Type: {$mimeType}; charset=utf8");
322
-		header("Cache-control: public, max-age=691200, must-revalidate");
323
-		header("Last-Modified: {$lastModifiedDate} GMT");
321
+		header("Content-Type: {$mimeType}; charset=utf-8");
322
+		header('Cache-control: public, max-age=691200, must-revalidate');
324 323
 		header("Expires: {$expiresDate} GMT");
324
+		header("Last-Modified: {$lastModifiedDate} GMT");
325
+		header('X-Content-Type-Options: no-sniff');
325 326
 
326 327
 		echo $content;
327 328
 
@@ -335,7 +336,7 @@ class JSMin {
335 336
 	 */
336 337
 	public static function send304()
337 338
 	{
338
-		header("status: 304 Not Modified", true, 304);
339
+		header('status: 304 Not Modified', true, 304);
339 340
 	}
340 341
 }
341 342
 

+ 0
- 0
public/js/cache/.gitkeep View File


+ 10
- 8
src/API/Kitsu/Model.php View File

@@ -37,9 +37,11 @@ use Aviat\AnimeClient\API\Kitsu\Transformer\{
37 37
 	MangaListTransformer
38 38
 };
39 39
 use Aviat\AnimeClient\Types\{
40
+	AbstractType,
40 41
 	Anime,
41
-	AnimeFormItem,
42
-	AnimeListItem
42
+	FormItem,
43
+	AnimeListItem,
44
+	MangaPage
43 45
 };
44 46
 use Aviat\Ion\{Di\ContainerAware, Json};
45 47
 
@@ -562,15 +564,15 @@ final class Model {
562 564
 	 * Get information about a particular manga
563 565
 	 *
564 566
 	 * @param string $slug
565
-	 * @return array
567
+	 * @return MangaPage
566 568
 	 */
567
-	public function getManga(string $slug): array
569
+	public function getManga(string $slug): MangaPage
568 570
 	{
569 571
 		$baseData = $this->getRawMediaData('manga', $slug);
570 572
 
571 573
 		if (empty($baseData))
572 574
 		{
573
-			return [];
575
+			return new MangaPage([]);
574 576
 		}
575 577
 
576 578
 		$transformed = $this->mangaTransformer->transform($baseData);
@@ -584,7 +586,7 @@ final class Model {
584 586
 	 * @param string $mangaId
585 587
 	 * @return array
586 588
 	 */
587
-	public function getMangaById(string $mangaId): array
589
+	public function getMangaById(string $mangaId): MangaPage
588 590
 	{
589 591
 		$baseData = $this->getRawMediaDataById('manga', $mangaId);
590 592
 		return $this->mangaTransformer->transform($baseData);
@@ -837,10 +839,10 @@ final class Model {
837 839
 	/**
838 840
 	 * Modify a list item
839 841
 	 *
840
-	 * @param AnimeFormItem $data
842
+	 * @param FormItem $data
841 843
 	 * @return Request
842 844
 	 */
843
-	public function updateListItem(AnimeFormItem $data): Request
845
+	public function updateListItem(FormItem $data): Request
844 846
 	{
845 847
 		return $this->listItem->update($data['id'], $data['data']);
846 848
 	}

+ 24
- 17
src/API/Kitsu/Transformer/MangaListTransformer.php View File

@@ -17,6 +17,10 @@
17 17
 namespace Aviat\AnimeClient\API\Kitsu\Transformer;
18 18
 
19 19
 use Aviat\AnimeClient\API\Kitsu;
20
+use Aviat\AnimeClient\Types\{
21
+	MangaFormItem, MangaFormItemData,
22
+	MangaListItem, MangaListItemDetail
23
+};
20 24
 use Aviat\Ion\StringWrapper;
21 25
 use Aviat\Ion\Transformer\AbstractTransformer;
22 26
 
@@ -31,9 +35,9 @@ final class MangaListTransformer extends AbstractTransformer {
31 35
 	 * Remap zipped anime data to a more logical form
32 36
 	 *
33 37
 	 * @param  array  $item manga entry item
34
-	 * @return array
38
+	 * @return MangaListItem
35 39
 	 */
36
-	public function transform($item): array
40
+	public function transform($item): MangaListItem
37 41
 	{
38 42
 		$included = $item['included'];
39 43
 		$mangaId = $item['relationships']['media']['data']['id'];
@@ -72,7 +76,10 @@ final class MangaListTransformer extends AbstractTransformer {
72 76
 			}
73 77
 		}
74 78
 
75
-		$map = [
79
+		$titles = Kitsu::filterTitles($manga);
80
+		$title = array_shift($titles);
81
+
82
+		$map = new MangaListItem([
76 83
 			'id' => $item['id'],
77 84
 			'mal_id' => $MALid,
78 85
 			'chapters' => [
@@ -83,22 +90,22 @@ final class MangaListTransformer extends AbstractTransformer {
83 90
 				'read' => '-', //$item['attributes']['volumes_read'],
84 91
 				'total' => $totalVolumes
85 92
 			],
86
-			'manga' => [
93
+			'manga' => new MangaListItemDetail([
94
+				'genres' => $genres,
87 95
 				'id' => $mangaId,
88
-				'titles' => Kitsu::filterTitles($manga),
89
-				'alternate_title' => NULL,
96
+				'image' => $manga['posterImage']['small'],
90 97
 				'slug' => $manga['slug'],
91
-				'url' => 'https://kitsu.io/manga/' . $manga['slug'],
98
+				'title' => $title,
99
+				'titles' => $titles,
92 100
 				'type' => $manga['mangaType'],
93
-				'image' => $manga['posterImage']['small'],
94
-				'genres' => $genres,
95
-			],
101
+				'url' => 'https://kitsu.io/manga/' . $manga['slug'],
102
+			]),
96 103
 			'reading_status' => $item['attributes']['status'],
97 104
 			'notes' => $item['attributes']['notes'],
98 105
 			'rereading' => (bool)$item['attributes']['reconsuming'],
99 106
 			'reread' => $item['attributes']['reconsumeCount'],
100 107
 			'user_rating' => $rating,
101
-		];
108
+		]);
102 109
 
103 110
 		return $map;
104 111
 	}
@@ -107,22 +114,22 @@ final class MangaListTransformer extends AbstractTransformer {
107 114
 	 * Untransform data to update the api
108 115
 	 *
109 116
 	 * @param  array $item
110
-	 * @return array
117
+	 * @return MangaFormItem
111 118
 	 */
112
-	public function untransform($item): array
119
+	public function untransform($item): MangaFormItem
113 120
 	{
114 121
 		$rereading = array_key_exists('rereading', $item) && (bool)$item['rereading'];
115 122
 
116
-		$map = [
123
+		$map = new MangaFormItem([
117 124
 			'id' => $item['id'],
118 125
 			'mal_id' => $item['mal_id'],
119
-			'data' => [
126
+			'data' => new MangaFormItemData([
120 127
 				'status' => $item['status'],
121 128
 				'reconsuming' => $rereading,
122 129
 				'reconsumeCount' => (int)$item['reread_count'],
123 130
 				'notes' => $item['notes'],
124
-			],
125
-		];
131
+			]),
132
+		]);
126 133
 
127 134
 		if (is_numeric($item['chapters_read']) && $item['chapters_read'] > 0)
128 135
 		{

+ 8
- 6
src/API/Kitsu/Transformer/MangaTransformer.php View File

@@ -16,6 +16,7 @@
16 16
 
17 17
 namespace Aviat\AnimeClient\API\Kitsu\Transformer;
18 18
 
19
+use Aviat\AnimeClient\Types\MangaPage;
19 20
 use Aviat\Ion\Transformer\AbstractTransformer;
20 21
 
21 22
 /**
@@ -28,23 +29,24 @@ final class MangaTransformer extends AbstractTransformer {
28 29
 	 * logical and workable structure
29 30
 	 *
30 31
 	 * @param  array  $item API library item
31
-	 * @return array
32
+	 * @return MangaPage
32 33
 	 */
33
-	public function transform($item)
34
+	public function transform($item): MangaPage
34 35
 	{
36
+		// \dump($item);
35 37
 		$genres = [];
36 38
 
37 39
 		foreach($item['included'] as $included)
38 40
 		{
39
-			if ($included['type'] === 'genres')
41
+			if ($included['type'] === 'categories')
40 42
 			{
41
-				$genres[] = $included['attributes']['name'];
43
+				$genres[] = $included['attributes']['title'];
42 44
 			}
43 45
 		}
44 46
 
45 47
 		sort($genres);
46 48
 
47
-		return [
49
+		return new MangaPage([
48 50
 			'id' => $item['id'],
49 51
 			'title' => $item['canonicalTitle'],
50 52
 			'en_title' => $item['titles']['en'],
@@ -56,7 +58,7 @@ final class MangaTransformer extends AbstractTransformer {
56 58
 			'synopsis' => $item['synopsis'],
57 59
 			'url' => "https://kitsu.io/manga/{$item['slug']}",
58 60
 			'genres' => $genres,
59
-		];
61
+		]);
60 62
 	}
61 63
 
62 64
 	private function count(int $value = NULL)

+ 3
- 3
src/API/MAL/Model.php View File

@@ -24,7 +24,7 @@ use Aviat\AnimeClient\API\MAL\{
24 24
 };
25 25
 use Aviat\AnimeClient\API\XML;
26 26
 use Aviat\AnimeClient\API\Mapping\{AnimeWatchingStatus, MangaReadingStatus};
27
-use Aviat\AnimeClient\Types\{Anime, AnimeFormItem};
27
+use Aviat\AnimeClient\Types\{Anime, FormItem};
28 28
 use Aviat\Ion\Di\ContainerAware;
29 29
 
30 30
 /**
@@ -148,11 +148,11 @@ final class Model {
148 148
 	/**
149 149
 	 * Update a list item
150 150
 	 *
151
-	 * @param AnimeFormItem $data
151
+	 * @param FormItem $data
152 152
 	 * @param string $type "anime" or "manga"
153 153
 	 * @return Request
154 154
 	 */
155
-	public function updateListItem(AnimeFormItem $data, string $type = 'anime'): Request
155
+	public function updateListItem(FormItem $data, string $type = 'anime'): Request
156 156
 	{
157 157
 		$updateData = [];
158 158
 

+ 1
- 1
src/Model/Anime.php View File

@@ -29,7 +29,7 @@ use Aviat\Ion\Json;
29 29
 /**
30 30
  * Model for handling requests dealing with the anime list
31 31
  */
32
-final class Anime extends API {
32
+class Anime extends API {
33 33
 	/**
34 34
 	 * Model for making requests to Kitsu API
35 35
 	 *

+ 21
- 13
src/Model/Manga.php View File

@@ -21,14 +21,18 @@ use Aviat\AnimeClient\API\{
21 21
 	Mapping\MangaReadingStatus,
22 22
 	ParallelAPIRequest
23 23
 };
24
+use Aviat\AnimeClient\Types\{
25
+	MangaFormItem,
26
+	MangaListItem,
27
+	MangaPage
28
+};
24 29
 use Aviat\Ion\Di\ContainerInterface;
25 30
 use Aviat\Ion\Json;
26 31
 
27 32
 /**
28 33
  * Model for handling requests dealing with the manga list
29 34
  */
30
-final class Manga extends API
31
-{
35
+class Manga extends API {
32 36
 	/**
33 37
 	 * Model for making requests to Kitsu API
34 38
 	 * @var \Aviat\AnimeClient\API\Kitsu\Model
@@ -71,17 +75,18 @@ final class Manga extends API
71 75
 		}
72 76
 
73 77
 		$APIstatus = MangaReadingStatus::TITLE_TO_KITSU[$status];
74
-		$data = $this->kitsuModel->getMangaList($APIstatus);
75
-		return $this->mapByStatus($data)[$status];
78
+		$data =
79
+			$this->mapByStatus($this->kitsuModel->getMangaList($APIstatus));
80
+		return $data[$status];
76 81
 	}
77 82
 
78 83
 	/**
79 84
 	 * Get the details of a manga
80 85
 	 *
81 86
 	 * @param string $manga_id
82
-	 * @return array
87
+	 * @return MangaPage
83 88
 	 */
84
-	public function getManga($manga_id): array
89
+	public function getManga($manga_id): MangaPage
85 90
 	{
86 91
 		return $this->kitsuModel->getManga($manga_id);
87 92
 	}
@@ -90,9 +95,9 @@ final class Manga extends API
90 95
 	 * Get anime by its kitsu id
91 96
 	 *
92 97
 	 * @param string $animeId
93
-	 * @return array
98
+	 * @return MangaPage
94 99
 	 */
95
-	public function getMangaById(string $animeId): array
100
+	public function getMangaById(string $animeId): MangaPage
96 101
 	{
97 102
 		return $this->kitsuModel->getMangaById($animeId);
98 103
 	}
@@ -102,9 +107,9 @@ final class Manga extends API
102 107
 	 * for editing/updating that item
103 108
 	 *
104 109
 	 * @param string $itemId
105
-	 * @return array
110
+	 * @return MangaListItem
106 111
 	 */
107
-	public function getLibraryItem(string $itemId): array
112
+	public function getLibraryItem(string $itemId): MangaListItem
108 113
 	{
109 114
 		return $this->kitsuModel->getListItem($itemId);
110 115
 	}
@@ -141,10 +146,10 @@ final class Manga extends API
141 146
 	/**
142 147
 	 * Update a list entry
143 148
 	 *
144
-	 * @param array $data
149
+	 * @param MangaFormItem $data
145 150
 	 * @return array
146 151
 	 */
147
-	public function updateLibraryItem(array $data): array
152
+	public function updateLibraryItem(MangaFormItem $data): array
148 153
 	{
149 154
 		$requester = new ParallelAPIRequest();
150 155
 
@@ -221,7 +226,10 @@ final class Manga extends API
221 226
 			$output[$key][] = $entry;
222 227
 		}
223 228
 
224
-		foreach ($output as &$val) {
229
+		unset($entry);
230
+
231
+		foreach ($output as &$val)
232
+		{
225 233
 			$this->sortByName($val, 'manga');
226 234
 		}
227 235
 

+ 11
- 0
src/Types/AbstractType.php View File

@@ -20,6 +20,17 @@ use ArrayAccess;
20 20
 use LogicException;
21 21
 
22 22
 abstract class AbstractType implements ArrayAccess {
23
+	/**
24
+	 * Populate values for unserializing data
25
+	 *
26
+	 * @param $properties
27
+	 * @return mixed
28
+	 */
29
+	public static function __set_state($properties)
30
+	{
31
+		return new static($properties);
32
+	}
33
+
23 34
 	/**
24 35
 	 * Sets the properties by using the constructor
25 36
 	 *

+ 1
- 5
src/Types/AnimeFormItem.php View File

@@ -19,8 +19,4 @@ namespace Aviat\AnimeClient\Types;
19 19
 /**
20 20
  * Type representing an Anime object for display
21 21
  */
22
-final class AnimeFormItem extends AbstractType {
23
-	public $data;
24
-	public $id;
25
-	public $mal_id;
26
-}
22
+final class AnimeFormItem extends FormItem { }

+ 1
- 9
src/Types/AnimeFormItemData.php View File

@@ -19,12 +19,4 @@ namespace Aviat\AnimeClient\Types;
19 19
 /**
20 20
  * Type representing an Anime object for display
21 21
  */
22
-final class AnimeFormItemData extends AbstractType {
23
-	public $notes;
24
-	public $private;
25
-	public $progress;
26
-	public $rating;
27
-	public $reconsumeCount;
28
-	public $reconsuming;
29
-	public $status;
30
-}
22
+final class AnimeFormItemData extends FormItemData {}

+ 27
- 0
src/Types/FormItem.php View File

@@ -0,0 +1,27 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+/**
20
+ * Type representing an Anime object for display
21
+ */
22
+abstract class FormItem extends AbstractType {
23
+	public $id;
24
+	public $mal_id;
25
+	public $data;
26
+}
27
+

+ 30
- 0
src/Types/FormItemData.php View File

@@ -0,0 +1,30 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+/**
20
+ * Type representing an Anime object for display
21
+ */
22
+abstract class FormItemData extends AbstractType {
23
+	public $notes;
24
+	public $private;
25
+	public $progress;
26
+	public $rating;
27
+	public $reconsumeCount;
28
+	public $reconsuming;
29
+	public $status;
30
+}

+ 23
- 0
src/Types/MangaFormItem.php View File

@@ -0,0 +1,23 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+/**
20
+ * Form data for updating a Manga List item
21
+ */
22
+final class MangaFormItem extends FormItem { }
23
+

+ 19
- 0
src/Types/MangaFormItemData.php View File

@@ -0,0 +1,19 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+final class MangaFormItemData extends FormItemData {}

+ 40
- 0
src/Types/MangaListItem.php View File

@@ -0,0 +1,40 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+/**
20
+ * Type representing an Anime object for display
21
+ */
22
+final class MangaListItem extends AbstractType {
23
+	public $id;
24
+	public $mal_id;
25
+	public $chapters = [
26
+		'read' => 0,
27
+		'total' => 0,
28
+	];
29
+	public $volumes = [
30
+		'read' => '-',
31
+		'total' => 0,
32
+	];
33
+	public $manga;
34
+	public $reading_status;
35
+	public $notes;
36
+	public $rereading;
37
+	public $reread;
38
+	public $user_rating;
39
+}
40
+

+ 31
- 0
src/Types/MangaListItemDetail.php View File

@@ -0,0 +1,31 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+/**
20
+ * Type representing the manga represented by the list item
21
+ */
22
+final class MangaListItemDetail extends AbstractType {
23
+	public $genres;
24
+	public $id;
25
+	public $image;
26
+	public $slug;
27
+	public $title;
28
+	public $titles;
29
+	public $type;
30
+	public $url;
31
+}

+ 35
- 0
src/Types/MangaPage.php View File

@@ -0,0 +1,35 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Hummingbird Anime List Client
4
+ *
5
+ * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
+ *
7
+ * PHP version 7
8
+ *
9
+ * @package     HummingbirdAnimeClient
10
+ * @author      Timothy J. Warren <tim@timshomepage.net>
11
+ * @copyright   2015 - 2018  Timothy J. Warren
12
+ * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @version     4.0
14
+ * @link        https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
15
+ */
16
+
17
+namespace Aviat\AnimeClient\Types;
18
+
19
+/**
20
+ * Type representing an Anime object for display
21
+ */
22
+final class MangaPage extends AbstractType {
23
+	public $chapter_count;
24
+	public $cover_image;
25
+	public $en_title;
26
+	public $genres;
27
+	public $id;
28
+	public $included;
29
+	public $jp_title;
30
+	public $manga_type;
31
+	public $synopsis;
32
+	public $title;
33
+	public $url;
34
+	public $volume_count;
35
+}

+ 8
- 4
tests/API/Kitsu/Transformer/MangaListTransformerTest.php View File

@@ -19,6 +19,10 @@ namespace Aviat\AnimeClient\Tests\API\Kitsu\Transformer;
19 19
 use Aviat\AnimeClient\API\JsonAPI;
20 20
 use Aviat\AnimeClient\API\Kitsu\Transformer\MangaListTransformer;
21 21
 use Aviat\AnimeClient\Tests\AnimeClientTestCase;
22
+use Aviat\AnimeClient\Types\{
23
+	MangaFormItem,
24
+	MangaFormItemData,
25
+};
22 26
 use Aviat\Ion\Json;
23 27
 
24 28
 class MangaListTransformerTest extends AnimeClientTestCase {
@@ -82,18 +86,18 @@ class MangaListTransformerTest extends AnimeClientTestCase {
82 86
 		];
83 87
 
84 88
 		$actual = $this->transformer->untransform($input);
85
-		$expected = [
89
+		$expected = new MangaFormItem([
86 90
 			'id' => '15084773',
87 91
 			'mal_id' => '26769',
88
-			'data' => [
92
+			'data' => new MangaFormItemData([
89 93
 				'status' => 'current',
90 94
 				'progress' => 67,
91 95
 				'reconsuming' => false,
92 96
 				'reconsumeCount' => 0,
93 97
 				'notes' => '',
94 98
 				'rating' => 4.5
95
-			]
96
-		];
99
+			])
100
+		]);
97 101
 
98 102
 		$this->assertEquals($expected, $actual);
99 103
 	}

+ 36
- 29
tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testTransform__1.php View File

@@ -1,46 +1,53 @@
1
-<?php return array (
2
-  'id' => '15839442',
3
-  'mal_id' => '33206',
4
-  'episodes' => 
1
+<?php return Aviat\AnimeClient\Types\AnimeListItem::__set_state(array(
2
+   'id' => '15839442',
3
+   'mal_id' => '33206',
4
+   'episodes' => 
5 5
   array (
6 6
     'watched' => '-',
7 7
     'total' => '-',
8 8
     'length' => NULL,
9 9
   ),
10
-  'airing' => 
10
+   'airing' => 
11 11
   array (
12 12
     'status' => 'Currently Airing',
13 13
     'started' => '2017-01-12',
14 14
     'ended' => NULL,
15 15
   ),
16
-  'anime' => 
17
-  array (
18
-    'id' => '12243',
19
-    'age_rating' => NULL,
20
-    'title' => 'Kobayashi-san Chi no Maid Dragon',
21
-    'titles' => 
22
-    array (
23
-      0 => 'Kobayashi-san Chi no Maid Dragon',
24
-      1 => 'Miss Kobayashi\'s Dragon Maid',
25
-      2 => '小林さんちのメイドラゴン',
26
-    ),
27
-    'slug' => 'kobayashi-san-chi-no-maid-dragon',
28
-    'type' => 'TV',
29
-    'image' => 'https://media.kitsu.io/anime/poster_images/12243/small.jpg?1481144116',
30
-    'genres' => 
16
+   'anime' => 
17
+  Aviat\AnimeClient\Types\Anime::__set_state(array(
18
+     'age_rating' => NULL,
19
+     'age_rating_guide' => NULL,
20
+     'cover_image' => 'https://media.kitsu.io/anime/poster_images/12243/small.jpg?1481144116',
21
+     'episode_count' => NULL,
22
+     'episode_length' => NULL,
23
+     'genres' => 
31 24
     array (
32 25
       0 => 'Comedy',
33 26
       1 => 'Fantasy',
34 27
       2 => 'Slice of Life',
35 28
     ),
36
-    'streaming_links' => 
29
+     'id' => '12243',
30
+     'included' => NULL,
31
+     'show_type' => 'TV',
32
+     'slug' => 'kobayashi-san-chi-no-maid-dragon',
33
+     'status' => NULL,
34
+     'streaming_links' => 
37 35
     array (
38 36
     ),
39
-  ),
40
-  'watching_status' => 'current',
41
-  'notes' => NULL,
42
-  'rewatching' => false,
43
-  'rewatched' => 0,
44
-  'user_rating' => '-',
45
-  'private' => false,
46
-);
37
+     'synopsis' => NULL,
38
+     'title' => 'Kobayashi-san Chi no Maid Dragon',
39
+     'titles' => 
40
+    array (
41
+      0 => 'Miss Kobayashi\'s Dragon Maid',
42
+      1 => '小林さんちのメイドラゴン',
43
+    ),
44
+     'trailer_id' => NULL,
45
+     'url' => NULL,
46
+  )),
47
+   'watching_status' => 'current',
48
+   'notes' => NULL,
49
+   'rewatching' => false,
50
+   'rewatched' => 0,
51
+   'user_rating' => '-',
52
+   'private' => false,
53
+));

+ 14
- 14
tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testUntransform with data set #0__1.php View File

@@ -1,14 +1,14 @@
1
-<?php return array (
2
-  'id' => 14047981,
3
-  'mal_id' => NULL,
4
-  'data' => 
5
-  array (
6
-    'status' => 'current',
7
-    'reconsuming' => false,
8
-    'reconsumeCount' => 0,
9
-    'notes' => 'Very formulaic.',
10
-    'progress' => 38,
11
-    'private' => false,
12
-    'rating' => 4,
13
-  ),
14
-);
1
+<?php return Aviat\AnimeClient\Types\AnimeFormItem::__set_state(array(
2
+   'id' => 14047981,
3
+   'mal_id' => NULL,
4
+   'data' => 
5
+  Aviat\AnimeClient\Types\AnimeFormItemData::__set_state(array(
6
+     'notes' => 'Very formulaic.',
7
+     'private' => false,
8
+     'progress' => 38,
9
+     'rating' => 4,
10
+     'reconsumeCount' => 0,
11
+     'reconsuming' => false,
12
+     'status' => 'current',
13
+  )),
14
+));

+ 14
- 14
tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testUntransform with data set #1__1.php View File

@@ -1,14 +1,14 @@
1
-<?php return array (
2
-  'id' => 14047981,
3
-  'mal_id' => '12345',
4
-  'data' => 
5
-  array (
6
-    'status' => 'current',
7
-    'reconsuming' => true,
8
-    'reconsumeCount' => 0,
9
-    'notes' => 'Very formulaic.',
10
-    'progress' => 38,
11
-    'private' => true,
12
-    'rating' => 4,
13
-  ),
14
-);
1
+<?php return Aviat\AnimeClient\Types\AnimeFormItem::__set_state(array(
2
+   'id' => 14047981,
3
+   'mal_id' => '12345',
4
+   'data' => 
5
+  Aviat\AnimeClient\Types\AnimeFormItemData::__set_state(array(
6
+     'notes' => 'Very formulaic.',
7
+     'private' => true,
8
+     'progress' => 38,
9
+     'rating' => 4,
10
+     'reconsumeCount' => 0,
11
+     'reconsuming' => true,
12
+     'status' => 'current',
13
+  )),
14
+));

+ 14
- 13
tests/API/Kitsu/Transformer/__snapshots__/AnimeListTransformerTest__testUntransform with data set #2__1.php View File

@@ -1,13 +1,14 @@
1
-<?php return array (
2
-  'id' => 14047983,
3
-  'mal_id' => '12347',
4
-  'data' => 
5
-  array (
6
-    'status' => 'current',
7
-    'reconsuming' => true,
8
-    'reconsumeCount' => 0,
9
-    'notes' => '',
10
-    'progress' => 12,
11
-    'private' => true,
12
-  ),
13
-);
1
+<?php return Aviat\AnimeClient\Types\AnimeFormItem::__set_state(array(
2
+   'id' => 14047983,
3
+   'mal_id' => '12347',
4
+   'data' => 
5
+  Aviat\AnimeClient\Types\AnimeFormItemData::__set_state(array(
6
+     'notes' => '',
7
+     'private' => true,
8
+     'progress' => 12,
9
+     'rating' => NULL,
10
+     'reconsumeCount' => 0,
11
+     'reconsuming' => true,
12
+     'status' => 'current',
13
+  )),
14
+));

+ 21
- 21
tests/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.php View File

@@ -1,17 +1,18 @@
1
-<?php return array (
2
-  'age_rating' => 'R',
3
-  'age_rating_guide' => 'Violence, Profanity',
4
-  'cover_image' => 'https://media.kitsu.io/anime/poster_images/7442/small.jpg?1418580054',
5
-  'episode_count' => 25,
6
-  'episode_length' => 24,
7
-  'genres' => 
1
+<?php return Aviat\AnimeClient\Types\Anime::__set_state(array(
2
+   'age_rating' => 'R',
3
+   'age_rating_guide' => 'Violence, Profanity',
4
+   'cover_image' => 'https://media.kitsu.io/anime/poster_images/7442/small.jpg?1418580054',
5
+   'episode_count' => 25,
6
+   'episode_length' => 24,
7
+   'genres' => 
8 8
   array (
9 9
   ),
10
-  'id' => 32344,
11
-  'show_type' => 'TV',
12
-  'slug' => 'attack-on-titan',
13
-  'status' => 'Finished Airing',
14
-  'streaming_links' => 
10
+   'id' => 32344,
11
+   'included' => NULL,
12
+   'show_type' => 'TV',
13
+   'slug' => 'attack-on-titan',
14
+   'status' => 'Finished Airing',
15
+   'streaming_links' => 
15 16
   array (
16 17
     0 => 
17 18
     array (
@@ -86,16 +87,15 @@
86 87
       ),
87 88
     ),
88 89
   ),
89
-  'synopsis' => 'Several hundred years ago, humans were nearly exterminated by titans. Titans are typically several stories tall, seem to have no intelligence, devour human beings and, worst of all, seem to do it for the pleasure rather than as a food source. A small percentage of humanity survived by enclosing themselves in a city protected by extremely high walls, even taller than the biggest of titans. Flash forward to the present and the city has not seen a titan in over 100 years. Teenage boy Eren and his foster sister Mikasa witness something horrific as the city walls are destroyed by a colossal titan that appears out of thin air. As the smaller titans flood the city, the two kids watch in horror as their mother is eaten alive. Eren vows that he will murder every single titan and take revenge for all of mankind.
90
+   'synopsis' => 'Several hundred years ago, humans were nearly exterminated by titans. Titans are typically several stories tall, seem to have no intelligence, devour human beings and, worst of all, seem to do it for the pleasure rather than as a food source. A small percentage of humanity survived by enclosing themselves in a city protected by extremely high walls, even taller than the biggest of titans. Flash forward to the present and the city has not seen a titan in over 100 years. Teenage boy Eren and his foster sister Mikasa witness something horrific as the city walls are destroyed by a colossal titan that appears out of thin air. As the smaller titans flood the city, the two kids watch in horror as their mother is eaten alive. Eren vows that he will murder every single titan and take revenge for all of mankind.
90 91
 
91 92
 (Source: ANN)',
92
-  'title' => 'Attack on Titan',
93
-  'titles' => 
93
+   'title' => 'Attack on Titan',
94
+   'titles' => 
94 95
   array (
95
-    0 => 'Attack on Titan',
96
-    1 => 'Shingeki no Kyojin',
97
-    2 => '進撃の巨人',
96
+    0 => 'Shingeki no Kyojin',
97
+    1 => '進撃の巨人',
98 98
   ),
99
-  'trailer_id' => 'n4Nj6Y_SNYI',
100
-  'url' => 'https://kitsu.io/anime/attack-on-titan',
101
-);
99
+   'trailer_id' => 'n4Nj6Y_SNYI',
100
+   'url' => 'https://kitsu.io/anime/attack-on-titan',
101
+));

+ 121
- 126
tests/API/Kitsu/Transformer/__snapshots__/MangaListTransformerTest__testTransform__1.php View File

@@ -1,31 +1,21 @@
1 1
 <?php return array (
2 2
   0 => 
3
-  array (
4
-    'id' => '15084773',
5
-    'mal_id' => '26769',
6
-    'chapters' => 
3
+  Aviat\AnimeClient\Types\MangaListItem::__set_state(array(
4
+     'id' => '15084773',
5
+     'mal_id' => '26769',
6
+     'chapters' => 
7 7
     array (
8 8
       'read' => 67,
9 9
       'total' => '-',
10 10
     ),
11
-    'volumes' => 
11
+     'volumes' => 
12 12
     array (
13 13
       'read' => '-',
14 14
       'total' => '-',
15 15
     ),
16
-    'manga' => 
17
-    array (
18
-      'id' => '20286',
19
-      'titles' => 
20
-      array (
21
-        0 => 'Bokura wa Minna Kawaisou',
22
-      ),
23
-      'alternate_title' => NULL,
24
-      'slug' => 'bokura-wa-minna-kawaisou',
25
-      'url' => 'https://kitsu.io/manga/bokura-wa-minna-kawaisou',
26
-      'type' => 'manga',
27
-      'image' => 'https://media.kitsu.io/manga/poster_images/20286/small.jpg?1434293999',
28
-      'genres' => 
16
+     'manga' => 
17
+    Aviat\AnimeClient\Types\MangaListItemDetail::__set_state(array(
18
+       'genres' => 
29 19
       array (
30 20
         0 => 'Comedy',
31 21
         1 => 'Romance',
@@ -33,40 +23,39 @@
33 23
         3 => 'Slice of Life',
34 24
         4 => 'Thriller',
35 25
       ),
36
-    ),
37
-    'reading_status' => 'current',
38
-    'notes' => '',
39
-    'rereading' => false,
40
-    'reread' => 0,
41
-    'user_rating' => 9.0,
42
-  ),
26
+       'id' => '20286',
27
+       'image' => 'https://media.kitsu.io/manga/poster_images/20286/small.jpg?1434293999',
28
+       'slug' => 'bokura-wa-minna-kawaisou',
29
+       'title' => 'Bokura wa Minna Kawaisou',
30
+       'titles' => 
31
+      array (
32
+      ),
33
+       'type' => 'manga',
34
+       'url' => 'https://kitsu.io/manga/bokura-wa-minna-kawaisou',
35
+    )),
36
+     'reading_status' => 'current',
37
+     'notes' => '',
38
+     'rereading' => false,
39
+     'reread' => 0,
40
+     'user_rating' => 9.0,
41
+  )),
43 42
   1 => 
44
-  array (
45
-    'id' => '15085607',
46
-    'mal_id' => '16',
47
-    'chapters' => 
43
+  Aviat\AnimeClient\Types\MangaListItem::__set_state(array(
44
+     'id' => '15085607',
45
+     'mal_id' => '16',
46
+     'chapters' => 
48 47
     array (
49 48
       'read' => 17,
50 49
       'total' => 120,
51 50
     ),
52
-    'volumes' => 
51
+     'volumes' => 
53 52
     array (
54 53
       'read' => '-',
55 54
       'total' => 14,
56 55
     ),
57
-    'manga' => 
58
-    array (
59
-      'id' => '47',
60
-      'titles' => 
61
-      array (
62
-        0 => 'Love Hina',
63
-      ),
64
-      'alternate_title' => NULL,
65
-      'slug' => 'love-hina',
66
-      'url' => 'https://kitsu.io/manga/love-hina',
67
-      'type' => 'manga',
68
-      'image' => 'https://media.kitsu.io/manga/poster_images/47/small.jpg?1434249493',
69
-      'genres' => 
56
+     'manga' => 
57
+    Aviat\AnimeClient\Types\MangaListItemDetail::__set_state(array(
58
+       'genres' => 
70 59
       array (
71 60
         0 => 'Comedy',
72 61
         1 => 'Ecchi',
@@ -74,41 +63,39 @@
74 63
         3 => 'Romance',
75 64
         4 => 'Sports',
76 65
       ),
77
-    ),
78
-    'reading_status' => 'current',
79
-    'notes' => '',
80
-    'rereading' => false,
81
-    'reread' => 0,
82
-    'user_rating' => 7.0,
83
-  ),
66
+       'id' => '47',
67
+       'image' => 'https://media.kitsu.io/manga/poster_images/47/small.jpg?1434249493',
68
+       'slug' => 'love-hina',
69
+       'title' => 'Love Hina',
70
+       'titles' => 
71
+      array (
72
+      ),
73
+       'type' => 'manga',
74
+       'url' => 'https://kitsu.io/manga/love-hina',
75
+    )),
76
+     'reading_status' => 'current',
77
+     'notes' => '',
78
+     'rereading' => false,
79
+     'reread' => 0,
80
+     'user_rating' => 7.0,
81
+  )),
84 82
   2 => 
85
-  array (
86
-    'id' => '15084529',
87
-    'mal_id' => '35003',
88
-    'chapters' => 
83
+  Aviat\AnimeClient\Types\MangaListItem::__set_state(array(
84
+     'id' => '15084529',
85
+     'mal_id' => '35003',
86
+     'chapters' => 
89 87
     array (
90 88
       'read' => 16,
91 89
       'total' => '-',
92 90
     ),
93
-    'volumes' => 
91
+     'volumes' => 
94 92
     array (
95 93
       'read' => '-',
96 94
       'total' => '-',
97 95
     ),
98
-    'manga' => 
99
-    array (
100
-      'id' => '11777',
101
-      'titles' => 
102
-      array (
103
-        0 => 'Yamada-kun to 7-nin no Majo',
104
-        1 => 'Yamada-kun and the Seven Witches',
105
-      ),
106
-      'alternate_title' => NULL,
107
-      'slug' => 'yamada-kun-to-7-nin-no-majo',
108
-      'url' => 'https://kitsu.io/manga/yamada-kun-to-7-nin-no-majo',
109
-      'type' => 'manga',
110
-      'image' => 'https://media.kitsu.io/manga/poster_images/11777/small.jpg?1438784325',
111
-      'genres' => 
96
+     'manga' => 
97
+    Aviat\AnimeClient\Types\MangaListItemDetail::__set_state(array(
98
+       'genres' => 
112 99
       array (
113 100
         0 => 'Comedy',
114 101
         1 => 'Ecchi',
@@ -118,89 +105,97 @@
118 105
         5 => 'Sports',
119 106
         6 => 'Supernatural',
120 107
       ),
121
-    ),
122
-    'reading_status' => 'current',
123
-    'notes' => '',
124
-    'rereading' => false,
125
-    'reread' => 0,
126
-    'user_rating' => 9.0,
127
-  ),
108
+       'id' => '11777',
109
+       'image' => 'https://media.kitsu.io/manga/poster_images/11777/small.jpg?1438784325',
110
+       'slug' => 'yamada-kun-to-7-nin-no-majo',
111
+       'title' => 'Yamada-kun to 7-nin no Majo',
112
+       'titles' => 
113
+      array (
114
+        0 => 'Yamada-kun and the Seven Witches',
115
+      ),
116
+       'type' => 'manga',
117
+       'url' => 'https://kitsu.io/manga/yamada-kun-to-7-nin-no-majo',
118
+    )),
119
+     'reading_status' => 'current',
120
+     'notes' => '',
121
+     'rereading' => false,
122
+     'reread' => 0,
123
+     'user_rating' => 9.0,
124
+  )),
128 125
   3 => 
129
-  array (
130
-    'id' => '15312827',
131
-    'mal_id' => '78523',
132
-    'chapters' => 
126
+  Aviat\AnimeClient\Types\MangaListItem::__set_state(array(
127
+     'id' => '15312827',
128
+     'mal_id' => '78523',
129
+     'chapters' => 
133 130
     array (
134 131
       'read' => 68,
135 132
       'total' => '-',
136 133
     ),
137
-    'volumes' => 
134
+     'volumes' => 
138 135
     array (
139 136
       'read' => '-',
140 137
       'total' => '-',
141 138
     ),
142
-    'manga' => 
143
-    array (
144
-      'id' => '27175',
145
-      'titles' => 
146
-      array (
147
-        0 => 'ReLIFE',
148
-      ),
149
-      'alternate_title' => NULL,
150
-      'slug' => 'relife',
151
-      'url' => 'https://kitsu.io/manga/relife',
152
-      'type' => 'manga',
153
-      'image' => 'https://media.kitsu.io/manga/poster_images/27175/small.jpg?1464379411',
154
-      'genres' => 
139
+     'manga' => 
140
+    Aviat\AnimeClient\Types\MangaListItemDetail::__set_state(array(
141
+       'genres' => 
155 142
       array (
156 143
         0 => 'Romance',
157 144
         1 => 'School',
158 145
         2 => 'Slice of Life',
159 146
       ),
160
-    ),
161
-    'reading_status' => 'current',
162
-    'notes' => '',
163
-    'rereading' => false,
164
-    'reread' => 0,
165
-    'user_rating' => '-',
166
-  ),
147
+       'id' => '27175',
148
+       'image' => 'https://media.kitsu.io/manga/poster_images/27175/small.jpg?1464379411',
149
+       'slug' => 'relife',
150
+       'title' => 'ReLIFE',
151
+       'titles' => 
152
+      array (
153
+      ),
154
+       'type' => 'manga',
155
+       'url' => 'https://kitsu.io/manga/relife',
156
+    )),
157
+     'reading_status' => 'current',
158
+     'notes' => '',
159
+     'rereading' => false,
160
+     'reread' => 0,
161
+     'user_rating' => '-',
162
+  )),
167 163
   4 => 
168
-  array (
169
-    'id' => '15084769',
170
-    'mal_id' => '60815',
171
-    'chapters' => 
164
+  Aviat\AnimeClient\Types\MangaListItem::__set_state(array(
165
+     'id' => '15084769',
166
+     'mal_id' => '60815',
167
+     'chapters' => 
172 168
     array (
173 169
       'read' => 43,
174 170
       'total' => '-',
175 171
     ),
176
-    'volumes' => 
172
+     'volumes' => 
177 173
     array (
178 174
       'read' => '-',
179 175
       'total' => '-',
180 176
     ),
181
-    'manga' => 
182
-    array (
183
-      'id' => '25491',
184
-      'titles' => 
185
-      array (
186
-        0 => 'Joshikausei',
187
-      ),
188
-      'alternate_title' => NULL,
189
-      'slug' => 'joshikausei',
190
-      'url' => 'https://kitsu.io/manga/joshikausei',
191
-      'type' => 'manga',
192
-      'image' => 'https://media.kitsu.io/manga/poster_images/25491/small.jpg?1434305043',
193
-      'genres' => 
177
+     'manga' => 
178
+    Aviat\AnimeClient\Types\MangaListItemDetail::__set_state(array(
179
+       'genres' => 
194 180
       array (
195 181
         0 => 'Comedy',
196 182
         1 => 'School',
197 183
         2 => 'Slice of Life',
198 184
       ),
199
-    ),
200
-    'reading_status' => 'current',
201
-    'notes' => '',
202
-    'rereading' => false,
203
-    'reread' => 0,
204
-    'user_rating' => 8.0,
205
-  ),
185
+       'id' => '25491',
186
+       'image' => 'https://media.kitsu.io/manga/poster_images/25491/small.jpg?1434305043',
187
+       'slug' => 'joshikausei',
188
+       'title' => 'Joshikausei',
189
+       'titles' => 
190
+      array (
191
+      ),
192
+       'type' => 'manga',
193
+       'url' => 'https://kitsu.io/manga/joshikausei',
194
+    )),
195
+     'reading_status' => 'current',
196
+     'notes' => '',
197
+     'rereading' => false,
198
+     'reread' => 0,
199
+     'user_rating' => 8.0,
200
+  )),
206 201
 );

+ 15
- 19
tests/API/Kitsu/Transformer/__snapshots__/MangaTransformerTest__testTransform__1.php View File

@@ -1,21 +1,17 @@
1
-<?php return array (
2
-  'id' => '20286',
3
-  'title' => 'Bokura wa Minna Kawaisou',
4
-  'en_title' => NULL,
5
-  'jp_title' => 'Bokura wa Minna Kawaisou',
6
-  'cover_image' => 'https://media.kitsu.io/manga/poster_images/20286/small.jpg?1434293999',
7
-  'manga_type' => 'manga',
8
-  'chapter_count' => '-',
9
-  'volume_count' => '-',
10
-  'synopsis' => 'Usa, a high-school student aspiring to begin a bachelor lifestyle, moves into a new apartment only to discover that he not only shares a room with a perverted roommate that has an obsession for underaged girls, but also that another girl, Ritsu, a love-at-first-sight, is living in the same building as well!
11
-(Source: Kirei Cake)',
12
-  'url' => 'https://kitsu.io/manga/bokura-wa-minna-kawaisou',
13
-  'genres' => 
1
+<?php return Aviat\AnimeClient\Types\MangaPage::__set_state(array(
2
+   'chapter_count' => '-',
3
+   'cover_image' => 'https://media.kitsu.io/manga/poster_images/20286/small.jpg?1434293999',
4
+   'en_title' => NULL,
5
+   'genres' => 
14 6
   array (
15
-    0 => 'Comedy',
16
-    1 => 'Romance',
17
-    2 => 'School',
18
-    3 => 'Slice of Life',
19
-    4 => 'Thriller',
20 7
   ),
21
-);
8
+   'id' => '20286',
9
+   'included' => NULL,
10
+   'jp_title' => 'Bokura wa Minna Kawaisou',
11
+   'manga_type' => 'manga',
12
+   'synopsis' => 'Usa, a high-school student aspiring to begin a bachelor lifestyle, moves into a new apartment only to discover that he not only shares a room with a perverted roommate that has an obsession for underaged girls, but also that another girl, Ritsu, a love-at-first-sight, is living in the same building as well!
13
+(Source: Kirei Cake)',
14
+   'title' => 'Bokura wa Minna Kawaisou',
15
+   'url' => 'https://kitsu.io/manga/bokura-wa-minna-kawaisou',
16
+   'volume_count' => '-',
17
+));