sfClassManipulator manipulates class code.
Method Summary
-
filterMethod($method, $callable)
Filters each line of the given method through a callable.
-
sfClassManipulator
fromFile($file)
Creates a manipulator object from a file.
-
string
getCode()
Gets the modified code.
-
string
getFile()
Gets the associated file.
-
string
getTokenValue($token)
Returns a token's string value.
-
save()
Saves the code back to the associated file.
-
setFile()
Sets the file associated with this instance.
-
splitSetup()
-
wrapMethod($method, $topCode, $bottomCode)
Wraps an existing method with some code.
-
__construct($code)
Constructor.
Method Details
-
filterMethod ($method, $callable)
Browse code
| $method |
The method name |
| $callable |
A PHP callable that accepts and returns one line of PHP code |
Filters each line of the given method through a callable.
-
(sfClassManipulator) fromFile ($file)
Browse code
Creates a manipulator object from a file.
returns A sfClassManipulator instance
-
Gets the modified code.
returns The modified code
-
Gets the associated file.
returns The associated file
-
(string) getTokenValue ($token)
Browse code
Returns a token's string value.
-
Saves the code back to the associated file.
This only works if you have bound the instance with a file with the setFile() method.
-
Sets the file associated with this instance.
-
-
wrapMethod ($method, $topCode, $bottomCode)
Browse code
| $method |
The method name to change |
| $topCode |
The code to add at the top of the method |
| $bottomCode |
The code to add at the bottom of the method |
Wraps an existing method with some code.
-
| $code |
The code to manipulate |
Constructor.
|