PathUtility.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Utility/Path/Drupal7/PathUtility.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Utility\Path\Drupal7;
use Drupal\drupalmoduleupgrader\Utility\Path\PathUtilityBase;
class PathUtility extends PathUtilityBase {
public static function getComponent($value) {
return new PathComponent($value);
}
public function isDynamic() {
return $this
->hasWildcards() || $this
->hasPlaceholders();
}
public function hasPlaceholders() {
return $this
->getPlaceholders()
->count() > 0;
}
public function getPlaceholders() {
return $this
->filter(function (PathComponent $component) {
return $component
->isPlaceholder();
});
}
public function deletePlaceholders() {
return $this
->filter(function (PathComponent $component) {
return !$component
->isPlaceholder();
});
}
}