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 MemcachedClient 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 MemcachedClient, and based on these observations, apply Extract Interface, too.
| 1 | <?php | ||
| 79 | class MemcachedClient { | ||
| 80 | 	// {{{ properties | ||
| 81 | 	// {{{ public | ||
| 82 | |||
| 83 | 	// {{{ constants | ||
| 84 | 	// {{{ flags | ||
| 85 | |||
| 86 | /** | ||
| 87 | * Flag: indicates data is serialized | ||
| 88 | */ | ||
| 89 | const SERIALIZED = 1; | ||
| 90 | |||
| 91 | /** | ||
| 92 | * Flag: indicates data is compressed | ||
| 93 | */ | ||
| 94 | const COMPRESSED = 2; | ||
| 95 | |||
| 96 | /** | ||
| 97 | * Flag: indicates data is an integer | ||
| 98 | */ | ||
| 99 | const INTVAL = 4; | ||
| 100 | |||
| 101 | // }}} | ||
| 102 | |||
| 103 | /** | ||
| 104 | * Minimum savings to store data compressed | ||
| 105 | */ | ||
| 106 | const COMPRESSION_SAVINGS = 0.20; | ||
| 107 | |||
| 108 | // }}} | ||
| 109 | |||
| 110 | /** | ||
| 111 | * Command statistics | ||
| 112 | * | ||
| 113 | * @var array | ||
| 114 | * @access public | ||
| 115 | */ | ||
| 116 | public $stats; | ||
| 117 | |||
| 118 | // }}} | ||
| 119 | 	// {{{ private | ||
| 120 | |||
| 121 | /** | ||
| 122 | * Cached Sockets that are connected | ||
| 123 | * | ||
| 124 | * @var array | ||
| 125 | * @access private | ||
| 126 | */ | ||
| 127 | public $_cache_sock; | ||
| 128 | |||
| 129 | /** | ||
| 130 | * Current debug status; 0 - none to 9 - profiling | ||
| 131 | * | ||
| 132 | * @var bool | ||
| 133 | * @access private | ||
| 134 | */ | ||
| 135 | public $_debug; | ||
| 136 | |||
| 137 | /** | ||
| 138 | * Dead hosts, assoc array, 'host'=>'unixtime when ok to check again' | ||
| 139 | * | ||
| 140 | * @var array | ||
| 141 | * @access private | ||
| 142 | */ | ||
| 143 | public $_host_dead; | ||
| 144 | |||
| 145 | /** | ||
| 146 | * Is compression available? | ||
| 147 | * | ||
| 148 | * @var bool | ||
| 149 | * @access private | ||
| 150 | */ | ||
| 151 | public $_have_zlib; | ||
| 152 | |||
| 153 | /** | ||
| 154 | * Do we want to use compression? | ||
| 155 | * | ||
| 156 | * @var bool | ||
| 157 | * @access private | ||
| 158 | */ | ||
| 159 | public $_compress_enable; | ||
| 160 | |||
| 161 | /** | ||
| 162 | * At how many bytes should we compress? | ||
| 163 | * | ||
| 164 | * @var int | ||
| 165 | * @access private | ||
| 166 | */ | ||
| 167 | public $_compress_threshold; | ||
| 168 | |||
| 169 | /** | ||
| 170 | * Are we using persistent links? | ||
| 171 | * | ||
| 172 | * @var bool | ||
| 173 | * @access private | ||
| 174 | */ | ||
| 175 | public $_persistent; | ||
| 176 | |||
| 177 | /** | ||
| 178 | * If only using one server; contains ip:port to connect to | ||
| 179 | * | ||
| 180 | * @var string | ||
| 181 | * @access private | ||
| 182 | */ | ||
| 183 | public $_single_sock; | ||
| 184 | |||
| 185 | /** | ||
| 186 | * Array containing ip:port or array(ip:port, weight) | ||
| 187 | * | ||
| 188 | * @var array | ||
| 189 | * @access private | ||
| 190 | */ | ||
| 191 | public $_servers; | ||
| 192 | |||
| 193 | /** | ||
| 194 | * Our bit buckets | ||
| 195 | * | ||
| 196 | * @var array | ||
| 197 | * @access private | ||
| 198 | */ | ||
| 199 | public $_buckets; | ||
| 200 | |||
| 201 | /** | ||
| 202 | * Total # of bit buckets we have | ||
| 203 | * | ||
| 204 | * @var int | ||
| 205 | * @access private | ||
| 206 | */ | ||
| 207 | public $_bucketcount; | ||
| 208 | |||
| 209 | /** | ||
| 210 | * # of total servers we have | ||
| 211 | * | ||
| 212 | * @var int | ||
| 213 | * @access private | ||
| 214 | */ | ||
| 215 | public $_active; | ||
| 216 | |||
| 217 | /** | ||
| 218 | * Stream timeout in seconds. Applies for example to fread() | ||
| 219 | * | ||
| 220 | * @var int | ||
| 221 | * @access private | ||
| 222 | */ | ||
| 223 | public $_timeout_seconds; | ||
| 224 | |||
| 225 | /** | ||
| 226 | * Stream timeout in microseconds | ||
| 227 | * | ||
| 228 | * @var int | ||
| 229 | * @access private | ||
| 230 | */ | ||
| 231 | public $_timeout_microseconds; | ||
| 232 | |||
| 233 | /** | ||
| 234 | * Connect timeout in seconds | ||
| 235 | */ | ||
| 236 | public $_connect_timeout; | ||
| 237 | |||
| 238 | /** | ||
| 239 | * Number of connection attempts for each server | ||
| 240 | */ | ||
| 241 | public $_connect_attempts; | ||
| 242 | |||
| 243 | /** | ||
| 244 | * @var LoggerInterface | ||
| 245 | */ | ||
| 246 | private $_logger; | ||
| 247 | |||
| 248 | // }}} | ||
| 249 | // }}} | ||
| 250 | 	// {{{ methods | ||
| 251 | 	// {{{ public functions | ||
| 252 | 	// {{{ memcached() | ||
| 253 | |||
| 254 | /** | ||
| 255 | * Memcache initializer | ||
| 256 | * | ||
| 257 | * @param array $args Associative array of settings | ||
| 258 | * | ||
| 259 | * @return mixed | ||
|  | |||
| 260 | */ | ||
| 261 | 	public function __construct( $args ) { | ||
| 281 | |||
| 282 | // }}} | ||
| 283 | 	// {{{ add() | ||
| 284 | |||
| 285 | /** | ||
| 286 | * Adds a key/value to the memcache server if one isn't already set with | ||
| 287 | * that key | ||
| 288 | * | ||
| 289 | * @param string $key Key to set with data | ||
| 290 | * @param mixed $val Value to store | ||
| 291 | * @param int $exp (optional) Expiration time. This can be a number of seconds | ||
| 292 | * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or | ||
| 293 | * longer must be the timestamp of the time at which the mapping should expire. It | ||
| 294 | * is safe to use timestamps in all cases, regardless of expiration | ||
| 295 | 	 * eg: strtotime("+3 hour") | ||
| 296 | * | ||
| 297 | * @return bool | ||
| 298 | */ | ||
| 299 | 	public function add( $key, $val, $exp = 0 ) { | ||
| 302 | |||
| 303 | // }}} | ||
| 304 | 	// {{{ decr() | ||
| 305 | |||
| 306 | /** | ||
| 307 | * Decrease a value stored on the memcache server | ||
| 308 | * | ||
| 309 | * @param string $key Key to decrease | ||
| 310 | * @param int $amt (optional) amount to decrease | ||
| 311 | * | ||
| 312 | * @return mixed False on failure, value on success | ||
| 313 | */ | ||
| 314 | 	public function decr( $key, $amt = 1 ) { | ||
| 317 | |||
| 318 | // }}} | ||
| 319 | 	// {{{ delete() | ||
| 320 | |||
| 321 | /** | ||
| 322 | * Deletes a key from the server, optionally after $time | ||
| 323 | * | ||
| 324 | * @param string $key Key to delete | ||
| 325 | * @param int $time (optional) how long to wait before deleting | ||
| 326 | * | ||
| 327 | * @return bool True on success, false on failure | ||
| 328 | */ | ||
| 329 | View Code Duplication | 	public function delete( $key, $time = 0 ) { | |
| 362 | |||
| 363 | /** | ||
| 364 | * Changes the TTL on a key from the server to $time | ||
| 365 | * | ||
| 366 | * @param string $key Key | ||
| 367 | * @param int $time TTL in seconds | ||
| 368 | * | ||
| 369 | * @return bool True on success, false on failure | ||
| 370 | */ | ||
| 371 | View Code Duplication | 	public function touch( $key, $time = 0 ) { | |
| 404 | |||
| 405 | /** | ||
| 406 | * @param string $key | ||
| 407 | * @param int $timeout | ||
| 408 | * @return bool | ||
| 409 | */ | ||
| 410 | 	public function lock( $key, $timeout = 0 ) { | ||
| 414 | |||
| 415 | /** | ||
| 416 | * @param string $key | ||
| 417 | * @return bool | ||
| 418 | */ | ||
| 419 | 	public function unlock( $key ) { | ||
| 423 | |||
| 424 | // }}} | ||
| 425 | 	// {{{ disconnect_all() | ||
| 426 | |||
| 427 | /** | ||
| 428 | * Disconnects all connected sockets | ||
| 429 | */ | ||
| 430 | 	public function disconnect_all() { | ||
| 437 | |||
| 438 | // }}} | ||
| 439 | 	// {{{ enable_compress() | ||
| 440 | |||
| 441 | /** | ||
| 442 | * Enable / Disable compression | ||
| 443 | * | ||
| 444 | * @param bool $enable True to enable, false to disable | ||
| 445 | */ | ||
| 446 | 	public function enable_compress( $enable ) { | ||
| 449 | |||
| 450 | // }}} | ||
| 451 | 	// {{{ forget_dead_hosts() | ||
| 452 | |||
| 453 | /** | ||
| 454 | * Forget about all of the dead hosts | ||
| 455 | */ | ||
| 456 | 	public function forget_dead_hosts() { | ||
| 459 | |||
| 460 | // }}} | ||
| 461 | 	// {{{ get() | ||
| 462 | |||
| 463 | /** | ||
| 464 | * Retrieves the value associated with the key from the memcache server | ||
| 465 | * | ||
| 466 | * @param array|string $key key to retrieve | ||
| 467 | * @param float $casToken [optional] | ||
| 468 | * | ||
| 469 | * @return mixed | ||
| 470 | */ | ||
| 471 | 	public function get( $key, &$casToken = null ) { | ||
| 519 | |||
| 520 | // }}} | ||
| 521 | 	// {{{ get_multi() | ||
| 522 | |||
| 523 | /** | ||
| 524 | * Get multiple keys from the server(s) | ||
| 525 | * | ||
| 526 | * @param array $keys Keys to retrieve | ||
| 527 | * | ||
| 528 | * @return array | ||
| 529 | */ | ||
| 530 | 	public function get_multi( $keys ) { | ||
| 583 | |||
| 584 | // }}} | ||
| 585 | 	// {{{ incr() | ||
| 586 | |||
| 587 | /** | ||
| 588 | * Increments $key (optionally) by $amt | ||
| 589 | * | ||
| 590 | * @param string $key Key to increment | ||
| 591 | * @param int $amt (optional) amount to increment | ||
| 592 | * | ||
| 593 | * @return int|null Null if the key does not exist yet (this does NOT | ||
| 594 | * create new mappings if the key does not exist). If the key does | ||
| 595 | * exist, this returns the new value for that key. | ||
| 596 | */ | ||
| 597 | 	public function incr( $key, $amt = 1 ) { | ||
| 600 | |||
| 601 | // }}} | ||
| 602 | 	// {{{ replace() | ||
| 603 | |||
| 604 | /** | ||
| 605 | * Overwrites an existing value for key; only works if key is already set | ||
| 606 | * | ||
| 607 | * @param string $key Key to set value as | ||
| 608 | * @param mixed $value Value to store | ||
| 609 | * @param int $exp (optional) Expiration time. This can be a number of seconds | ||
| 610 | * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or | ||
| 611 | * longer must be the timestamp of the time at which the mapping should expire. It | ||
| 612 | * is safe to use timestamps in all cases, regardless of exipration | ||
| 613 | 	 * eg: strtotime("+3 hour") | ||
| 614 | * | ||
| 615 | * @return bool | ||
| 616 | */ | ||
| 617 | 	public function replace( $key, $value, $exp = 0 ) { | ||
| 620 | |||
| 621 | // }}} | ||
| 622 | 	// {{{ run_command() | ||
| 623 | |||
| 624 | /** | ||
| 625 | * Passes through $cmd to the memcache server connected by $sock; returns | ||
| 626 | * output as an array (null array if no output) | ||
| 627 | * | ||
| 628 | * @param Resource $sock Socket to send command on | ||
| 629 | * @param string $cmd Command to run | ||
| 630 | * | ||
| 631 | * @return array Output array | ||
| 632 | */ | ||
| 633 | 	public function run_command( $sock, $cmd ) { | ||
| 655 | |||
| 656 | // }}} | ||
| 657 | 	// {{{ set() | ||
| 658 | |||
| 659 | /** | ||
| 660 | * Unconditionally sets a key to a given value in the memcache. Returns true | ||
| 661 | * if set successfully. | ||
| 662 | * | ||
| 663 | * @param string $key Key to set value as | ||
| 664 | * @param mixed $value Value to set | ||
| 665 | * @param int $exp (optional) Expiration time. This can be a number of seconds | ||
| 666 | * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or | ||
| 667 | * longer must be the timestamp of the time at which the mapping should expire. It | ||
| 668 | * is safe to use timestamps in all cases, regardless of exipration | ||
| 669 | 	 * eg: strtotime("+3 hour") | ||
| 670 | * | ||
| 671 | * @return bool True on success | ||
| 672 | */ | ||
| 673 | 	public function set( $key, $value, $exp = 0 ) { | ||
| 676 | |||
| 677 | // }}} | ||
| 678 | 	// {{{ cas() | ||
| 679 | |||
| 680 | /** | ||
| 681 | * Sets a key to a given value in the memcache if the current value still corresponds | ||
| 682 | * to a known, given value. Returns true if set successfully. | ||
| 683 | * | ||
| 684 | * @param float $casToken Current known value | ||
| 685 | * @param string $key Key to set value as | ||
| 686 | * @param mixed $value Value to set | ||
| 687 | * @param int $exp (optional) Expiration time. This can be a number of seconds | ||
| 688 | * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or | ||
| 689 | * longer must be the timestamp of the time at which the mapping should expire. It | ||
| 690 | * is safe to use timestamps in all cases, regardless of exipration | ||
| 691 | 	 * eg: strtotime("+3 hour") | ||
| 692 | * | ||
| 693 | * @return bool True on success | ||
| 694 | */ | ||
| 695 | 	public function cas( $casToken, $key, $value, $exp = 0 ) { | ||
| 698 | |||
| 699 | // }}} | ||
| 700 | 	// {{{ set_compress_threshold() | ||
| 701 | |||
| 702 | /** | ||
| 703 | * Set the compression threshold | ||
| 704 | * | ||
| 705 | * @param int $thresh Threshold to compress if larger than | ||
| 706 | */ | ||
| 707 | 	public function set_compress_threshold( $thresh ) { | ||
| 710 | |||
| 711 | // }}} | ||
| 712 | 	// {{{ set_debug() | ||
| 713 | |||
| 714 | /** | ||
| 715 | * Set the debug flag | ||
| 716 | * | ||
| 717 | * @see __construct() | ||
| 718 | * @param bool $dbg True for debugging, false otherwise | ||
| 719 | */ | ||
| 720 | 	public function set_debug( $dbg ) { | ||
| 723 | |||
| 724 | // }}} | ||
| 725 | 	// {{{ set_servers() | ||
| 726 | |||
| 727 | /** | ||
| 728 | * Set the server list to distribute key gets and puts between | ||
| 729 | * | ||
| 730 | * @see __construct() | ||
| 731 | * @param array $list Array of servers to connect to | ||
| 732 | */ | ||
| 733 | 	public function set_servers( $list ) { | ||
| 744 | |||
| 745 | /** | ||
| 746 | * Sets the timeout for new connections | ||
| 747 | * | ||
| 748 | * @param int $seconds Number of seconds | ||
| 749 | * @param int $microseconds Number of microseconds | ||
| 750 | */ | ||
| 751 | 	public function set_timeout( $seconds, $microseconds ) { | ||
| 755 | |||
| 756 | // }}} | ||
| 757 | // }}} | ||
| 758 | 	// {{{ private methods | ||
| 759 | 	// {{{ _close_sock() | ||
| 760 | |||
| 761 | /** | ||
| 762 | * Close the specified socket | ||
| 763 | * | ||
| 764 | * @param string $sock Socket to close | ||
| 765 | * | ||
| 766 | * @access private | ||
| 767 | */ | ||
| 768 | 	function _close_sock( $sock ) { | ||
| 773 | |||
| 774 | // }}} | ||
| 775 | 	// {{{ _connect_sock() | ||
| 776 | |||
| 777 | /** | ||
| 778 | * Connects $sock to $host, timing out after $timeout | ||
| 779 | * | ||
| 780 | * @param int $sock Socket to connect | ||
| 781 | * @param string $host Host:IP to connect to | ||
| 782 | * | ||
| 783 | * @return bool | ||
| 784 | * @access private | ||
| 785 | */ | ||
| 786 | 	function _connect_sock( &$sock, $host ) { | ||
| 816 | |||
| 817 | // }}} | ||
| 818 | 	// {{{ _dead_sock() | ||
| 819 | |||
| 820 | /** | ||
| 821 | * Marks a host as dead until 30-40 seconds in the future | ||
| 822 | * | ||
| 823 | * @param string $sock Socket to mark as dead | ||
| 824 | * | ||
| 825 | * @access private | ||
| 826 | */ | ||
| 827 | 	function _dead_sock( $sock ) { | ||
| 831 | |||
| 832 | /** | ||
| 833 | * @param string $host | ||
| 834 | */ | ||
| 835 | 	function _dead_host( $host ) { | ||
| 841 | |||
| 842 | // }}} | ||
| 843 | 	// {{{ get_sock() | ||
| 844 | |||
| 845 | /** | ||
| 846 | * get_sock | ||
| 847 | * | ||
| 848 | * @param string $key Key to retrieve value for; | ||
| 849 | * | ||
| 850 | * @return Resource|bool Resource on success, false on failure | ||
| 851 | * @access private | ||
| 852 | */ | ||
| 853 | 	function get_sock( $key ) { | ||
| 890 | |||
| 891 | // }}} | ||
| 892 | 	// {{{ _hashfunc() | ||
| 893 | |||
| 894 | /** | ||
| 895 | * Creates a hash integer based on the $key | ||
| 896 | * | ||
| 897 | * @param string $key Key to hash | ||
| 898 | * | ||
| 899 | * @return int Hash value | ||
| 900 | * @access private | ||
| 901 | */ | ||
| 902 | 	function _hashfunc( $key ) { | ||
| 908 | |||
| 909 | // }}} | ||
| 910 | 	// {{{ _incrdecr() | ||
| 911 | |||
| 912 | /** | ||
| 913 | * Perform increment/decriment on $key | ||
| 914 | * | ||
| 915 | * @param string $cmd Command to perform | ||
| 916 | * @param string|array $key Key to perform it on | ||
| 917 | * @param int $amt Amount to adjust | ||
| 918 | * | ||
| 919 | * @return int New value of $key | ||
| 920 | * @access private | ||
| 921 | */ | ||
| 922 | 	function _incrdecr( $cmd, $key, $amt = 1 ) { | ||
| 949 | |||
| 950 | // }}} | ||
| 951 | 	// {{{ _load_items() | ||
| 952 | |||
| 953 | /** | ||
| 954 | * Load items into $ret from $sock | ||
| 955 | * | ||
| 956 | * @param Resource $sock Socket to read from | ||
| 957 | * @param array $ret returned values | ||
| 958 | * @param float $casToken [optional] | ||
| 959 | * @return bool True for success, false for failure | ||
| 960 | * | ||
| 961 | * @access private | ||
| 962 | */ | ||
| 963 | 	function _load_items( $sock, &$ret, &$casToken = null ) { | ||
| 1037 | |||
| 1038 | // }}} | ||
| 1039 | 	// {{{ _set() | ||
| 1040 | |||
| 1041 | /** | ||
| 1042 | * Performs the requested storage operation to the memcache server | ||
| 1043 | * | ||
| 1044 | * @param string $cmd Command to perform | ||
| 1045 | * @param string $key Key to act on | ||
| 1046 | * @param mixed $val What we need to store | ||
| 1047 | * @param int $exp (optional) Expiration time. This can be a number of seconds | ||
| 1048 | * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or | ||
| 1049 | * longer must be the timestamp of the time at which the mapping should expire. It | ||
| 1050 | * is safe to use timestamps in all cases, regardless of exipration | ||
| 1051 | 	 * eg: strtotime("+3 hour") | ||
| 1052 | * @param float $casToken [optional] | ||
| 1053 | * | ||
| 1054 | * @return bool | ||
| 1055 | * @access private | ||
| 1056 | */ | ||
| 1057 | 	function _set( $cmd, $key, $val, $exp, $casToken = null ) { | ||
| 1122 | |||
| 1123 | // }}} | ||
| 1124 | 	// {{{ sock_to_host() | ||
| 1125 | |||
| 1126 | /** | ||
| 1127 | * Returns the socket for the host | ||
| 1128 | * | ||
| 1129 | * @param string $host Host:IP to get socket for | ||
| 1130 | * | ||
| 1131 | * @return Resource|bool IO Stream or false | ||
| 1132 | * @access private | ||
| 1133 | */ | ||
| 1134 | 	function sock_to_host( $host ) { | ||
| 1159 | |||
| 1160 | /** | ||
| 1161 | * @param string $text | ||
| 1162 | */ | ||
| 1163 | 	function _debugprint( $text ) { | ||
| 1166 | |||
| 1167 | /** | ||
| 1168 | * @param string $text | ||
| 1169 | */ | ||
| 1170 | 	function _error_log( $text ) { | ||
| 1173 | |||
| 1174 | /** | ||
| 1175 | * Write to a stream. If there is an error, mark the socket dead. | ||
| 1176 | * | ||
| 1177 | * @param Resource $sock The socket | ||
| 1178 | * @param string $buf The string to write | ||
| 1179 | * @return bool True on success, false on failure | ||
| 1180 | */ | ||
| 1181 | 	function _fwrite( $sock, $buf ) { | ||
| 1201 | |||
| 1202 | /** | ||
| 1203 | * Handle an I/O error. Mark the socket dead and log an error. | ||
| 1204 | * | ||
| 1205 | * @param Resource $sock | ||
| 1206 | * @param string $msg | ||
| 1207 | */ | ||
| 1208 | 	function _handle_error( $sock, $msg ) { | ||
| 1220 | |||
| 1221 | /** | ||
| 1222 | * Read the specified number of bytes from a stream. If there is an error, | ||
| 1223 | * mark the socket dead. | ||
| 1224 | * | ||
| 1225 | * @param Resource $sock The socket | ||
| 1226 | * @param int $len The number of bytes to read | ||
| 1227 | * @return string|bool The string on success, false on failure. | ||
| 1228 | */ | ||
| 1229 | 	function _fread( $sock, $len ) { | ||
| 1252 | |||
| 1253 | /** | ||
| 1254 | * Read a line from a stream. If there is an error, mark the socket dead. | ||
| 1255 | * The \r\n line ending is stripped from the response. | ||
| 1256 | * | ||
| 1257 | * @param Resource $sock The socket | ||
| 1258 | * @return string|bool The string on success, false on failure | ||
| 1259 | */ | ||
| 1260 | 	function _fgets( $sock ) { | ||
| 1284 | |||
| 1285 | /** | ||
| 1286 | * Flush the read buffer of a stream | ||
| 1287 | * @param Resource $f | ||
| 1288 | */ | ||
| 1289 | 	function _flush_read_buffer( $f ) { | ||
| 1305 | |||
| 1306 | // }}} | ||
| 1307 | // }}} | ||
| 1308 | // }}} | ||
| 1309 | } | ||
| 1310 | |||
| 1312 | 
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.