\phpDocumentorDsn

Data Source Name (DSN), a reference to a path on a local or remote system with the ability to add parameters.

The format for the DSN is inspired by the PDO DSN format ({@see}) where you have a string containing Semicolon Separated Values (SSV), where each part is a key=value pair. Exception to this rule is the first entry in the string; this is the URI where the referenced Data Source is located.

A simple example can be a reference to your project folder:

file:///home/mvriel/project/src

Yet a more complex example may be a reference to a specific branch on a git repository:

git+https://github.com/phpDocumentor/phpDocumentor;path=/src;branch=release/3.0

In the example above we reference a git repository using the http protocol and as options we mention that the branch that we would like to parse is release/3.0 and in it we want to start at the path /src.

Summary

Methods
Properties
Constants
__construct()
createFromString()
createFromUri()
__toString()
getScheme()
getHost()
getPort()
getUsername()
getPassword()
getPath()
isWindowsLocalPath()
getQuery()
getParameters()
resolve()
withPath()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
parseParameters()
parseParameter()
$dsn
$uri
$parameters
N/A

Properties

$dsn

$dsn : string

Type

string

$uri

$uri : \League\Uri\Contracts\UriInterface

Type

\League\Uri\Contracts\UriInterface —

$parameters

$parameters : string[]

Type

string[]

Methods

__construct()

__construct(\League\Uri\Contracts\UriInterface  $uri, string[]  $parameters, string  $dsn) : mixed

Initializes the Dsn

Parameters

\League\Uri\Contracts\UriInterface $uri
string[] $parameters
string $dsn

Returns

mixed —

createFromString()

createFromString(string  $dsn) : self

Parameters

string $dsn

Returns

self —

createFromUri()

createFromUri(\League\Uri\Contracts\UriInterface  $uri, string[]  $parameters = []) : self

Parameters

\League\Uri\Contracts\UriInterface $uri
string[] $parameters

Returns

self —

__toString()

__toString() : string

Returns a string representation of the DSN.

Returns

string —

getScheme()

getScheme() : ?string

Returns the scheme part of the DSN

Returns

?string —

getHost()

getHost() : string

Returns the host part of the DSN

Returns

string —

getPort()

getPort() : ?int

Returns the port part of the DSN

Returns

?int —

getUsername()

getUsername() : string

Returns the username part of the DSN

Returns

string —

getPassword()

getPassword() : string

Returns the password part of the DSN

Returns

string —

getPath()

getPath() : \phpDocumentor\Path

Returns the path part of the DSN

Returns

\phpDocumentor\Path —

isWindowsLocalPath()

isWindowsLocalPath() : bool

Returns

bool —

getQuery()

getQuery() : string[]

Returns the query part of the DSN

Returns

string[] —

getParameters()

getParameters() : string[]

Returns the parameters part of the DSN

Returns

string[] —

resolve()

resolve(\phpDocumentor\Dsn  $baseDsn) : self

Parameters

\phpDocumentor\Dsn $baseDsn

Returns

self —

withPath()

withPath(\phpDocumentor\Path  $path) : self

Parameters

\phpDocumentor\Path $path

Returns

self —

parseParameters()

parseParameters(string[]  $parameters) : array<string,string>

validates and sets the parameters property

Parameters

string[] $parameters

Returns

array

parseParameter()

parseParameter(string  $part) : \Generator<string,string>

Parameters

string $part

Returns

\Generator