Return one or all ports.

@param string $name
@return PortInterface[]|PortInterface
@throws PortException
190123
public function get(string $name = '')
    {
        switch (true) {
            case ('' == $name):
                $result = $this->ports;
                break;
            case $this->has($name):
                $result = $this->ports[$name];
                break;
            default:
                throw new PortException("The port {$name} does not exist!");
        }

        return $result;
    }
1342539
protected function getTransportForBus(string $name): Transport
    {
        if ($this->forceTransportsToInMemory) {
            return $this->container->get('gdbots_pbjx.transport.in_memory');
        }

        $transport = $this->container->getParameter('gdbots_pbjx.' . $name . '_bus.transport');
        if (empty($transport)) {
            return $this->getDefaultTransport();
        }

        return $this->container->get('gdbots_pbjx.transport.' . $transport);
    }
745730
public function get(string $name): LinkInterface
    {
        if (!$this->has($name)) {
            throw new \InvalidArgumentException('Missing link ' . $name);
        }

        return $this->collection[$name];
    }
272150
public function getAll($name)
    {
        $s = $this->getNormalizedHeaderName($name);
        $ret = [];
        if (!empty($this->headerMap[$s])) {
            foreach ($this->headerMap[$s] as $index) {
                $ret[] = $this->getByIndex($index);
            }
        }
        return $ret;
    }
1335346
public function get($name)
    {
        $selected = null;
        /** @var ElementInterface|ContainerInterface $element */
        foreach ($this as $element) {
            if ($element->getName() == $name) {
                $selected = $element;
                break;
            }

            if ($element instanceof ContainerInterface) {
                $selected = $element->get($name);
                if (null !== $selected) {
                    break;
                }
            }
        }

        return $selected;
    }
1294027
public function connection($name = null)
	{
		if (is_array($name)) return $this->multiple($name);

		return $this->resolve($name ?: $this->getDefaultConnection());
	}
395430
public function parseTable($name): array
    {
        if ($name instanceof Model) {
            return [$name->alias(), $name->name()];
        }

        if (is_array($name)) {
            return [key($name), current($name)];
        }

        if (is_scalar($name)) {
            return static::parseName($name);
        }

        return [null, $name];
    }
1153140
public function getConnection($name)
    {
        if (!$this->hasConnection($name)) {
            throw new \InvalidArgumentException(sprintf('The connection "%s" does not exist.', $name));
        }

        return $this->connections[$name];
    }
641382
public static function get($name)
    {
        $registry = static::getRegistry();

        if (isset($registry->{$name})) {
            return $registry->{$name};
        }

        static::_buildTransport($name);

        return $registry->{$name};
    }
569300
public function getTransport($name)
    {
        if (!isset($this->transports[$name])) {
            $transport = null;

            foreach ($this->extensions as $extension) {
                if ($extension->hasTransport($name)) {
                    $transport = $extension->getTransport($name);
                    break;
                }
            }

            if (!$transport) {
                throw new \InvalidArgumentException(sprintf('Could not load transport "%s"', $name));
            }

            $this->transports[$transport->getName()] = $transport;
        }

        return $this->transports[$name];
    }
326732
public function allOf(string $name): array
    {
        $oid = AttributeType::attrNameToOID($name);
        $attrs = array_filter($this->_attributes,
            function (Attribute $attr) use ($oid) {
                return $attr->oid() == $oid;
            });
        return array_values($attrs);
    }
941288
protected function getContainer($name)
    {
        if (!isset($this->containers[$name])) {
            $this->createContainer($name);
        }

        return $this->containers[$name];
    }
314448
public static function getSortedSet(string $name): array
    {
        $obj = new RedisSortedSet(self::handle(), $name);
        return $obj->all();
    }
1119784
public function getEvent(string $name): array
    {
        return isset($this->events[$name]) ? $this->events[$name] : [];
    }
192273
public function getPolicyByHostname($name)
    {
        if (! $this->inventory->hasHost($name)) {
            return array();
        }

        $policy = array();
        $host = $this->inventory->getHost($name);

        foreach ($this->inventory->getHostGroupsByHost($host) as $group) {
            $policy = array_replace_recursive($policy, $group->getFirewallPolicy());
        }

        return array_replace_recursive($policy, $host->getFirewallPolicy());
    }
129117
public function get($name): ?Lock
    {
        if (isset($this->list[$name])) {
            return $this->list[$name];
        } else {
            return null;
        }
    }
816627
public function getConnection($name = null, $forceNew = false) {
		if (!$forceNew && isset($this->connections[$name])) {
			return $this->connections[$name];
		}

		$config = $this->getConnectionConfig($name);

		if (!$config) {
			return null;
		}

		$pdoArgs = [$config['dsn'], $config['username'], $config['password']];
		$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];

		if (isset($config['options'])) {
			$options = $config['options'] + $options;
		}
		$pdoArgs[] = $options;

		$this->connections[$name] = new PDO(...$pdoArgs);

		return $this->connections[$name];
	}