You are here

public function ManageExport::isReadyToImport in Content Export YAML 8

File

src/ManageExport.php, line 94

Class

ManageExport

Namespace

Drupal\content_export_yaml

Code

public function isReadyToImport($file) {
  if (file_exists($file)) {
    try {
      $content = file_get_contents($file, FILE_USE_INCLUDE_PATH);
      $parsed = new Parser();
      $object = $parsed
        ->parse($content, SymfonyYaml::PARSE_OBJECT);
      if ($object) {
        return true;
      }
    } catch (\Exception $e) {
      \Drupal::logger('content_export_yaml')
        ->error('File yaml  has error :' . $e);
    }
  }
  return false;
}