You are here

class PropertyPath in Plug 7

Contains utility methods for dealing with property paths.

For more extensive functionality, use Symfony's PropertyAccess component.

@since 2.5

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of PropertyPath

4 files declare their use of PropertyPath
ConstraintViolationBuilder.php in lib/Symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php
ExecutionContext.php in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php
PropertyPathTest.php in lib/Symfony/validator/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php
RecursiveContextualValidator.php in lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

File

lib/Symfony/validator/Symfony/Component/Validator/Util/PropertyPath.php, line 23

Namespace

Symfony\Component\Validator\Util
View source
class PropertyPath {

  /**
   * Appends a path to a given property path.
   *
   * If the base path is empty, the appended path will be returned unchanged.
   * If the base path is not empty, and the appended path starts with a
   * squared opening bracket ("["), the concatenation of the two paths is
   * returned. Otherwise, the concatenation of the two paths is returned,
   * separated by a dot (".").
   *
   * @param string $basePath The base path
   * @param string $subPath  The path to append
   *
   * @return string The concatenation of the two property paths
   */
  public static function append($basePath, $subPath) {
    if ('' !== (string) $subPath) {
      if ('[' === $subPath[0]) {
        return $basePath . $subPath;
      }
      return '' !== (string) $basePath ? $basePath . '.' . $subPath : $subPath;
    }
    return $basePath;
  }

  /**
   * Not instantiable.
   */
  private function __construct() {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PropertyPath::append public static function Appends a path to a given property path.
PropertyPath::__construct private function Not instantiable.