final class PhpNamespace

Namespaced part of a PHP file.

Generates:

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

Constants

NameNormal

NameFunction

NameConstant

deprecated NAME_NORMAL

deprecated NAME_FUNCTION

deprecated 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|null $alias = null, string $of = self::NameNormal)

No description

void
removeUse(string $name, string $of = self::NameNormal)

No description

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

No description

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

No description

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

No description

string
unresolveName(string $name) deprecated

No description

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

No description

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

No description

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

No description

add(ClassLike $class)

No description

addClass(string $name)

No description

addInterface(string $name)

No description

addTrait(string $name)

No description

addEnum(string $name)

No description

removeClass(string $name)

No description

addFunction(string $name)

No description

removeFunction(string $name)

No description

array
getClasses()

No description

array
getFunctions()

No description

string
__toString()

No description

Details

at line 57
__construct(string $name)

No description

Parameters

string $name

at line 67
string getName()

No description

Return Value

string

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

internal  
 

No description

Parameters

bool $state

Return Value

PhpNamespace

at line 83
bool hasBracketedSyntax()

No description

Return Value

bool

at line 90
bool getBracketedSyntax() deprecated

deprecated use hasBracketedSyntax()

No description

Return Value

bool

at line 100
PhpNamespace addUse(string $name, string|null $alias = null, string $of = self::NameNormal)

No description

Parameters

string $name
string|null $alias
string $of

Return Value

PhpNamespace

Exceptions

InvalidStateException

at line 140
void removeUse(string $name, string $of = self::NameNormal)

No description

Parameters

string $name
string $of

Return Value

void

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

No description

Parameters

string $name
string|null $alias

Return Value

PhpNamespace

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

No description

Parameters

string $name
string|null $alias

Return Value

PhpNamespace

at line 163
array getUses(string $of = self::NameNormal)

No description

Parameters

string $of

Return Value

array

at line 175
string unresolveName(string $name) deprecated

deprecated use simplifyName()

No description

Parameters

string $name

Return Value

string

at line 182
string resolveName(string $name, string $of = self::NameNormal)

No description

Parameters

string $name
string $of

Return Value

string

at line 203
string simplifyType(string $type, string $of = self::NameNormal)

No description

Parameters

string $type
string $of

Return Value

string

at line 209
string simplifyName(string $name, string $of = self::NameNormal)

No description

Parameters

string $name
string $of

Return Value

string

at line 253
PhpNamespace add(ClassLike $class)

No description

Parameters

ClassLike $class

Return Value

PhpNamespace

at line 272
ClassType addClass(string $name)

No description

Parameters

string $name

Return Value

ClassType

at line 279
InterfaceType addInterface(string $name)

No description

Parameters

string $name

Return Value

InterfaceType

at line 286
TraitType addTrait(string $name)

No description

Parameters

string $name

Return Value

TraitType

at line 293
EnumType addEnum(string $name)

No description

Parameters

string $name

Return Value

EnumType

at line 300
PhpNamespace removeClass(string $name)

No description

Parameters

string $name

Return Value

PhpNamespace

at line 307
GlobalFunction addFunction(string $name)

No description

Parameters

string $name

Return Value

GlobalFunction

at line 320
PhpNamespace removeFunction(string $name)

No description

Parameters

string $name

Return Value

PhpNamespace

at line 328
array getClasses()

No description

Return Value

array

at line 340
array getFunctions()

No description

Return Value

array

at line 357
string __toString()

No description

Return Value

string

Traits

SmartObject