You are here

public static function PropertyPath::append 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::append()

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 (".").

Parameters

string $basePath The base path:

string $subPath The path to append:

Return value

string The concatenation of the two property paths

9 calls to PropertyPath::append()
ConstraintViolationBuilder::atPath in vendor/symfony/validator/Violation/ConstraintViolationBuilder.php
Stores the property path at which the violation should be generated.
ConstraintViolationBuilder::atPath in core/lib/Drupal/Core/TypedData/Validation/ConstraintViolationBuilder.php
Stores the property path at which the violation should be generated.
ExecutionContext::getPropertyPath in vendor/symfony/validator/Context/ExecutionContext.php
Returns the property path to the value that the validator is currently validating.
ExecutionContext::getPropertyPath in core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php
Returns the property path to the value that the validator is currently validating.
PropertyPathTest::testAppend in vendor/symfony/validator/Tests/Util/PropertyPathTest.php
@dataProvider provideAppendPaths

... See full list

File

vendor/symfony/validator/Util/PropertyPath.php, line 39

Class

PropertyPath
Contains utility methods for dealing with property paths.

Namespace

Symfony\Component\Validator\Util

Code

public static function append($basePath, $subPath) {
  if ('' !== (string) $subPath) {
    if ('[' === $subPath[0]) {
      return $basePath . $subPath;
    }
    return '' !== (string) $basePath ? $basePath . '.' . $subPath : $subPath;
  }
  return $basePath;
}