/**
  * @param FixtureEpisodeData $fixture
  * @param string             $baseName
  */
 protected function parseEpisodeName(FixtureEpisodeData $fixture, &$baseName)
 {
     $name = $baseName[0];
     $regex = ['{\\b(\\[?\\(?us|uk\\)?\\]?)\\b}i' => '', '{([a-z])([A-Z][a-z])}' => '$1 $2', '{\\s+}' => ' '];
     foreach ($regex as $search => $replace) {
         $name = ucwords(trim(preg_replace($search, $replace, $name)));
     }
     $search = ['.', '-', '['];
     foreach ($search as $s) {
         $name = ucwords(trim(str_replace($s, ' ', $name)));
     }
     $fixture->setName($name);
 }
Example #2
0
 /**
  * @param FixtureEpisodeData $f
  * @param Tv\Episode|null    $e
  * @param Tv|null            $s
  */
 private function hydrateFixtureEpisode(FixtureEpisodeData $f, Tv\Episode $e = null, Tv $s = null)
 {
     if ($s === null || $e === null) {
         return;
     }
     $f->setName($s->getName());
     $f->setTitle($e->getName());
     $f->setEpisodeNumberStart($e->getEpisodeNumber());
     $f->setSeasonNumber($e->getSeasonNumber());
     $f->setId($e->getId());
     $f->setYear($s->getFirstAirDate()->format('Y'));
     $f->setEnabled(true);
 }