class PathUtility in Drupal 7 to 8/9 Module Upgrader 8
Same name in this branch
- 8 src/Utility/Path/Drupal7/PathUtility.php \Drupal\drupalmoduleupgrader\Utility\Path\Drupal7\PathUtility
- 8 src/Utility/Path/Drupal8/PathUtility.php \Drupal\drupalmoduleupgrader\Utility\Path\Drupal8\PathUtility
Represents a Drupal 7 route path.
Hierarchy
- class \Drupal\drupalmoduleupgrader\Utility\Path\PathUtilityBase extends \Doctrine\Common\Collections\ArrayCollection implements PathUtilityInterface
- class \Drupal\drupalmoduleupgrader\Utility\Path\Drupal7\PathUtility
Expanded class hierarchy of PathUtility
3 files declare their use of PathUtility
- ParameterBindingTest.php in tests/
src/ Unit/ Routing/ ParameterBindingTest.php - PathUtilityTest.php in tests/
src/ Unit/ Utility/ Path/ Drupal7/ PathUtilityTest.php - RouteWrapper.php in src/
Routing/ Drupal7/ RouteWrapper.php
File
- src/
Utility/ Path/ Drupal7/ PathUtility.php, line 10
Namespace
Drupal\drupalmoduleupgrader\Utility\Path\Drupal7View source
class PathUtility extends PathUtilityBase {
/**
* {@inheritdoc}
*/
public static function getComponent($value) {
return new PathComponent($value);
}
/**
* Returns if the path has %wildcards or placeholders (%) in it.
*
* @return bool
*/
public function isDynamic() {
return $this
->hasWildcards() || $this
->hasPlaceholders();
}
/**
* Returns if there are placeholders in the path.
*
* @return bool
*/
public function hasPlaceholders() {
return $this
->getPlaceholders()
->count() > 0;
}
/**
* Returns every placeholder in the path, keyed by position.
*
* @return static
*/
public function getPlaceholders() {
return $this
->filter(function (PathComponent $component) {
return $component
->isPlaceholder();
});
}
/**
* Returns a copy of the collection with all placeholders removed.
*
* @return static
*/
public function deletePlaceholders() {
return $this
->filter(function (PathComponent $component) {
return !$component
->isPlaceholder();
});
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PathUtility:: |
public | function | Returns a copy of the collection with all placeholders removed. | |
PathUtility:: |
public static | function |
Returns a new path component wrapping a value. Overrides PathUtilityInterface:: |
|
PathUtility:: |
public | function | Returns every placeholder in the path, keyed by position. | |
PathUtility:: |
public | function | Returns if there are placeholders in the path. | |
PathUtility:: |
public | function | Returns if the path has %wildcards or placeholders (%) in it. | |
PathUtilityBase:: |
protected | property | The next index for getNextWildcard() to slice on. | |
PathUtilityBase:: |
public | function | ||
PathUtilityBase:: |
public | function | ||
PathUtilityBase:: |
public | function | After PHP 7.2+ for count() E_WARNING will now be emitted when attempting to count() non-countable types. Ref: https://secure.php.net/manual/en/migration72.incompatible.php#migration7... | |
PathUtilityBase:: |
public | function | Returns a copy of the collection with wildcards removed. | |
PathUtilityBase:: |
public | function | Filters the path by a string. The filtered path will only contain components whose string representation is identical to $element. | |
PathUtilityBase:: |
public | function | Returns the next wildcard, if any. | |
PathUtilityBase:: |
public | function |
Returns a PathUtilityInterface for the parent path. Overrides PathUtilityInterface:: |
|
PathUtilityBase:: |
public | function | Returns every {wildcard} in the path, keyed by position. | |
PathUtilityBase:: |
public | function |
Returns if there are wildcards in the path. Overrides PathUtilityInterface:: |
|
PathUtilityBase:: |
public | function |
Constructs a path utility. Overrides PathUtilityInterface:: |
|
PathUtilityBase:: |
public | function |
Collapses the path into a string. Overrides PathUtilityInterface:: |