\Horde\RefactorRule

This class represents both a file being refactored and a refactoring rule applied to this file.

Extend this class to implement actual refactorings.

Summary

Methods
Properties
Constants
__construct()
run()
dump()
__get()
addWarning()
pauseWarnings()
resumeWarnings()
$warnings
No constants found
No protected methods found
$_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.

Throws

\Horde\Refactor\Exception\StopProcessing

on unrecoverable error.

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.