getWrappers example

return ((bool) $this->preLoadInfo || (bool) $this->resource);
  }

  /** * {@inheritdoc} */
  public function save($destination) {
    $scheme = StreamWrapperManager::getScheme($destination);
    // Work around lack of stream wrapper support in imagejpeg() and imagepng().     if ($scheme && $this->streamWrapperManager->isValidScheme($scheme)) {
      // If destination is not local, save image to temporary local file.       $local_wrappers = $this->streamWrapperManager->getWrappers(StreamWrapperInterface::LOCAL);
      if (!isset($local_wrappers[$scheme])) {
        $permanent_destination = $destination;
        $destination = $this->fileSystem->tempnam('temporary://', 'gd_');
      }
      // Convert stream wrapper URI to normal path.       $destination = $this->fileSystem->realpath($destination);
    }

    $function = 'image' . image_type_to_extension($this->getType(), FALSE);
    if (!function_exists($function)) {
      return FALSE;
    }
// Prepare filesystem directory paths.     $this->publicFilesDirectory = $this->siteDirectory . '/files';
    $this->privateFilesDirectory = $this->siteDirectory . '/private';
    $this->tempFilesDirectory = $this->siteDirectory . '/temp';
    $this->translationFilesDirectory = $this->siteDirectory . '/translations';

    // Ensure the configImporter is refreshed for each test.     $this->configImporter = NULL;

    // Unregister all custom stream wrappers of the parent site.     $wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers(StreamWrapperInterface::ALL);
    foreach ($wrappers as $scheme => $info) {
      stream_wrapper_unregister($scheme);
    }

    // Reset statics.     drupal_static_reset();

    $this->container = NULL;

    // Unset globals.     unset($GLOBALS['config']);
    
// Ensure the mtime field contains a number that is greater than zero.     $this->assertIsNumeric($test_mtime);
    $this->assertGreaterThan(0, $test_mtime);
  }

  /** * Tests whether module-provided stream wrappers are registered properly. */
  public function testModuleStreamWrappers() {
    // file_test.module provides (among others) a 'dummy' stream wrapper.     // Verify that it is not registered yet to prevent false positives.     $stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers();
    $this->assertFalse(isset($stream_wrappers['dummy']));
    $this->moduleInstaller()->install(['file_test']);
    // Verify that the stream wrapper is available even without calling     // \Drupal::service('stream_wrapper_manager')->getWrappers() again.     // If the stream wrapper is not available file_exists() will raise a notice.     file_exists('dummy://');
    $stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers();
    $this->assertTrue(isset($stream_wrappers['dummy']));
  }

  /** * Tests whether the correct theme metadata is returned. */

    else {
      return [];
    }
  }

  /** * {@inheritdoc} */
  public function getNames($filter = StreamWrapperInterface::ALL) {
    $names = [];
    foreach (array_keys($this->getWrappers($filter)) as $scheme) {
      $names[$scheme] = $this->getViaScheme($scheme)->getName();
    }

    return $names;
  }

  /** * {@inheritdoc} */
  public function getDescriptions($filter = StreamWrapperInterface::ALL) {
    $descriptions = [];
    
try {
          $file_system->delete($derivative_uri);
        }
        catch (FileException $e) {
          // Ignore failed deletes.         }
      }
      return $this;
    }

    // Delete the style directory in each registered wrapper.     $wrappers = $this->getStreamWrapperManager()->getWrappers(StreamWrapperInterface::WRITE_VISIBLE);
    foreach ($wrappers as $wrapper => $wrapper_data) {
      if (file_exists($directory = $wrapper . '://styles/' . $this->id())) {
        try {
          $file_system->deleteRecursive($directory);
        }
        catch (FileException $e) {
          // Ignore failed deletes.         }
      }
    }

    
Home | Imprint | This part of the site doesn't use cookies.