@param Meta   $meta
@param string $fileContent

@return bool
352563
public function isUpdatable(Meta $meta, $fileContent)
    {
        if (null !== $meta->getStartTokenRegex()) {
            // When no start token is found just ignore the content to prevent corrupting
            if (!preg_match($meta->getStartTokenRegex(), $fileContent, $startMatch)) {
                return false;
            }

            $fileContent = substr($fileContent, strlen($startMatch[0]));
        }

        // Check for preservation header
        if (preg_match('&^'.preg_quote($meta->getStartDelimiter()).'?!&', $fileContent)) {
            return false;
        }

        return true;
    }
497931
public function parseAnnotations($fileContents)
    {
        $ret = array();
        if (preg_match('/^#\s*@(\w+)[:=]?\s+([\'"])?(.*)\2\s*$/m', $fileContents, $m)) {
            $ret[$m[1]] = $m[3];
        }
        return $ret;
    }
732051
private static function compareContents($filePath, $newContent)
    {
        if (file_exists($filePath)) {
            $currentContent = file_get_contents($filePath);
            return strcmp($currentContent, $newContent) === 0;
        }

        return false;
    }
264033
public function update($path, $contents, Config $config)
    {
        try {
            return $this->normalizeMetadata($this->api->upload($path, $contents, true));
        } catch (\Exception $e) {
            return false;
        }
    }
582138
public function cacheFile($cacheKey, $fileContents) {

        // Get directory and filename
        list($directory, $filename) = $this->getDirectoryAndFilenameFromKey($cacheKey);

        // Make the cache directory
        if (!file_exists($directory)) mkdir($directory, 0777, true);

        // Save the file
        file_put_contents($directory . "/" . $filename, $fileContents);

    }
608309
public function hasMetadata(string $name) : bool
    {
        return $this->metadata->any(function (ContentMetadata $metadata) use ($name) {
            return $metadata->name === $name;
        });
    }
758518
public function removeMeta(\Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $meta)
    {
        $this->meta->removeElement($meta);
    }
1102582
private function isTranslation(ClassMetadata $meta)
    {
        return $this->getClassAnalyzer()->hasTrait($meta->getReflectionClass(), $this->translationTrait, true);
    }
537319
static function fixImgPaths( $fileContent, $file )
    {
        if ( preg_match_all( "/url\(\s*[\'|\"]?([A-Za-z0-9_\-\/\.\\%?&@#=]+)[\'|\"]?\s*\)/ix", $fileContent, $urlMatches ) )
        {
           $urlPaths = array();
           $urlMatches = array_unique( $urlMatches[1] );
           $cssPathArray   = explode( '/', $file );
           $wwwDir = self::getWwwDir();
           // Pop the css file name
           array_pop( $cssPathArray );
           $cssPathCount = count( $cssPathArray );
           foreach ( $urlMatches as $match )
           {
               $match = str_replace( '\\', '/', $match );
               $relativeCount = substr_count( $match, '../' );
               // Replace path if it is realtive
               if ( $match[0] !== '/' and strpos( $match, 'http:' ) === false )
               {
                   $cssPathSlice = $relativeCount === 0 ? $cssPathArray : array_slice( $cssPathArray  , 0, $cssPathCount - $relativeCount  );
                   $newMatchPath = $wwwDir;
                   if ( !empty( $cssPathSlice ) )
                   {
                       $newMatchPath .= implode( '/', $cssPathSlice ) . '/';
                   }
                   $newMatchPath .= str_replace( '../', '', $match );
                   $urlPaths[$match] = $newMatchPath;
               }
           }
           $fileContent = strtr( $fileContent, $urlPaths );
        }
        return $fileContent;
    }
1354313
public function update(string $path, string $contents, array $config = []): bool
    {
        $location = $this->applyBasePath($path);
        $this->ensureDirectory(dirname($location));

        if (file_put_contents($location, $contents, $this->writeFlags) === false) {
            return false;
        }

        if (($visibility = Arr::get($config, 'visibility')) !== null) {
            $this->setVisibility($path, $visibility);
        }

        unset($location, $visibility);

        return true;
    }
762478
static function writeFile( $filename,  $fileContent,  $flags=null){
        mkdir(dirname($filename), 0777, true);
        file_put_contents($filename,$fileContent,$flags);
    }
798810
public function _fetchContents( $filePath, $fname = false )
    {
        if ( $fname )
            $fname .= "::_fetchContents($filePath)";
        else
            $fname = "_fetchContents($filePath)";
        $metaData = $this->_fetchMetadata( $filePath, $fname );
        // @todo Throw an exception
        if ( !$metaData )
        {
            eZDebug::writeError( "File '$filePath' does not exist while trying to fetch its contents.", __METHOD__ );
            return false;
        }

        // @todo Catch an exception
        if ( !$contents = $this->dfsbackend->getContents( $filePath ) )
        {
            eZDebug::writeError("An error occurred while reading contents of DFS://$filePath", __METHOD__ );
            return false;
        }
        return $contents;
    }
1295690
public function saveFile($filePath, $fileContent)
    {
        if (false === is_dir(dirname($filePath))) {
            mkdir(dirname($filePath), 0755);
        }

        return file_put_contents($filePath, $fileContent);
    }
334844
protected function _saveMetadatas($id, $metadatas)
    {
        $file = $this->_metadatasFile($id);
        $result = $this->_filePutContents($file, serialize($metadatas));
        if (!$result) {
            return false;
        }
        return true;
    }
1364084
public function matchExact($meta)
    {
        $metaArray = $meta->toArray();
        foreach (array('MetaName', 'MetaValue') as $key) {
            if (strcmp($metaArray[$key], $this->fields[$key]) !== 0)
                return false;
        }

        return true;
    }
1020652
private function writeTemplateToFile($fileContent, $filename, $force = false)
    {
        $created = false;
        if ($force || !file_exists($filename)) {
            try {
                $this->cache->storeData($filename, $fileContent, Cache::TEXT, true);
                $created = true;
            } catch (\Exception $e) {
                Logger::log($e->getMessage(), LOG_ERR);
            }
        } else {
            Logger::log($filename . t(' not exists or cant write'), LOG_ERR);
        }
        return $created;
    }
143650
public function hasMetaData(ArticleMetaInterface $metaData)
    {
        $result = false;

        foreach($this->metaData as $meta)
        {
            if($meta->getKey() == $metaData->getKey() && $meta->getValue() == $metaData->getValue())
            {
                $result = true;

                break;
            }
        }

        return $result;
    }