public function getInfo(string $key = null)
    {
        if ($this->info == null) {
            $resource = $this->linker->getLink()->getAgent()->getResource();
            $resourceType = $resource->getType();

            $serverVersion = $clientVersion = null;

            if ($resourceType == Resource::TYPE_MYSQL_LINK) {
                $object = $resource->getObject();
                foreach (get_class_vars(get_class($object)) as $var => $_) {
                    $this->info[$var] = $object->{$var};
                }
                $serverVersion = preg_replace('~\s*([^ ]+).*~', '\1', $object->server_info);
                $clientVersion = preg_replace('~(?:[a-z]+\s+)?([^ ]+).*~i', '\1', $object->client_info);
            } elseif ($resourceType == Resource::TYPE_PGSQL_LINK) {
                $this->info = pg_version($resource->getObject());
                $serverVersion = preg_replace('~\s*([^ ]+).*~', '\1', $this->info['server']);
                $clientVersion = preg_replace('~\s*([^ ]+).*~', '\1', $this->info['client']);
            }

            $this->info['serverVersion'] = $serverVersion;
            $this->info['clientVersion'] = $clientVersion;
        }

        return ($key == null) ? $this->info : $this->info[$key] ?? null;
    }
public function getInfo(string $key = null)
    {
        if ($this->info == null) {
            $resource = $this->linker->getLink()->getAgent()->getResource();
            $resourceType = $resource->getType();

            $serverVersion = $clientVersion = null;

            if ($resourceType == Resource::TYPE_MYSQL_LINK) {
                $object = $resource->getObject();
                foreach (get_class_vars(get_class($object)) as $var => $_) {
                    $this->info[$var] = $object->{$var};
                }
                $serverVersion = preg_replace('~\s*([^ ]+).*~', '\1', $object->server_info);
                $clientVersion = preg_replace('~(?:[a-z]+\s+)?([^ ]+).*~i', '\1', $object->client_info);
            } elseif ($resourceType == Resource::TYPE_PGSQL_LINK) {
                $this->info = pg_version($resource->getObject());
                $serverVersion = preg_replace('~\s*([^ ]+).*~', '\1', $this->info['server']);
                $clientVersion = preg_replace('~\s*([^ ]+).*~', '\1', $this->info['client']);
            }

            $this->info['serverVersion'] = $serverVersion;
            $this->info['clientVersion'] = $clientVersion;
        }

        return ($key == null) ? $this->info : $this->info[$key] ?? null;
    }
public function getInfo ( string $ key = null ) { if ( $ this -> info == null ) { $ resource = $ this -> linker -> getLink ( ) -> getAgent ( ) -> getResource ( ) ; $ resourceType = $ resource -> getType ( ) ; $ serverVersion = $ clientVersion = null ; if ( $ resourceType == Resource :: TYPE_MYSQL_LINK ) { $ object = $ resource -> getObject ( ) ; foreach ( get_class_vars ( get_class ( $ object ) ) as $ var => $ _ ) { $ this -> info [ $ var ] = $ object -> { $ var } ; } $ serverVersion = preg_replace ( '~\s*([^ ]+).*~' , '\1' , $ object -> server_info ) ; $ clientVersion = preg_replace ( '~(?:[a-z]+\s+)?([^ ]+).*~i' , '\1' , $ object -> client_info ) ; } elseif ( $ resourceType == Resource :: TYPE_PGSQL_LINK ) { $ this -> info = pg_version ( $ resource -> getObject ( ) ) ; $ serverVersion = preg_replace ( '~\s*([^ ]+).*~' , '\1' , $ this -> info [ 'server' ] ) ; $ clientVersion = preg_replace ( '~\s*([^ ]+).*~' , '\1' , $ this -> info [ 'client' ] ) ; } $ this -> info [ 'serverVersion' ] = $ serverVersion ; $ this -> info [ 'clientVersion' ] = $ clientVersion ; } return ( $ key == null ) ? $ this -> info : $ this -> info [ $ key ] ?? null ; }
Get info.
@param  string|null $key
@return any
Get info .