Security update for Core, with self-updated composer
[yaffs-website] / vendor / consolidation / annotated-command / src / CommandFileDiscovery.php
index a409c0b821ce83e1382f68c1441f9df258efbe9c..06489fb08679a86e9837b6da4f114ff14e130385 100644 (file)
@@ -40,6 +40,8 @@ class CommandFileDiscovery
     protected $includeFilesAtBase = true;
     /** @var integer */
     protected $searchDepth = 2;
+    /** @var bool */
+    protected $followLinks = false;
 
     public function __construct()
     {
@@ -101,6 +103,16 @@ class CommandFileDiscovery
         return $this;
     }
 
+    /**
+     * Specify that the discovery object should follow symlinks. By
+     * default, symlinks are not followed.
+     */
+    public function followLinks($followLinks = true)
+    {
+        $this->followLinks = $followLinks;
+        return $this;
+    }
+
     /**
      * Set the list of search locations to examine in each directory where
      * command files may be found.  This replaces whatever was there before.
@@ -325,6 +337,10 @@ class CommandFileDiscovery
             $finder->exclude($item);
         }
 
+        if ($this->followLinks) {
+            $finder->followLinks();
+        }
+
         return $finder;
     }