code: private function findLastImportedPath($yamlContents)
      {
          $data = Yaml::parse($yamlContents);
          if (!isset($data['imports'])) {
              return false;
          }
  
          // find the last imports entry
          $lastImport = end($data['imports']);
          if (!isset($lastImport['resource'])) {
              return false;
          }
  
          return $lastImport['resource'];
      }
docs: Finds the last imported resource path in the YAML file.
  
  @param $yamlContents
  
  @return bool|string