@param FolderInterface $folder

@return bool
493331
public function isDeleteAllowed(FolderInterface $folder)
    {
        if (!$this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN') && !$this->authorizationChecker->isGranted('FOLDER_DELETE', $folder)) {
            return false;
        }

        if ($this->deletePolicy === 'delete_all') {
            return true;
        }

        $folderUsageRepository = $this->entityManager->getRepository('PhlexibleMediaManagerBundle:FolderUsage');
        $folderUsages = $folderUsageRepository->findBy(['folder' => $folder]);

        foreach ($folderUsages as $folderUsage) {
            if (in_array($folderUsage->getStatus(), [FolderUsage::STATUS_ONLINE, FolderUsage::STATUS_LATEST])) {
                return false;
            }
            if ($folderUsage->getStatus() === FolderUsage::STATUS_OLD && $this->deletePolicy === 'hide_old') {
                return false;
            }
        }

        return true;
    }
384655
public function renameFolder(Folder $folder, $newTitle)
	{
		$entityManager = $this->getDoctrineEntityManager();
		$entityManager->beginTransaction();
		$oldFolder = clone($folder);
		$entityManager->detach($oldFolder);

		try {
			$folder->setFileName($newTitle);

			// validating folder before renaming
			foreach ($this->folderUploadFilters as $filter) {
				$filter->validateFolder($folder);
			}

			$entityManager->flush();

			// rename folder in both file storages
			$this->renameFolderInFileSystem($oldFolder, $folder);
		} catch (\Exception $e) {
			$entityManager->detach($folder);
			$entityManager->rollback();

			throw $e;
		}

		$entityManager->commit();
	}
5595
public function equals(FilePathInterface $filePath): bool
    {
        return $this->getDrive() === $filePath->getDrive() && $this->isAbsolute() === $filePath->isAbsolute() && $this->getDirectoryParts() === $filePath->getDirectoryParts() && $this->getFilename() === $filePath->getFilename();
    }
725562
public function actionFolderUpdate($folderId)
    {
        $this->checkRouteAccess(self::PERMISSION_ROUTE);
        
        $model = StorageFolder::findOne($folderId);
        if (!$model) {
            return false;
        }
        $model->attributes = Yii::$app->request->post();
    
        $this->flushApiCache();
        
        return $model->update();
    }
64925
public function process(RequestInterface $request): bool
    {
        if (!$request->getMethod()->isGet()) {
            return false;
        }

        if ($request->getUrl()->getQueryString() === null) {
            return false;
        }

        return $this->doProcess($request->getQueryParameters());
    }
69654
protected static function isAsset(PackageInterface $package)
    {
        foreach (Assets::getTypes() as $type) {
            $type = Assets::createType($type);

            if ($package->getType() === $type->getComposerType()) {
                return true;
            }
        }

        return false;
    }
779983
protected function pathExists($folder)
    {
        $folder = Str::studly($folder);

        return in_array($folder, $this->getAllBaseNames());
    }
1253575
public function setFolder($folder)
    {
        if (substr($folder, strrpos($folder, '/')) !== strlen($folder)) {
            $folder .= '/';
        }
        $this->folder = $folder;
    }
14557
private function isImage(FileInterface $file) {
    $image = $this->getImage($file);

    if ($image === NULL) {
      return FALSE;
    }

    return $image->isValid();
  }
117917
private boolean folderContainsFiles(File folder) {
        if (folder != null) {
            File[] files = folder.listFiles();
            for (File file : files)
                if (file.isFile())
                    return true;
            for (File file : files)
                if (file.isDirectory())
                    if (folderContainsFiles(file))
                        return true;
        }
        return false;
    }
968599
public function isForPackage(PackageInterface $package)
    {
        if ($this->getForPackage() !== $package->getName()) {
            return false;
        }
        $fpv = $this->getForPackageVersion();
        if ($fpv !== null) {
            $pv = new Constraint('=', $package->getVersion());
            if (!$fpv->matches($pv)) {
                return false;
            }
        }

        return true;
    }
489231
public function folder(Folder $folder = null)
    {
        if (is_null($folder)) {
            return $this->folder;
        }

        $this->folder = $folder;

        return $this;
    }
734193
public function deletePluginEntry($folder, $element=null)
	{
		if ($this->baseDb->tableExists('#__plugins'))
		{
			// Delete plugin(s) entry
			$query = "DELETE FROM `#__plugins` WHERE `folder` = " . $this->baseDb->quote($folder) . ((!is_null($element)) ? " AND `element` = '{$element}'" : "");
			$this->baseDb->setQuery($query);
			$this->baseDb->query();

			$this->log(sprintf('Removed plugin entry for "%s"', 'plg_' . $folder . ($element ? '_' . $element : '')));

			return true;
		}
		elseif ($this->baseDb->tableExists('#__extensions'))
		{
			// Delete plugin(s) entry
			$query = "DELETE FROM `#__extensions` WHERE `folder` = " . $this->baseDb->quote($folder) . ((!is_null($element)) ? " AND `element` = '{$element}'" : "");
			$this->baseDb->setQuery($query);
			$this->baseDb->query();

			$this->log(sprintf('Removed extension entry for plugin "%s"', 'plg_' . $folder . ($element ? '_' . $element : '')));

			return true;
		}

		return false;
	}
934940
public function getRootFolderFor(Folder $folder)
    {
        $parentIds = $this->getParentIds($folder);

        return $this->repository->getFolder($parentIds[0]);
    }
1225731
protected function validateFolder($exposeFolder)
    {
        if (strstr($exposeFolder, '.')) {
            return false;
        }
        if (strpos($exposeFolder, '/') === 0) {
            return false;
        }
        if (strpos($exposeFolder, '\\') === 0) {
            return false;
        }
        return true;
    }
1074265
public function setPermissions($folder)
    {
        // Get path to folder
        $folder = $this->releasesManager->getCurrentReleasePath($folder);
        $this->explainer->line('Setting permissions for '.$folder);

        // Get permissions options
        $callback = $this->config->getContextually('remote.permissions.callback');
        $commands = (array) $callback($folder, $this);

        // Cancel if setting of permissions is not configured
        if (empty($commands)) {
            return true;
        }

        return $this->modulable->runForCurrentRelease($commands);
    }
861893
public function createFolder(Folder $folder)
	{
		// validating folder before creation
		foreach ($this->folderUploadFilters as $filter) {
			$filter->validateFolder($folder);
		}

		$this->createBothFoldersInFileSystem($folder);
	}