// // CountryCashes.swift // TournamentStats // // Created by Laurent Morvillier on 09/06/2019. // Copyright © 2019 Stax River. All rights reserved. // import Foundation class CountryCounter : HTMLRepresentable { var country: String var counter: Int init(country: String, counter: Int) { self.country = country self.counter = counter } func increment() { self.counter += 1 } static func headers() -> [String] { return ["Country", "Cashes"] } func colums() -> [String] { let formattedCountry: String if let flagoji = Locale.current.flagoji(from: self.country) { formattedCountry = "\(flagoji) \(self.country)" } else { formattedCountry = self.country } var strings: [String] = [] strings.append(formattedCountry) strings.append("\(counter)") return strings } // static func htmlHeaders() -> String { // var strings: [String] = [] // strings.append("Country") // strings.append("Cashes") // let all = strings.joined(separator: "") // return "\(all)" // } // // func html() -> String { // // let formattedCountry: String // if let flagoji = Locale.current.flagoji(from: self.country) { // formattedCountry = "\(flagoji) \(self.country)" // } else { // formattedCountry = self.country // } // // var strings: [String] = [] // strings.append(formattedCountry) // strings.append("\(counter)") // let all = strings.joined(separator: "") // return "\(all)" // } }