libSmalldb  v2.0.2
Public Member Functions | Static Public Member Functions | List of all members
PhpFileWriter Class Reference

Description

Write PHP files in a convenient way.

Public Member Functions

 __construct ()
 PhpFileWriter constructor. More...
 
 write (string $filename)
 
 getPhpCode ()
 
 getParamAsCode (\ReflectionParameter $param)
 
 getTypeAsCode (?\ReflectionType $typeReflection)
 
 getParamCode (?\ReflectionType $type, string $name)
 
 getMethodParametersCode (\ReflectionMethod $method)
 
 useClasses (array $fqcnList)
 
 useClass (string $fqcn, ?string $useAlias=null)
 
 getIdentifier (string $name, string $suffix=null)
 
 writeString (string $string='',... $args)
 
 writeln (string $string='',... $args)
 
 eof ()
 
 setFileHeader (string $generator_name)
 
 beginBlock (string $statement='',... $args)
 
 midBlock (string $statement,... $args)
 
 endBlock (string $suffix='',... $args)
 
 comment (string $comment)
 
 docComment (string $comment)
 
 setClassName (string $className)
 
 setNamespace (string $namespace)
 
 beginClass (string $classname, ?string $extends=null, array $implements=[])
 
 beginAbstractClass (string $classname, ?string $extends=null, array $implements=[])
 
 endClass ()
 
 beginInterface (string $classname, array $extends=[])
 
 endInterface ()
 
 beginTrait (string $classname)
 
 endTrait ()
 
 beginMethodOverride (\ReflectionMethod $parentMethod, array & $parentCallArgs=null)
 
 beginMethod (string $name, array $args=[], string $returnType='')
 
 beginProtectedMethod (string $name, array $args=[], string $returnType='')
 
 beginPrivateMethod (string $name, array $args=[], string $returnType='')
 
 beginFinalMethod (string $name, array $args=[], string $returnType='')
 
 beginStaticMethod (string $name, array $args=[], string $returnType='')
 
 endMethod ()
 
 writeAbstractMethod (string $name, array $args=[], string $returnType='')
 
 writeInterfaceMethod (string $name, array $args=[], string $returnType='')
 
 hasMethod (string $methodName)
 

Static Public Member Functions

static toCamelCase (string $identifier)
 
static getShortClassName (string $fqcn)
 
static getClassNamespace (string $fqcn)
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

PhpFileWriter constructor.

Member Function Documentation

◆ write()

write ( string  $filename)

◆ getPhpCode()

getPhpCode ( )

◆ getParamAsCode()

getParamAsCode ( \ReflectionParameter  $param)
Exceptions

◆ getTypeAsCode()

getTypeAsCode ( ?\ReflectionType  $typeReflection)

◆ getParamCode()

getParamCode ( ?\ReflectionType  $type,
string  $name 
)

◆ getMethodParametersCode()

getMethodParametersCode ( \ReflectionMethod  $method)
Returns
[string[],string[]]

◆ toCamelCase()

static toCamelCase ( string  $identifier)
static

◆ getShortClassName()

static getShortClassName ( string  $fqcn)
static

◆ getClassNamespace()

static getClassNamespace ( string  $fqcn)
static

◆ useClasses()

useClasses ( array  $fqcnList)

◆ useClass()

useClass ( string  $fqcn,
?string  $useAlias = null 
)

◆ getIdentifier()

getIdentifier ( string  $name,
string  $suffix = null 
)

◆ writeString()

writeString ( string  $string = '',
  $args 
)

◆ writeln()

writeln ( string  $string = '',
  $args 
)

◆ eof()

eof ( )

◆ setFileHeader()

setFileHeader ( string  $generator_name)

◆ beginBlock()

beginBlock ( string  $statement = '',
  $args 
)

◆ midBlock()

midBlock ( string  $statement,
  $args 
)

◆ endBlock()

endBlock ( string  $suffix = '',
  $args 
)

◆ comment()

comment ( string  $comment)

◆ docComment()

docComment ( string  $comment)

◆ setClassName()

setClassName ( string  $className)

◆ setNamespace()

setNamespace ( string  $namespace)

◆ beginClass()

beginClass ( string  $classname,
?string  $extends = null,
array  $implements = [] 
)

◆ beginAbstractClass()

beginAbstractClass ( string  $classname,
?string  $extends = null,
array  $implements = [] 
)

◆ endClass()

endClass ( )

◆ beginInterface()

beginInterface ( string  $classname,
array  $extends = [] 
)

◆ endInterface()

endInterface ( )

◆ beginTrait()

beginTrait ( string  $classname)

◆ endTrait()

endTrait ( )

◆ beginMethodOverride()

beginMethodOverride ( \ReflectionMethod  $parentMethod,
array &  $parentCallArgs = null 
)

◆ beginMethod()

beginMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ beginProtectedMethod()

beginProtectedMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ beginPrivateMethod()

beginPrivateMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ beginFinalMethod()

beginFinalMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ beginStaticMethod()

beginStaticMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ endMethod()

endMethod ( )

◆ writeAbstractMethod()

writeAbstractMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ writeInterfaceMethod()

writeInterfaceMethod ( string  $name,
array  $args = [],
string  $returnType = '' 
)

◆ hasMethod()

hasMethod ( string  $methodName)