Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. JsonFile.php

function JsonFile::filePutContentsIfModified

Modify file properties only if content modified

Return value

int|false

1 call to JsonFile::filePutContentsIfModified()
JsonFile::write in vendor/composer/composer/src/Composer/Json/JsonFile.php
Writes json file.

File

vendor/composer/composer/src/Composer/Json/JsonFile.php, line 182

Class

JsonFile
Reads/writes json files.

Namespace

Composer\Json

Code

private function filePutContentsIfModified(string $path, string $content) {
    $currentContent = @file_get_contents($path);
    if (false === $currentContent || $currentContent !== $content) {
        return file_put_contents($path, $content);
    }
    return 0;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal