Conditions | 4 |
Paths | 4 |
Total Lines | 57 |
Code Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
41 | public function historicEventsAll(string $language_tag): Collection |
||
42 | { |
||
43 | switch ($language_tag) { |
||
44 | case 'en-AU': |
||
45 | case 'en-GB': |
||
46 | case 'en-US': |
||
47 | return new Collection([ |
||
|
|||
48 | "1 EVEN George Washington\n2 TYPE 1st President of the United States\n2 DATE 30 APR 1789", |
||
49 | "1 EVEN John Adams\n2 TYPE 2nd President of the United States\n2 DATE 4 MAR 1797", |
||
50 | "1 EVEN Thomas Jefferson\n2 TYPE 3rd President of the United States\n2 DATE 4 MAR 1801", |
||
51 | "1 EVEN James Madison\n2 TYPE 4th President of the United States\n2 DATE 4 MAR 1809", |
||
52 | "1 EVEN James Monroe\n2 TYPE 5th President of the United States\n2 DATE 4 MAR 1817", |
||
53 | "1 EVEN John Quincy Adams\n2 TYPE 6th President of the United States\n2 DATE 4 MAR 1825", |
||
54 | "1 EVEN Andrew Jackson\n2 TYPE 7th President of the United States\n2 DATE 4 MAR 1829", |
||
55 | "1 EVEN Martin Van Buren\n2 TYPE 8th President of the United States\n2 DATE 4 MAR 1837", |
||
56 | "1 EVEN William Henry Harrison\n2 TYPE 9th President of the United States\n2 DATE 4 MAR 1841", |
||
57 | "1 EVEN John Tyler\n2 TYPE 10th President of the United States\n2 DATE 4 APR 1841", |
||
58 | "1 EVEN James K Polk\n2 TYPE 11th President of the United States\n2 DATE 4 MAR 1845", |
||
59 | "1 EVEN Zachary Taylor\n2 TYPE 12th President of the United States\n2 DATE 4 MAR 1849", |
||
60 | "1 EVEN Millard Fillmore\n2 TYPE 13th President of the United States\n2 DATE 9 JUL 1850", |
||
61 | "1 EVEN Franklin Pierce\n2 TYPE 14th President of the United States\n2 DATE 4 MAR 1853", |
||
62 | "1 EVEN James Buchanan\n2 TYPE 15th President of the United States\n2 DATE 4 MAR 1857", |
||
63 | "1 EVEN Abraham Lincoln\n2 TYPE 16th President of the United States\n2 DATE 4 MAR 1861", |
||
64 | "1 EVEN Andrew Johnson\n2 TYPE 17th President of the United States\n2 DATE 15 APR 1865", |
||
65 | "1 EVEN Ulysses S Grant\n2 TYPE 18th President of the United States\n2 DATE 4 MAR 1869", |
||
66 | "1 EVEN Rutherford B Hayes\n2 TYPE 19th President of the United States\n2 DATE 4 MAR 1877", |
||
67 | "1 EVEN James A Garfield\n2 TYPE 20th President of the United States\n2 DATE 4 MAR 1881", |
||
68 | "1 EVEN Chester A Arthur\n2 TYPE 21st President of the United States\n2 DATE 19 SEP 1881", |
||
69 | "1 EVEN Grover Cleveland\n2 TYPE 22nd President of the United States\n2 DATE 4 MAR 1885", |
||
70 | "1 EVEN Benjamin Harrison\n2 TYPE 23rd President of the United States\n2 DATE 4 MAR 1889", |
||
71 | "1 EVEN Grover Cleveland\n2 TYPE 24th President of the United States\n2 DATE 4 MAR 1893", |
||
72 | "1 EVEN William McKinley\n2 TYPE 25th President of the United States\n2 DATE 4 MAR 1897", |
||
73 | "1 EVEN Theodore Roosevelt\n2 TYPE 26th President of the United States\n2 DATE 14 SEP 1901", |
||
74 | "1 EVEN William Howard Taft\n2 TYPE 27th President of the United States\n2 DATE 4 MAR 1909", |
||
75 | "1 EVEN Woodrow Wilson\n2 TYPE 28th President of the United States\n2 DATE 4 MAR 1913", |
||
76 | "1 EVEN Warren G Harding\n2 TYPE 29th President of the United States\n2 DATE 4 MAR 1921", |
||
77 | "1 EVEN Calvin Coolidge\n2 TYPE 30th President of the United States\n2 DATE 2 AUG 1923", |
||
78 | "1 EVEN Herbert Hoover\n2 TYPE 31st President of the United States\n2 DATE 4 MAR 1929", |
||
79 | "1 EVEN Franklin D Roosevelt\n2 TYPE 32nd President of the United States\n2 DATE 4 MAR 1933", |
||
80 | "1 EVEN Harry S Truman\n2 TYPE 33rd President of the United States\n2 DATE 12 APR 1945", |
||
81 | "1 EVEN Dwight D Eisenhower\n2 TYPE 34th President of the United States\n2 DATE 20 JAN 1953", |
||
82 | "1 EVEN John F Kennedy\n2 TYPE 35th President of the United States\n2 DATE 20 JAN 1961", |
||
83 | "1 EVEN Lyndon B Johnson\n2 TYPE 36th President of the United States\n2 DATE 22 NOV 1963", |
||
84 | "1 EVEN Richard Nixon\n2 TYPE 37th President of the United States\n2 DATE 20 JAN 1969", |
||
85 | "1 EVEN Gerald Ford\n2 TYPE 38th President of the United States\n2 DATE 9 AUG 1974", |
||
86 | "1 EVEN Jimmy Carter\n2 TYPE 39th President of the United States\n2 DATE 20 JAN 1977", |
||
87 | "1 EVEN Ronald Reagan\n2 TYPE 40th President of the United States\n2 DATE 20 JAN 1981", |
||
88 | "1 EVEN George H W Bush\n2 TYPE 41st President of the United States\n2 DATE 20 JAN 1989", |
||
89 | "1 EVEN Bill Clinton\n2 TYPE 42nd President of the United States\n2 DATE 20 JAN 1993", |
||
90 | "1 EVEN George W Bush\n2 TYPE 43rd President of the United States\n2 DATE 20 JAN 2001", |
||
91 | "1 EVEN Barack Obama\n2 TYPE 44th President of the United States\n2 DATE 20 JAN 2009", |
||
92 | "1 EVEN Donald Trump\n2 TYPE 45th President of the United States\n2 DATE 20 JAN 2017", |
||
93 | "1 EVEN Joe Biden\n2 TYPE 46th President of the United States\n2 DATE 20 JAN 2021", |
||
94 | ]); |
||
95 | |||
96 | default: |
||
97 | return new Collection(); |
||
98 | } |
||
101 |