Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function asciiDump()
 {
     if (empty($this->root)) {
         return '';
     } else {
         return $this->root->asciiDump();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function mapTerm($source, $target, TermInterface $term)
 {
     if ($source == 'educa' && $target == 'classification system' || $source == 'classification system' && $target == 'educa') {
         $description = $term->describe();
         $map = ['computer_science_programming' => 'computer science', 'ethics and religions' => 'ethics religions communities', 'accounting' => 'accounting finance', 'creative activities' => 'art craft design', 'sport' => 'motion health', 'general_education' => 'interdisciplinary topics skills', 'collective_projects' => 'projects', 'indipendent_of_levels' => 'independent of levels', 'indipendent_of_levels_others' => 'independent of levels others', 'pre-school' => 'compulsory education', 'applied mathematics' => 'mathematics', 'geometry' => 'mathematics', 'home economics' => 'domestic science', 'commercial accounting' => 'accounting', 'office_and_typing' => 'media and ict', 'prevention_and_health' => 'motion health', 'environment_and_dependencies' => 'development', 'personal_projects' => 'projects'];
         if ($source == 'educa') {
             $taxonId = isset($map[$description->id]) ? $map[$description->id] : str_replace('_', ' ', $description->id);
             // Set the context. If the identifier is the same as the
             // original term, use the context of the original term. If it's
             // not, or the original term is not available, use "LOM-CHv1.2".
             $context = $description->id == $taxonId && method_exists($term, 'getContext') ? $term->getContext() : 'LOM-CHv1.2';
         } else {
             // Set a default value.
             $context = 'LOM-CHv1.0';
             $taxonId = ($i = array_search($description->id, $map)) ? $i : (method_exists($term, 'getContext') && ($context = $term->getContext()) && (!preg_match('/^LOM-CH/', $context) || version_compare($context, 'LOM-CHv1.2', '<')) ? $description->id : str_replace(' ', '_', $description->id));
         }
         return new EducaTerm($description->type, $taxonId, isset($description->name) ? $description->name : null, $context);
     }
     // @codeCoverageIgnoreStart
     return null;
     // @codeCoverageIgnoreEnd
 }