private function getCredentialFromSpecialization($details) { $credential = new Credential(); $credential->setName($details['name']); $credential->setPricePeriod(Credential::CREDENTIAL_PRICE_PERIOD_TOTAL); $credential->setPrice(0); $credential->setSlug($details['short_name'] . '-specialization'); $credential->setInitiative($this->initiative); $credential->setUrl(sprintf(self::SPECIALIZATION_PAGE_URL, $details['short_name'], $details['id'])); $credential->setOneLiner($details['subhead']); // Add the institutions foreach ($details['universities'] as $university) { $ins = $this->dbHelper->getInstitutionBySlug($university['short_name']); if ($ins) { $credential->addInstitution($ins); } else { $this->out("University Not Found - " . $university['name']); } } // Add the courses foreach ($details['topics'] as $topic) { $course = $this->dbHelper->getCourseByShortName('coursera_' . $topic['short_name']); if ($course) { $credential->addCourse($course); } else { $this->out("Course Not Found - " . $topic['name']); } } // Get Description $credential->setDescription($details['byline']); return $credential; }