/**
  * Gets the sample input from the filesystem.
  *
  * @param Request $r
  * @throws InvalidFilesystemOperationException
  */
 public static function getSampleInput(Request $r)
 {
     $source_path = PROBLEMS_PATH . DIRECTORY_SEPARATOR . $r['problem']->getAlias() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . 'sample.in';
     try {
         $file_content = FileHandler::ReadFile($source_path);
     } catch (Exception $e) {
         // Most problems won't have a sample input.
         $file_content = '';
     }
     return $file_content;
 }
 /**
  * Read already deployed statements from filesystem and apply transformations
  * $lang.markdown => statements/$lang.html as well as encoding checks
  *
  * @param string $dirpath
  * @param array $filesToUnzip
  */
 private function handleStatements(array $filesToUnzip = null)
 {
     // Get a list of all available statements.
     // At this point, zip is validated and it has at least 1 statement. No need to check
     $statements = preg_grep('/^statements\\/[a-zA-Z]{2}\\.markdown$/', $filesToUnzip);
     $this->log->info('Handling statements...');
     // Transform statements from markdown to HTML
     foreach ($statements as $statement) {
         // Get the path to the markdown unzipped file
         $markdown_filepath = "{$this->tmpDir}/{$statement}";
         $this->log->info('Reading file ' . $markdown_filepath);
         // Read the contents of the original markdown file
         $this->current_markdown_file_contents = FileHandler::ReadFile($markdown_filepath);
         // Deploy statement raw (.markdown) and transformed (.html)
         $this->HTMLizeStatement($this->tmpDir, basename($statement));
         $this->updatedLanguages[] = basename($statement, '.markdown');
     }
 }