/**
  * Gets the full list of files to be created - by looking at the file
  * builder + any input files that should override those.
  *
  * @param Activity $activity
  * @return array
  */
 private function getFilesToCreate(Activity $activity)
 {
     $challenge = $activity->getChallengeObject();
     $fileBuilder = $challenge->getFileBuilder();
     $files = array();
     // loop through *all* of the files in the builder - this should be the full set
     foreach ($fileBuilder->getFilenames() as $filename) {
         // look first to see if an input file was sent
         if ($activity->hasInputFile($filename)) {
             $files[$filename] = $activity->getInputFileContents($filename);
         } else {
             // fallback to get the original file contents
             $fileBuilder->getFileObject($filename);
         }
     }
     return $files;
 }
Ejemplo n.º 2
0
 public function getInlineCodeToExecute(\Twig_Environment $twig, Activity $activity)
 {
     $challenge = $activity->getChallengeObject();
     return $twig->render('twig_worker.php.twig', array('entryPointFilename' => $challenge->getFileBuilder()->getEntryPointFilename()));
 }