You are here

class PropertyPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Util/PropertyPath.php \Symfony\Component\Validator\Util\PropertyPath

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

7 files declare their use of PropertyPath
ConstraintViolationBuilder.php in vendor/symfony/validator/Violation/ConstraintViolationBuilder.php
ConstraintViolationBuilder.php in core/lib/Drupal/Core/TypedData/Validation/ConstraintViolationBuilder.php
Contains \Drupal\Core\TypedData\Validation\ConstraintViolationBuilder.
ExecutionContext.php in vendor/symfony/validator/Context/ExecutionContext.php
ExecutionContext.php in core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php
Contains \Drupal\Core\TypedData\Validation\ExecutionContext.
PropertyPathTest.php in vendor/symfony/validator/Tests/Util/PropertyPathTest.php

... See full list

File

vendor/symfony/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.