Code Duplication    Length = 15-15 lines in 2 locations

src/Asset/AssetPaths.php 1 location

@@ 112-126 (lines=15) @@
109
     * @return string
110
     * @throws \Exception
111
     */
112
    public function realPath($path)
113
    {
114
        if (str_contains($path, '::')) {
115
116
            list($namespace, $path) = explode('::', $path);
117
118
            if (!isset($this->paths[$namespace])) {
119
                throw new \Exception("Path hint [{$namespace}::{$path}] does not exist!");
120
            }
121
122
            return rtrim($this->paths[$namespace], '/') . '/' . $path;
123
        }
124
125
        return $path;
126
    }
127
128
    /**
129
     * Return the download path for a remote asset.

src/Image/ImagePaths.php 1 location

@@ 107-121 (lines=15) @@
104
     * @return string
105
     * @throws \Exception
106
     */
107
    public function realPath($path)
108
    {
109
        if (str_contains($path, '::')) {
110
111
            list($namespace, $path) = explode('::', $path);
112
113
            if (!isset($this->paths[$namespace])) {
114
                throw new \Exception("Path hint [{$namespace}::{$path}] does not exist!");
115
            }
116
117
            return rtrim($this->paths[$namespace], '/') . '/' . $path;
118
        }
119
120
        return $path;
121
    }
122
123
    /**
124
     * Return the output path for an image.