code: public function write(string $contents, int $opts = 0): bool
      {
          if ($this->prepareWrite() !== true) {
              $this->error = "failed to write '{$this->path}; {$this->error}";
              return false;
          }
          return $this->writeFile($contents, $opts);
      }
docs: Prepare and write to the file
  
  @param string $contents
  @param int $opts Bitmask options to pass to `file_put_contents`
  @return bool