You are here

public function PathUtilityBase::add in Drupal 7 to 8/9 Module Upgrader 8

1 call to PathUtilityBase::add()
PathUtilityBase::__construct in src/Utility/Path/PathUtilityBase.php
Constructs a path utility.

File

src/Utility/Path/PathUtilityBase.php, line 39

Class

PathUtilityBase
Base class for PathUtilityInterface implementations.

Namespace

Drupal\drupalmoduleupgrader\Utility\Path

Code

public function add($value) {
  if ($value instanceof PathComponentInterface) {
    parent::add($value);
  }
  elseif (is_scalar($value)) {
    $this
      ->add(static::getComponent($value));
  }
  else {
    throw new \InvalidArgumentException();
  }
}