Skip to content

Commit 75a55e7

Browse files
committed
remove more checks
1 parent aa0ec13 commit 75a55e7

File tree

2 files changed

+1
-301
lines changed

2 files changed

+1
-301
lines changed

src/Types/Twitter/App.php

Lines changed: 1 addition & 256 deletions
Original file line numberDiff line numberDiff line change
@@ -46,264 +46,9 @@ public function country(string $county = null)
4646
{
4747
if (! empty($county)) {
4848
$county = strtoupper($county);
49-
if (array_key_exists($county, self::$countries)) {
50-
$this->setProperty(self::PREFIX, 'app:country', $county);
51-
}
49+
$this->setProperty(self::PREFIX, 'app:country', $county);
5250
}
5351

5452
return $this;
5553
}
56-
57-
private static $countries = [
58-
'BD' => 'Bangladesh',
59-
'BE' => 'Belgium',
60-
'BF' => 'Burkina Faso',
61-
'BG' => 'Bulgaria',
62-
'BA' => 'Bosnia and Herzegovina',
63-
'BB' => 'Barbados',
64-
'WF' => 'Wallis and Futuna',
65-
'BL' => 'Saint Barthelemy',
66-
'BM' => 'Bermuda',
67-
'BN' => 'Brunei',
68-
'BO' => 'Bolivia',
69-
'BH' => 'Bahrain',
70-
'BI' => 'Burundi',
71-
'BJ' => 'Benin',
72-
'BT' => 'Bhutan',
73-
'JM' => 'Jamaica',
74-
'BV' => 'Bouvet Island',
75-
'BW' => 'Botswana',
76-
'WS' => 'Samoa',
77-
'BQ' => 'Bonaire, Saint Eustatius and Saba ',
78-
'BR' => 'Brazil',
79-
'BS' => 'Bahamas',
80-
'JE' => 'Jersey',
81-
'BY' => 'Belarus',
82-
'BZ' => 'Belize',
83-
'RU' => 'Russia',
84-
'RW' => 'Rwanda',
85-
'RS' => 'Serbia',
86-
'TL' => 'East Timor',
87-
'RE' => 'Reunion',
88-
'TM' => 'Turkmenistan',
89-
'TJ' => 'Tajikistan',
90-
'RO' => 'Romania',
91-
'TK' => 'Tokelau',
92-
'GW' => 'Guinea-Bissau',
93-
'GU' => 'Guam',
94-
'GT' => 'Guatemala',
95-
'GS' => 'South Georgia and the South Sandwich Islands',
96-
'GR' => 'Greece',
97-
'GQ' => 'Equatorial Guinea',
98-
'GP' => 'Guadeloupe',
99-
'JP' => 'Japan',
100-
'GY' => 'Guyana',
101-
'GG' => 'Guernsey',
102-
'GF' => 'French Guiana',
103-
'GE' => 'Georgia',
104-
'GD' => 'Grenada',
105-
'GB' => 'United Kingdom',
106-
'GA' => 'Gabon',
107-
'SV' => 'El Salvador',
108-
'GN' => 'Guinea',
109-
'GM' => 'Gambia',
110-
'GL' => 'Greenland',
111-
'GI' => 'Gibraltar',
112-
'GH' => 'Ghana',
113-
'OM' => 'Oman',
114-
'TN' => 'Tunisia',
115-
'JO' => 'Jordan',
116-
'HR' => 'Croatia',
117-
'HT' => 'Haiti',
118-
'HU' => 'Hungary',
119-
'HK' => 'Hong Kong',
120-
'HN' => 'Honduras',
121-
'HM' => 'Heard Island and McDonald Islands',
122-
'VE' => 'Venezuela',
123-
'PR' => 'Puerto Rico',
124-
'PS' => 'Palestinian Territory',
125-
'PW' => 'Palau',
126-
'PT' => 'Portugal',
127-
'SJ' => 'Svalbard and Jan Mayen',
128-
'PY' => 'Paraguay',
129-
'IQ' => 'Iraq',
130-
'PA' => 'Panama',
131-
'PF' => 'French Polynesia',
132-
'PG' => 'Papua New Guinea',
133-
'PE' => 'Peru',
134-
'PK' => 'Pakistan',
135-
'PH' => 'Philippines',
136-
'PN' => 'Pitcairn',
137-
'PL' => 'Poland',
138-
'PM' => 'Saint Pierre and Miquelon',
139-
'ZM' => 'Zambia',
140-
'EH' => 'Western Sahara',
141-
'EE' => 'Estonia',
142-
'EG' => 'Egypt',
143-
'ZA' => 'South Africa',
144-
'EC' => 'Ecuador',
145-
'IT' => 'Italy',
146-
'VN' => 'Vietnam',
147-
'SB' => 'Solomon Islands',
148-
'ET' => 'Ethiopia',
149-
'SO' => 'Somalia',
150-
'ZW' => 'Zimbabwe',
151-
'SA' => 'Saudi Arabia',
152-
'ES' => 'Spain',
153-
'ER' => 'Eritrea',
154-
'ME' => 'Montenegro',
155-
'MD' => 'Moldova',
156-
'MG' => 'Madagascar',
157-
'MF' => 'Saint Martin',
158-
'MA' => 'Morocco',
159-
'MC' => 'Monaco',
160-
'UZ' => 'Uzbekistan',
161-
'MM' => 'Myanmar',
162-
'ML' => 'Mali',
163-
'MO' => 'Macao',
164-
'MN' => 'Mongolia',
165-
'MH' => 'Marshall Islands',
166-
'MK' => 'Macedonia',
167-
'MU' => 'Mauritius',
168-
'MT' => 'Malta',
169-
'MW' => 'Malawi',
170-
'MV' => 'Maldives',
171-
'MQ' => 'Martinique',
172-
'MP' => 'Northern Mariana Islands',
173-
'MS' => 'Montserrat',
174-
'MR' => 'Mauritania',
175-
'IM' => 'Isle of Man',
176-
'UG' => 'Uganda',
177-
'TZ' => 'Tanzania',
178-
'MY' => 'Malaysia',
179-
'MX' => 'Mexico',
180-
'IL' => 'Israel',
181-
'FR' => 'France',
182-
'IO' => 'British Indian Ocean Territory',
183-
'SH' => 'Saint Helena',
184-
'FI' => 'Finland',
185-
'FJ' => 'Fiji',
186-
'FK' => 'Falkland Islands',
187-
'FM' => 'Micronesia',
188-
'FO' => 'Faroe Islands',
189-
'NI' => 'Nicaragua',
190-
'NL' => 'Netherlands',
191-
'NO' => 'Norway',
192-
'NA' => 'Namibia',
193-
'VU' => 'Vanuatu',
194-
'NC' => 'New Caledonia',
195-
'NE' => 'Niger',
196-
'NF' => 'Norfolk Island',
197-
'NG' => 'Nigeria',
198-
'NZ' => 'New Zealand',
199-
'NP' => 'Nepal',
200-
'NR' => 'Nauru',
201-
'NU' => 'Niue',
202-
'CK' => 'Cook Islands',
203-
'XK' => 'Kosovo',
204-
'CI' => 'Ivory Coast',
205-
'CH' => 'Switzerland',
206-
'CO' => 'Colombia',
207-
'CN' => 'China',
208-
'CM' => 'Cameroon',
209-
'CL' => 'Chile',
210-
'CC' => 'Cocos Islands',
211-
'CA' => 'Canada',
212-
'CG' => 'Republic of the Congo',
213-
'CF' => 'Central African Republic',
214-
'CD' => 'Democratic Republic of the Congo',
215-
'CZ' => 'Czech Republic',
216-
'CY' => 'Cyprus',
217-
'CX' => 'Christmas Island',
218-
'CR' => 'Costa Rica',
219-
'CW' => 'Curacao',
220-
'CV' => 'Cape Verde',
221-
'CU' => 'Cuba',
222-
'SZ' => 'Swaziland',
223-
'SY' => 'Syria',
224-
'SX' => 'Sint Maarten',
225-
'KG' => 'Kyrgyzstan',
226-
'KE' => 'Kenya',
227-
'SS' => 'South Sudan',
228-
'SR' => 'Suriname',
229-
'KI' => 'Kiribati',
230-
'KH' => 'Cambodia',
231-
'KN' => 'Saint Kitts and Nevis',
232-
'KM' => 'Comoros',
233-
'ST' => 'Sao Tome and Principe',
234-
'SK' => 'Slovakia',
235-
'KR' => 'South Korea',
236-
'SI' => 'Slovenia',
237-
'KP' => 'North Korea',
238-
'KW' => 'Kuwait',
239-
'SN' => 'Senegal',
240-
'SM' => 'San Marino',
241-
'SL' => 'Sierra Leone',
242-
'SC' => 'Seychelles',
243-
'KZ' => 'Kazakhstan',
244-
'KY' => 'Cayman Islands',
245-
'SG' => 'Singapore',
246-
'SE' => 'Sweden',
247-
'SD' => 'Sudan',
248-
'DO' => 'Dominican Republic',
249-
'DM' => 'Dominica',
250-
'DJ' => 'Djibouti',
251-
'DK' => 'Denmark',
252-
'VG' => 'British Virgin Islands',
253-
'DE' => 'Germany',
254-
'YE' => 'Yemen',
255-
'DZ' => 'Algeria',
256-
'US' => 'United States',
257-
'UY' => 'Uruguay',
258-
'YT' => 'Mayotte',
259-
'UM' => 'United States Minor Outlying Islands',
260-
'LB' => 'Lebanon',
261-
'LC' => 'Saint Lucia',
262-
'LA' => 'Laos',
263-
'TV' => 'Tuvalu',
264-
'TW' => 'Taiwan',
265-
'TT' => 'Trinidad and Tobago',
266-
'TR' => 'Turkey',
267-
'LK' => 'Sri Lanka',
268-
'LI' => 'Liechtenstein',
269-
'LV' => 'Latvia',
270-
'TO' => 'Tonga',
271-
'LT' => 'Lithuania',
272-
'LU' => 'Luxembourg',
273-
'LR' => 'Liberia',
274-
'LS' => 'Lesotho',
275-
'TH' => 'Thailand',
276-
'TF' => 'French Southern Territories',
277-
'TG' => 'Togo',
278-
'TD' => 'Chad',
279-
'TC' => 'Turks and Caicos Islands',
280-
'LY' => 'Libya',
281-
'VA' => 'Vatican',
282-
'VC' => 'Saint Vincent and the Grenadines',
283-
'AE' => 'United Arab Emirates',
284-
'AD' => 'Andorra',
285-
'AG' => 'Antigua and Barbuda',
286-
'AF' => 'Afghanistan',
287-
'AI' => 'Anguilla',
288-
'VI' => 'U.S. Virgin Islands',
289-
'IS' => 'Iceland',
290-
'IR' => 'Iran',
291-
'AM' => 'Armenia',
292-
'AL' => 'Albania',
293-
'AO' => 'Angola',
294-
'AQ' => 'Antarctica',
295-
'AS' => 'American Samoa',
296-
'AR' => 'Argentina',
297-
'AU' => 'Australia',
298-
'AT' => 'Austria',
299-
'AW' => 'Aruba',
300-
'IN' => 'India',
301-
'AX' => 'Aland Islands',
302-
'AZ' => 'Azerbaijan',
303-
'IE' => 'Ireland',
304-
'ID' => 'Indonesia',
305-
'UA' => 'Ukraine',
306-
'QA' => 'Qatar',
307-
'MZ' => 'Mozambique',
308-
];
30954
}

tests/TwitterTypesTest.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,13 @@
5151
->iPhoneApp('AppName', 'A1B2C3D4E5', 'https://app.domainname.com');
5252
assertMatchesHtmlSnapshot((string) $og);
5353

54-
//With Wrong URL
55-
$og = App::make('Title | Example')
56-
->description('Description')
57-
->site('@astrotomic_oss')
58-
->iPhoneApp('AppName', 'A1B2C3D4E5', 'https:/app.domainname.com');
59-
assertMatchesHtmlSnapshot((string) $og);
60-
6154
//With Correct Country
6255
$og = App::make('Title | Example')
6356
->description('Description')
6457
->site('@astrotomic_oss')
6558
->iPhoneApp('AppName', 'A1B2C3D4E5', 'https://app.domainname.com')
6659
->country('HR');
6760
assertMatchesHtmlSnapshot((string) $og);
68-
69-
//With Wrong Country
70-
$og = App::make('Title | Example')
71-
->description('Description')
72-
->site('@astrotomic_oss')
73-
->iPhoneApp('AppName', 'A1B2C3D4E5', 'https://app.domainname.com')
74-
->country('CRO');
75-
assertMatchesHtmlSnapshot((string) $og);
7661
})->group('twitter', 'app');
7762

7863
it('can generate iPad app tags ', function () {
@@ -90,28 +75,13 @@
9075
->iPadApp('AppName', 'A1B2C3D4E5', 'https://app.domainname.com');
9176
assertMatchesHtmlSnapshot((string) $og);
9277

93-
//With Wrong URL
94-
$og = App::make('Title | Example')
95-
->description('Description')
96-
->site('@astrotomic_oss')
97-
->iPadApp('AppName', 'A1B2C3D4E5', 'https:/app.domainname.com');
98-
assertMatchesHtmlSnapshot((string) $og);
99-
10078
//With Correct Country
10179
$og = App::make('Title | Example')
10280
->description('Description')
10381
->site('@astrotomic_oss')
10482
->iPadApp('AppName', 'A1B2C3D4E5', 'https://app.domainname.com')
10583
->country('HR');
10684
assertMatchesHtmlSnapshot((string) $og);
107-
108-
//With Wrong Country
109-
$og = App::make('Title | Example')
110-
->description('Description')
111-
->site('@astrotomic_oss')
112-
->iPadApp('AppName', 'A1B2C3D4E5', 'https://app.domainname.com')
113-
->country('CRO');
114-
assertMatchesHtmlSnapshot((string) $og);
11585
})->group('twitter', 'app');
11686

11787
it('can generate Google Play app tags ', function () {
@@ -129,28 +99,13 @@
12999
->googlePlayApp('AppName', 'id123456789', 'https://app.domainname.com');
130100
assertMatchesHtmlSnapshot((string) $og);
131101

132-
//With Wrong URL
133-
$og = App::make('Title | Example')
134-
->description('Description')
135-
->site('@astrotomic_oss')
136-
->googlePlayApp('AppName', 'id123456789', 'https:/app.domainname.com');
137-
assertMatchesHtmlSnapshot((string) $og);
138-
139102
//With Correct Country
140103
$og = App::make('Title | Example')
141104
->description('Description')
142105
->site('@astrotomic_oss')
143106
->googlePlayApp('AppName', 'id123456789', 'https://app.domainname.com')
144107
->country('HR');
145108
assertMatchesHtmlSnapshot((string) $og);
146-
147-
//With Wrong Country
148-
$og = App::make('Title | Example')
149-
->description('Description')
150-
->site('@astrotomic_oss')
151-
->googlePlayApp('AppName', 'id123456789', 'https://app.domainname.com')
152-
->country('CRO');
153-
assertMatchesHtmlSnapshot((string) $og);
154109
})->group('twitter', 'app');
155110

156111
it('can generate combined app tags ', function () {

0 commit comments

Comments
 (0)