public static function getModeFromStringRepresentation($permissions)
    {
        if (strlen($permissions) !== 10) {
            throw new InvalidArgumentException('Please provide a 10 character long string');
        }
        $mode = 0;

        if ($permissions[0] == 's') {
            $mode = 0140000;
        } elseif ($permissions[0] == 'l') {
            $mode = 0120000;
        } elseif ($permissions[0] == '-') {
            $mode = 0100000;
        } elseif ($permissions[0] == 'b') {
            $mode = 060000;
        } elseif ($permissions[0] == 'd') {
            $mode = 040000;
        } elseif ($permissions[0] == 'c') {
            $mode = 020000;
        } elseif ($permissions[0] == 'p') {
            $mode = 010000;
        } elseif ($permissions[0] == 'u') {
            $mode = 0;
        }

        if ($permissions[1] == 'r') {
            $mode += 0400;
        }
        if ($permissions[2] == 'w') {
            $mode += 0200;
        }
        if ($permissions[3] == 'x') {
            $mode += 0100;
        } elseif ($permissions[3] == 's') {
            $mode += 04100;
        } elseif ($permissions[3] == 'S') {
            $mode += 04000;
        }

        if ($permissions[4] == 'r') {
            $mode += 040;
        }
        if ($permissions[5] == 'w') {
            $mode += 020;
        }
        if ($permissions[6] == 'x') {
            $mode += 010;
        } elseif ($permissions[6] == 's') {
            $mode += 02010;
        } elseif ($permissions[6] == 'S') {
            $mode += 02000;
        }

        if ($permissions[7] == 'r') {
            $mode += 04;
        }
        if ($permissions[8] == 'w') {
            $mode += 02;
        }
        if ($permissions[9] == 'x') {
            $mode += 01;
        } elseif ($permissions[9] == 't') {
            $mode += 01001;
        } elseif ($permissions[9] == 'T') {
            $mode += 01000;
        }

        return $mode;
    }