]> git.street.me.uk Git - andy/gpx.git/commitdiff
Add function to empty a TypedDoublyLinkedList
authorAndy Street <andy@street.me.uk>
Wed, 16 Jan 2019 21:11:23 +0000 (21:11 +0000)
committerAndy Street <andy@street.me.uk>
Wed, 16 Jan 2019 21:12:05 +0000 (21:12 +0000)
src/libgpx/typeddoublylinkedlist.php

index b01ba0b0a8faf4c3ea60f6738a4469a15111cf79..0c00e08c343a8ec7e8a9bf0d88633c4408036050 100644 (file)
@@ -164,4 +164,16 @@ class TypedDoublyLinkedList extends SplDoublyLinkedList
     return parent::unshift($value);
   }
 
+  /**
+   * Empty the list.
+   *
+   * @return void
+   */
+  public function empty()
+  {
+    while (!$this->isEmpty()) {
+      $this->pop();
+    }
+  }
+
 }