symfony API

sfClassManipulator Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

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)

    $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)

    $file A file name

    Creates a manipulator object from a file.

    returns A sfClassManipulator instance

  • (string) getCode ()

    Gets the modified code.

    returns The modified code

  • (string) getFile ()

    Gets the associated file.

    returns The associated file

  • (string) getTokenValue ($token)

    Returns a token's string value.

  • save ()

    Saves the code back to the associated file.


    This only works if you have bound the instance with a file with the setFile() method.

  • setFile ()

    Sets the file associated with this instance.

  • splitSetup ()

  • wrapMethod ($method, $topCode, $bottomCode)

    $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.

  • __construct ($code)

    $code The code to manipulate

    Constructor.