/**
  * Execute the named scan on the named module.
  *
  * Will always update the module with a status change.
  *
  * @param Module $module
  * @param string $scan
  *
  * @return Index
  *   $this
  */
 function runScan(Module $module, $scan)
 {
     if (!$module->exists()) {
         $this->log("Module is no longer available at " . $module->getLocation(), '', 2);
         $module->addStatus("{$scan}:unavailable");
         $this->entityManager->persist($module);
         $this->entityManager->flush();
         return $this;
     }
     // Deduce magic function name, then try to invoke it.
     // This means that as new scan types get added, they can be run
     // just by being named correctly..
     $funcname = "run" . ucfirst($scan) . "Scan";
     if (method_exists($this, $funcname)) {
         $this->log("Running '{$scan}' scan on '{$module->name}'", 'progress', 1);
         $this->{$funcname}($module);
     } else {
         $this->log("No expected function {$funcname} available yet. Not running it on " . $module->name, 'TODO', 2);
         $module->addStatus("{$scan}:unavailable");
     }
     $this->entityManager->persist($module);
     $this->entityManager->flush();
     return $this;
 }