private static function parseManga($item) { $crawler = new Crawler($item); $manga = new Manga(); $manga->setId($crawler->filter('id')->text()); $manga->setTitle($crawler->filter('title')->text()); $otherTitles = array(); $english = explode('; ', $crawler->filter('english')->text()); if (count($english) > 0 && $english !== '') { $otherTitles['english'] = $english; } $synonyms = explode('; ', $crawler->filter('synonyms')->text()); if (count($synonyms) > 0 && $synonyms[0] !== '') { $otherTitles['synonyms'] = $synonyms; } $manga->setOtherTitles($otherTitles); $manga->setOtherTitles($otherTitles); $manga->setChapters($crawler->filter('chapters')->text()); $manga->setVolumes($crawler->filter('volumes')->text()); $manga->setMembersScore($crawler->filter('score')->text()); $manga->setStatus($crawler->filter('status')->text()); $startDate = $crawler->filter('start_date')->text(); if ($startDate !== '0000-00-00') { $manga->setStartDate((new \DateTime())->createFromFormat('Y-m-d', $startDate)); } $EndDate = $crawler->filter('end_date')->text(); if ($EndDate !== '0000-00-00') { $manga->setEndDate((new \DateTime())->createFromFormat('Y-m-d', $EndDate)); } $manga->setSynopsis($crawler->filter('synopsis')->text()); $manga->setImageUrl($crawler->filter('image')->text()); return $manga; }