public function toString()
    {
        $this->failOnWriteOnly();

        if ($this->shouldLock === false) {
            return $this->readAll();

        }

        $path = (string)$this->url();

        // If the file was not locked by me (but someone else)
        if (!$this->lockApplied && $this->pathIsLocked($path)) {
            throw new ResourceLockedException("$path is locked");
        }

        return $this->readAll();

    }