You are here

public static function PropertyPath::append in Plug 7

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

6 calls to PropertyPath::append()
ConstraintViolationBuilder::atPath in lib/Symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php
Stores the property path at which the violation should be generated.
ExecutionContext::getPropertyPath in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php
Returns the property path to the value that the validator is currently validating.
PropertyPathTest::testAppend in lib/Symfony/validator/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php
@dataProvider provideAppendPaths
RecursiveContextualValidator::validateClassNode in lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
Validates a class node.
RecursiveContextualValidator::validateProperty in lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
Validates a property of an object against the constraints specified for this property.

... See full list

File

lib/Symfony/validator/Symfony/Component/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;
}