public function add($em, $src = null)
 {
     $rsp = array();
     // Return error if $src is empty
     if (!isset($src)) {
         return array('success' => false, 'errorCode' => 'emptyField');
     }
     $configService = $this->getConfigService();
     $dateAgo = $this->getUtilityService()->getDateAgo($configService::EPISODE_DAY_MAX);
     // Check to see if the value is url (XML feed) or Youtube channel ID
     // If the input is a URL for XML Feed
     if (filter_var($src, FILTER_VALIDATE_URL)) {
         // Get data with SimplePie first
         $simplepie = new SimplePieService($src);
         $subscription = $simplepie->getSubscriptionArray();
         $episodes = $simplepie->getEpisodeCollection($dateAgo);
         //Check for empty fields
         // If the subscription array has any empty values try the ZetaService
         // Then fold the missing values together
         //			if(in_array("", array_merge($subscription, $episodes))){
         //				$rsp = $this->checkForEmptyFields( new ZetaXMLService(), $subscription, $episodes, $dateAgo);
         //				$subscription = $rsp['subscription'];
         //				$episodes = $rsp['episodes'];
         //			}
         $subscription = $this->createSubscriptionEntity(new Subscription(), $subscription, $src, $episodes[0]['src']);
         $em->persist($subscription);
         $em->flush($subscription);
         $episodeService = new EpisodeService();
         $episodes = $episodeService->buildBulkEpisodes($em, $episodes, $subscription);
         $rsp = array('subscription' => $this->getSubscriptionArray($subscription), 'episodes' => $episodes);
     } else {
         // Youtube
     }
     return $rsp;
 }
 /**
  * @depends testConstruct
  */
 public function testMakeSubscriptionArray(SimplePieService $rawData)
 {
     $subscription = $rawData->getSubscriptionArray();
     $this->assertEquals('This Week in Tech (MP3)', $subscription['title']);
     $this->assertEquals('81kf7gnedDGD', $subscription['description']);
     $this->assertEquals('http://localhost/zowcast/rest/web/xml/2d5g7Dv2', $subscription['homePage']);
     $this->assertEquals('5d2gUF3', $subscription['img']);
 }