izzum\statemachine\persistence\PDO::getConnection PHP Method

getConnection() public method

The connection retrieved will be reused if one already exists.
public getConnection ( ) : PDO
return PDO
    public function getConnection()
    {
        try {
            if ($this->connection === null) {
                $this->connection = new \PDO($this->dsn, $this->user, $this->password, $this->options);
                $this->setupConnection($this->connection);
            }
            return $this->connection;
        } catch (\Exception $e) {
            throw new Exception(sprintf("error creating PDO [%s], message: [%s]", $this->dsn, $e->getMessage()), Exception::PERSISTENCE_FAILED_TO_CONNECT);
        }
    }