Returns an array filled with Client objects.

@param  array $filter
@return array|Client[]
357340
public function clientList(array $filter = array())
  {
    if($this->clientList === null)
    {
      $clients = $this->request("clientlist -uid -away -badges -voice -info -times -groups -icon -country -ip")->toAssocArray("clid");

      $this->clientList = array();

      foreach($clients as $clid => $client)
      {
        if($this->getParent()->getExcludeQueryClients() && $client["client_type"]) continue;

        $this->clientList[$clid] = new Client($this, $client);
      }

      uasort($this->clientList, array(__CLASS__, "sortClientList"));

      $this->resetNodeList();
    }

    return $this->filterList($this->clientList, $filter);
  }
111077
protected function getClassNameWithParams($filter)
    {
        $pattern = explode(':', $filter);

        $className = trim($pattern[0]);

        $params = [];

        if(isset($pattern[1])) {
            $params = array_map('trim', explode(',', $pattern[1]));
        }

        return [$className, $params];
    }
101183
public function all($filters = array())
	{
		// load all session keys
		$result   = $this->database->scan(0, array('MATCH' => $this->prefix . '*'));
		$cursor   = $result[0];
		$sessions = $result[1];

		// var to hold distinct sessions
		$distinct = array();

		// loop through all session keys and get data
		foreach ($sessions as $k => $v)
		{
			// get session data for key
			$sessions[$k] = $this->database->hgetall($v);
			$userid       = $sessions[$k]->userid;
			$guest        = $sessions[$k]->guest;
			$client       = $sessions[$k]->client_id;

			// guest filter
			if (isset($filters['guest']) && $filters['guest'] != $guest)
			{
				unset($sessions[$k]);
				continue;
			}

			// client filter
			if (isset($filters['client']))
			{
				// make sure is array
				if (!is_array($filters['client']))
				{
					$filters['client'] = array($filters['client']);
				}
				// check to make sure client is in what we want
				if (!in_array($client, $filters['client']))
				{
					unset($sessions[$k]);
					continue;
				}
			}

			// distinct filter
			if (isset($filters['distinct']) && $filters['distinct'] == 1)
			{
				if (isset($distinct[$client]) && in_array($userid, array_keys($distinct[$client])))
				{
					$key         = $distinct[$client][$userid]->key;
					$beforeTime  = $distinct[$client][$userid]->time;
					$currentTime = $sessions[$k]->time;

					// is this sessions time greater then the 
					// previous one saved for this user for this client?
					if ($currentTime < $beforeTime)
					{
						$key = $k;
					}

					unset($sessions[$key]);
					continue;
				}
				else
				{
					$sessions[$k]->key = $k;
					$distinct[$client][$userid] = $sessions[$k];
				}
			}
		}

		// return array of session objects
		return array_values(array_filter($sessions));
	}
194624
public function toArray(
        array $columns = [],
        $filter = null
    ): array {
        $data = [];
        foreach ($this as $key => $item) {
            $data[$key] = $item;
        }
        unset($data['_keyMap']);
        if (!empty($this->_keyMap)) {
            foreach ($this->_keyMap as $beanKey => $dataKey) {
                if (array_key_exists($beanKey, $data)) {
                    $data[$dataKey] = $data[$beanKey];
                    unset($data[$beanKey]);
                }
            }
        }

        empty($columns) || $data = array_intersect_key(
            $data,
            array_flip($columns)
        );
        if ($filter === static::FILTER_NOT_NULL) {
            return array_filter($data, function ($val) {
                return !is_null($val);
            });
        } else if ($filter === static::FILTER_NOT_EMPTY) {
            return array_filter($data, function ($val) {
                if ($val === 0 || $val === '0') {
                    return true;
                } else {
                    return !empty($val);
                }
            });
        } else if (is_callable($filter)) {
            return array_filter($data, $filter);
        }
        return $data;
    }
820007
public function getEmails(array $filters): array
    {
        @trigger_error(sprintf('The %s() method is deprecated since version 0.8. Use EmailActivityApi::list() instead.', __METHOD__), E_USER_DEPRECATED);

        /** @var EmailActivityApi $apiHandler */
        $apiHandler = $this->closeIoApiWrapper->getEmailActivitiesApi();

        return $apiHandler->list(0, self::MAX_ITEMS_PER_REQUEST, $filters);
    }
710998
protected function getFilterArray(FilterInterface $filter): array
    {
        $result = [];

        if ($filter instanceof Filter) {
            $result[$this->keyRepository->get('f')] = $filter->getField();
            if ($filter->getOperator() !== null) {
                $result[$this->keyRepository->get('o')] = $filter->getOperator();
            }
            if ($filter->getData() !== null) {
                $result[$this->keyRepository->get('d')] = $filter->getData();
            }
        }
        if ($filter instanceof GroupAndFilter) {
            $group = [];
            foreach ($filter as $subFilter) {
                $group[] = $this->getFilterArray($subFilter);
            }
            $result[$this->keyRepository->get('and')] = $group;
        }
        if ($filter instanceof GroupOrFilter) {
            $group = [];
            foreach ($filter as $subFilter) {
                $group[] = $this->getFilterArray($subFilter);
            }
            $result[$this->keyRepository->get('or')] = $group;
        }

        return $result;
    }
1230865
public function getMetrics(array $filter = [])
    {
        $optionsResolver = $this->createOptionResolver();
        $optionsResolver->setDefault('displayed', 1);
        $optionsResolver->setAllowedValues('displayed', array(0, 1));
        $options = $optionsResolver->resolve($filter);

        $queryParams = '?'.http_build_query($options);

        $response = $this->client->get('metrics'.$queryParams);

        return json_decode($response->getBody(true), true);
    }
834269
public static function getOptions($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/options' . $filter->toQuery(), 'Option');
    }
683635
public function listIssues(string $filter = AbstractApi::FILTER_ASSIGNED, string $state = AbstractApi::STATE_OPEN,
                               string $labels = '', string $sort = AbstractApi::SORT_CREATED,
                               string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([
                'filter'    => $filter,
                'state'     => $state,
                'labels'    => $labels,
                'sort'      => $sort,
                'direction' => $direction,
                'since'     => (new DateTime($since))->format(DateTime::ATOM)
            ])));
    }
1207709
public function getSetters($filter = \ReflectionProperty::IS_PUBLIC)
    {
        $setters = array();
        $methods = $this->getMethods($filter);
        foreach ($methods as $method) {
            if (substr($method->getName(), 0, 3) === 'set') {
                $setters[] = $method;
            }
        }

        return $setters;
    }
1269789
public function getNodes(?callable $filter = null, string $namespace = self::DEFAULT_NAMESPACE): array
    {
        $nodes = [];
        $nodeRefs = $this->nodeRefs[$namespace] ?? [];

        foreach ($nodeRefs as $key => $nodeRef) {
            try {
                $node = $this->ncrCache->getNode($nodeRef);
                if (null === $filter || $filter($node, $nodeRef)) {
                    $nodes[$key] = $node;
                }
            } catch (\Throwable $e) {
                // if you don't node me by now, you will never never never node me.
            }
        }

        return $nodes;
    }
1120864
public function getGroups($filter = array()) {
        $by = 'c_sort';
        $order = 'asc';

        $res = array();

        /** @noinspection PhpDynamicAsStaticMethodCallInspection */
        $dbres = \CGroup::GetList($by, $order, $filter);
        while ($item = $dbres->Fetch()) {
            $res[] = $this->getGroup($item['ID']);
        }

        return $res;

    }
1100801
protected function fetchApplications($filter = array())
    {
        $repositories = $this->repositories;

        /** @var ApplicationRepository $appRepo */
        $appRepo      = $repositories->get('Applications/Application');
        $query        = array('isDraft' => null);

        foreach ($filter as $key => $value) {
            switch ($key) {
                case "before":
                    $date = new \DateTime($value);
                    $q = array('$lt' => $date);
                    if (isset($query['dateCreated.date'])) {
                        $query['dateCreated.date'] = array_merge(
                            $query['dateCreated.date'],
                            $q
                        );
                    } else {
                        $query['dateCreated.date'] = $q;
                    }
                    break;

                case "after":
                    $date = new \DateTime($value);
                    $q = array('$gt' => $date);
                    if (isset($query['dateCreated.date'])) {
                        $query['dateCreated.date'] = array_merge(
                            $query['dateCreated.date'],
                            $q
                        );
                    } else {
                        $query['dateCreated.date'] = $q;
                    }
                    break;

                case "id":
                    $query['_id'] = new \MongoId($value);
                    break;
                case "isDraft":
                    $query['isDraft'] = (bool) $value;
                    break;
                default:
                    $query[$key] = $value;
                    break;
            }
        }
        
        $applications = $appRepo->findBy($query);
        
        return $applications;
    }
129918
public function getProperties($filter = null)
    {
        $properties     = parent::getProperties();
        $moufProperties = array();
        foreach ($properties as $property) {
        	// Workaround for PHP BUG: https://bugs.php.net/bug.php?id=62560
        	if ($this->getName() == "Exception" && strpos($property->getName(), "trace") === 0) {
        		continue;
        	}
            $moufProperties[] = new MoufReflectionProperty($this, $property->getName());
        }
        
        return $moufProperties;
    }
403458
private static function parseListFilter(array $filter)
    {
        $filter_array = [];

        if ($filter) {
            foreach ($filter as $k => $v) {
                if (!\in_array($k, self::$filterArray, true)) {
                    throw new Exception('Network Filters Not Found');
                }

                if (\is_array($v)) {
                    $filter_array[$k] = $v;
                } else {
                    $filter_array[$k] = [$v];
                }
            }
        } else {
            $filter_array = null;
        }

        return json_encode($filter_array);
    }
184922
public function getProperties($filter = -1)
    {
        $properties = parent::getProperties($filter);
        foreach ($properties as $key => $val) {
            $properties[$key] = new ReflectionProperty($this->getName(), $val->getName());
        }

        return $properties;
    }
1166091
public function getServices($filter = null)
	{
		$services = array();

		// Create the request
		$request = new client\Request('/api/mpegts/service/grid');

		if ($filter)
			$request->setFilter($filter);

		// Get the response
		$response = $this->_client->getResponse($request);
		$rawContent = $response->getContent();

		$content = json_decode($rawContent);

		foreach ($content->entries as $entry)
			$services[] = model\Service::fromRawEntry($entry);

		return $services;
	}