aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/scssphp/source-span/src/FileLocation.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/scssphp/source-span/src/FileLocation.php')
-rw-r--r--vendor/scssphp/source-span/src/FileLocation.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/scssphp/source-span/src/FileLocation.php b/vendor/scssphp/source-span/src/FileLocation.php
new file mode 100644
index 000000000..8028196c6
--- /dev/null
+++ b/vendor/scssphp/source-span/src/FileLocation.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace SourceSpan;
+
+use League\Uri\Contracts\UriInterface;
+
+/**
+ * The implementation of {@see SourceLocation} based on a {@see SourceFile}.
+ *
+ * @see SourceFile::location()
+ */
+final class FileLocation extends SourceLocationMixin
+{
+ /**
+ * @internal
+ */
+ public function __construct(
+ private readonly SourceFile $file,
+ private readonly int $offset,
+ ) {
+ }
+
+ public function getFile(): SourceFile
+ {
+ return $this->file;
+ }
+
+ public function getOffset(): int
+ {
+ return $this->offset;
+ }
+
+ public function getLine(): int
+ {
+ return $this->file->getLine($this->offset);
+ }
+
+ public function getColumn(): int
+ {
+ return $this->file->getColumn($this->offset);
+ }
+
+ public function getSourceUrl(): ?UriInterface
+ {
+ return $this->file->getSourceUrl();
+ }
+
+ public function pointSpan(): FileSpan
+ {
+ return new ConcreteFileSpan($this->file, $this->offset, $this->offset);
+ }
+}