Check whether the file is dirty.

If $isDirty is not null, the dirty state will be set before its new value
is returned.

@param boolean $isDirty
@return boolean
511430
public function isDirty($isDirty = null)
    {
        if ($isDirty !== null) {
            $this->isDirty = (boolean) $isDirty;
        }
        return $this->isDirty;
    }
745882
protected function checkCache($originalFile, $cacheFile)
    {
        if (! $ret = parent::checkCache($originalFile, $cacheFile)) {
            return false;
        }

        if (Utils::isSerialized($ret, $ret)) {
            // Go through each file and make sure none of them have changed
            foreach ($ret['files'] as $file => $lastModified) {
                if (filemtime($file) > $lastModified) {
                    return false;
                }
            }

            $ret = serialize($ret);
        }

        return $ret;
    }
757469
static function cleanDirectory($dirPath, $keepStructure = false)
    {
        $scanResult = static::scanDirectory($dirPath);
        if (!$scanResult) return false;

        try {
            foreach ($scanResult['files'] as $file) unlink($file);
            if (!$keepStructure) {
                krsort($scanResult['dirs']);
                foreach ($scanResult['dirs'] as $dir) rmdir($dir);
            }
            return true;
        } catch (\Throwable $throwable) {
            return false;
        }
    }
1096156
public function isDirty()
    {
        if (
            !empty($this->_dirtyAttr) ||
            (($this instanceof DeleteBySaving) && $this->isDeleted())
        ) {
            return true;
        }

        foreach (array_keys(get_object_vars($this)) as $key) {
            foreach ((array) $this->$key as $sub) {
                if (($sub instanceof DirtyAware) && $sub->isDirty()) {
                    return true;
                }
            }
        }
        return false;
    }
993650
public function check($base_dir, $is_diff = false)
    {
        $start_checks = (int)microtime(true);

        if (!$base_dir) {
            throw new \InvalidArgumentException('Cannot work with empty base_dir');
        }

        $diff_files = null;
        $deleted_files = null;

        $this->full_run = true;

        $reference_cache = $this->file_reference_provider->loadReferenceCache(true);

        if ($is_diff
            && $reference_cache
            && $this->parser_cache_provider
            && $this->parser_cache_provider->canDiffFiles()
        ) {
            $deleted_files = $this->file_reference_provider->getDeletedReferencedFiles();
            $diff_files = $deleted_files;

            foreach ($this->config->getProjectDirectories() as $dir_name) {
                $diff_files = array_merge($diff_files, $this->getDiffFilesInDir($dir_name, $this->config));
            }
        }

        if ($this->output_format === self::TYPE_CONSOLE) {
            echo 'Scanning files...' . "\n";
        }

        if ($diff_files === null
            || $deleted_files === null
            || count($diff_files) > 200
            || $this->codebase->find_unused_code) {
            $this->codebase->scanner->addFilesToDeepScan($this->project_files);
        }

        if ($diff_files === null
            || $deleted_files === null
            || count($diff_files) > 200
        ) {
            $this->codebase->analyzer->addFiles($this->project_files);

            $this->config->initializePlugins($this);

            $this->codebase->scanFiles($this->threads);
        } else {
            if ($this->debug_output) {
                echo count($diff_files) . ' changed files: ' . "\n";
                echo '    ' . implode("\n    ", $diff_files) . "\n";
            }

            if ($diff_files || $this->codebase->find_unused_code) {
                $file_list = $this->getReferencedFilesFromDiff($diff_files);

                // strip out deleted files
                $file_list = array_diff($file_list, $deleted_files);

                $this->checkDiffFilesWithConfig($this->config, $file_list);

                $this->config->initializePlugins($this);

                $this->codebase->scanFiles($this->threads);
            }
        }

        if ($this->output_format === self::TYPE_CONSOLE) {
            echo 'Analyzing files...' . "\n";
        }

        $this->config->visitStubFiles($this->codebase, $this->debug_output);

        $plugin_classes = $this->config->after_codebase_populated;

        if ($plugin_classes) {
            foreach ($plugin_classes as $plugin_fq_class_name) {
                $plugin_fq_class_name::afterCodebasePopulated($this->codebase);
            }
        }

        $this->codebase->analyzer->analyzeFiles($this, $this->threads, $this->codebase->alter_code);

        if ($this->parser_cache_provider) {
            $removed_parser_files = $this->parser_cache_provider->deleteOldParserCaches(
                $is_diff ? $this->parser_cache_provider->getLastGoodRun() : $start_checks
            );

            if ($this->debug_output && $removed_parser_files) {
                echo 'Removed ' . $removed_parser_files . ' old parser caches' . "\n";
            }

            if ($is_diff) {
                $this->parser_cache_provider->touchParserCaches($this->getAllFiles($this->config), $start_checks);
            }
        }
    }
473710
private function hasReturnType(): bool
    {
        if ($this->hasReturnType === null) {
            $this->hasReturnType = FunctionHelper::hasReturnTypeHint($this->file->getBaseFile(), $this->stackPos);
        }

        return $this->hasReturnType;
    }
580098
public function isDirty($attributes = null)
	{
		$dirty = $this->getDirty();

		if (is_null($attributes)) return count($dirty) > 0;

		if ( ! is_array($attributes)) $attributes = func_get_args();

		foreach ($attributes as $attribute)
		{
			if (array_key_exists($attribute, $dirty)) return true;
		}

		return false;
	}
1212749
protected function isMultiValuedPropertyDirty(array $cleanData, $currentValue)
    {
        if (count($cleanData['value']) > 0 && count($cleanData['value']) === count($currentValue)) {
            if ($currentValue instanceof \SplObjectStorage) {
                $cleanIdentifiers = [];
                foreach ($cleanData['value'] as &$cleanObjectData) {
                    $cleanIdentifiers[] = $cleanObjectData['value']['identifier'];
                }
                sort($cleanIdentifiers);
                $currentIdentifiers = [];
                foreach ($currentValue as $currentObject) {
                    $currentIdentifier = $this->getIdentifierByObject($currentObject);
                    if ($currentIdentifier !== null) {
                        $currentIdentifiers[] = $currentIdentifier;
                    }
                }
                sort($currentIdentifiers);
                if ($cleanIdentifiers !== $currentIdentifiers) {
                    return true;
                }
            } else {
                foreach ($cleanData['value'] as &$cleanObjectData) {
                    if (!isset($currentValue[$cleanObjectData['index']])) {
                        return true;
                    }
                    if (($cleanObjectData['type'] === 'array' && $this->isMultiValuedPropertyDirty($cleanObjectData, $currentValue[$cleanObjectData['index']]) === true)
                        || ($cleanObjectData['type'] !== 'array' && $this->isSingleValuedPropertyDirty($cleanObjectData['type'], $cleanObjectData['value'], $currentValue[$cleanObjectData['index']]) === true)) {
                        return true;
                    }
                }
            }
        } elseif (count($cleanData['value']) > 0 || count($currentValue) > 0) {
            return true;
        }
        return false;
    }
1255227
public function getDirty()
    {
        $dirty = [];

        foreach ($this->attributes as $key => $value) {
            if (! array_key_exists($key, $this->original)) {
                $dirty[$key] = $value;
            } elseif ($value !== $this->original[$key] &&
                                 ! $this->originalIsNumericallyEquivalent($key)) {
                $dirty[$key] = $value;
            }
        }

        return $dirty;
    }
1261703
private function updateFileCleanly(JsonFile $jsonFile, array $new, $requireKey, $removeKey, $sortPackages, $isPostInstall)
    {
        $composerJson = $jsonFile->read();
        $manipulator = new JsonManipulator($composerJson);

        foreach ($new as $package => $constraint) {
            $constraint = $isPostInstall ? $this->findBestVersionForPackage($package, $constraint) : $constraint;
            if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
                return false;
            }
            if (!$manipulator->removeSubNode($removeKey, $package)) {
                return false;
            }
        }
        $jsonFile->put($manipulator->getContents());

        return true;
    }
723634
public function getDirty($include_json = false)
    {
        $dirty = parent::getDirty();

        if (!empty($this->json_values)) {
            foreach ($this->json_values as $column_name => $json_data) {
                if ($count = count($json_data->getDirty())) {
                    $dirty[$column_name] = (string) $json_data;
                } elseif ($count == 0) {
                    unset($dirty[$column_name]);
                }
            }
        }
        if (!$include_json) {
            return $dirty;
        }
        if (!empty($this->json_values)) {
            foreach ($this->json_values as $column_name => &$json_data) {
                $dirty_json = $json_data->getDirty();
                foreach ($dirty_json as $key => $value) {
                    $dirty[$column_name.'.'.$key] = $value;
                }
            }
        }

        return $dirty;
    }
265526
function is_default_file($new = null, $return_entity = false)
    {
        if (isset($new) && ($this->_attributes['is_default_file'] != $new)){
            $this->change('is_default_file', (bool)$new);
            if ($this->_attributes['is_default_file']){
                $this->change('file', '');
            }
        }
        if ($return_entity){
            if (!isset($this->_def_file)){
                if (empty($this->_attributes['is_default_file'])){
                    $this->_def_file = false;
                }else
                if (($this->_def_file = $this->proto(null, true))){
                    if ($p = $this->_def_file->is_default_file(null, true)) $this->_def_file = $p;
                }
            }
            return $this->_def_file;
        }
        return $this->_attributes['is_default_file'];
    }
713160
public function isCacheFresh()
    {
        $fileDate = $this->getOldestCachefileDate();
        $stashDate = $this->getLastTranslationChangeDate();

        if ($fileDate === null) {
            return true;
        }

        return $fileDate >= $stashDate;
    }
739007
public function isDir(): bool
    {
        if ($this->caching == false) {
            return is_dir($this->getAbsoluteFilePath());
        }

        if ($this->isDir == null) {
            $this->isDir = is_dir($this->getAbsoluteFilePath());
        }

        return $this->isDir;
    }
1206629
protected void setDirty(boolean d) {
        boolean old = isDirty();
        this.dirty = d;
        firePropertyChange("dirty", old, isDirty());
        if (isDirty()) {
            clearCache();
        }
    }
53533
func (fbo *folderBlockOps) IsDirty(lState *kbfssync.LockState, file data.Path) bool {
	fbo.blockLock.RLock(lState)
	defer fbo.blockLock.RUnlock(lState)
	// A dirty file should probably match all three of these, but
	// check them individually just in case.
	if fbo.config.DirtyBlockCache().IsDirty(
		fbo.id(), file.TailPointer(), file.Branch) {
		return true
	}

	if _, ok := fbo.dirtyFiles[file.TailPointer()]; ok {
		return ok
	}

	_, ok := fbo.unrefCache[file.TailRef()]
	return ok
}
1367780
public function getDirty()
	{
		// Kinvey needs all of the model's attributes for update operations
		// see (http://devcenter.kinvey.com/rest/guides/datastore#Saving).

		$dirty = $this->attributes;

		if (array_key_exists(static::UPDATED_AT, $dirty)) unset($dirty[static::UPDATED_AT]);

		return $dirty;
	}