Removes duplicate assets from the entire collection.
@return void
181213
protected function removeDuplicates()
    {
        foreach ($this->assets as $type => &$collection) {

            $pathCache = [];
            foreach ($collection as $key => $asset) {

                if (!$path = array_get($asset, 'path')) {
                    continue;
                }

                if (isset($pathCache[$path])) {
                    array_forget($collection, $key);
                    continue;
                }

                $pathCache[$path] = true;
            }

        }
    }
433917
public function clear()
    {
        if (null !== $this->aCategory) {
            $this->aCategory->removeC2P($this);
        }
        if (null !== $this->aPage) {
            $this->aPage->removeC2P($this);
        }
        $this->category_id = null;
        $this->page_id = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
1121724
public function delete() {
        global $DB;
        $DB->delete_records('portfolio_instance_config', array('instance' => $this->get('id')));
        $DB->delete_records('portfolio_instance_user', array('instance' => $this->get('id')));
        $DB->delete_records('portfolio_tempdata', array('instance' => $this->get('id')));
        $DB->delete_records('portfolio_instance', array('id' => $this->get('id')));
        $this->dirty = false;
        return true;
    }
636483
public function clear()
    {
        $this->paths = [];
        $this->names = [];
        $this->recursive = false;
        $this->file_only = false;
        $this->directory_only = false;
    }
1137981
public function clear()
    {
        $this->errors = [];
        $this->notices = [];
        $this->warnings = [];

        $this->warningsExist = false;
        $this->noticesExist = false;
        $this->errorsExist = false;

        $this->propertyResults = [];
    }
1297845
public function removeMergedAssets($pluginName = false)
    {
        $assetsToRemove = array($this->getMergedStylesheetAsset());

        if ($pluginName) {
            if ($this->pluginContainsJScriptAssets($pluginName)) {
                if (Manager::getInstance()->isPluginBundledWithCore($pluginName)) {
                    $assetsToRemove[] = $this->getMergedCoreJSAsset();
                } else {
                    $assetsToRemove[] = $this->getMergedNonCoreJSAsset();
                }
            }
        } else {
            $assetsToRemove[] = $this->getMergedCoreJSAsset();
            $assetsToRemove[] = $this->getMergedNonCoreJSAsset();
        }

        $this->removeAssets($assetsToRemove);
    }
834036
public function removeAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->removeElement($asset);
            return true;
        }
        return false;
    }
1050876
final protected function clear(){
        $this->_distinct = false;
        $this->_select = [];
        $this->_from = '';
        $this->_join = [];
        $this->_wheres = [];
        $this->_group_by = [];
        $this->_order_by = [];
        $this->_limit = [];
    }
936818
public function onBeforeDelete()
    {
        $currentVersion = $this->owner->CurrentVersion();

        // make sure there actually is a current version, otherwise we're going
        // to end up deleting a bunch of incorrect stuff!
        if ($currentVersion && $currentVersion->ID > 0) {
            $folder = dirname($this->owner->CurrentVersion()->getFullPath());

            if ($versions = $this->owner->Versions()) {
                foreach ($versions as $version) {
                    $version->delete();
                }
            }

            if (is_dir($folder)) {
                Filesystem::removeFolder($folder);
            }

            // If the _versions folder is now empty - because there are no other versions of any assets - then we can
            // delete the _versions folder
            $folder = dirname($folder); // We want the parent of $folder, as we just deleted $folder
            if (is_dir($folder)) {
                $dir = opendir($folder);
                $foundOtherFile = false;

                while ($file = readdir($dir)) {
                    if (($file == '.' || $file == '..')) {
                        continue;
                    }
                    $foundOtherFile = true;
                }

                if (!$foundOtherFile) {
                    // No other files found, so we can delete the _versions folder
                    rmdir($folder);
                }
            }
        }
    }
1337675
public function clean()
    {
        if ($this->files->exists($this->path)) {
            $this->files->cleanDirectory($this->path);
        }
    }
606102
public function remove()
    {
        $this->debug->groupCollapsed(__METHOD__);
        $name = $this->data['name'];
        $this->trashCollectFiles($this->data);
        $this->data = array();
        unset($_SESSION['form_persist'][$name]);
        if (empty($_SESSION['form_persist'])) {
            unset($_SESSION['form_persist']);
        }
        $this->debug->groupEnd();
    }
1102544
public function clear()
    {
        if (null !== $this->aSport) {
            $this->aSport->removeGroup($this);
        }
        $this->id = null;
        $this->title = null;
        $this->description = null;
        $this->slug = null;
        $this->sport_id = null;
        $this->skill_count = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
1333939
final public function clearCollection()
    {
        $reset = [
            &$this->collection,
            &$this->collectionRaw,
        ];

        foreach ($reset as &$property) {
            $property = [];
        }
    }
437069
public function clearAll()
    {
        $path  = $this->getFilePath();
        $files = glob($path . '*' . $this->fileExtension);

        foreach ($files as $file)
        {
            @unlink($file);
        }

        static::$keys = [];
    }
41113
private function altImagesToUnique()
    {
        if ($this->alternateImageUrls->count() === 0) {
            return;
        }
        $images = $this->getAlternateImageUrls();
        $resetImages = false;
        $duplicates = array_count_values($images);
        foreach ($duplicates as $val => $count) {
            if ($count > 1) {
                $resetImages = true;
                $images = array_unique($images);
                break;
            }
        }
        $key = array_search($this->getImageUrl(), $images, true);
        if ($key !== false) {
            $resetImages = true;
            unset($images[$key]);
        }
        if ($resetImages) {
            $this->setAlternateImageUrls(array_values($images));
        }
    }
869282
private function removeFiles()
    {
        foreach ($this->files as $filename) {
            if (file_exists($filename)) {
                @unlink($filename);
            }
        }
        $this->files = array();
    }
204412
public function clear()
    {
        $this->items  = [];
        $this->serial = 0;
        $this->count  = 0;
        $this->sorted = false;
    }