return parent FilesystemFolder of current folder
returns NULL, when current folder is already the root folder

@param boolean $force
@return FilesystemFolder
508908
public function getParentFolder($force = FALSE) {
		
		if(!isset($this->parentFolder) || $force) {
			
			$parentPath = realpath($this->path . '..');
			
			// flag parentFolder property, when $this is already the root folder
			
			if($parentPath === $this->path) {
				$this->parentFolder = FALSE;
			}

			else {
				$this->parentFolder = self::getInstance($parentPath);
			}

		}

		// return NULL (instead of FALSE) when there is no parent folder

		return $this->parentFolder ?: NULL;
		
	}
664862
public function getFileSystem()
    {
        if (null == $this->fileSystem) {
            $this->setFileSystem(Helper::getFileSystem());
        }

        return $this->fileSystem;
    }
1363540
public function get_parent_directory() {
        if ($this->file_record->filepath === '/' and $this->file_record->filename === '.') {
            //root dir does not have parent
            return null;
        }

        if ($this->file_record->filename !== '.') {
            return $this->fs->create_directory($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $this->file_record->filepath);
        }

        $filepath = $this->file_record->filepath;
        $filepath = trim($filepath, '/');
        $dirs = explode('/', $filepath);
        array_pop($dirs);
        $filepath = implode('/', $dirs);
        $filepath = ($filepath === '') ? '/' : "/$filepath/";

        return $this->fs->create_directory($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $filepath);
    }
471293
public function get_definition($force = false) {
        if ($this->definition === false || $force) {
            $this->load_definition();
        }
        return $this->definition;
    }
927529
public function getParent()
    {
        return $this->BaseClass && $this->ParentID
            ? DataObject::get_by_id($this->BaseClass, $this->ParentID, true)
            : null;
    }
116611
protected function getBaseDirectory()
    {
        if (! $this->fileSystem) {
            $this->fileSystem = $this->getServiceLocator()
                ->get(FileSystemService::SERVICE_ID)
                ->getDirectory($this->getFileSystemId());
        }

        return $this->fileSystem;
    }
929140
protected function deleteFolderContent($data, $root = '', $force = false)
    {
        $root = FileUtilities::fixFolderPath($root);
        $out = [];
        if (!empty($data)) {
            foreach ($data as $key => $resource) {
                $path = array_get($resource, 'path');
                $name = array_get($resource, 'name');

                if (!empty($path)) {
                    $fullPath = $path;
                } else {
                    if (!empty($name)) {
                        $fullPath = $root . '/' . $name;
                    } else {
                        throw new BadRequestException('No path or name provided for resource.');
                    }
                }

                switch (array_get($resource, 'type')) {
                    case 'file':
                        $out[$key] = ['name' => $name, 'path' => $path, 'type' => 'file'];
                        try {
                            $this->driver->deleteFile($this->container, $fullPath);
                        } catch (\Exception $ex) {
                            $out[$key]['error'] = ['message' => $ex->getMessage()];
                        }
                        break;
                    case 'folder':
                        $out[$key] = ['name' => $name, 'path' => $path, 'type' => 'folder'];
                        try {
                            $this->driver->deleteFolder($this->container, $fullPath, $force);
                        } catch (\Exception $ex) {
                            $out[$key]['error'] = ['message' => $ex->getMessage()];
                        }
                        break;
                }
            }
        }

        return $out;
    }
1312241
public function get_parent() {
        if ($this->lf->get_filepath() === '/' and $this->lf->is_directory()) {
            if ($this->areaonly) {
                return null;
            } else if ($this->itemidused) {
                return $this->browser->get_file_info($this->context, $this->lf->get_component(), $this->lf->get_filearea());
            } else {
                return $this->browser->get_file_info($this->context);
            }
        }

        if (!$this->lf->is_directory()) {
            return $this->browser->get_file_info($this->context, $this->lf->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid(), $this->lf->get_filepath(), '.');
        }

        $filepath = $this->lf->get_filepath();
        $filepath = trim($filepath, '/');
        $dirs = explode('/', $filepath);
        array_pop($dirs);
        $filepath = implode('/', $dirs);
        $filepath = ($filepath === '') ? '/' : "/$filepath/";

        return $this->browser->get_file_info($this->context, $this->lf->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid(), $filepath, '.');
    }
616991
public function getFileSystem()
    {
        if (! $this->fileSystem) {
            $this->fileSystem = $this->getServiceLocator()
                ->get(FileSystemService::SERVICE_ID)
                ->getFileSystem($this->getFileSystemId());
        }

        return $this->fileSystem;
    }
1156369
private function getBaseFolder()
    {
        $container = $this->application->getContainer();
        if (
                null === $this->baseFolder 
                && $container->hasParameter('classcontent_thumbnail.base_folder')
        ) {
            $this->baseFolder = $container->getParameter('classcontent_thumbnail.base_folder');
        }

        return $this->baseFolder;
    }
79383
public function getFileSystem()
    {
        if (! $this->storage) {
            $this->storage = $this->getServiceLocator()->get(PortableElementFileStorage::SERVICE_ID);
            $this->storage->setServiceLocator($this->getServiceLocator());
            $this->storage->setModel($this->getModel());
        }
        return $this->storage;
    }
551899
public function filesystem(string $path = null)
    {
        if (!$this->filesystem instanceof Filesystem) {
            $local = new Local($path);

            $this->filesystem = new Filesystem($local);
        }

        return $this->filesystem;
    }
38148
private function getFsRoot(): ?string
    {
        if (null === $this->fsRoot) {
            $tempDir = rtrim(sys_get_temp_dir(), '\\/');

            do {
                $name = $tempDir.'/'.uniqid('vfs', true);
            } while (file_exists($name));

            $this->fs->mkdir($name);
            $this->fsRoot = $name;
        }

        return $this->fsRoot;
    }
179625
public function loadRatioList($force = false)
    {
        if (($force === false) && (count($this->ratioList) > 0)) {
            return $this->ratioList;
        }

        $repository = $this->objectManager->getRepository('Tbbc\MoneyBundle\Entity\DoctrineStorageRatio');
        $doctrineStorageRatios = $repository->findAll();

        // FIXME
        // if filename doesn't exist, init with only reference currency code
        if (0 === count($doctrineStorageRatios)) {
            $this->ratioList = array($this->referenceCurrencyCode => 1.0);
            $this->saveRatioList($this->ratioList);

            return $this->ratioList;
        }

        $this->ratioList = array();

        foreach ($doctrineStorageRatios as $doctrineStorageRatio) {
            $this->ratioList[$doctrineStorageRatio->getCurrencyCode()] = $doctrineStorageRatio->getRatio();
        }

        return $this->ratioList;
    }
718245
public function squash($force = false) {
        if ($this->cache !== null && !$force) return $this->cache;
        if ($this->parent) {
            return $this->cache = array_merge($this->parent->squash($force), $this->data);
        } else {
            return $this->cache = $this->data;
        }
    }
1124590
public function getItems(bool $force = false) : CNabuCatalogItemList
    {
        if ($this->nb_tree_child_list->isEmpty() || $force) {
            $this->nb_tree_child_list->merge(
                CNabuCatalogItem::buildObjectListFromSQL(
                    'nb_catalog_item_id',
                    'SELECT *
                       FROM nb_catalog_item
                      WHERE nb_catalog_id=%catalog_id$d
                        AND nb_catalog_item_parent_id=%parent_id$d
                      ORDER BY nb_catalog_item_order ASC',
                    array(
                        'catalog_id' => $this->getCatalogId(),
                        'parent_id' => $this->getId()
                    ),
                    $this->getCatalog()
                )
            );
        }

        return $this->nb_tree_child_list;
    }
1063527
protected function checkFiles($force = false) {
        $files = $this->getFiles();
        foreach ($files as $file) {
            $this->checkFile($file, $force);
        }
    }