code: public function contains($path)
      {
          $realpath = realpath($path);
          if (false === $realpath) {
              return false;
          }
  
          return substr($realpath, 0, strlen($this->rootpath)) === $this->rootpath;
      }
docs: checks if given path is located within root path
  
  @param   string  $path
  @return  bool