1 | <?php |
||
10 | class Spreadsheet |
||
11 | { |
||
12 | /** @var string */ |
||
13 | protected $id; |
||
14 | |||
15 | /** @var array */ |
||
16 | protected $locales = []; |
||
17 | |||
18 | /** @var array */ |
||
19 | protected $translations = []; |
||
20 | |||
21 | /** @var Api */ |
||
22 | protected $api; |
||
23 | |||
24 | 2 | public function __construct($id, $locales, $api = null) |
|
30 | |||
31 | public function setLocales($locales) |
||
32 | { |
||
33 | $this->locales = $locales; |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | 2 | public function setTranslations($translations) |
|
44 | |||
45 | public function getTranslations() |
||
46 | { |
||
47 | return $this->translations; |
||
48 | } |
||
49 | |||
50 | public function getTranslationsCount() |
||
51 | { |
||
52 | return count($this->translations); |
||
53 | } |
||
54 | |||
55 | public function getId() |
||
56 | { |
||
57 | return $this->id; |
||
58 | } |
||
59 | |||
60 | public function getUrl() |
||
61 | { |
||
62 | return 'https://docs.google.com/spreadsheets/d/'.$this->id; |
||
63 | } |
||
64 | |||
65 | 2 | public function getLocales() |
|
69 | |||
70 | public function getLocalesCount() |
||
71 | { |
||
72 | return count($this->locales); |
||
73 | } |
||
74 | |||
75 | 1 | public function getHeader() |
|
76 | { |
||
77 | 1 | return array_merge( |
|
78 | 1 | array_merge(['Full key'], $this->getLocales()), |
|
79 | 1 | ['Namespace', 'Group', 'Key', 'Source file'] |
|
80 | 1 | ); |
|
81 | } |
||
82 | |||
83 | public function getCamelizedHeader() |
||
93 | |||
94 | public function getHeaderColumnsCount() |
||
95 | { |
||
96 | $header = $this->getHeader(); |
||
97 | |||
98 | return count($header); |
||
99 | } |
||
100 | |||
101 | public function getHeaderRowsCount() |
||
105 | |||
106 | /** |
||
107 | * @param $sheetId |
||
108 | * @param $sheetTitle |
||
109 | * |
||
110 | * @return TranslationsSheetCoordinates |
||
111 | */ |
||
112 | public function translationsEmptySheetCoordinates($sheetId, $sheetTitle) |
||
120 | |||
121 | /** |
||
122 | * @param $sheetId |
||
123 | * @param $sheetTitle |
||
124 | * @return TranslationsSheetCoordinates |
||
125 | */ |
||
126 | public function translationsSheetCoordinates($sheetId, $sheetTitle) |
||
135 | |||
136 | public function sheetStyles() |
||
140 | |||
141 | /** |
||
142 | * Return api instance initialized with the spreadsheet ID. |
||
143 | * |
||
144 | * @return Api |
||
145 | */ |
||
146 | public function api() |
||
150 | } |
||
151 |