Get info on currently open tunnels.

@param bool $open

@return array
340924
protected function getTunnelInfo($open = true)
    {
        if (!isset($this->tunnelInfo)) {
            $this->tunnelInfo = [];
            // @todo move this to State service (in a new major version)
            $filename = $this->config()->getWritableUserDir() . '/tunnel-info.json';
            if (file_exists($filename)) {
                $this->debug(sprintf('Loading tunnel info from %s', $filename));
                $this->tunnelInfo = (array) json_decode(file_get_contents($filename), true);
            }
        }

        if ($open) {
            $needsSave = false;
            foreach ($this->tunnelInfo as $key => $tunnel) {
                /** @noinspection PhpComposerExtensionStubsInspection */
                if (isset($tunnel['pid']) && function_exists('posix_kill') && !posix_kill($tunnel['pid'], 0)) {
                    $this->debug(sprintf(
                        'The tunnel at port %d is no longer open, removing from list',
                        $tunnel['localPort']
                    ));
                    unset($this->tunnelInfo[$key]);
                    $needsSave = true;
                }
            }
            if ($needsSave) {
                $this->saveTunnelInfo();
            }
        }

        return $this->tunnelInfo;
    }
896239
public function getBrowsers()
	{
		if( !$this->_open )
		{
			trigger_error( "Log File not read", E_USER_ERROR );
			return array();
		}
		$remote_addrs	= array();	
		$browsers		= array();
		foreach( $this->data as $entry )
		{
			if( $entry['remote_addr'] != $this->skip && $entry['http_user_agent'] )
			{
				if( isset( $remote_addrs[$entry['remote_addr']] ) )
				{
					if( $remote_addrs[$entry['remote_addr']] < $entry['timestamp'] - 30 * 60 )
					{
						if( isset( $browsers[$entry['http_user_agent']] ) )
							$browsers[$entry['http_user_agent']] ++;
						else
							$browsers[$entry['http_user_agent']]	= 1;
					}
					$remote_addrs[$entry['remote_addr']]	= $entry['timestamp'];
				}
				else
				{
					if( isset( $browsers[$entry['http_user_agent']] ) )
						$browsers[$entry['http_user_agent']] ++;
					else
						$browsers[$entry['http_user_agent']]	= 1;
					$remote_addrs[$entry['remote_addr']]	= $entry['timestamp'];
				}
			}
		}
		arsort( $browsers );
		$lines	= array();
		foreach( $browsers as $browser => $count )
			$lines[]	= "<tr><td>".$browser."</td><td>".$count."</td></tr>";
		$lines		= implode( "\n\t", $lines );
		$content	= "<table>".$lines."</table>";
		return $content;
	}
1259456
public function all($object=true)
  {
    $properties = get_object_vars($this);
    
    if ( $object ){
      return (object)$properties;
    }
    
    return $properties;
  }
401591
public function getForwardPathInfo()
    {
        return [
            [
                'fromMeta' => $this->scopeModel->getMeta(),
                'toMeta' => $this->relation->toModel->getMeta(),
                'targetFields' => $this->getForeignRelatedFields(),
                // field that joins the relationship
                'joinField' => $this,
                // is this path info for m2m relationship
                'm2m' => false,
                // true if we moving from owning to inverse side, false if moving from inverse to owning
                'direct' => true,
            ],
        ];
    }
729951
public function read($path) {
        $mapping = $this->mapper->get($path);

        if (!$mapping) {
            return false;
        }

        try {
            $file = $this->client->get($mapping['fid']);

            if (!$file) {
                return false;
            }

            return [
                'contents' => stream_get_contents($file)
            ];
        } catch (SeaweedFSException $e) {
            return false;
        }
    }
579049
public static function getOpenStatusCodes()
    {
        return array(
            self::STATUS_NEW,
            self::STATUS_ACCEPTED_BY_SELLER,
            self::STATUS_REJECTED_BY_SELLER,
            self::STATUS_IN_PICK_AT_SELLER,
            self::STATUS_READY_FOR_DISPATCH_TO_HUB,
            self::STATUS_IN_TRANSIT_TO_HUB,
            self::STATUS_READY_FOR_PICKUP_FROM_HUB,
            self::STATUS_AT_HUB,
        );
    }
393744
protected function findAvailableRoutes()
    {
        $routes = [];
        $rules = Director::config()->get('rules');

        foreach ($rules as $pattern => $controllerInfo) {
            $routeClass = (is_string($controllerInfo)) ? $controllerInfo : $controllerInfo['Controller'];

            try {
                $routeController = Injector::inst()->get($routeClass);
                if ($routeController instanceof Controller) {
                    $routes[] = $pattern;
                }
            } catch (InjectorNotFoundException $ex) {
            }

        }
        return $routes;
    }
376302
public function get_open_bbcodes_after($position)
	{
		$bbcodes = array();
		for ($i = 1; $i <= $this->array_size; $i++)
		{
			if (($this->bbcode_list[$this->array_size - $i]['open_start'] < $position) &&
				 ($this->bbcode_list[$this->array_size - $i]['close_start'] >= $position))
			{
				$bbcodes[] = $this->bbcode_list[$this->array_size - $i]['bbcode_tag'];
			}
		}
		return $bbcodes;
	}
1038248
public function routeDetails($translate = false) {
        $fetchList = [
            'routeDest' => 'destination',
            'routeMask' => 'mask',
            'routeTos' => 'TOS',
            'routeNextHop' => 'nextHop',
            'routeIfIndex' => 'ifIndex',
            'routeType' => 'type',
            'routeProto' => 'protocol',
            'routeAge' => 'age',
            'routeInfo' => 'info',
            'routeNextHopAS' => 'nextHopAS',
            'routeMetric1' => 'metric1',
            'routeMetric2' => 'metric2',
            'routeMetric3' => 'metric3',
            'routeMetric4' => 'metric4',
            'routeMetric5' => 'metric5',
            'routeStatus' => 'status'
        ];
        $canTranslate = [ 'routeType', 'routeProto', 'routeStatus'];
        $details = [];

        foreach ($fetchList as $fn => $idx) {
            if (in_array($fn, $canTranslate))
                $values = $this->$fn($translate);
            else
                $values = $this->$fn();
            foreach ($values as $ip => $value)
                $details[$ip][$idx] = $value;
        }
        return $details;
    }
288221
protected function get_whitelisted_ports() {
        global $CFG;
        if (!isset($CFG->curlsecurityallowedport)) {
            return [];
        }
        return array_filter(array_map('trim', explode("\n", $CFG->curlsecurityallowedport)), function($entry) {
            return !empty($entry);
        });
    }
973414
protected function getCurrentState()
    {
        return [
            'application_name' => $this->config->get('application_name'),
            'application' => realpath($this->paths->getBasePath()),
            'configuration' => realpath($this->paths->getConfigurationPath()),
            'logs' => $this->paths->getLogsPath(),
        ];
    }
930187
public static function get_current_tour($reset = false) {
        global $PAGE;

        static $tour = false;

        if ($tour === false || $reset) {
            $tour = self::get_matching_tours($PAGE->url);
        }

        return $tour;
    }
419378
public static function getBooleanStrings(bool $state = null): array
    {
        $strings = [
            false => ['', '0', 'false', 'no', 'off'],
            true => ['1', 'true', 'yes', 'on']
        ];
        
        return isset($state) ? $strings[$state] : array_merge($strings[false], $strings[true]);
    }
1055964
public function findOpen($limit = 999): array
    {
        $queryBuilder = $this->createQuery();

        return (array)$queryBuilder->select('*')
            ->from($this->getTableName())
            ->where($queryBuilder->expr()->eq('call_date', $queryBuilder->createNamedParameter(0)))
            ->setMaxResults($limit)
            ->execute()
            ->fetchAll();
    }
578052
public function dirInfo($key = '/', $recursive = false)
    {
        $query = [];
        if ($recursive === true) {
            $query['recursive'] = 'true';
        }

        return $this->httpGet($this->getKeyUrl($key), $query);
    }
1323339
public function getRequestInfo($key = null)
    {
        if ( ! $this->isInitialized())
        {
            return $key ? '' : [];
        }

        return $key ? curl_getinfo($this->curl, $key) : curl_getinfo($this->curl);
    }
331467
protected function getReadOnlyOperations()
    {
        return array(
            'EXISTS' => true,
            'TYPE' => true,
            'KEYS' => true,
            'SCAN' => true,
            'RANDOMKEY' => true,
            'TTL' => true,
            'GET' => true,
            'MGET' => true,
            'SUBSTR' => true,
            'STRLEN' => true,
            'GETRANGE' => true,
            'GETBIT' => true,
            'LLEN' => true,
            'LRANGE' => true,
            'LINDEX' => true,
            'SCARD' => true,
            'SISMEMBER' => true,
            'SINTER' => true,
            'SUNION' => true,
            'SDIFF' => true,
            'SMEMBERS' => true,
            'SSCAN' => true,
            'SRANDMEMBER' => true,
            'ZRANGE' => true,
            'ZREVRANGE' => true,
            'ZRANGEBYSCORE' => true,
            'ZREVRANGEBYSCORE' => true,
            'ZCARD' => true,
            'ZSCORE' => true,
            'ZCOUNT' => true,
            'ZRANK' => true,
            'ZREVRANK' => true,
            'ZSCAN' => true,
            'ZLEXCOUNT' => true,
            'ZRANGEBYLEX' => true,
            'ZREVRANGEBYLEX' => true,
            'HGET' => true,
            'HMGET' => true,
            'HEXISTS' => true,
            'HLEN' => true,
            'HKEYS' => true,
            'HVALS' => true,
            'HGETALL' => true,
            'HSCAN' => true,
            'HSTRLEN' => true,
            'PING' => true,
            'AUTH' => true,
            'SELECT' => true,
            'ECHO' => true,
            'QUIT' => true,
            'OBJECT' => true,
            'BITCOUNT' => true,
            'BITPOS' => true,
            'TIME' => true,
            'PFCOUNT' => true,
            'SORT' => array($this, 'isSortReadOnly'),
            'BITFIELD' => array($this, 'isBitfieldReadOnly'),
            'GEOHASH' => true,
            'GEOPOS' => true,
            'GEODIST' => true,
            'GEORADIUS' => array($this, 'isGeoradiusReadOnly'),
            'GEORADIUSBYMEMBER' => array($this, 'isGeoradiusReadOnly'),
        );
    }