public static function fromString(string $direction): Direction
    {
        if($direction == self::IN ) {
            return self::in();
        } else if($direction == self::OUT) {
            return self::out();
        } else {
            throw new Exceptions\InvalidDirectionException($direction);
        }
    }