<?php namespace PHPFUI\MySQLSlowQuery; class Session extends \PHPFUI\MySQLSlowQuery\BaseObject { public function __construct(array $sessionData = [], string $parseMode = '') { $this->fields = [ 'Server' => '', 'Version' => '', 'Port' => '', 'Transport' => '', ]; $this->Server = \trim(\str_replace('. started with:', '', $sessionData[0] ?? 'unknown')); $this->Version = \substr(\strstr($this->Server, 'Version: ') ?: '', 9); $delimiter = 'mariadb' == $parseMode ? ' ' : ', '; if (\strpos($sessionData[1] ?? '', $delimiter)) { [$this->Port, $this->Transport] = \explode($delimiter, \trim($sessionData[1])); } } }