public static function compileMode(array $perms)
    {
        $fmode = 0;
        $fmode |= !empty($perms['owner']['read'])    ? self::OWNER_READ    : 0;
        $fmode |= !empty($perms['owner']['write'])   ? self::OWNER_WRITE   : 0;
        $fmode |= !empty($perms['owner']['execute']) ? self::OWNER_EXECUTE : 0;

        $fmode |= !empty($perms['group']['read'])    ? self::GROUP_READ    : 0;
        $fmode |= !empty($perms['group']['write'])   ? self::GROUP_WRITE   : 0;
        $fmode |= !empty($perms['group']['execute']) ? self::GROUP_EXECUTE : 0;

        $fmode |= !empty($perms['world']['read'])    ? self::WORLD_READ    : 0;
        $fmode |= !empty($perms['world']['write'])   ? self::WORLD_WRITE   : 0;
        $fmode |= !empty($perms['world']['execute']) ? self::WORLD_EXECUTE : 0;

        return $fmode;
    }