you want to first create an object of your class DirTree, such as
$testObj = new DirTree();
then you can play with it and evoke methods it knows - such as parse_dir():
$testObj->parse_dir($some_folder);
on a quick glimpse, you seem to have used the $this->parse_dir() correctly in the class. but when you try calling it again recursively within parse_dir(), you need to create an object first, which you apply the method to.
i assume it should look somewhat like
$tmpTree = new DirTree();
$tree[][$folder] = $tmpTree->parse_dir("$folder/$item");
or - if you tweak the method a bit - you could also use this:
$tmpTree = new DirTree("$folder/$item");
$tree[][$folder] = $tmpTree->parse_dir();
instead of
$tree[][$folder] = parse_dir( "$folder/$item");