\Horde\Refactor\RulePhp4Constructor

Refactors a PHP4 class file to have both the old-style and new-style constructor method names, and have them in the correct order for both backward and forward compatibility.

Extend this class to implement actual refactorings.

Summary

Methods
Properties
Constants
__construct()
run()
dump()
__get()
addWarning()
pauseWarnings()
resumeWarnings()
$warnings
No constants found
_swapCtors()
_createPhp5Ctor()
$_config
$_tokens
$_warnings
N/A
No private methods found
No private properties found
N/A

Properties

$warnings

$warnings : array<mixed,string>

Warning messages.

Type

array<mixed,string>

$_config

$_config : \Horde\Refactor\Horde\Refactor\Config\Base

Rule configuration.

Type

\Horde\Refactor\Horde\Refactor\Config\Base

$_tokens

$_tokens : \Horde\Refactor\Horde\Refactor\Tokens

Current list of tokens.

Type

\Horde\Refactor\Horde\Refactor\Tokens

$_warnings

$_warnings : array<mixed,string>

A list of warning messages.

Type

array<mixed,string>

Methods

__construct()

__construct(string  $file, \Horde\Refactor\Horde\Refactor\Config\Base  $config) 

Constructor.

Parameters

string $file

Name of the file to parse and refactor.

\Horde\Refactor\Horde\Refactor\Config\Base $config

The rule configuration.

run()

run() 

Applies the actual refactoring to the tokenized code.

dump()

dump() : string

Returns the file code in its current state.

Returns

string —

The file code.

__get()

__get(  $name) 

Getter.

Parameters

$name

addWarning()

addWarning(string  $warning) 

Adds a warning.

Parameters

string $warning

A warning.

pauseWarnings()

pauseWarnings() 

Pauses the logging of warnings and errors.

resumeWarnings()

resumeWarnings() 

Resumes the logging of warnings and errors.

_swapCtors()

_swapCtors(integer  $ctor5, integer  $start, integer  $ctor4) 

Swaps the PHP 5 and PHP 4 constructors.

Parameters

integer $ctor5

The start position of the PHP 5 constructor.

integer $start

The start position of the PHP 4 constructor including phpdoc.

integer $ctor4

The start position of the PHP 4 constructor.

_createPhp5Ctor()

_createPhp5Ctor(integer  $ctor4, \Horde\Refactor\Rule\strign  $extends) 

Creates new backward and forward compatible constructors.

Parameters

integer $ctor4

The start position of the PHP 4 constructor.

\Horde\Refactor\Rule\strign $extends

The extended class if any.