PHPDaemon\BoundSocket\Generic::importParams PHP Method

importParams() protected method

Import parameters
protected importParams ( ) : void
return void
    protected function importParams()
    {
        foreach ($this->uri['params'] as $key => $val) {
            if (isset($this->{$key}) && is_bool($this->{$key})) {
                $this->{$key} = (bool) $val;
                continue;
            }
            if (!property_exists($this, $key)) {
                Daemon::log(get_class($this) . ': unrecognized setting \'' . $key . '\'');
                continue;
            }
            $this->{$key} = $val;
        }
        if (property_exists($this, 'port') && !isset($this->port)) {
            if (isset($this->uri['port'])) {
                $this->port = $this->uri['port'];
            } elseif ($this->defaultPort) {
                $this->port = $this->defaultPort;
            }
        }
        if (property_exists($this, 'host') && !isset($this->host)) {
            if (isset($this->uri['host'])) {
                $this->host = $this->uri['host'];
            }
        }
        if (!$this->ctxname) {
            return;
        }
        if (!isset(Daemon::$config->{'TransportContext:' . $this->ctxname})) {
            Daemon::log(get_class($this) . ': undefined transport context \'' . $this->ctxname . '\'');
            return;
        }
        $ctx = Daemon::$config->{'TransportContext:' . $this->ctxname};
        foreach ($ctx as $key => $entry) {
            $value = $entry instanceof \PHPDaemon\Config\Entry\Generic ? $entry->value : $entry;
            if (isset($this->{$key}) && is_bool($this->{$key})) {
                $this->{$key} = (bool) $value;
                continue;
            }
            if (!property_exists($this, $key)) {
                Daemon::log(get_class($this) . ': unrecognized setting in transport context \'' . $this->ctxname . '\': \'' . $key . '\'');
                continue;
            }
            $this->{$key} = $value;
        }
    }