Return aggregated status.

@param ExtendedFolderInterface $folder

@return array
166592
public function getUsedIn(ExtendedFolderInterface $folder)
    {
        $qb = $this->folderUsageRepository->createQueryBuilder('u');
        $qb
            ->select(['u.usageType', 'u.usageId', 'u.status'])
            ->join('u.folder', 'f')
            ->where($qb->expr()->eq('f.id', $qb->expr()->literal($folder->getId())));

        $usedIn = [];
        foreach ($qb->getQuery()->getScalarResult() as $row) {
            $usedIn[] = [
                'usage_type' => $row['usageType'],
                'usage_id' => $row['usageId'],
                'status' => $row['status'],
            ];
        }

        return $usedIn;
    }
706827
public function getFolder(...$folder)
    {
        $folder = implode('/', $folder);
        $folder = $this->modulable->replacePatterns($folder);

        $base = $this->connections->is('local') ? getcwd() : $this->getHomeFolder();
        $base = $base.'/';
        $stage = $this->connections->getCurrentConnectionKey()->stage;
        if ($folder && $stage) {
            $base .= $stage.'/';
        }

        // Replace base and cap it
        $folder = preg_replace('#^'.$base.'#', null, $folder);
        $folder = $base.$folder;

        return $folder;
    }
938889
public function get_acl($folder)
    {
        if (!$this->get_capability('ACL')) {
            return null;
        }

        if (!$this->check_connection()) {
            return null;
        }

        return $this->conn->getACL($folder);
    }
502284
public function getStat($key)
    {
        $stat = $this->zipArchive->statName($key);
        if (false === $stat) {
            return array();
        }

        return $stat;
    }
103625
public function getFoldersArray()
    {
        if ($this->_foldersArray === null) {
            $query = (new Query())
                ->from('{{%admin_storage_folder}} as folder')
                ->select(['folder.id', 'name', 'parent_id', 'timestamp_create', 'COUNT(file.id) filesCount'])
                ->where(['folder.is_deleted' => false])
                ->orderBy(['name' => 'ASC'])
                ->leftJoin('{{%admin_storage_file}} as file', 'folder.id=file.folder_id AND file.is_deleted = 0')
                ->groupBy(['folder.id'])
                ->indexBy(['id']);

            $this->_foldersArray = $this->getQueryCacheHelper($query, self::CACHE_KEY_FOLDER);
        }

        return $this->_foldersArray;
    }
626983
private function getFolderByHandle(string $folderHandle): \stdClass
    {
        $volume = Craft::$app->volumes->getVolumeByHandle($folderHandle);
        if ($volume) {
            $folder = $this->getFolderByVolumeId($volume->id);
            if ($folder) {
                return  (object) [
                    'id' => $folder->id,
                    'handle' => $folderHandle
                ];
            }
        }
        return null;
    }
376737
public function aggregate()
    {
        $commands = [];
        foreach ($this->getVisibleCommands() as $name => $cmd) {
            $commands[$name] = $cmd;
        }

        foreach ($this->commandGroups as $g) {
            if ($g->isHidden) {
                continue;
            }
            foreach ($g->getCommands() as $name => $cmd) {
                unset($commands[$name]);
            }
        }

        uasort($this->commandGroups, function ($a, $b) {
            if ($a->getId() === 'dev') {
                return 1;
            }

            return 0;
        });

        return [
            'groups' => $this->commandGroups,
            'commands' => $commands,
        ];
    }
585320
private function listAllFiles($folder, $extension = '*')
    {
        /**
         * @var array<mixed, string> $fileList
         * @var string $i
         * @var string $file
         * @var \RecursiveDirectoryIterator $dir
         * @var \RecursiveIteratorIterator $ite
         */
        $dir = new \RecursiveDirectoryIterator($folder);
        $ite = new \RecursiveIteratorIterator($dir);
        if ($extension === '*') {
            $pattern = '/.*/';
        } else {
            $pattern = '/.*\.' . $extension . '$/';
        }
        $files = new \RegexIterator($ite, $pattern, \RegexIterator::GET_MATCH);

        /** @var array<string, string> $fileList */
        $fileList = [];

        /**
         * @var string $fileSub
         */
        foreach($files as $fileSub) {
            $fileList = \array_merge($fileList, $fileSub);
        }

        /**
         * @var string $i
         * @var string $file
         */
        foreach ($fileList as $i => $file) {
            if (\preg_match('#/\.{1,2}$#', (string) $file)) {
                unset($fileList[$i]);
            }
        }
        return \array_values($fileList);
    }
1297120
public function actionAll($sort = '')
    {
        $order = ExtHelpers::getOrder($sort, [
            'url_id',
            'route',
            'method',
            'host',
            'enable_rule',
            'note',
            'status'
        ], [], 'url_id DESC');
        $list = DpAdminMenuUrl::find()->orderBy($order)->all();

        return [
            'total' => count($list),
            'list' => $list,
        ];
    }
1141642
public function isDir($folder)
    {
        $metadata = $this->dropbox->getMetadata($this->pathRoot.$folder);
        return is_array($metadata) && isset($metadata['is_dir']) && $metadata['is_dir']==true;
    }
265056
public static function getStatuses()
    {
        return [
            self::STATUS_ACTIVE => Yii::t('podium/view', 'Active'),
            self::STATUS_BANNED => Yii::t('podium/view', 'Banned'),
            self::STATUS_REGISTERED => Yii::t('podium/view', 'Registered'),
        ];
    }
621031
public function getCount($folder = null){

        if ($folder) {
            $conn = $this->getFolder($folder);
        } else {
            $conn = $this->conn;
        }

        return imap_num_msg($conn);
    }
1124888
public function getHighestStatus(ExtendedFolderInterface $folder)
    {
        $status = $this->getStatus($folder);

        if ($status & 8) {
            return 8;
        } elseif ($status & 4) {
            return 4;
        } elseif ($status & 2) {
            return 2;
        } elseif ($status & 1) {
            return 1;
        }

        return 0;
    }
41394
public static function getUserBasedCachedDir($folder = null)
    {
        $path = [
            sys_get_temp_dir(),
            'symfony2',
        ];

        if (null !== $folder) {
            $path[] = sprintf('%s_%s', $folder, self::getCurrentSetupHash());
        }

        $path[] = SystemUtility::getCurrentUser();

        $folder = implode(DIRECTORY_SEPARATOR, $path);

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

        return $this->repository->getFolder($parentIds[0]);
    }
973385
public function getStatusInfo( $folder = NULL )
	{
		$address	= $this->connection->getAddress( $folder );
		$info		= imap_status( $this->connection->getStream(), $address, SA_ALL );
		if( !$info )
			throw new Exception( "imap_status() failed: ". imap_lasterror() );
		return array(
			"messages"	=> $info->messages,
			"recent"	=> $info->recent,
			"unseen"	=> $info->unseen,
		);
	}
51064
public function getStatus()
    {
        /** @var $result CallResult */
        $result = $this->getGit()->{'status'}($this->getRepositoryPath(), array(
            '--short'
        ));
        $result->assertSuccess(
            sprintf('Cannot retrieve status from "%s"', $this->getRepositoryPath())
        );

        $output = rtrim($result->getStdOut());
        if (empty($output)) {
            return array();
        }

        $status = array_map(function($f) {
            $line   = rtrim($f);
            $parts  = array();
            preg_match('/^(?<x>.)(?<y>.)\s(?<f>.+?)(?:\s->\s(?<f2>.+))?$/', $line, $parts);

            $status = array(
                'file'      => $parts['f'],
                'x'         => trim($parts['x']),
                'y'         => trim($parts['y']),
                'renamed'   => (array_key_exists('f2', $parts)) ? $parts['f2'] : null
            );
            return $status;
        }, explode("\n", $output));
        return $status;
    }