final class PhpNamespace

Namespaced part of a PHP file.

Generates:

  • namespace statement
  • variable amount of use statements
  • one or more class declarations

Constants

NAME_NORMAL

NAME_FUNCTION

NAME_CONSTANT

Methods

__construct(string $name)

No description

string
getName()

No description

setBracketedSyntax(bool $state = true)

No description

bool
hasBracketedSyntax()

No description

bool
getBracketedSyntax() deprecated

No description

addUse(string $name, string $alias = null, string $of = self::NAME_NORMAL)

No description

addUseFunction(string $name, string $alias = null)

No description

addUseConstant(string $name, string $alias = null)

No description

array
getUses(string $of = self::NAME_NORMAL)

No description

string
unresolveName(string $name) deprecated

No description

string
resolveName(string $name, string $of = self::NAME_NORMAL)

No description

string
simplifyType(string $type, string $of = self::NAME_NORMAL)

No description

string
simplifyName(string $name, string $of = self::NAME_NORMAL)

No description

add(ClassType $class)

No description

addClass(string $name)

No description

addInterface(string $name)

No description

addTrait(string $name)

No description

addEnum(string $name)

No description

addFunction(string $name)

No description

array
getClasses()

No description

array
getFunctions()

No description

string
__toString()

No description

Details

at line 53
__construct(string $name)

No description

Parameters

string $name

at line 62
string getName()

No description

Return Value

string

at line 72
PhpNamespace setBracketedSyntax(bool $state = true)

internal  
 

No description

Parameters

bool $state

Return Value

PhpNamespace

at line 79
bool hasBracketedSyntax()

No description

Return Value

bool

at line 86
bool getBracketedSyntax() deprecated

deprecated use hasBracketedSyntax()

No description

Return Value

bool

at line 96
PhpNamespace addUse(string $name, string $alias = null, string $of = self::NAME_NORMAL)

No description

Parameters

string $name
string $alias
string $of

Return Value

PhpNamespace

Exceptions

InvalidStateException

at line 138
PhpNamespace addUseFunction(string $name, string $alias = null)

No description

Parameters

string $name
string $alias

Return Value

PhpNamespace

at line 145
PhpNamespace addUseConstant(string $name, string $alias = null)

No description

Parameters

string $name
string $alias

Return Value

PhpNamespace

at line 152
array getUses(string $of = self::NAME_NORMAL)

No description

Parameters

string $of

Return Value

array

at line 164
string unresolveName(string $name) deprecated

deprecated use simplifyName()

No description

Parameters

string $name

Return Value

string

at line 170
string resolveName(string $name, string $of = self::NAME_NORMAL)

No description

Parameters

string $name
string $of

Return Value

string

at line 191
string simplifyType(string $type, string $of = self::NAME_NORMAL)

No description

Parameters

string $type
string $of

Return Value

string

at line 197
string simplifyName(string $name, string $of = self::NAME_NORMAL)

No description

Parameters

string $name
string $of

Return Value

string

at line 239
PhpNamespace add(ClassType $class)

No description

Parameters

ClassType $class

Return Value

PhpNamespace

at line 254
ClassType addClass(string $name)

No description

Parameters

string $name

Return Value

ClassType

at line 261
ClassType addInterface(string $name)

No description

Parameters

string $name

Return Value

ClassType

at line 267
ClassType addTrait(string $name)

No description

Parameters

string $name

Return Value

ClassType

at line 273
ClassType addEnum(string $name)

No description

Parameters

string $name

Return Value

ClassType

at line 279
GlobalFunction addFunction(string $name)

No description

Parameters

string $name

Return Value

GlobalFunction

at line 290
array getClasses()

No description

Return Value

array

at line 301
array getFunctions()

No description

Return Value

array

at line 317
string __toString()

No description

Return Value

string

Traits

Strict class for better experience.