FilesystemImporter

Extends Importer

An importer that loads files from a load path on the filesystem.

package

Application

Methods

__construct

__construct(stringloadPath) : mixed

Arguments

loadPath

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 string

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 mixed

__toString

__toString() : string
Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 string

If $url is recognized by this importer, returns its canonical format.

canonicalize(\League\Uri\Contracts\UriInterfaceurl) : ?\League\Uri\Contracts\UriInterface

Note that canonical URLs must be absolute, including a scheme. Returning file: URLs is encouraged if the imported stylesheet comes from a file on disk.

If Sass has already loaded a stylesheet with the returned canonical URL, it re-uses the existing parse tree. This means that importers must ensure that the same canonical URL always refers to the same stylesheet, even across different importers.

This may return null if $url isn't recognized by this importer.

If this importer's URL format supports file extensions, it should canonicalize them the same way as the default filesystem importer:

  • The importer should look for stylesheets by adding the prefix _ to the URL's basename, and by adding the extensions .sass and .scss if the URL doesn't already have one of those extensions. For example, if the URL was foo/bar/baz, the importer would look for:

    • foo/bar/baz.sass
    • foo/bar/baz.scss
    • foo/bar/_baz.sass
    • foo/bar/_baz.scss

    If the URL was foo/bar/baz.scss, the importer would just look for:

    • foo/bar/baz.scss
    • foo/bar/_baz.scss

    If the importer finds a stylesheet at more than one of these URLs, it should throw an exception indicating that the import is ambiguous. Note that if the extension is explicitly specified, a stylesheet with the opposite extension may exist.

  • If none of the possible paths is valid, the importer should perform the same resolution on the URL followed by /index. In the example above, it would look for:

    • foo/bar/baz/_index.sass
    • foo/bar/baz/index.sass
    • foo/bar/baz/_index.scss
    • foo/bar/baz/index.scss

    As above, if the importer finds a stylesheet at more than one of these URLs, it should throw an exception indicating that the import is ambiguous.

If no stylesheets are found, the importer should return null.

Calling {@see \ScssPhp\ScssPhp\Importer\canonicalize} multiple times with the same URL must return the same result. Calling {@see \ScssPhp\ScssPhp\Importer\canonicalize} with a URL returned by {@see \ScssPhp\ScssPhp\Importer\canonicalize} must return that URL. Calling {@see \ScssPhp\ScssPhp\Importer\canonicalize} with a URL relative to one returned by {@see \ScssPhp\ScssPhp\Importer\canonicalize} must return a meaningful result.

Arguments

url

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 \League\Uri\Contracts\UriInterface

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 ?\League\Uri\Contracts\UriInterface

Without accessing the filesystem, returns whether passing $url to {@see canonicalize} could possibly return $canonicalUrl.

couldCanonicalize(\League\Uri\Contracts\UriInterfaceurl, \League\Uri\Contracts\UriInterfacecanonicalUrl) : bool

This is expected to be very efficient, and subclasses are allowed to return false positives if it would be inefficient to determine whether $url would actually resolve to $canonicalUrl. Subclasses are not allowed to return false negatives.

Arguments

url

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 \League\Uri\Contracts\UriInterface

canonicalUrl

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 \League\Uri\Contracts\UriInterface

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 bool

The canonical URL of the stylesheet that caused the current {@see canonicalize} invocation.

getContainingUrl() : ?\League\Uri\Contracts\UriInterface
inherited final

This is only set when the containing stylesheet has a canonical URL, and when the URL being canonicalized is either relative or has a scheme for which {@see \ScssPhp\ScssPhp\Importer\isNonCanonicalScheme} returns true. This restriction ensures that canonical URLs are always interpreted the same way regardless of their context.

Subclasses should only access this from within calls to {@see \ScssPhp\ScssPhp\Importer\canonicalize}. Outside of that context, its value is undefined and subject to change.

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 ?\League\Uri\Contracts\UriInterface

Whether the current {@see canonicalize} invocation comes from an `@import` rule.

isFromImport() : bool
inherited final

When evaluating @import rules, URLs should canonicalize to an import-only file if one exists for the URL being canonicalized. Otherwise, canonicalization should be identical for @import and @use rules.

Subclasses should only access this from within calls to {@see \ScssPhp\ScssPhp\Importer\canonicalize}. Outside of that context, its value is undefined and subject to change.

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 bool

Returns whether the given URL scheme (without `:`) should be considered "non-canonical" for this importer.

isNonCanonicalScheme(stringscheme) : bool
inherited

An importer may not return a URL with a non-canonical scheme from {@see \ScssPhp\ScssPhp\Importer\canonicalize}. In exchange, {@see \ScssPhp\ScssPhp\Importer\getContainingUrl} is available within {@see \ScssPhp\ScssPhp\Importer\canonicalize} for absolute URLs with non-canonical schemes so that the importer can resolve those URLs differently based on where they're loaded.

This must always return the same value for the same $scheme. It is expected to be very efficient.

Arguments

scheme

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 string

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 bool

Loads the Sass text for the given $url, or returns `null` if this importer can't find the stylesheet it refers to.

load(\League\Uri\Contracts\UriInterfaceurl) : ?\ScssPhp\ScssPhp\Importer\ImporterResult

The $url comes from a call to {@see \ScssPhp\ScssPhp\Importer\canonicalize} for this importer.

When Sass encounters an @import rule in a stylesheet, it first calls {@see \ScssPhp\ScssPhp\Importer\canonicalize} and {@see \ScssPhp\ScssPhp\Importer\load} on the importer that first loaded that stylesheet with the imported URL resolved relative to the stylesheet's original URL. If either of those returns null, it then calls {@see \ScssPhp\ScssPhp\Importer\canonicalize} and {@see \ScssPhp\ScssPhp\Importer\load} on each importer in order with the URL as it appears in the @import rule.

If the importer finds a stylesheet at $url but it fails to load for some reason, or if $url is uniquely associated with this importer but doesn't refer to a real stylesheet, the importer may throw an exception that will be wrapped by Sass.

Arguments

url

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 \League\Uri\Contracts\UriInterface

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50

Response

Deprecated: Please use getType in phar:///app/lib/system/lib/phpdocumentor/lib/phpDocumentor.phar/src/phpDocumentor/Descriptor/Traits/CanHaveAType.php on line 50 ?\ScssPhp\ScssPhp\Importer\ImporterResult

Properties

The path relative to which this importer looks for files.

loadPath : string

Type(s)

string