symfony API

sfToolkit Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.3 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.3 version. Switch to:

sfToolkit provides basic utility methods.

Method Summary

  • array &($values, $name, $default)
    Returns a reference to an array value for a path.
  • string addIncludePath($path, $position)
    Adds a path to the PHP include_path setting.
  • arrayDeepMerge()
  • clearDirectory($directory)
    Clear all files in a given directory.
  • clearGlob($pattern)
    Clear all files and directories corresponding to a glob pattern.
  • string extractClassName($filename)
    Extract the class or interface name from filename.
  • array getArrayValueForPath($values, $name, $default)
    Returns an array value for a path.
  • string getPhpCli()
    Get path to php cli.
  • getTmpDir()
    DEPRECATED. Use sys_get_temp_dir() directly (available since PHP 5.2.1).
  • bool hasArrayValueForPath($values, $name)
    Returns true if the a path exists for the given array.
  • string I18N_toEncoding($string, $to)
    Converts UTF-8 strings to a different encoding. NB. The result may not have been encoded if iconv fails.
  • string I18N_toUTF8($string, $from)
    Converts strings to UTF-8 via iconv. NB, the result may not by UTF-8 if the conversion failed.
  • boolean isArrayValuesEmpty($array)
    Checks if array values are empty
  • bool isPathAbsolute($path)
    Determine if a filesystem path is absolute.
  • bool isUTF8()
    Checks if a string is an utf8.
  • mixed literalize($value, $quoted)
    Finds the type of the passed value, returns the value as the new type.
  • pregtr($search, $replacePairs)
    Returns subject replaced with regular expression matchs
  • removeArrayValueForPath($values, $name, $default)
    Removes a path for the given array.
  • string replaceConstants($value)
    Replaces constant identifiers in a scalar value.
  • array stringToArray($string)
    Converts string to array
  • string stripComments($source)
    Strips comments from php source code
  • array stripslashesDeep($value)
    Strip slashes recursively from array

Method Details

  • (array) & ($values, $name, $default) Browse code

    $values The values to search
    $name The token name
    $default Default if not found

    Returns a reference to an array value for a path.

    returns reference

  • (string) addIncludePath ($path, $position) Browse code

    $path Single string path or an array of paths
    $position Either 'front' or 'back'

    Adds a path to the PHP include_path setting.

    returns The old include path

  • arrayDeepMerge () Browse code

  • clearDirectory ($directory) Browse code

    $directory An absolute filesystem path to a directory.

    Clear all files in a given directory.

  • clearGlob ($pattern) Browse code

    $pattern An absolute filesystem pattern.

    Clear all files and directories corresponding to a glob pattern.

  • (string) extractClassName ($filename) Browse code

    $filename A filename.

    Extract the class or interface name from filename.

    returns A class or interface name, if one can be extracted, otherwise null.

  • (array) getArrayValueForPath ($values, $name, $default) Browse code

    $values The values to search
    $name The token name
    $default Default if not found

    Returns an array value for a path.

  • (string) getPhpCli () Browse code

    Get path to php cli.

    throws sfException If no php cli found

  • getTmpDir () Browse code

    DEPRECATED. Use sys_get_temp_dir() directly (available since PHP 5.2.1).

  • (bool) hasArrayValueForPath ($values, $name) Browse code

    $values The values to search
    $name The token name

    Returns true if the a path exists for the given array.

  • (string) I18N_toEncoding ($string, $to) Browse code

    $string the UTF-8 string for conversion
    $to new encoding

    Converts UTF-8 strings to a different encoding. NB. The result may not have been encoded if iconv fails.


    This file comes from Prado (BSD License)

    returns encoded string.

  • (string) I18N_toUTF8 ($string, $from) Browse code

    $string string to convert to UTF-8
    $from current encoding

    Converts strings to UTF-8 via iconv. NB, the result may not by UTF-8 if the conversion failed.


    This file comes from Prado (BSD License)

    returns UTF-8 encoded string, original string if iconv failed.

  • (boolean) isArrayValuesEmpty ($array) Browse code

    $array the array to check

    Checks if array values are empty

    returns true if empty, otherwise false

  • (bool) isPathAbsolute ($path) Browse code

    $path A filesystem path.

    Determine if a filesystem path is absolute.

    returns true, if the path is absolute, otherwise false.

  • (bool) isUTF8 () Browse code

    Checks if a string is an utf8.


    Yi Stone Li
    Copyright (c) 2007 Yahoo! Inc. All rights reserved.
    Licensed under the BSD open source license

    returns true if $string is valid UTF-8 and false otherwise.

  • (mixed) literalize ($value, $quoted) Browse code

    $quoted Quote?

    Finds the type of the passed value, returns the value as the new type.

  • pregtr ($search, $replacePairs) Browse code

    $search subject to search
    $replacePairs array of search => replace pairs

    Returns subject replaced with regular expression matchs

  • removeArrayValueForPath ($values, $name, $default) Browse code

    $values The values to search
    $name The token name
    $default The default value to return if the name does not exist

    Removes a path for the given array.

  • (string) replaceConstants ($value) Browse code

    $value the value to perform the replacement on

    Replaces constant identifiers in a scalar value.

    returns the value with substitutions made

  • (array) stringToArray ($string) Browse code

    $string the value to convert to array

    Converts string to array

  • (string) stripComments ($source) Browse code

    $source PHP source code.

    Strips comments from php source code

    returns Comment free source code.

  • (array) stripslashesDeep ($value) Browse code

    $value the value to strip

    Strip slashes recursively from array

    returns clean value with slashes stripped