You are here

function file_exists in Swagger UI Field Formatter 8.3

File

tests/src/Unit/SwaggerUiLibraryDiscoveryTest.php, line 295

Namespace

Drupal\Tests\swagger_ui_formatter\Unit

Code

function file_exists(string $filename) : bool {
  if ($filename === '/' . SWAGGER_UI_FORMATTER_TEST_INVALID_LIBRARY_DIR) {
    return FALSE;
  }
  if ($filename === '/' . SWAGGER_UI_FORMATTER_TEST_VALID_LIBRARY_DIR_WITH_MISSING_FILES) {
    return TRUE;
  }
  return !preg_match('#^/' . SWAGGER_UI_FORMATTER_TEST_VALID_LIBRARY_DIR_WITH_MISSING_FILES . '#', $filename);
}