X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fdrupalmoduleupgrader%2Fsrc%2FUtility%2FPath%2FDrupal7%2FPathUtility.php;fp=web%2Fmodules%2Fcontrib%2Fdrupalmoduleupgrader%2Fsrc%2FUtility%2FPath%2FDrupal7%2FPathUtility.php;h=2adf5a956e469c798cac97448148986ffca319c9;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/drupalmoduleupgrader/src/Utility/Path/Drupal7/PathUtility.php b/web/modules/contrib/drupalmoduleupgrader/src/Utility/Path/Drupal7/PathUtility.php new file mode 100644 index 000000000..2adf5a956 --- /dev/null +++ b/web/modules/contrib/drupalmoduleupgrader/src/Utility/Path/Drupal7/PathUtility.php @@ -0,0 +1,64 @@ +hasWildcards() || $this->hasPlaceholders()); + } + + /** + * Returns if there are placeholders in the path. + * + * @return boolean + */ + 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()); + }); + } + +}