static function kind($path)
 {
     $k = filetype($path);
     switch ($k) {
         case "file":
             return sys__FileSystem_FileKind::$kfile;
             break;
         case "dir":
             return sys__FileSystem_FileKind::$kdir;
             break;
         default:
             return sys__FileSystem_FileKind::kother($k);
             break;
     }
 }
<?php

class sys__FileSystem_FileKind extends Enum
{
    public static $kdir;
    public static $kfile;
    public static function kother($k)
    {
        return new sys__FileSystem_FileKind("kother", 2, array($k));
    }
    public static $__constructors = array(0 => 'kdir', 1 => 'kfile', 2 => 'kother');
}
sys__FileSystem_FileKind::$kdir = new sys__FileSystem_FileKind("kdir", 0);
sys__FileSystem_FileKind::$kfile = new sys__FileSystem_FileKind("kfile", 1);