Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -1,8 +1,16 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Description of DonationData |
6 | | - * |
| 5 | + * DonationData |
| 6 | + * This class is responsible for pulling all the data used by DonationInterface |
| 7 | + * from various sources. Once pulled, DonationData will then normalize and |
| 8 | + * sanitize the data for use by the various gateway adapters which connect to |
| 9 | + * the payment gateways, and through those gateway adapters, the forms that |
| 10 | + * provide the user interface. |
| 11 | + * |
| 12 | + * DonationData was not written to be instantiated by anything other than a |
| 13 | + * gateway adapter (or class descended from GatewayAdapter). |
| 14 | + * |
7 | 15 | * @author khorn |
8 | 16 | */ |
9 | 17 | class DonationData { |
— | — | @@ -10,14 +18,38 @@ |
11 | 19 | protected $normalized = array( ); |
12 | 20 | public $boss; |
13 | 21 | |
| 22 | + /** |
| 23 | + * DonationData constructor |
| 24 | + * @param string $owning_class The name of the class that instantiated this |
| 25 | + * instance of DonationData. This is used to grab gateway-specific functions |
| 26 | + * and values, such as the logging function and gateway-specific global |
| 27 | + * variables. |
| 28 | + * @param boolean $test Indicates if DonationData has been instantiated in |
| 29 | + * testing mode. Default is false. |
| 30 | + * @param mixed $data An optional array of donation data that will, if |
| 31 | + * present, circumvent the usual process of gathering the data from various |
| 32 | + * places in $wgRequest, or 'false' to gather the data the usual way. |
| 33 | + * Default is false. |
| 34 | + */ |
14 | 35 | function __construct( $owning_class, $test = false, $data = false ) { |
15 | | - //TODO: Actually think about this bit. |
16 | | - // ...and keep in mind we can re-populate if it's a test or whatever. (But that may not be a good idea either) |
17 | 36 | $this->boss = $owning_class; |
18 | 37 | $this->gatewayID = $this->getGatewayIdentifier(); |
19 | 38 | $this->populateData( $test, $data ); |
20 | 39 | } |
21 | 40 | |
| 41 | + /** |
| 42 | + * populateData, called on construct, pulls donation data from various |
| 43 | + * sources. Once the data has been pulled, it will handle any session data |
| 44 | + * if present, normalize the data regardless of the source, and handle the |
| 45 | + * caching variables. |
| 46 | + * @global Webrequest $wgRequest |
| 47 | + * @param boolean $test Indicates if DonationData has been instantiated in |
| 48 | + * testing mode. Default is false. |
| 49 | + * @param mixed $external_data An optional array of donation data that will, |
| 50 | + * if present, circumvent the usual process of gathering the data from |
| 51 | + * various places in $wgRequest, or 'false' to gather the data the usual way. |
| 52 | + * Default is false. |
| 53 | + */ |
22 | 54 | protected function populateData( $test = false, $external_data = false ) { |
23 | 55 | global $wgRequest; |
24 | 56 | $this->normalized = array( ); |
— | — | @@ -162,6 +194,18 @@ |
163 | 195 | return $this->normalized; |
164 | 196 | } |
165 | 197 | |
| 198 | + /** |
| 199 | + * populateData helper function. |
| 200 | + * If there is no external data provided upon DonationData construct, and |
| 201 | + * the object was instantiated in test mode, populateData_Test in intended |
| 202 | + * to provide a baseline minimum of data with which to run tests without |
| 203 | + * exploding. |
| 204 | + * Populates $this->normalized. |
| 205 | + * TODO: Implement an override for the test data, in the event that a |
| 206 | + * partial data array is provided when DonationData is instantiated. |
| 207 | + * @param array $testdata Intended to implement an override for any values |
| 208 | + * that may be provided on instantiation. |
| 209 | + */ |
166 | 210 | protected function populateData_Test( $testdata = false ) { |
167 | 211 | // define arrays of cc's and cc #s for random selection |
168 | 212 | $cards = array( 'american' ); |
— | — | @@ -232,9 +276,11 @@ |
233 | 277 | } |
234 | 278 | |
235 | 279 | /** |
236 | | - * Tells you if a value is something or not. |
237 | | - * @param string $key The field you would like to determine if it exists or not. |
238 | | - * @return boolean true if the field is something. False if it is null, or an empty string. |
| 280 | + * Tells you if a value in $this->normalized is something or not. |
| 281 | + * @param string $key The field you would like to determine if it exists in |
| 282 | + * a usable way or not. |
| 283 | + * @return boolean true if the field is something. False if it is null, or |
| 284 | + * an empty string. |
239 | 285 | */ |
240 | 286 | public function isSomething( $key ) { |
241 | 287 | if ( array_key_exists( $key, $this->normalized ) ) { |
— | — | @@ -249,7 +295,8 @@ |
250 | 296 | |
251 | 297 | /** |
252 | 298 | * getVal_Escaped |
253 | | - * @param string $key The data field you would like to retrieve. |
| 299 | + * @param string $key The data field you would like to retrieve. Pulls the |
| 300 | + * data from $this->normalized if it is found to be something. |
254 | 301 | * @return mixed The normalized and escaped value of that $key. |
255 | 302 | */ |
256 | 303 | public function getVal_Escaped( $key ) { |
— | — | @@ -265,7 +312,8 @@ |
266 | 313 | /** |
267 | 314 | * getVal |
268 | 315 | * For Internal Use Only! External objects should use getVal_Escaped. |
269 | | - * @param string $key The data field you would like to retrieve. |
| 316 | + * @param string $key The data field you would like to retrieve directly |
| 317 | + * from $this->normalized. |
270 | 318 | * @return mixed The normalized value of that $key. |
271 | 319 | */ |
272 | 320 | protected function getVal( $key ) { |
— | — | @@ -278,14 +326,23 @@ |
279 | 327 | |
280 | 328 | /** |
281 | 329 | * Sets a key in the normalized data array, to a new value. |
| 330 | + * This function should only ever be used for keys that are not listed in |
| 331 | + * DonationData::getCalculatedFields(). |
| 332 | + * TODO: If the $key is listed in DonationData::getCalculatedFields(), use |
| 333 | + * DonationData::addData() instead. Or be a jerk about it and throw an |
| 334 | + * exception. (Personally I like the second one) |
282 | 335 | * @param string $key The key you want to set. |
283 | 336 | * @param string $val The value you'd like to assign to the key. |
284 | 337 | */ |
285 | | - function setVal( $key, $val ) { |
| 338 | + public function setVal( $key, $val ) { |
286 | 339 | $this->normalized[$key] = $val; |
287 | 340 | } |
288 | 341 | |
289 | | - function expunge( $key ) { |
| 342 | + /** |
| 343 | + * Removes a value from $this->normalized. |
| 344 | + * @param type $key |
| 345 | + */ |
| 346 | + public function expunge( $key ) { |
290 | 347 | if ( array_key_exists( $key, $this->normalized ) ) { |
291 | 348 | unset( $this->normalized[$key] ); |
292 | 349 | } |
— | — | @@ -294,11 +351,12 @@ |
295 | 352 | /** |
296 | 353 | * Returns an array of all the fields that get re-calculated during a |
297 | 354 | * normalize. |
298 | | - * This will most likely be used on the outside when in the process of |
299 | | - * adding data. |
| 355 | + * This can be used on the outside when in the process of changing data, |
| 356 | + * particularly if any of the recalculted fields need to be restaged by the |
| 357 | + * gateway adapter. |
300 | 358 | * @return array An array of values matching all recauculated fields. |
301 | 359 | */ |
302 | | - function getCalculatedFields() { |
| 360 | + public function getCalculatedFields() { |
303 | 361 | $fields = array( |
304 | 362 | 'utm_source', |
305 | 363 | 'amount', |
— | — | @@ -317,9 +375,13 @@ |
318 | 376 | |
319 | 377 | /** |
320 | 378 | * Normalizes the current set of data, just after it's been |
321 | | - * pulled (or re-pulled) from a source. |
| 379 | + * pulled (or re-pulled) from a data source. |
| 380 | + * Care should be taken in the normalize helper functions to write code in |
| 381 | + * such a way that running them multiple times on the same array won't cause |
| 382 | + * the data to stroll off into the sunset: Normalize will definitely need to |
| 383 | + * be called multiple times against the same array. |
322 | 384 | */ |
323 | | - function normalize() { |
| 385 | + protected function normalize() { |
324 | 386 | if ( !empty( $this->normalized ) ) { |
325 | 387 | $this->setUtmSource(); |
326 | 388 | $this->setNormalizedAmount(); |
— | — | @@ -337,8 +399,17 @@ |
338 | 400 | /** |
339 | 401 | * normalize helper function |
340 | 402 | * Sets the form class we will be using. |
| 403 | + * In the case that we are using forms, form_name will be harvested from |
| 404 | + * $wgRequest by populateData. If we are coming from somewhere that does not |
| 405 | + * use a form interface (like an api call), this logic should be skipped. |
| 406 | + * |
| 407 | + * For any specified form, if it is enabled and available, the class would |
| 408 | + * have been autoloaded at this point. If it is not enabled and available, |
| 409 | + * we will check the default for the calling gateway, and failing that, |
| 410 | + * throw an exception. |
| 411 | + * |
341 | 412 | */ |
342 | | - function setFormClass(){ |
| 413 | + protected function setFormClass(){ |
343 | 414 | //don't actually try to load the forms here... but do determine if what we've got in there will load or not. |
344 | 415 | //Elsewise, set it to the default. |
345 | 416 | |
— | — | @@ -362,8 +433,10 @@ |
363 | 434 | /** |
364 | 435 | * normalize helper function |
365 | 436 | * Setting the country correctly. |
| 437 | + * If we have no country, we try to get something rational through GeoIP |
| 438 | + * lookup. |
366 | 439 | */ |
367 | | - function setCountry() { |
| 440 | + protected function setCountry() { |
368 | 441 | global $wgRequest; |
369 | 442 | if ( !$this->isSomething('country') ){ |
370 | 443 | // If no country was passed, try to do GeoIP lookup |
— | — | @@ -381,8 +454,10 @@ |
382 | 455 | /** |
383 | 456 | * normalize helper function |
384 | 457 | * Setting the currency code correctly. |
| 458 | + * Historically, this value could come in through 'currency' or |
| 459 | + * 'currency_code'. After this fires, we will only have 'currency_code'. |
385 | 460 | */ |
386 | | - function setCurrencyCode() { |
| 461 | + protected function setCurrencyCode() { |
387 | 462 | global $wgRequest; |
388 | 463 | |
389 | 464 | //at this point, we can have either currency, or currency_code. |
— | — | @@ -413,7 +488,7 @@ |
414 | 489 | * If a contribution tracking id is already present, no new rows will be |
415 | 490 | * assigned. |
416 | 491 | */ |
417 | | - function handleContributionTrackingID(){ |
| 492 | + protected function handleContributionTrackingID(){ |
418 | 493 | if ( !$this->isSomething( 'contribution_tracking_id' ) && |
419 | 494 | ( !$this->isCaching() ) ){ |
420 | 495 | $this->saveContributionTracking(); |
— | — | @@ -426,7 +501,7 @@ |
427 | 502 | * calculate it from the data fields more than once. |
428 | 503 | * @return boolean true if we are going to be caching, false if we aren't. |
429 | 504 | */ |
430 | | - function isCaching(){ |
| 505 | + public function isCaching(){ |
431 | 506 | |
432 | 507 | static $cache = null; |
433 | 508 | |
— | — | @@ -455,7 +530,7 @@ |
456 | 531 | * Takes all possible sources for the intended donation amount, and |
457 | 532 | * normalizes them into the 'amount' field. |
458 | 533 | */ |
459 | | - function setNormalizedAmount() { |
| 534 | + protected function setNormalizedAmount() { |
460 | 535 | if ( !($this->isSomething( 'amount' )) || !(preg_match( '/^\d+(\.(\d+)?)?$/', $this->getVal( 'amount' ) ) ) ) { |
461 | 536 | if ( $this->isSomething( 'amountGiven' ) && preg_match( '/^\d+(\.(\d+)?)?$/', $this->getVal( 'amountGiven' ) ) ) { |
462 | 537 | $this->setVal( 'amount', number_format( $this->getVal( 'amountGiven' ), 2, '.', '' ) ); |
— | — | @@ -473,7 +548,7 @@ |
474 | 549 | * comes in populated or not, and where it came from. |
475 | 550 | * @return null |
476 | 551 | */ |
477 | | - function setNormalizedOrderIDs() { |
| 552 | + protected function setNormalizedOrderIDs() { |
478 | 553 | //basically, we need a new order_id every time we come through here, but if there's an internal already there, |
479 | 554 | //we want to use that one internally. So. |
480 | 555 | //Exception: If we pass in an order ID in the querystring: Don't mess with it. |
— | — | @@ -493,7 +568,7 @@ |
494 | 569 | /** |
495 | 570 | * Generate an order id exactly once for this go-round. |
496 | 571 | */ |
497 | | - static function generateOrderId() { |
| 572 | + protected static function generateOrderId() { |
498 | 573 | static $order_id = null; |
499 | 574 | if ( $order_id === null ) { |
500 | 575 | $order_id = ( double ) microtime() * 1000000 . mt_rand( 1000, 9999 ); |
— | — | @@ -515,6 +590,12 @@ |
516 | 591 | $value = htmlspecialchars( $value, $flags, 'UTF-8', $double_encode ); |
517 | 592 | } |
518 | 593 | |
| 594 | + /** |
| 595 | + * log: This grabs the adapter class that instantiated DonationData, and |
| 596 | + * uses its log function. |
| 597 | + * @param string $message The message to log. |
| 598 | + * @param type $log_level |
| 599 | + */ |
519 | 600 | protected function log( $message, $log_level=LOG_INFO ) { |
520 | 601 | $c = $this->getAdapterClass(); |
521 | 602 | if ( $c && is_callable( array( $c, 'log' ) )){ |
— | — | @@ -522,6 +603,14 @@ |
523 | 604 | } |
524 | 605 | } |
525 | 606 | |
| 607 | + /** |
| 608 | + * getGatewayIdentifier |
| 609 | + * This grabs the adapter class that instantiated DonationData, and returns |
| 610 | + * the result of its 'getIdentifier' function. Used for normalizing the |
| 611 | + * 'gateway' value, and stashing and retrieving the edit token (and other |
| 612 | + * things, where needed) in the session. |
| 613 | + * @return type |
| 614 | + */ |
526 | 615 | protected function getGatewayIdentifier() { |
527 | 616 | $c = $this->getAdapterClass(); |
528 | 617 | if ( $c && is_callable( array( $c, 'getIdentifier' ) ) ){ |
— | — | @@ -531,6 +620,16 @@ |
532 | 621 | } |
533 | 622 | } |
534 | 623 | |
| 624 | + /** |
| 625 | + * getGatewayGlobal |
| 626 | + * This grabs the adapter class that instantiated DonationData, and returns |
| 627 | + * the result of its 'getGlobal' function for the $varname passed in. Used |
| 628 | + * to determine gateway-specific configuration settings. |
| 629 | + * @param string $varname the global variable (minus prefix) that we want to |
| 630 | + * check. |
| 631 | + * @return mixed The value of the gateway global if it exists. Else, the |
| 632 | + * value of the Donation Interface global if it exists. Else, null. |
| 633 | + */ |
535 | 634 | protected function getGatewayGlobal( $varname ) { |
536 | 635 | $c = $this->getAdapterClass(); |
537 | 636 | if ( $c && is_callable( array( $c, 'getGlobal' ) ) ){ |
— | — | @@ -611,8 +710,18 @@ |
612 | 711 | } |
613 | 712 | } |
614 | 713 | |
| 714 | + /** |
| 715 | + * getAnnoyingOrderIDLogLinePrefix |
| 716 | + * Constructs and returns the annoying order ID log line prefix. |
| 717 | + * This has moved from being annoyingly all over the place in the edit token |
| 718 | + * logging code before it was functionalized, to being annoying to look at |
| 719 | + * in the logs because the two numbers in the prefix are frequently |
| 720 | + * identical (and large). |
| 721 | + * TODO: Determine if anything actually looks at both of those numbers, in |
| 722 | + * order to make this less annoying. Rename on success. |
| 723 | + * @return string Annoying Order ID Log Line Prefix in all its dubious glory. |
| 724 | + */ |
615 | 725 | protected function getAnnoyingOrderIDLogLinePrefix() { |
616 | | - //TODO: ...aww. But it's so descriptive. |
617 | 726 | return $this->getVal( 'order_id' ) . ' ' . $this->getVal( 'i_order_id' ) . ': '; |
618 | 727 | } |
619 | 728 | |
— | — | @@ -649,8 +758,10 @@ |
650 | 759 | } |
651 | 760 | |
652 | 761 | /** |
| 762 | + * token_refreshAllTokenEverything |
653 | 763 | * In the case where we have an expired session (token mismatch), we go |
654 | | - * ahead and fix it for 'em for their next post. |
| 764 | + * ahead and fix it for 'em for their next post. We do this by refreshing |
| 765 | + * everything that has to do with the edit token. |
655 | 766 | */ |
656 | 767 | protected function token_refreshAllTokenEverything(){ |
657 | 768 | $unsalted = self::token_generateToken(); |
— | — | @@ -661,6 +772,13 @@ |
662 | 773 | $this->setVal( 'token', $salted ); |
663 | 774 | } |
664 | 775 | |
| 776 | + /** |
| 777 | + * token_applyMD5AndSalt |
| 778 | + * Takes a clear-text token, and returns the MD5'd result of the token plus |
| 779 | + * the configured gateway salt. |
| 780 | + * @param string $clear_token The original, unsalted, unencoded edit token. |
| 781 | + * @return string The salted and MD5'd token. |
| 782 | + */ |
665 | 783 | protected function token_applyMD5AndSalt( $clear_token ){ |
666 | 784 | $salt = $this->getGatewayGlobal( 'Salt' ); |
667 | 785 | |
— | — | @@ -674,9 +792,10 @@ |
675 | 793 | |
676 | 794 | |
677 | 795 | /** |
678 | | - * Generate a token string |
679 | | - * |
680 | | - * @var mixed $padding |
| 796 | + * token_generateToken |
| 797 | + * Generate a random string to be used as an edit token. |
| 798 | + * @var string $padding A string with which we could pad out the random hex |
| 799 | + * further. |
681 | 800 | * @return string |
682 | 801 | */ |
683 | 802 | public static function token_generateToken( $padding = '' ) { |
— | — | @@ -685,7 +804,11 @@ |
686 | 805 | } |
687 | 806 | |
688 | 807 | /** |
689 | | - * Determine the validity of a token |
| 808 | + * token_matchEditToken |
| 809 | + * Determine the validity of a token by checking it against the salted |
| 810 | + * version of the clear-text token we have already stored in the session. |
| 811 | + * On failure, it resets the edit token both in the session and in the form, |
| 812 | + * so they will match on the user's next load. |
690 | 813 | * |
691 | 814 | * @var string $val |
692 | 815 | * @return bool |
— | — | @@ -702,10 +825,14 @@ |
703 | 826 | } |
704 | 827 | |
705 | 828 | /** |
| 829 | + * ensureSession |
706 | 830 | * Ensure that we have a session set for the current user. |
707 | | - * |
708 | 831 | * If we do not have a session set for the current user, |
709 | 832 | * start the session. |
| 833 | + * BE CAREFUL with this one, as creating sessions willy-nilly will break |
| 834 | + * squid caching for reasons that are not immediately obvious. |
| 835 | + * (See DonationData::doCacheStuff, and basically everything about setting |
| 836 | + * headers in $wgOut) |
710 | 837 | */ |
711 | 838 | protected static function ensureSession() { |
712 | 839 | // if the session is already started, do nothing |
— | — | @@ -717,6 +844,7 @@ |
718 | 845 | } |
719 | 846 | |
720 | 847 | /** |
| 848 | + * sessionExists |
721 | 849 | * Checks to see if the session exists without actually creating one. |
722 | 850 | * @return bool true if we have a session, otherwise false. |
723 | 851 | */ |
— | — | @@ -726,16 +854,30 @@ |
727 | 855 | return false; |
728 | 856 | } |
729 | 857 | |
| 858 | + /** |
| 859 | + * token_checkTokens |
| 860 | + * The main function to check the salted and MD5'd token we should have |
| 861 | + * saved and gathered from $wgRequest, against the clear-text token we |
| 862 | + * should have saved to the user's session. |
| 863 | + * token_getSaltedSessionToken() will start off the process if this is a |
| 864 | + * first load, and there's no saved token in the session yet. |
| 865 | + * @global Webrequest $wgRequest |
| 866 | + * @staticvar string $match |
| 867 | + * @return type |
| 868 | + */ |
730 | 869 | public function token_checkTokens() { |
731 | 870 | global $wgRequest; |
732 | | - static $match = null; |
| 871 | + static $match = null; //because we only want to do this once per load. |
733 | 872 | |
734 | 873 | if ( $match === null ) { |
735 | 874 | if ( $this->isCaching() ){ |
736 | 875 | //This makes sense. |
737 | 876 | //If all three conditions for caching are currently true, the |
738 | 877 | //last thing we want to do is screw it up by setting a session |
739 | | - //token before the page loads. |
| 878 | + //token before the page loads, because sessions break caching. |
| 879 | + //The API will set the session and form token values immediately |
| 880 | + //after that first page load, which is all we care about saving |
| 881 | + //in the cache anyway. |
740 | 882 | return true; |
741 | 883 | } |
742 | 884 | |
— | — | @@ -815,6 +957,10 @@ |
816 | 958 | * because the form elements for comment anonymization and email opt-out |
817 | 959 | * are backwards (they are really opt-in) relative to contribution_tracking |
818 | 960 | * (which is opt-out), we need to reverse the values. |
| 961 | + * Difficulty here is compounded by the fact that these values come from |
| 962 | + * checkboxes on forms, which simply don't make it to $wgRequest if they are |
| 963 | + * not checked... or not present in the form at all. In other words, this |
| 964 | + * situation is painful and you probably want to leave it alone. |
819 | 965 | * NOTE: If you prune here, and there is a paypal redirect, you will have |
820 | 966 | * problems with the email-opt/optout and comment-option/anonymous. |
821 | 967 | */ |
— | — | @@ -945,6 +1091,15 @@ |
946 | 1092 | } |
947 | 1093 | } |
948 | 1094 | |
| 1095 | + /** |
| 1096 | + * addDonorDataToSession |
| 1097 | + * Adds all the fields that are required to make a well-formed stomp |
| 1098 | + * message, to the user's session for later use. This mechanism is used by gateways that |
| 1099 | + * have a user being directed somewhere out of our control, and then coming |
| 1100 | + * back to complete a transaction. (Globalcollect Hosted Credit Card, for |
| 1101 | + * example) |
| 1102 | + * |
| 1103 | + */ |
949 | 1104 | public function addDonorDataToSession() { |
950 | 1105 | self::ensureSession(); |
951 | 1106 | $donordata = $this->getStompMessageFields(); |
— | — | @@ -1011,6 +1166,15 @@ |
1012 | 1167 | session_destroy(); //killed on the server. |
1013 | 1168 | } |
1014 | 1169 | |
| 1170 | + /** |
| 1171 | + * addData |
| 1172 | + * Adds an array of data to the normalized array, and then re-normalizes it. |
| 1173 | + * NOTE: If any gateway is using this function, it should then immediately |
| 1174 | + * repopulate its own data set with the DonationData source, and then |
| 1175 | + * re-stage values as necessary. |
| 1176 | + * @param array $newdata An array of data to integrate with the existing |
| 1177 | + * data held by the DonationData object. |
| 1178 | + */ |
1015 | 1179 | public function addData( $newdata ) { |
1016 | 1180 | if ( is_array( $newdata ) && !empty( $newdata ) ) { |
1017 | 1181 | foreach ( $newdata as $key => $val ) { |
— | — | @@ -1022,6 +1186,11 @@ |
1023 | 1187 | $this->normalize(); |
1024 | 1188 | } |
1025 | 1189 | |
| 1190 | + /** |
| 1191 | + * incrementNumAttempt |
| 1192 | + * Adds one to the 'numAttempt' field we use to keep track of how many times |
| 1193 | + * a donor has tried to do something. |
| 1194 | + */ |
1026 | 1195 | public function incrementNumAttempt() { |
1027 | 1196 | if ( $this->isSomething( 'numAttempt' ) ) { |
1028 | 1197 | $attempts = $this->getVal( 'numAttempt' ); |
— | — | @@ -1034,6 +1203,10 @@ |
1035 | 1204 | } |
1036 | 1205 | } |
1037 | 1206 | |
| 1207 | + /** |
| 1208 | + * Gets the name of the adapter class that instantiated DonationData. |
| 1209 | + * @return mixed The name of the class if it exists, or false. |
| 1210 | + */ |
1038 | 1211 | protected function getAdapterClass(){ |
1039 | 1212 | if ( class_exists( $this->boss ) ) { |
1040 | 1213 | return $this->boss; |