Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Browser often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Browser, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 37 | class Browser |
||
| 38 | { |
||
| 39 | private $_agent = ''; |
||
| 40 | private $_browser_name = ''; |
||
| 41 | private $_version = ''; |
||
| 42 | private $_platform = ''; |
||
| 43 | private $_os = ''; |
||
| 44 | private $_is_aol = false; |
||
| 45 | private $_is_mobile = false; |
||
| 46 | private $_is_tablet = false; |
||
| 47 | private $_is_robot = false; |
||
| 48 | private $_is_facebook = false; |
||
| 49 | private $_aol_version = ''; |
||
| 50 | |||
| 51 | const BROWSER_UNKNOWN = 'unknown'; |
||
| 52 | const VERSION_UNKNOWN = 'unknown'; |
||
| 53 | |||
| 54 | const BROWSER_OPERA = 'Opera'; // http://www.opera.com/ |
||
| 55 | const BROWSER_OPERA_MINI = 'Opera Mini'; // http://www.opera.com/mini/ |
||
| 56 | const BROWSER_WEBTV = 'WebTV'; // http://www.webtv.net/pc/ |
||
| 57 | const BROWSER_IE = 'Internet Explorer'; // http://www.microsoft.com/ie/ |
||
| 58 | const BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // http://en.wikipedia.org/wiki/Internet_Explorer_Mobile |
||
| 59 | const BROWSER_KONQUEROR = 'Konqueror'; // http://www.konqueror.org/ |
||
| 60 | const BROWSER_ICAB = 'iCab'; // http://www.icab.de/ |
||
| 61 | const BROWSER_OMNIWEB = 'OmniWeb'; // http://www.omnigroup.com/applications/omniweb/ |
||
| 62 | const BROWSER_FIREBIRD = 'Firebird'; // http://www.ibphoenix.com/ |
||
| 63 | const BROWSER_FIREFOX = 'Firefox'; // http://www.mozilla.com/en-US/firefox/firefox.html |
||
| 64 | const BROWSER_ICEWEASEL = 'Iceweasel'; // http://www.geticeweasel.org/ |
||
| 65 | const BROWSER_SHIRETOKO = 'Shiretoko'; // http://wiki.mozilla.org/Projects/shiretoko |
||
| 66 | const BROWSER_MOZILLA = 'Mozilla'; // http://www.mozilla.com/en-US/ |
||
| 67 | const BROWSER_AMAYA = 'Amaya'; // http://www.w3.org/Amaya/ |
||
| 68 | const BROWSER_LYNX = 'Lynx'; // http://en.wikipedia.org/wiki/Lynx |
||
| 69 | const BROWSER_SAFARI = 'Safari'; // http://apple.com |
||
| 70 | const BROWSER_IPHONE = 'iPhone'; // http://apple.com |
||
| 71 | const BROWSER_IPOD = 'iPod'; // http://apple.com |
||
| 72 | const BROWSER_IPAD = 'iPad'; // http://apple.com |
||
| 73 | const BROWSER_CHROME = 'Chrome'; // http://www.google.com/chrome |
||
| 74 | const BROWSER_ANDROID = 'Android'; // http://www.android.com/ |
||
| 75 | const BROWSER_GOOGLEBOT = 'GoogleBot'; // http://en.wikipedia.org/wiki/Googlebot |
||
| 76 | const BROWSER_SLURP = 'Yahoo! Slurp'; // http://en.wikipedia.org/wiki/Yahoo!_Slurp |
||
| 77 | const BROWSER_W3CVALIDATOR = 'W3C Validator'; // http://validator.w3.org/ |
||
| 78 | const BROWSER_BLACKBERRY = 'BlackBerry'; // http://www.blackberry.com/ |
||
| 79 | const BROWSER_ICECAT = 'IceCat'; // http://en.wikipedia.org/wiki/GNU_IceCat |
||
| 80 | const BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // http://en.wikipedia.org/wiki/Web_Browser_for_S60 |
||
| 81 | const BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform |
||
| 82 | const BROWSER_MSN = 'MSN Browser'; // http://explorer.msn.com/ |
||
| 83 | const BROWSER_MSNBOT = 'MSN Bot'; // http://search.msn.com/msnbot.htm |
||
| 84 | const BROWSER_BINGBOT = 'Bing Bot'; // http://en.wikipedia.org/wiki/Bingbot |
||
| 85 | |||
| 86 | const BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // http://browser.netscape.com/ (DEPRECATED) |
||
| 87 | const BROWSER_GALEON = 'Galeon'; // http://galeon.sourceforge.net/ (DEPRECATED) |
||
| 88 | const BROWSER_NETPOSITIVE = 'NetPositive'; // http://en.wikipedia.org/wiki/NetPositive (DEPRECATED) |
||
| 89 | const BROWSER_PHOENIX = 'Phoenix'; // http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED) |
||
| 90 | |||
| 91 | const PLATFORM_UNKNOWN = 'unknown'; |
||
| 92 | const PLATFORM_WINDOWS = 'Windows'; |
||
| 93 | const PLATFORM_WINDOWS_CE = 'Windows CE'; |
||
| 94 | const PLATFORM_APPLE = 'Apple'; |
||
| 95 | const PLATFORM_LINUX = 'Linux'; |
||
| 96 | const PLATFORM_OS2 = 'OS/2'; |
||
| 97 | const PLATFORM_BEOS = 'BeOS'; |
||
| 98 | const PLATFORM_IPHONE = 'iPhone'; |
||
| 99 | const PLATFORM_IPOD = 'iPod'; |
||
| 100 | const PLATFORM_IPAD = 'iPad'; |
||
| 101 | const PLATFORM_BLACKBERRY = 'BlackBerry'; |
||
| 102 | const PLATFORM_NOKIA = 'Nokia'; |
||
| 103 | const PLATFORM_FREEBSD = 'FreeBSD'; |
||
| 104 | const PLATFORM_OPENBSD = 'OpenBSD'; |
||
| 105 | const PLATFORM_NETBSD = 'NetBSD'; |
||
| 106 | const PLATFORM_SUNOS = 'SunOS'; |
||
| 107 | const PLATFORM_OPENSOLARIS = 'OpenSolaris'; |
||
| 108 | const PLATFORM_ANDROID = 'Android'; |
||
| 109 | |||
| 110 | const OPERATING_SYSTEM_UNKNOWN = 'unknown'; |
||
| 111 | |||
| 112 | public function __construct($userAgent = "") |
||
| 113 | { |
||
| 114 | $this->reset(); |
||
| 115 | if ($userAgent != "") { |
||
| 116 | $this->setUserAgent($userAgent); |
||
| 117 | } else { |
||
| 118 | $this->determine(); |
||
| 119 | } |
||
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
| 123 | * Reset all properties |
||
| 124 | */ |
||
| 125 | public function reset() |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Check to see if the specific browser is valid |
||
| 142 | * @param string $browserName |
||
| 143 | * @return bool True if the browser is the specified browser |
||
| 144 | */ |
||
| 145 | function isBrowser($browserName) |
||
| 149 | |||
| 150 | /** |
||
| 151 | * The name of the browser. All return types are from the class contants |
||
| 152 | * @return string Name of the browser |
||
| 153 | */ |
||
| 154 | public function getBrowser() |
||
| 158 | |||
| 159 | /** |
||
| 160 | * Set the name of the browser |
||
| 161 | * @param $browser string The name of the Browser |
||
| 162 | */ |
||
| 163 | public function setBrowser($browser) |
||
| 167 | |||
| 168 | /** |
||
| 169 | * The name of the platform. All return types are from the class contants |
||
| 170 | * @return string Name of the browser |
||
| 171 | */ |
||
| 172 | public function getPlatform() |
||
| 176 | |||
| 177 | /** |
||
| 178 | * Set the name of the platform |
||
| 179 | * @param string $platform The name of the Platform |
||
| 180 | */ |
||
| 181 | public function setPlatform($platform) |
||
| 185 | |||
| 186 | /** |
||
| 187 | * The version of the browser. |
||
| 188 | * @return string Version of the browser (will only contain alpha-numeric characters and a period) |
||
| 189 | */ |
||
| 190 | public function getVersion() |
||
| 194 | |||
| 195 | /** |
||
| 196 | * Set the version of the browser |
||
| 197 | * @param string $version The version of the Browser |
||
| 198 | */ |
||
| 199 | public function setVersion($version) |
||
| 203 | |||
| 204 | /** |
||
| 205 | * The version of AOL. |
||
| 206 | * @return string Version of AOL (will only contain alpha-numeric characters and a period) |
||
| 207 | */ |
||
| 208 | public function getAolVersion() |
||
| 212 | |||
| 213 | /** |
||
| 214 | * Set the version of AOL |
||
| 215 | * @param string $version The version of AOL |
||
| 216 | */ |
||
| 217 | public function setAolVersion($version) |
||
| 221 | |||
| 222 | /** |
||
| 223 | * Is the browser from AOL? |
||
| 224 | * @return boolean True if the browser is from AOL otherwise false |
||
| 225 | */ |
||
| 226 | public function isAol() |
||
| 230 | |||
| 231 | /** |
||
| 232 | * Is the browser from a mobile device? |
||
| 233 | * @return boolean True if the browser is from a mobile device otherwise false |
||
| 234 | */ |
||
| 235 | public function isMobile() |
||
| 239 | |||
| 240 | /** |
||
| 241 | * Is the browser from a tablet device? |
||
| 242 | * @return boolean True if the browser is from a tablet device otherwise false |
||
| 243 | */ |
||
| 244 | public function isTablet() |
||
| 248 | |||
| 249 | /** |
||
| 250 | * Is the browser from a robot (ex Slurp,GoogleBot)? |
||
| 251 | * @return boolean True if the browser is from a robot otherwise false |
||
| 252 | */ |
||
| 253 | public function isRobot() |
||
| 257 | |||
| 258 | /** |
||
| 259 | * Is the browser from facebook? |
||
| 260 | * @return boolean True if the browser is from facebook otherwise false |
||
| 261 | */ |
||
| 262 | public function isFacebook() |
||
| 263 | { |
||
| 264 | return $this->_is_facebook; |
||
| 265 | } |
||
| 266 | |||
| 267 | /** |
||
| 268 | * Set the browser to be from AOL |
||
| 269 | * @param $isAol |
||
| 270 | */ |
||
| 271 | public function setAol($isAol) |
||
| 275 | |||
| 276 | /** |
||
| 277 | * Set the Browser to be mobile |
||
| 278 | * @param boolean $value is the browser a mobile browser or not |
||
| 279 | */ |
||
| 280 | protected function setMobile($value = true) |
||
| 284 | |||
| 285 | /** |
||
| 286 | * Set the Browser to be tablet |
||
| 287 | * @param boolean $value is the browser a tablet browser or not |
||
| 288 | */ |
||
| 289 | protected function setTablet($value = true) |
||
| 290 | { |
||
| 291 | $this->_is_tablet = $value; |
||
| 292 | } |
||
| 293 | |||
| 294 | /** |
||
| 295 | * Set the Browser to be a robot |
||
| 296 | * @param boolean $value is the browser a robot or not |
||
| 297 | */ |
||
| 298 | protected function setRobot($value = true) |
||
| 302 | |||
| 303 | /** |
||
| 304 | * Set the Browser to be a Facebook request |
||
| 305 | * @param boolean $value is the browser a robot or not |
||
| 306 | */ |
||
| 307 | protected function setFacebook($value = true) |
||
| 308 | { |
||
| 309 | $this->_is_facebook = $value; |
||
| 310 | } |
||
| 311 | |||
| 312 | /** |
||
| 313 | * Get the user agent value in use to determine the browser |
||
| 314 | * @return string The user agent from the HTTP header |
||
| 315 | */ |
||
| 316 | public function getUserAgent() |
||
| 320 | |||
| 321 | /** |
||
| 322 | * Set the user agent value (the construction will use the HTTP header value - this will overwrite it) |
||
| 323 | * @param string $agent_string The value for the User Agent |
||
| 324 | */ |
||
| 325 | public function setUserAgent($agent_string) |
||
| 331 | |||
| 332 | /** |
||
| 333 | * Used to determine if the browser is actually "chromeframe" |
||
| 334 | * @since 1.7 |
||
| 335 | * @return boolean True if the browser is using chromeframe |
||
| 336 | */ |
||
| 337 | public function isChromeFrame() |
||
| 341 | |||
| 342 | /** |
||
| 343 | * Returns a formatted string with a summary of the details of the browser. |
||
| 344 | * @return string formatted string with a summary of the browser |
||
| 345 | */ |
||
| 346 | public function __toString() |
||
| 353 | |||
| 354 | /** |
||
| 355 | * Protected routine to calculate and determine what the browser is in use (including platform) |
||
| 356 | */ |
||
| 357 | protected function determine() |
||
| 363 | |||
| 364 | /** |
||
| 365 | * Protected routine to determine the browser type |
||
| 366 | * @return boolean True if the browser was detected otherwise false |
||
| 367 | */ |
||
| 368 | protected function checkBrowsers() |
||
| 427 | |||
| 428 | /** |
||
| 429 | * Determine if the user is using a BlackBerry (last updated 1.7) |
||
| 430 | * @return boolean True if the browser is the BlackBerry browser otherwise false |
||
| 431 | */ |
||
| 432 | protected function checkBrowserBlackBerry() |
||
| 444 | |||
| 445 | /** |
||
| 446 | * Determine if the user is using an AOL User Agent (last updated 1.7) |
||
| 447 | * @return boolean True if the browser is from AOL otherwise false |
||
| 448 | */ |
||
| 449 | protected function checkForAol() |
||
| 462 | |||
| 463 | /** |
||
| 464 | * Determine if the browser is the GoogleBot or not (last updated 1.7) |
||
| 465 | * @return boolean True if the browser is the GoogletBot otherwise false |
||
| 466 | */ |
||
| 467 | protected function checkBrowserGoogleBot() |
||
| 479 | |||
| 480 | /** |
||
| 481 | * Determine if the browser is the MSNBot or not (last updated 1.9) |
||
| 482 | * @return boolean True if the browser is the MSNBot otherwise false |
||
| 483 | */ |
||
| 484 | protected function checkBrowserMSNBot() |
||
| 496 | |||
| 497 | /** |
||
| 498 | * Determine if the browser is the BingBot or not (last updated 1.9) |
||
| 499 | * @return boolean True if the browser is the BingBot otherwise false |
||
| 500 | */ |
||
| 501 | protected function checkBrowserBingBot() |
||
| 513 | |||
| 514 | /** |
||
| 515 | * Determine if the browser is the W3C Validator or not (last updated 1.7) |
||
| 516 | * @return boolean True if the browser is the W3C Validator otherwise false |
||
| 517 | */ |
||
| 518 | protected function checkBrowserW3CValidator() |
||
| 541 | |||
| 542 | /** |
||
| 543 | * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7) |
||
| 544 | * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false |
||
| 545 | */ |
||
| 546 | protected function checkBrowserSlurp() |
||
| 559 | |||
| 560 | /** |
||
| 561 | * Determine if the browser is Internet Explorer or not (last updated 1.7) |
||
| 562 | * @return boolean True if the browser is Internet Explorer otherwise false |
||
| 563 | */ |
||
| 564 | protected function checkBrowserInternetExplorer() |
||
| 616 | |||
| 617 | /** |
||
| 618 | * Determine if the browser is Opera or not (last updated 1.7) |
||
| 619 | * @return boolean True if the browser is Opera otherwise false |
||
| 620 | */ |
||
| 621 | protected function checkBrowserOpera() |
||
| 668 | |||
| 669 | /** |
||
| 670 | * Determine if the browser is Chrome or not (last updated 1.7) |
||
| 671 | * @return boolean True if the browser is Chrome otherwise false |
||
| 672 | */ |
||
| 673 | protected function checkBrowserChrome() |
||
| 692 | |||
| 693 | |||
| 694 | /** |
||
| 695 | * Determine if the browser is WebTv or not (last updated 1.7) |
||
| 696 | * @return boolean True if the browser is WebTv otherwise false |
||
| 697 | */ |
||
| 698 | View Code Duplication | protected function checkBrowserWebTv() |
|
| 709 | |||
| 710 | /** |
||
| 711 | * Determine if the browser is NetPositive or not (last updated 1.7) |
||
| 712 | * @return boolean True if the browser is NetPositive otherwise false |
||
| 713 | */ |
||
| 714 | protected function checkBrowserNetPositive() |
||
| 725 | |||
| 726 | /** |
||
| 727 | * Determine if the browser is Galeon or not (last updated 1.7) |
||
| 728 | * @return boolean True if the browser is Galeon otherwise false |
||
| 729 | */ |
||
| 730 | View Code Duplication | protected function checkBrowserGaleon() |
|
| 741 | |||
| 742 | /** |
||
| 743 | * Determine if the browser is Konqueror or not (last updated 1.7) |
||
| 744 | * @return boolean True if the browser is Konqueror otherwise false |
||
| 745 | */ |
||
| 746 | View Code Duplication | protected function checkBrowserKonqueror() |
|
| 757 | |||
| 758 | /** |
||
| 759 | * Determine if the browser is iCab or not (last updated 1.7) |
||
| 760 | * @return boolean True if the browser is iCab otherwise false |
||
| 761 | */ |
||
| 762 | protected function checkBrowserIcab() |
||
| 772 | |||
| 773 | /** |
||
| 774 | * Determine if the browser is OmniWeb or not (last updated 1.7) |
||
| 775 | * @return boolean True if the browser is OmniWeb otherwise false |
||
| 776 | */ |
||
| 777 | View Code Duplication | protected function checkBrowserOmniWeb() |
|
| 788 | |||
| 789 | /** |
||
| 790 | * Determine if the browser is Phoenix or not (last updated 1.7) |
||
| 791 | * @return boolean True if the browser is Phoenix otherwise false |
||
| 792 | */ |
||
| 793 | View Code Duplication | protected function checkBrowserPhoenix() |
|
| 803 | |||
| 804 | /** |
||
| 805 | * Determine if the browser is Firebird or not (last updated 1.7) |
||
| 806 | * @return boolean True if the browser is Firebird otherwise false |
||
| 807 | */ |
||
| 808 | View Code Duplication | protected function checkBrowserFirebird() |
|
| 818 | |||
| 819 | /** |
||
| 820 | * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) |
||
| 821 | * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008) |
||
| 822 | * @return boolean True if the browser is Netscape Navigator 9+ otherwise false |
||
| 823 | */ |
||
| 824 | protected function checkBrowserNetscapeNavigator9Plus() |
||
| 837 | |||
| 838 | /** |
||
| 839 | * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7) |
||
| 840 | * @return boolean True if the browser is Shiretoko otherwise false |
||
| 841 | */ |
||
| 842 | View Code Duplication | protected function checkBrowserShiretoko() |
|
| 851 | |||
| 852 | /** |
||
| 853 | * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7) |
||
| 854 | * @return boolean True if the browser is Ice Cat otherwise false |
||
| 855 | */ |
||
| 856 | View Code Duplication | protected function checkBrowserIceCat() |
|
| 865 | |||
| 866 | /** |
||
| 867 | * Determine if the browser is Nokia or not (last updated 1.7) |
||
| 868 | * @return boolean True if the browser is Nokia otherwise false |
||
| 869 | */ |
||
| 870 | protected function checkBrowserNokia() |
||
| 884 | |||
| 885 | /** |
||
| 886 | * Determine if the browser is Firefox or not (last updated 1.7) |
||
| 887 | * @return boolean True if the browser is Firefox otherwise false |
||
| 888 | */ |
||
| 889 | protected function checkBrowserFirefox() |
||
| 912 | |||
| 913 | /** |
||
| 914 | * Determine if the browser is Firefox or not (last updated 1.7) |
||
| 915 | * @return boolean True if the browser is Firefox otherwise false |
||
| 916 | */ |
||
| 917 | View Code Duplication | protected function checkBrowserIceweasel() |
|
| 928 | |||
| 929 | /** |
||
| 930 | * Determine if the browser is Mozilla or not (last updated 1.7) |
||
| 931 | * @return boolean True if the browser is Mozilla otherwise false |
||
| 932 | */ |
||
| 933 | protected function checkBrowserMozilla() |
||
| 953 | |||
| 954 | /** |
||
| 955 | * Determine if the browser is Lynx or not (last updated 1.7) |
||
| 956 | * @return boolean True if the browser is Lynx otherwise false |
||
| 957 | */ |
||
| 958 | View Code Duplication | protected function checkBrowserLynx() |
|
| 969 | |||
| 970 | /** |
||
| 971 | * Determine if the browser is Amaya or not (last updated 1.7) |
||
| 972 | * @return boolean True if the browser is Amaya otherwise false |
||
| 973 | */ |
||
| 974 | View Code Duplication | protected function checkBrowserAmaya() |
|
| 985 | |||
| 986 | /** |
||
| 987 | * Determine if the browser is Safari or not (last updated 1.7) |
||
| 988 | * @return boolean True if the browser is Safari otherwise false |
||
| 989 | */ |
||
| 990 | protected function checkBrowserSafari() |
||
| 1008 | |||
| 1009 | /** |
||
| 1010 | * Detect if URL is loaded from FacebookExternalHit |
||
| 1011 | * @return boolean True if it detects FacebookExternalHit otherwise false |
||
| 1012 | */ |
||
| 1013 | protected function checkFacebookExternalHit() |
||
| 1023 | |||
| 1024 | /** |
||
| 1025 | * Detect if URL is being loaded from internal Facebook browser |
||
| 1026 | * @return boolean True if it detects internal Facebook browser otherwise false |
||
| 1027 | */ |
||
| 1028 | protected function checkForFacebookIos() |
||
| 1037 | |||
| 1038 | /** |
||
| 1039 | * Detect Version for the Safari browser on iOS devices |
||
| 1040 | * @return boolean True if it detects the version correctly otherwise false |
||
| 1041 | */ |
||
| 1042 | View Code Duplication | protected function getSafariVersionOnIos() |
|
| 1043 | { |
||
| 1044 | $aresult = explode('/',stristr($this->_agent,'Version')); |
||
| 1045 | if( isset($aresult[1]) ) |
||
| 1046 | { |
||
| 1047 | $aversion = explode(' ',$aresult[1]); |
||
| 1048 | $this->setVersion($aversion[0]); |
||
| 1049 | return true; |
||
| 1050 | } |
||
| 1051 | return false; |
||
| 1052 | } |
||
| 1053 | |||
| 1054 | /** |
||
| 1055 | * Detect Version for the Chrome browser on iOS devices |
||
| 1056 | * @return boolean True if it detects the version correctly otherwise false |
||
| 1057 | */ |
||
| 1058 | View Code Duplication | protected function getChromeVersionOnIos() |
|
| 1059 | { |
||
| 1060 | $aresult = explode('/',stristr($this->_agent,'CriOS')); |
||
| 1061 | if( isset($aresult[1]) ) |
||
| 1062 | { |
||
| 1063 | $aversion = explode(' ',$aresult[1]); |
||
| 1064 | $this->setVersion($aversion[0]); |
||
| 1065 | $this->setBrowser(self::BROWSER_CHROME); |
||
| 1066 | return true; |
||
| 1067 | } |
||
| 1068 | return false; |
||
| 1069 | } |
||
| 1070 | |||
| 1071 | /** |
||
| 1072 | * Determine if the browser is iPhone or not (last updated 1.7) |
||
| 1073 | * @return boolean True if the browser is iPhone otherwise false |
||
| 1074 | */ |
||
| 1075 | View Code Duplication | protected function checkBrowseriPhone() { |
|
| 1087 | |||
| 1088 | /** |
||
| 1089 | * Determine if the browser is iPad or not (last updated 1.7) |
||
| 1090 | * @return boolean True if the browser is iPad otherwise false |
||
| 1091 | */ |
||
| 1092 | View Code Duplication | protected function checkBrowseriPad() { |
|
| 1104 | |||
| 1105 | /** |
||
| 1106 | * Determine if the browser is iPod or not (last updated 1.7) |
||
| 1107 | * @return boolean True if the browser is iPod otherwise false |
||
| 1108 | */ |
||
| 1109 | View Code Duplication | protected function checkBrowseriPod() { |
|
| 1121 | |||
| 1122 | /** |
||
| 1123 | * Determine if the browser is Android or not (last updated 1.7) |
||
| 1124 | * @return boolean True if the browser is Android otherwise false |
||
| 1125 | */ |
||
| 1126 | protected function checkBrowserAndroid() |
||
| 1146 | |||
| 1147 | /** |
||
| 1148 | * Determine the user's platform (last updated 1.7) |
||
| 1149 | */ |
||
| 1150 | protected function checkPlatform() |
||
| 1151 | { |
||
| 1222 | } |
||
| 1223 | |||
| 1225 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.