Returns the name, code and number of resources of each workspace.

@param integer $max

@return array
428734
public function findWorkspacesWithMostResources($max)
    {
        $qb = $this
            ->createQueryBuilder('ws')
            ->select('ws.name, ws.code, COUNT(rs.id) AS total')
            ->leftJoin('Claroline\CoreBundle\Entity\Resource\ResourceNode', 'rs', 'WITH', 'ws = rs.workspace')
            ->groupBy('ws.id')
            ->orderBy('total', 'DESC');

        if ($max > 1) {
            $qb->setMaxResults($max);
        }

        return $qb->getQuery()->getResult();
    }
823163
public function getAllNamespaces()
    {
        $returnValue = array();

        
        
        if(count($this->namespaces) == 0){
        	$db = core_kernel_classes_DbWrapper::singleton();
        	$query = 'SELECT modelid, modeluri FROM models';
			$result = $db->query($query);
			
			while ($row = $result->fetch()){	
				$id 	= $row['modelid'];
				$uri 	= $row['modeluri'];
				$this->namespaces[$id] = $uri;
			}
        }
        
        foreach($this->namespaces as $id => $uri){
        	$returnValue[$uri] = new common_ext_Namespace($id, $uri);
        }

        

        return (array) $returnValue;
    }
1114228
public function getNamespaces()
    {
        $db = Database::getActiveConnection();

        /** @var PDOStatement $results */
        $results = $db->createQueryBuilder()
            ->select('configNamespace')
            ->from('Config', 'c')
            ->where('configNamespace != ""')
            ->groupBy('configNamespace')
            ->execute();

        return array_map('array_shift', $results->fetchAll());
    }
378741
public function getWorkspaceOutsiders(Workspace $workspace, $page, $max = 50)
    {
        $query = $this->groupRepo->findWorkspaceOutsiders($workspace, false);

        return $this->pagerFactory->createPager($query, $page, $max);
    }
796655
public function getAll()
	{
		$keys = eaccelerator_list_keys();

		$hash = $this->options['hash'];

		$data = array();

		foreach ($keys as $key)
		{
			// Trim leading ":" to work around list_keys namespace bug in eAcc.
			// This will still work when bug is fixed.
			$name    = ltrim($key['name'], ':');
			$namearr = explode('-', $name);

			if ($namearr !== false && $namearr[0] == $hash && $namearr[1] == 'cache')
			{
				$group = $namearr[2];

				if (!isset($data[$group]))
				{
					$item = new Auditor($group);
				}
				else
				{
					$item = $data[$group];
				}

				$item->tally($key['size'] / 1024);

				$data[$group] = $item;
			}
		}

		return $data;
	}
1205556
public function GetList() {
        $namespacePrefix = "\\Applications\\" .
                "APP_NAME" .
                "\\Resources\\Common\\";
        $resourceNamespace = $this->GetResourceNamespace($namespacePrefix, $this->GroupValue);
        $resourceFile = new $resourceNamespace();
        return $resourceFile->GetList();
    }
248861
public function getFields($offset = 0, $limit = 100)
	{
		$fields = [];
		foreach ($this->client->get("fields?offset={$offset}&limit={$limit}") as $field) {
			$fields[] = new Resources\Field($this, $field);
		}
		return $fields;
	}
724406
public function getWorkspaces()
    {
        return $this->getCachedProperty(
            'workspaces',
            function () {
                $result = [];
                $items = $this->getValue('workspaces');
                if (is_array($items)) {
                    /** @var array $items */
                    foreach ($items as $item) {
                        try {
                            $result[] = new Workspace($item);
                        } catch (\InvalidArgumentException $e) {
                            throw new \UnexpectedValueException(
                                $e->getMessage(),
                                $e->getCode(),
                                $e
                            );
                        }
                    }
                }

                return $result;
            }
        );
    }
29660
public function getWorkspaceOutsidersByName(Workspace $workspace, $search, $page, $max = 50)
    {
        $query = $this->groupRepo->findWorkspaceOutsidersByName($workspace, $search, false);

        return $this->pagerFactory->createPager($query, $page, $max);
    }
805664
protected function extractNamespace($fullQualifiedNamespace) {
        $parts     = explode('\\', $fullQualifiedNamespace);
        $copyParts = $parts;
        $copyParts = array_splice($copyParts, 0, -1);

        return [
            'namespace'                => implode('\\', $copyParts),
            'class'                    => end($parts),
            'full_qualified_namespace' => $fullQualifiedNamespace
        ];
    }
715674
public function getResourceTypeNames()
    {
        if (!isset($GLOBALS['config']['ResourceType']) || !is_array($GLOBALS['config']['ResourceType'])) {
            return array();
        }

        $_names = array();
        foreach ($GLOBALS['config']['ResourceType'] as $key => $_resourceType) {
            if (isset($_resourceType['name'])) {
                $_names[] = (string)$_resourceType['name'];
            }
        }

        return $_names;
    }
310868
private function getMeta(Workspace $workspace, array $options)
    {
        $data = [
            'lang' => $workspace->getLang(),
            'forceLang' => (bool) $workspace->getLang(),
            'slug' => $workspace->getSlug(),
            'model' => $workspace->isModel(),
            'personal' => $workspace->isPersonal(),
            'description' => $workspace->getDescription(),
            'created' => DateNormalizer::normalize($workspace->getCreated()),
            'updated' => DateNormalizer::normalize($workspace->getCreated()), // todo implement
            'creator' => $workspace->getCreator() ? $this->userSerializer->serialize($workspace->getCreator(), [Options::SERIALIZE_MINIMAL]) : null,
        ];

        if (!in_array(Options::SERIALIZE_LIST, $options)) {
            // this query is very slow
            $data['totalUsers'] = $this->finder->fetch(
              User::class,
              ['workspace' => $workspace->getUuid()],
              null,
              0,
              -1,
              true
            );
            $data['totalResources'] = $this->workspaceManager->countResources($workspace);
            $data['usedStorage'] = $this->workspaceManager->getUsedStorage($workspace);
        }

        return $data;
    }
210466
public static function getNamespaces()
    {
        $called = get_called_class();

        if (!isset(static::$namespaces[$called])) {
            static::$namespaces[$called] = new PriorityQueue();
        }

        return static::$namespaces[$called];
    }
189411
private function getResources()
    {

        $resources = [];
        foreach( $this->getClassAnnotations() as $annotation ) {

            // is this a resource
            if( 0 === strpos($annotation, "resource") ) {
                $resources[] = explode(' ', $annotation)[1];
            }

        }

        return $resources;

    }
395521
public function range(int $min=null, int $max=null)
        {
                $min      = is_null($min) ? '-inf' : $min;
                $max      = is_null($max) ? '+inf' : $max;
           
                $response = $this->_redis->zrevrangebyscore($this->_key, $max, $min, 'WITHSCORES');
                $result   = [];
                for($i=0,$num=count($response);$i<$num;$i++) {
                        $result[$response[$i]] = intval($response[++$i]);
                }
                return $result;
        }
672873
public function getMetaSummaryLimited($maxSentences = 2)
    {
        if ($this->owner->hasMetaSummary()) {
            return trim(preg_replace('/\s+/', ' ', $this->owner->getMetaSummary()->LimitSentences($maxSentences)));
        }
    }
1007175
private function findFileNamespaces()
    {
        $namespaces = array();

        // namespaces can be only top-level nodes, so we can scan them directly
        foreach ($this->topLevelNodes as $topLevelNode) {
            if ($topLevelNode instanceof Namespace_) {
                $namespaceName = $topLevelNode->name ? $topLevelNode->name->toString() : '';

                $namespaces[$namespaceName] = new ReflectionFileNamespace(
                    $this->fileName,
                    $namespaceName,
                    $topLevelNode
                );
            }
        }

        return $namespaces;
    }