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 ServerXmlConfiguration 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 ServerXmlConfiguration, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 35 | class ServerXmlConfiguration implements ServerConfigurationInterface |
||
| 36 | { |
||
| 37 | |||
| 38 | /** |
||
| 39 | * The configured rewrite rules |
||
| 40 | * |
||
| 41 | * @var array |
||
| 42 | */ |
||
| 43 | protected $rewrites = array(); |
||
| 44 | |||
| 45 | /** |
||
| 46 | * The configured locations. |
||
| 47 | * |
||
| 48 | * @var array |
||
| 49 | */ |
||
| 50 | protected $locations = array(); |
||
| 51 | |||
| 52 | /** |
||
| 53 | * The configured headers |
||
| 54 | * |
||
| 55 | * @var array |
||
| 56 | */ |
||
| 57 | protected $headers = array(); |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Holds the environmentVariables array |
||
| 61 | * |
||
| 62 | * @var array |
||
| 63 | */ |
||
| 64 | protected $environmentVariables = array(); |
||
| 65 | |||
| 66 | /** |
||
| 67 | * The server name for internal purposes. |
||
| 68 | * |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | protected $name = 'httpsServer'; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * The server class name. |
||
| 75 | * |
||
| 76 | * @var string |
||
| 77 | */ |
||
| 78 | protected $type = '\\AppserverIo\\Server\\Servers\\MultiThreadedServer'; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * The worker class name. |
||
| 82 | * |
||
| 83 | * @var string |
||
| 84 | */ |
||
| 85 | protected $workerType = '\\AppserverIo\\Server\\Workers\\ThreadWorker'; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * The socket class name. |
||
| 89 | * |
||
| 90 | * @var string |
||
| 91 | */ |
||
| 92 | protected $socketType = '\\AppserverIo\\Server\\Sockets\\StreamSocket'; |
||
| 93 | |||
| 94 | /** |
||
| 95 | * The stream context class name. |
||
| 96 | * |
||
| 97 | * @var string |
||
| 98 | */ |
||
| 99 | protected $streamContextType = '\\AppserverIo\\Server\\Contexts\\StreamContext'; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * The server context class name. |
||
| 103 | * |
||
| 104 | * @var string |
||
| 105 | */ |
||
| 106 | protected $serverContextType = '\\AppserverIo\\Server\\Contexts\\ServerContext'; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * The request context class name. |
||
| 110 | * |
||
| 111 | * @var string |
||
| 112 | */ |
||
| 113 | protected $requestContextType = '\\AppserverIo\\Server\\Contexts\\RequestContext'; |
||
| 114 | |||
| 115 | /** |
||
| 116 | * The logger name for internal purposes. |
||
| 117 | * |
||
| 118 | * @var string |
||
| 119 | */ |
||
| 120 | protected $loggerName = 'System'; |
||
| 121 | |||
| 122 | /** |
||
| 123 | * The server admin's email addres. |
||
| 124 | * |
||
| 125 | * @var string |
||
| 126 | */ |
||
| 127 | protected $admin = '[email protected]'; |
||
| 128 | |||
| 129 | /** |
||
| 130 | * The server software name. |
||
| 131 | * |
||
| 132 | * @var string |
||
| 133 | */ |
||
| 134 | protected $software = 'phpWebServer/7.0.0'; |
||
| 135 | |||
| 136 | /** |
||
| 137 | * The number of workers to start. |
||
| 138 | * |
||
| 139 | * @var integer |
||
| 140 | */ |
||
| 141 | protected $workerNumber = 64; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * The minimum number of requests a worker handles. |
||
| 145 | * |
||
| 146 | * @var integer |
||
| 147 | */ |
||
| 148 | protected $workerAcceptMin = 16; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * The maximum number of requests a worker handles. |
||
| 152 | * |
||
| 153 | * @var integer |
||
| 154 | */ |
||
| 155 | protected $workerAcceptMax = 64; |
||
| 156 | |||
| 157 | /** |
||
| 158 | * The transport protocol to use. |
||
| 159 | * |
||
| 160 | * @var string |
||
| 161 | */ |
||
| 162 | protected $transport = 'tcp'; |
||
| 163 | |||
| 164 | /** |
||
| 165 | * The IP address to use. |
||
| 166 | * |
||
| 167 | * @var string |
||
| 168 | */ |
||
| 169 | protected $address = '0.0.0.0'; |
||
| 170 | |||
| 171 | /** |
||
| 172 | * The port to use. |
||
| 173 | * |
||
| 174 | * @var string |
||
| 175 | */ |
||
| 176 | protected $port = 9080; |
||
| 177 | |||
| 178 | /** |
||
| 179 | * Socket flags used for socket initialization. |
||
| 180 | * |
||
| 181 | * @var string |
||
| 182 | */ |
||
| 183 | protected $flags = null; |
||
| 184 | |||
| 185 | /** |
||
| 186 | * The server's document root. |
||
| 187 | * |
||
| 188 | * @var string |
||
| 189 | */ |
||
| 190 | protected $documentRoot = 'var/www'; |
||
| 191 | |||
| 192 | /** |
||
| 193 | * Directory index files to be used. |
||
| 194 | * |
||
| 195 | * @var string |
||
| 196 | */ |
||
| 197 | protected $directoryIndex = 'index.php index.html index.htm'; |
||
| 198 | |||
| 199 | /** |
||
| 200 | * The maximum requests to be handled for a keep alive connection. |
||
| 201 | * |
||
| 202 | * @var integer |
||
| 203 | */ |
||
| 204 | protected $keepAliveMax = 64; |
||
| 205 | |||
| 206 | /** |
||
| 207 | * The timeout for the keep alive connection. |
||
| 208 | * |
||
| 209 | * @var integer |
||
| 210 | */ |
||
| 211 | protected $keepAliveTimeout = 5; |
||
| 212 | |||
| 213 | /** |
||
| 214 | * Flag to enable/disable auto index functionality. |
||
| 215 | * |
||
| 216 | * @var boolean |
||
| 217 | */ |
||
| 218 | protected $autoIndex = false; |
||
| 219 | |||
| 220 | /** |
||
| 221 | * The path to the error page template. |
||
| 222 | * |
||
| 223 | * @var string |
||
| 224 | */ |
||
| 225 | protected $errorsPageTemplatePath = 'resources/templates/www/error.phtml'; |
||
| 226 | |||
| 227 | /** |
||
| 228 | * The path to the welcome page template. |
||
| 229 | * |
||
| 230 | * @var string |
||
| 231 | */ |
||
| 232 | protected $welcomePageTemplatePath = 'resources/templates/www/welcome.phtml'; |
||
| 233 | |||
| 234 | /** |
||
| 235 | * The path to the auto index template. |
||
| 236 | * |
||
| 237 | * @var string |
||
| 238 | */ |
||
| 239 | protected $autoIndexTemplatePath = 'resources/templates/www/auto_index.phtml'; |
||
| 240 | |||
| 241 | /** |
||
| 242 | * The path to the SSL certificate. |
||
| 243 | * |
||
| 244 | * @var string |
||
| 245 | */ |
||
| 246 | protected $certPath = 'etc/webserver.pem'; |
||
| 247 | |||
| 248 | /** |
||
| 249 | * The path to the SSL certificate's private key file. |
||
| 250 | * |
||
| 251 | * @var string |
||
| 252 | */ |
||
| 253 | protected $privateKeyPath = null; |
||
| 254 | |||
| 255 | /** |
||
| 256 | * The path to the Diffie Hellmann param file. |
||
| 257 | * |
||
| 258 | * @var string |
||
| 259 | */ |
||
| 260 | protected $dhParamPath = null; |
||
| 261 | |||
| 262 | /** |
||
| 263 | * The SSL certificate's passphrase. |
||
| 264 | * |
||
| 265 | * @var string |
||
| 266 | */ |
||
| 267 | protected $passphrase = null; |
||
| 268 | |||
| 269 | /** |
||
| 270 | * The crypto method(s) to use. |
||
| 271 | * |
||
| 272 | * @var string |
||
| 273 | */ |
||
| 274 | protected $cryptoMethod = 'STREAM_CRYPTO_METHOD_TLS_SERVER'; |
||
| 275 | |||
| 276 | /** |
||
| 277 | * The peer name. |
||
| 278 | * |
||
| 279 | * @var string |
||
| 280 | */ |
||
| 281 | protected $peerName = null; |
||
| 282 | |||
| 283 | /** |
||
| 284 | * Flag to enable/disable peer verification. |
||
| 285 | * |
||
| 286 | * @var boolean |
||
| 287 | */ |
||
| 288 | protected $verifyPeer = false; |
||
| 289 | |||
| 290 | /** |
||
| 291 | * The flag to enable/disable peer name verification. |
||
| 292 | * |
||
| 293 | * @var boolean |
||
| 294 | */ |
||
| 295 | protected $verifyPeerName = false; |
||
| 296 | |||
| 297 | /** |
||
| 298 | * Flag to allow/disallow self signed SSL certificates. |
||
| 299 | * |
||
| 300 | * @var boolean |
||
| 301 | */ |
||
| 302 | protected $allowSelfSigned = true; |
||
| 303 | |||
| 304 | /** |
||
| 305 | * The flag to disable TLS compression. This can help mitigate the CRIME attack vector. |
||
| 306 | * |
||
| 307 | * @var boolean |
||
| 308 | */ |
||
| 309 | protected $disableCompression = true; |
||
| 310 | |||
| 311 | /** |
||
| 312 | * The flag to control cipher ordering preferences during negotiation has to be allowed. |
||
| 313 | * |
||
| 314 | * @var boolean |
||
| 315 | */ |
||
| 316 | protected $honorCipherOrder = true; |
||
| 317 | |||
| 318 | /** |
||
| 319 | * The curve to use with ECDH ciphers, if not specified prime256v1 will be used. |
||
| 320 | * |
||
| 321 | * @var string |
||
| 322 | */ |
||
| 323 | protected $ecdhCurve = 'prime256v1'; |
||
| 324 | |||
| 325 | /** |
||
| 326 | * The flag to enable/disable new key pair has to be created in scenarios where ECDH cipher suites are negotiated (instead of the preferred ECDHE ciphers). |
||
| 327 | * @var boolean |
||
| 328 | */ |
||
| 329 | protected $singleEcdhUse = true; |
||
| 330 | |||
| 331 | /** |
||
| 332 | * The flag to enable/disable new key pair creation when using DH parameters (improves forward secrecy). |
||
| 333 | * |
||
| 334 | * @var boolean |
||
| 335 | */ |
||
| 336 | protected $singleDhUse = true; |
||
| 337 | |||
| 338 | /** |
||
| 339 | * The list of available ciphers. |
||
| 340 | * |
||
| 341 | * @var string |
||
| 342 | * @link http://php.net/manual/en/context.ssl.php#context.ssl.ciphers |
||
| 343 | * @link https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER_LIST_FORMAT |
||
| 344 | */ |
||
| 345 | protected $ciphers = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK'; |
||
| 346 | |||
| 347 | /** |
||
| 348 | * Constructs config |
||
| 349 | * |
||
| 350 | * @param \SimpleXMLElement $node The simple xml element used to build config |
||
| 351 | */ |
||
| 352 | public function __construct($node) |
||
| 402 | |||
| 403 | /** |
||
| 404 | * Prepares the headers array based on a simple xml element node |
||
| 405 | * |
||
| 406 | * @param \SimpleXMLElement $node The xml node |
||
| 407 | * |
||
| 408 | * @return array |
||
| 409 | */ |
||
| 410 | public function prepareHeaders(\SimpleXMLElement $node) |
||
| 439 | |||
| 440 | /** |
||
| 441 | * Prepares the modules array based on a simple xml element node |
||
| 442 | * |
||
| 443 | * @param \SimpleXMLElement $node The xml node |
||
| 444 | * |
||
| 445 | * @return array |
||
| 446 | */ |
||
| 447 | public function prepareModules(\SimpleXMLElement $node) |
||
| 457 | |||
| 458 | /** |
||
| 459 | * Prepares the connectionHandlers array based on a simple xml element node |
||
| 460 | * |
||
| 461 | * @param \SimpleXMLElement $node The xml node |
||
| 462 | * |
||
| 463 | * @return array |
||
| 464 | */ |
||
| 465 | public function prepareConnectionHandlers(\SimpleXMLElement $node) |
||
| 476 | |||
| 477 | /** |
||
| 478 | * Prepares the handlers array based on a simple xml element node |
||
| 479 | * |
||
| 480 | * @param \SimpleXMLElement $node The xml node |
||
| 481 | * |
||
| 482 | * @return array |
||
| 483 | */ |
||
| 484 | public function prepareHandlers(\SimpleXMLElement $node) |
||
| 505 | |||
| 506 | /** |
||
| 507 | * Prepares the virtual hosts array based on a simple xml element node |
||
| 508 | * |
||
| 509 | * @param \SimpleXMLElement $node The xml node |
||
| 510 | * |
||
| 511 | * @return array |
||
| 512 | */ |
||
| 513 | public function prepareVirtualHosts(\SimpleXMLElement $node) |
||
| 543 | |||
| 544 | /** |
||
| 545 | * Prepares the rewrite maps based on a simple xml element node |
||
| 546 | * |
||
| 547 | * @param \SimpleXMLElement $node The xml node |
||
| 548 | * |
||
| 549 | * @return array |
||
| 550 | */ |
||
| 551 | View Code Duplication | public function prepareRewriteMaps(\SimpleXMLElement $node) |
|
| 568 | |||
| 569 | /** |
||
| 570 | * Prepares the rewrites array based on a simple xml element node |
||
| 571 | * |
||
| 572 | * @param \SimpleXMLElement $node The xml node |
||
| 573 | * |
||
| 574 | * @return array |
||
| 575 | */ |
||
| 576 | public function prepareRewrites(\SimpleXMLElement $node) |
||
| 588 | |||
| 589 | /** |
||
| 590 | * Prepares the certificates array based on a simple xml element node |
||
| 591 | * |
||
| 592 | * @param \SimpleXMLElement $node The xml node |
||
| 593 | * |
||
| 594 | * @return array |
||
| 595 | */ |
||
| 596 | public function prepareCertificates(\SimpleXMLElement $node) |
||
| 611 | |||
| 612 | /** |
||
| 613 | * Prepares the locations array based on a simple xml element node |
||
| 614 | * |
||
| 615 | * @param \SimpleXMLElement $node The xml node |
||
| 616 | * |
||
| 617 | * @return array |
||
| 618 | */ |
||
| 619 | public function prepareLocations(\SimpleXMLElement $node) |
||
| 635 | |||
| 636 | /** |
||
| 637 | * Prepares the environmentVariables array based on a simple xml element node |
||
| 638 | * |
||
| 639 | * @param \SimpleXMLElement $node The xml node |
||
| 640 | * |
||
| 641 | * @return array |
||
| 642 | */ |
||
| 643 | public function prepareEnvironmentVariables(\SimpleXMLElement $node) |
||
| 655 | |||
| 656 | /** |
||
| 657 | * Prepares the authentications array based on a simple xml element node |
||
| 658 | * |
||
| 659 | * @param \SimpleXMLElement $node The xml node |
||
| 660 | * |
||
| 661 | * @return array |
||
| 662 | */ |
||
| 663 | View Code Duplication | public function prepareAuthentications(\SimpleXMLElement $node) |
|
| 679 | |||
| 680 | /** |
||
| 681 | * Prepares the access array based on a simple xml element node |
||
| 682 | * |
||
| 683 | * @param \SimpleXMLElement $node The xml node |
||
| 684 | * |
||
| 685 | * @return array |
||
| 686 | */ |
||
| 687 | View Code Duplication | public function prepareAccesses(\SimpleXMLElement $node) |
|
| 704 | |||
| 705 | /** |
||
| 706 | * Prepares the analytics array based on a simple XML element node |
||
| 707 | * |
||
| 708 | * @param \SimpleXMLElement $node The XML node |
||
| 709 | * |
||
| 710 | * @return array |
||
| 711 | */ |
||
| 712 | public function prepareAnalytics(\SimpleXMLElement $node) |
||
| 746 | |||
| 747 | /** |
||
| 748 | * Return's name |
||
| 749 | * |
||
| 750 | * @return string |
||
| 751 | */ |
||
| 752 | public function getName() |
||
| 756 | |||
| 757 | /** |
||
| 758 | * Return's type |
||
| 759 | * |
||
| 760 | * @return string |
||
| 761 | */ |
||
| 762 | public function getType() |
||
| 766 | |||
| 767 | /** |
||
| 768 | * Return's logger name |
||
| 769 | * |
||
| 770 | * @return string |
||
| 771 | */ |
||
| 772 | public function getLoggerName() |
||
| 776 | |||
| 777 | /** |
||
| 778 | * Return's transport |
||
| 779 | * |
||
| 780 | * @return string |
||
| 781 | */ |
||
| 782 | public function getTransport() |
||
| 786 | |||
| 787 | /** |
||
| 788 | * Returns rewrites |
||
| 789 | * |
||
| 790 | * @return array |
||
| 791 | */ |
||
| 792 | public function getRewrites() |
||
| 796 | |||
| 797 | /** |
||
| 798 | * Return's address |
||
| 799 | * |
||
| 800 | * @return string |
||
| 801 | */ |
||
| 802 | public function getAddress() |
||
| 806 | |||
| 807 | /** |
||
| 808 | * Return's port |
||
| 809 | * |
||
| 810 | * @return int |
||
| 811 | */ |
||
| 812 | public function getPort() |
||
| 816 | |||
| 817 | /** |
||
| 818 | * Return's flags |
||
| 819 | * |
||
| 820 | * @return string |
||
| 821 | */ |
||
| 822 | public function getFlags() |
||
| 826 | |||
| 827 | /** |
||
| 828 | * Return's software |
||
| 829 | * |
||
| 830 | * @return string |
||
| 831 | */ |
||
| 832 | public function getSoftware() |
||
| 836 | |||
| 837 | /** |
||
| 838 | * Return's admin |
||
| 839 | * |
||
| 840 | * @return string |
||
| 841 | */ |
||
| 842 | public function getAdmin() |
||
| 846 | |||
| 847 | /** |
||
| 848 | * Return's analytics |
||
| 849 | * |
||
| 850 | * @return string |
||
| 851 | */ |
||
| 852 | public function getAnalytics() |
||
| 856 | |||
| 857 | /** |
||
| 858 | * Return's keep-alive max connection |
||
| 859 | * |
||
| 860 | * @return int |
||
| 861 | */ |
||
| 862 | public function getKeepAliveMax() |
||
| 866 | |||
| 867 | /** |
||
| 868 | * Return's keep-alive timeout |
||
| 869 | * |
||
| 870 | * @return int |
||
| 871 | */ |
||
| 872 | public function getKeepAliveTimeout() |
||
| 876 | |||
| 877 | /** |
||
| 878 | * Return's template path for errors page |
||
| 879 | * |
||
| 880 | * @return string |
||
| 881 | */ |
||
| 882 | public function getErrorsPageTemplatePath() |
||
| 886 | |||
| 887 | /** |
||
| 888 | * Returns template path for possible configured welcome page |
||
| 889 | * |
||
| 890 | * @return string |
||
| 891 | */ |
||
| 892 | public function getWelcomePageTemplatePath() |
||
| 896 | |||
| 897 | /** |
||
| 898 | * Returns template path for possible configured auto index page |
||
| 899 | * |
||
| 900 | * @return string |
||
| 901 | */ |
||
| 902 | public function getAutoIndexTemplatePath() |
||
| 906 | |||
| 907 | /** |
||
| 908 | * Return's worker number |
||
| 909 | * |
||
| 910 | * @return int |
||
| 911 | */ |
||
| 912 | public function getWorkerNumber() |
||
| 916 | |||
| 917 | /** |
||
| 918 | * Return's worker's accept min count |
||
| 919 | * |
||
| 920 | * @return int |
||
| 921 | */ |
||
| 922 | public function getWorkerAcceptMin() |
||
| 926 | |||
| 927 | /** |
||
| 928 | * Return's worker's accept max count |
||
| 929 | * |
||
| 930 | * @return int |
||
| 931 | */ |
||
| 932 | public function getWorkerAcceptMax() |
||
| 936 | |||
| 937 | /** |
||
| 938 | * Return's the auto index configuration |
||
| 939 | * |
||
| 940 | * @return boolean |
||
| 941 | */ |
||
| 942 | public function getAutoIndex() |
||
| 946 | |||
| 947 | /** |
||
| 948 | * Return's server context type |
||
| 949 | * |
||
| 950 | * @return string |
||
| 951 | */ |
||
| 952 | public function getServerContextType() |
||
| 956 | |||
| 957 | /** |
||
| 958 | * Returns stream context type |
||
| 959 | * |
||
| 960 | * @return string |
||
| 961 | */ |
||
| 962 | public function getStreamContextType() |
||
| 966 | |||
| 967 | /** |
||
| 968 | * Return's server context type |
||
| 969 | * |
||
| 970 | * @return string |
||
| 971 | */ |
||
| 972 | public function getRequestContextType() |
||
| 976 | |||
| 977 | /** |
||
| 978 | * Return's socket type |
||
| 979 | * |
||
| 980 | * @return string |
||
| 981 | */ |
||
| 982 | public function getSocketType() |
||
| 986 | |||
| 987 | /** |
||
| 988 | * Return's worker type |
||
| 989 | * |
||
| 990 | * @return string |
||
| 991 | */ |
||
| 992 | public function getWorkerType() |
||
| 996 | |||
| 997 | /** |
||
| 998 | * Return's document root |
||
| 999 | * |
||
| 1000 | * @return string |
||
| 1001 | */ |
||
| 1002 | public function getDocumentRoot() |
||
| 1006 | |||
| 1007 | /** |
||
| 1008 | * Return's directory index definition |
||
| 1009 | * |
||
| 1010 | * @return string |
||
| 1011 | */ |
||
| 1012 | public function getDirectoryIndex() |
||
| 1016 | |||
| 1017 | /** |
||
| 1018 | * Return's the connection handlers |
||
| 1019 | * |
||
| 1020 | * @return array |
||
| 1021 | */ |
||
| 1022 | public function getConnectionHandlers() |
||
| 1026 | |||
| 1027 | /** |
||
| 1028 | * Returns the headers used by the server |
||
| 1029 | * |
||
| 1030 | * @return array |
||
| 1031 | */ |
||
| 1032 | public function getHeaders() |
||
| 1036 | |||
| 1037 | /** |
||
| 1038 | * Returns the certificates used by the server |
||
| 1039 | * |
||
| 1040 | * @return array |
||
| 1041 | */ |
||
| 1042 | public function getCertificates() |
||
| 1046 | |||
| 1047 | /** |
||
| 1048 | * Return's the virtual hosts |
||
| 1049 | * |
||
| 1050 | * @return array |
||
| 1051 | */ |
||
| 1052 | public function getVirtualHosts() |
||
| 1056 | |||
| 1057 | /** |
||
| 1058 | * Return's the authentication information's |
||
| 1059 | * |
||
| 1060 | * @return array |
||
| 1061 | */ |
||
| 1062 | public function getAuthentications() |
||
| 1066 | |||
| 1067 | /** |
||
| 1068 | * Return's modules |
||
| 1069 | * |
||
| 1070 | * @return array |
||
| 1071 | */ |
||
| 1072 | public function getModules() |
||
| 1076 | |||
| 1077 | /** |
||
| 1078 | * Return's array |
||
| 1079 | * |
||
| 1080 | * @return array |
||
| 1081 | */ |
||
| 1082 | public function getHandlers() |
||
| 1086 | |||
| 1087 | /** |
||
| 1088 | * Return's cert path |
||
| 1089 | * |
||
| 1090 | * @return string |
||
| 1091 | */ |
||
| 1092 | public function getCertPath() |
||
| 1096 | |||
| 1097 | /** |
||
| 1098 | * Return's passphrase |
||
| 1099 | * |
||
| 1100 | * @return string |
||
| 1101 | */ |
||
| 1102 | public function getPassphrase() |
||
| 1106 | |||
| 1107 | /** |
||
| 1108 | * Returns the environment variable configuration |
||
| 1109 | * |
||
| 1110 | * @return array |
||
| 1111 | */ |
||
| 1112 | public function getEnvironmentVariables() |
||
| 1116 | |||
| 1117 | /** |
||
| 1118 | * Returns the access configuration. |
||
| 1119 | * |
||
| 1120 | * @return array |
||
| 1121 | */ |
||
| 1122 | public function getAccesses() |
||
| 1126 | |||
| 1127 | /** |
||
| 1128 | * Returns the locations. |
||
| 1129 | * |
||
| 1130 | * @return array |
||
| 1131 | */ |
||
| 1132 | public function getLocations() |
||
| 1136 | |||
| 1137 | /** |
||
| 1138 | * Returns the rewrite maps. |
||
| 1139 | * |
||
| 1140 | * @return array |
||
| 1141 | */ |
||
| 1142 | public function getRewriteMaps() |
||
| 1146 | |||
| 1147 | /** |
||
| 1148 | * Return's DH param path |
||
| 1149 | * |
||
| 1150 | * @return string |
||
| 1151 | */ |
||
| 1152 | public function getDhParamPath() |
||
| 1156 | |||
| 1157 | /** |
||
| 1158 | * Return's private key path |
||
| 1159 | * |
||
| 1160 | * @return string |
||
| 1161 | */ |
||
| 1162 | public function getPrivateKeyPath() |
||
| 1166 | |||
| 1167 | /** |
||
| 1168 | * Return's the crypto method to use |
||
| 1169 | * |
||
| 1170 | * @return string |
||
| 1171 | */ |
||
| 1172 | public function getCryptoMethod() |
||
| 1176 | |||
| 1177 | /** |
||
| 1178 | * Return's the peer name to be used, if this value is not set, then the name is guessed based on the hostname used when opening the stream |
||
| 1179 | * |
||
| 1180 | * @return string |
||
| 1181 | */ |
||
| 1182 | public function getPeerName() |
||
| 1186 | |||
| 1187 | /** |
||
| 1188 | * Return's TRUE it the verification of use SSL certificate has to be required |
||
| 1189 | * |
||
| 1190 | * @return boolean |
||
| 1191 | */ |
||
| 1192 | public function getVerifyPeer() |
||
| 1196 | |||
| 1197 | /** |
||
| 1198 | * Return's TRUE it the peer name has to be verified |
||
| 1199 | * |
||
| 1200 | * @return boolean |
||
| 1201 | */ |
||
| 1202 | public function getVerifyPeerName() |
||
| 1206 | |||
| 1207 | /** |
||
| 1208 | * Return's TRUE to disable TLS compression. This can help mitigate the CRIME attack vector |
||
| 1209 | * |
||
| 1210 | * @return boolean |
||
| 1211 | */ |
||
| 1212 | public function getDisableCompression() |
||
| 1216 | |||
| 1217 | /** |
||
| 1218 | * Return's TRUE if self-signed certificates has to be allowed, but requires verify_peer to be FALSE |
||
| 1219 | * |
||
| 1220 | * @return boolean |
||
| 1221 | */ |
||
| 1222 | public function getAllowSelfSigned() |
||
| 1226 | |||
| 1227 | /** |
||
| 1228 | * Return's TRUE if control cipher ordering preferences during negotiation has to be allowed |
||
| 1229 | * |
||
| 1230 | * @return boolean |
||
| 1231 | */ |
||
| 1232 | public function getHonorCipherOrder() |
||
| 1236 | |||
| 1237 | /** |
||
| 1238 | * Return's the curve to use with ECDH ciphers, if not specified prime256v1 will be used |
||
| 1239 | * |
||
| 1240 | * @return string |
||
| 1241 | */ |
||
| 1242 | public function getEcdhCurve() |
||
| 1246 | |||
| 1247 | /** |
||
| 1248 | * Return's TRUE if a new key pair has to be created in scenarios where ECDH cipher suites are negotiated (instead of the preferred ECDHE ciphers) |
||
| 1249 | * |
||
| 1250 | * @return boolean |
||
| 1251 | */ |
||
| 1252 | public function getSingleEcdhUse() |
||
| 1256 | |||
| 1257 | /** |
||
| 1258 | * Return's TRUE if new key pair has to be created when using DH parameters (improves forward secrecy) |
||
| 1259 | * |
||
| 1260 | * @return boolean |
||
| 1261 | */ |
||
| 1262 | public function getSingleDhUse() |
||
| 1266 | |||
| 1267 | /** |
||
| 1268 | * Return's the list of available ciphers. |
||
| 1269 | * |
||
| 1270 | * @return string |
||
| 1271 | * @link http://php.net/manual/en/context.ssl.php#context.ssl.ciphers |
||
| 1272 | * @link https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER_LIST_FORMAT |
||
| 1273 | */ |
||
| 1274 | public function getCiphers() |
||
| 1278 | } |
||
| 1279 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: