Complex classes like OrderStep 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 OrderStep, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 12 | class OrderStep extends DataObject implements EditableEcommerceObject  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 13 | { | 
            ||
| 14 | public function calculateddefertimeinseconds()  | 
            ||
| 18 | |||
| 19 | /**  | 
            ||
| 20 | * standard SS variable.  | 
            ||
| 21 | *  | 
            ||
| 22 | * @return array  | 
            ||
| 23 | */  | 
            ||
| 24 | private static $db = array(  | 
            ||
| 25 | 'Name' => 'Varchar(50)',  | 
            ||
| 26 | 'Code' => 'Varchar(50)',  | 
            ||
| 27 | 'Description' => 'Text',  | 
            ||
| 28 | 'EmailSubject' => 'Varchar(200)',  | 
            ||
| 29 | 'CustomerMessage' => 'HTMLText',  | 
            ||
| 30 | //customer privileges  | 
            ||
| 31 | 'CustomerCanEdit' => 'Boolean',  | 
            ||
| 32 | 'CustomerCanCancel' => 'Boolean',  | 
            ||
| 33 | 'CustomerCanPay' => 'Boolean',  | 
            ||
| 34 | //What to show the customer...  | 
            ||
| 35 | 'ShowAsUncompletedOrder' => 'Boolean',  | 
            ||
| 36 | 'ShowAsInProcessOrder' => 'Boolean',  | 
            ||
| 37 | 'ShowAsCompletedOrder' => 'Boolean',  | 
            ||
| 38 | 'HideStepFromCustomer' => 'Boolean',  | 
            ||
| 39 | //sorting index  | 
            ||
| 40 | 'Sort' => 'Int',  | 
            ||
| 41 | 'DeferTimeInSeconds' => 'Int',  | 
            ||
| 42 | 'DeferFromSubmitTime' => 'Boolean'  | 
            ||
| 43 | );  | 
            ||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | /**  | 
            ||
| 48 | * standard SS variable.  | 
            ||
| 49 | *  | 
            ||
| 50 | * @return array  | 
            ||
| 51 | */  | 
            ||
| 52 | private static $indexes = array(  | 
            ||
| 53 | 'Code' => true,  | 
            ||
| 54 | 'Sort' => true,  | 
            ||
| 55 | );  | 
            ||
| 56 | |||
| 57 | /**  | 
            ||
| 58 | * standard SS variable.  | 
            ||
| 59 | *  | 
            ||
| 60 | * @return array  | 
            ||
| 61 | */  | 
            ||
| 62 | private static $has_many = array(  | 
            ||
| 63 | 'Orders' => 'Order',  | 
            ||
| 64 | 'OrderEmailRecords' => 'OrderEmailRecord',  | 
            ||
| 65 | );  | 
            ||
| 66 | |||
| 67 | /**  | 
            ||
| 68 | * standard SS variable.  | 
            ||
| 69 | *  | 
            ||
| 70 | * @return array  | 
            ||
| 71 | */  | 
            ||
| 72 | private static $field_labels = array(  | 
            ||
| 73 | 'Sort' => 'Sorting Index',  | 
            ||
| 74 | 'CustomerCanEdit' => 'Customer can edit order',  | 
            ||
| 75 | 'CustomerCanPay' => 'Customer can pay order',  | 
            ||
| 76 | 'CustomerCanCancel' => 'Customer can cancel order',  | 
            ||
| 77 | );  | 
            ||
| 78 | |||
| 79 | /**  | 
            ||
| 80 | * standard SS variable.  | 
            ||
| 81 | *  | 
            ||
| 82 | * @return array  | 
            ||
| 83 | */  | 
            ||
| 84 | private static $summary_fields = array(  | 
            ||
| 85 | 'NameAndDescription' => 'Step',  | 
            ||
| 86 | 'ShowAsSummary' => 'Phase',  | 
            ||
| 87 | );  | 
            ||
| 88 | |||
| 89 | /**  | 
            ||
| 90 | * standard SS variable.  | 
            ||
| 91 | *  | 
            ||
| 92 | * @return array  | 
            ||
| 93 | */  | 
            ||
| 94 | private static $casting = array(  | 
            ||
| 95 | 'Title' => 'Varchar',  | 
            ||
| 96 | 'CustomerCanEditNice' => 'Varchar',  | 
            ||
| 97 | 'CustomerCanPayNice' => 'Varchar',  | 
            ||
| 98 | 'CustomerCanCancelNice' => 'Varchar',  | 
            ||
| 99 | 'ShowAsUncompletedOrderNice' => 'Varchar',  | 
            ||
| 100 | 'ShowAsInProcessOrderNice' => 'Varchar',  | 
            ||
| 101 | 'ShowAsCompletedOrderNice' => 'Varchar',  | 
            ||
| 102 | 'HideStepFromCustomerNice' => 'Varchar',  | 
            ||
| 103 | 'HasCustomerMessageNice' => 'Varchar',  | 
            ||
| 104 | 'ShowAsSummary' => 'HTMLText',  | 
            ||
| 105 | 'NameAndDescription' => 'HTMLText'  | 
            ||
| 106 | );  | 
            ||
| 107 | |||
| 108 | /**  | 
            ||
| 109 | * standard SS variable.  | 
            ||
| 110 | *  | 
            ||
| 111 | * @return array  | 
            ||
| 112 | */  | 
            ||
| 113 | private static $searchable_fields = array(  | 
            ||
| 114 | 'Name' => array(  | 
            ||
| 115 | 'title' => 'Name',  | 
            ||
| 116 | 'filter' => 'PartialMatchFilter',  | 
            ||
| 117 | ),  | 
            ||
| 118 | 'Code' => array(  | 
            ||
| 119 | 'title' => 'Code',  | 
            ||
| 120 | 'filter' => 'PartialMatchFilter',  | 
            ||
| 121 | ),  | 
            ||
| 122 | );  | 
            ||
| 123 | |||
| 124 | |||
| 125 | /**  | 
            ||
| 126 | * casted variable.  | 
            ||
| 127 | *  | 
            ||
| 128 | * @return string  | 
            ||
| 129 | */  | 
            ||
| 130 | public function Title()  | 
            ||
| 138 | |||
| 139 | /**  | 
            ||
| 140 | * casted variable.  | 
            ||
| 141 | *  | 
            ||
| 142 | * @return string  | 
            ||
| 143 | */  | 
            ||
| 144 | public function CustomerCanEditNice()  | 
            ||
| 156 | |||
| 157 | /**  | 
            ||
| 158 | * casted variable.  | 
            ||
| 159 | *  | 
            ||
| 160 | * @return string  | 
            ||
| 161 | */  | 
            ||
| 162 | public function CustomerCanPayNice()  | 
            ||
| 174 | |||
| 175 | /**  | 
            ||
| 176 | * casted variable.  | 
            ||
| 177 | *  | 
            ||
| 178 | * @return string  | 
            ||
| 179 | */  | 
            ||
| 180 | public function CustomerCanCancelNice()  | 
            ||
| 192 | |||
| 193 | public function ShowAsUncompletedOrderNice()  | 
            ||
| 205 | |||
| 206 | /**  | 
            ||
| 207 | * casted variable.  | 
            ||
| 208 | *  | 
            ||
| 209 | * @return string  | 
            ||
| 210 | */  | 
            ||
| 211 | public function ShowAsInProcessOrderNice()  | 
            ||
| 223 | |||
| 224 | /**  | 
            ||
| 225 | * casted variable.  | 
            ||
| 226 | *  | 
            ||
| 227 | * @return string  | 
            ||
| 228 | */  | 
            ||
| 229 | public function ShowAsCompletedOrderNice()  | 
            ||
| 241 | |||
| 242 | /**  | 
            ||
| 243 | * do not show in steps at all.  | 
            ||
| 244 | * @return boolean  | 
            ||
| 245 | */  | 
            ||
| 246 | public function HideFromEveryone()  | 
            ||
| 250 | |||
| 251 | /**  | 
            ||
| 252 | * casted variable.  | 
            ||
| 253 | *  | 
            ||
| 254 | * @return string  | 
            ||
| 255 | */  | 
            ||
| 256 | public function HideStepFromCustomerNice()  | 
            ||
| 260 | |||
| 261 | public function getHideStepFromCustomerNice()  | 
            ||
| 269 | |||
| 270 | /**  | 
            ||
| 271 | * standard SS variable.  | 
            ||
| 272 | *  | 
            ||
| 273 | * @return string  | 
            ||
| 274 | */  | 
            ||
| 275 | private static $singular_name = 'Order Step';  | 
            ||
| 276 | public function i18n_singular_name()  | 
            ||
| 280 | |||
| 281 | /**  | 
            ||
| 282 | * standard SS variable.  | 
            ||
| 283 | *  | 
            ||
| 284 | * @return string  | 
            ||
| 285 | */  | 
            ||
| 286 | private static $plural_name = 'Order Steps';  | 
            ||
| 287 | public function i18n_plural_name()  | 
            ||
| 291 | |||
| 292 | /**  | 
            ||
| 293 | * Standard SS variable.  | 
            ||
| 294 | *  | 
            ||
| 295 | * @var string  | 
            ||
| 296 | */  | 
            ||
| 297 | private static $description = 'A step that any order goes through.';  | 
            ||
| 298 | |||
| 299 | /**  | 
            ||
| 300 | * SUPER IMPORTANT TO KEEP ORDER!  | 
            ||
| 301 | * standard SS variable.  | 
            ||
| 302 | *  | 
            ||
| 303 | * @return string  | 
            ||
| 304 | */  | 
            ||
| 305 | private static $default_sort = '"Sort" ASC';  | 
            ||
| 306 | |||
| 307 | /**  | 
            ||
| 308 | * returns all the order steps  | 
            ||
| 309 | * that the admin should / can edit....  | 
            ||
| 310 | *  | 
            ||
| 311 | * @return DataList  | 
            ||
| 312 | */  | 
            ||
| 313 | public static function admin_manageable_steps()  | 
            ||
| 318 | |||
| 319 | /**  | 
            ||
| 320 | * return StatusIDs (orderstep IDs) from orders that are bad....  | 
            ||
| 321 | * (basically StatusID values that do not exist)  | 
            ||
| 322 | *  | 
            ||
| 323 | * @return array  | 
            ||
| 324 | */  | 
            ||
| 325 | public static function bad_order_step_ids()  | 
            ||
| 337 | |||
| 338 | /**  | 
            ||
| 339 | * turns code into ID.  | 
            ||
| 340 | *  | 
            ||
| 341 | * @param string $code  | 
            ||
| 342 | * @param int  | 
            ||
| 343 | */  | 
            ||
| 344 | public static function get_status_id_from_code($code)  | 
            ||
| 355 | |||
| 356 | /**  | 
            ||
| 357 | *@return array  | 
            ||
| 358 | **/  | 
            ||
| 359 | public static function get_codes_for_order_steps_to_include()  | 
            ||
| 372 | |||
| 373 | /**  | 
            ||
| 374 | * returns a list of ordersteps that have not been created yet.  | 
            ||
| 375 | *  | 
            ||
| 376 | * @return array  | 
            ||
| 377 | **/  | 
            ||
| 378 | public static function get_not_created_codes_for_order_steps_to_include()  | 
            ||
| 392 | |||
| 393 | /**  | 
            ||
| 394 | *@return string  | 
            ||
| 395 | **/  | 
            ||
| 396 | public function getMyCode()  | 
            ||
| 405 | |||
| 406 | /**  | 
            ||
| 407 | * IMPORTANT:: MUST HAVE Code must be defined!!!  | 
            ||
| 408 | * standard SS variable.  | 
            ||
| 409 | *  | 
            ||
| 410 | * @return array  | 
            ||
| 411 | */  | 
            ||
| 412 | private static $defaults = array(  | 
            ||
| 413 | 'CustomerCanEdit' => 0,  | 
            ||
| 414 | 'CustomerCanCancel' => 0,  | 
            ||
| 415 | 'CustomerCanPay' => 1,  | 
            ||
| 416 | 'ShowAsUncompletedOrder' => 0,  | 
            ||
| 417 | 'ShowAsInProcessOrder' => 0,  | 
            ||
| 418 | 'ShowAsCompletedOrder' => 0,  | 
            ||
| 419 | 'Code' => 'ORDERSTEP',  | 
            ||
| 420 | );  | 
            ||
| 421 | |||
| 422 | /**  | 
            ||
| 423 | * standard SS method.  | 
            ||
| 424 | */  | 
            ||
| 425 | public function populateDefaults()  | 
            ||
| 430 | |||
| 431 | /**  | 
            ||
| 432 | *@return FieldList  | 
            ||
| 433 | **/  | 
            ||
| 434 | public function getCMSFields()  | 
            ||
| 517 | |||
| 518 | /**  | 
            ||
| 519 | * link to edit the record.  | 
            ||
| 520 | *  | 
            ||
| 521 | * @param string | Null $action - e.g. edit  | 
            ||
| 522 | *  | 
            ||
| 523 | * @return string  | 
            ||
| 524 | */  | 
            ||
| 525 | public function CMSEditLink($action = null)  | 
            ||
| 533 | |||
| 534 | /**  | 
            ||
| 535 | * tells the order to display itself with an alternative display page.  | 
            ||
| 536 | * in that way, orders can be displayed differently for certain steps  | 
            ||
| 537 | * for example, in a print step, the order can be displayed in a  | 
            ||
| 538 | * PRINT ONLY format.  | 
            ||
| 539 | *  | 
            ||
| 540 | * When the method return null, the order is displayed using the standard display page  | 
            ||
| 541 | *  | 
            ||
| 542 | * @see Order::DisplayPage  | 
            ||
| 543 | *  | 
            ||
| 544 | * @return null|object (Page)  | 
            ||
| 545 | **/  | 
            ||
| 546 | public function AlternativeDisplayPage()  | 
            ||
| 550 | |||
| 551 | /**  | 
            ||
| 552 | * Allows the opportunity for the Order Step to add any fields to Order::getCMSFields  | 
            ||
| 553 | * Usually this is added before ActionNextStepManually.  | 
            ||
| 554 | *  | 
            ||
| 555 | * @param FieldList $fields  | 
            ||
| 556 | * @param Order $order  | 
            ||
| 557 | *  | 
            ||
| 558 | * @return FieldList  | 
            ||
| 559 | **/  | 
            ||
| 560 | public function addOrderStepFields(FieldList $fields, Order $order)  | 
            ||
| 564 | |||
| 565 | /**  | 
            ||
| 566 | *@return ValidationResult  | 
            ||
| 567 | **/  | 
            ||
| 568 | public function validate()  | 
            ||
| 586 | |||
| 587 | /**************************************************  | 
            ||
| 588 | * moving between statusses...  | 
            ||
| 589 | **************************************************/  | 
            ||
| 590 | /**  | 
            ||
| 591 | *initStep:  | 
            ||
| 592 | * makes sure the step is ready to run.... (e.g. check if the order is ready to be emailed as receipt).  | 
            ||
| 593 | * should be able to run this function many times to check if the step is ready.  | 
            ||
| 594 | *  | 
            ||
| 595 | * @see Order::doNextStatus  | 
            ||
| 596 | *  | 
            ||
| 597 | * @param Order object  | 
            ||
| 598 | *  | 
            ||
| 599 | * @return bool - true if the current step is ready to be run...  | 
            ||
| 600 | **/  | 
            ||
| 601 | public function initStep(Order $order)  | 
            ||
| 607 | |||
| 608 | /**  | 
            ||
| 609 | *doStep:  | 
            ||
| 610 | * should only be able to run this function once  | 
            ||
| 611 | * (init stops you from running it twice - in theory....)  | 
            ||
| 612 | * runs the actual step.  | 
            ||
| 613 | *  | 
            ||
| 614 | * @see Order::doNextStatus  | 
            ||
| 615 | *  | 
            ||
| 616 | * @param Order object  | 
            ||
| 617 | *  | 
            ||
| 618 | * @return bool - true if run correctly.  | 
            ||
| 619 | **/  | 
            ||
| 620 | public function doStep(Order $order)  | 
            ||
| 626 | |||
| 627 | /**  | 
            ||
| 628 | * nextStep:  | 
            ||
| 629 | * returns the next step (after it checks if everything is in place for the next step to run...).  | 
            ||
| 630 | *  | 
            ||
| 631 | * @see Order::doNextStatus  | 
            ||
| 632 | *  | 
            ||
| 633 | * @param Order $order  | 
            ||
| 634 | *  | 
            ||
| 635 | * @return OrderStep | Null (next step OrderStep object)  | 
            ||
| 636 | **/  | 
            ||
| 637 | public function nextStep(Order $order)  | 
            ||
| 648 | |||
| 649 | /**************************************************  | 
            ||
| 650 | * Boolean checks  | 
            ||
| 651 | **************************************************/  | 
            ||
| 652 | |||
| 653 | /**  | 
            ||
| 654 | * Checks if a step has passed (been completed) in comparison to the current step.  | 
            ||
| 655 | *  | 
            ||
| 656 | * @param string $code: the name of the step to check  | 
            ||
| 657 | * @param bool $orIsEqualTo if set to true, this method will return TRUE if the step being checked is the current one  | 
            ||
| 658 | *  | 
            ||
| 659 | * @return bool  | 
            ||
| 660 | **/  | 
            ||
| 661 | public function hasPassed($code, $orIsEqualTo = false)  | 
            ||
| 679 | |||
| 680 | /**  | 
            ||
| 681 | * @param string $code  | 
            ||
| 682 | *  | 
            ||
| 683 | * @return bool  | 
            ||
| 684 | **/  | 
            ||
| 685 | public function hasPassedOrIsEqualTo($code)  | 
            ||
| 689 | |||
| 690 | /**  | 
            ||
| 691 | * @param string $code  | 
            ||
| 692 | *  | 
            ||
| 693 | * @return bool  | 
            ||
| 694 | **/  | 
            ||
| 695 | public function hasNotPassed($code)  | 
            ||
| 699 | |||
| 700 | /**  | 
            ||
| 701 | * Opposite of hasPassed.  | 
            ||
| 702 | *  | 
            ||
| 703 | * @param string $code  | 
            ||
| 704 | *  | 
            ||
| 705 | * @return bool  | 
            ||
| 706 | **/  | 
            ||
| 707 | public function isBefore($code)  | 
            ||
| 711 | |||
| 712 | /**  | 
            ||
| 713 | *@return bool  | 
            ||
| 714 | **/  | 
            ||
| 715 | protected function isDefaultStatusOption()  | 
            ||
| 719 | |||
| 720 | /**************************************************  | 
            ||
| 721 | |||
| 722 | **************************************************/  | 
            ||
| 723 | |||
| 724 | /**  | 
            ||
| 725 | * @var string  | 
            ||
| 726 | */  | 
            ||
| 727 | protected $emailClassName = '';  | 
            ||
| 728 | |||
| 729 | /**  | 
            ||
| 730 | * returns the email class used for emailing the  | 
            ||
| 731 | * customer during a specific step (IF ANY!).  | 
            ||
| 732 | *  | 
            ||
| 733 | * @return string  | 
            ||
| 734 | */  | 
            ||
| 735 | public function getEmailClassName()  | 
            ||
| 739 | |||
| 740 | /**  | 
            ||
| 741 | * return true if done already or mailed successfully now.  | 
            ||
| 742 | *  | 
            ||
| 743 | * @param order $order  | 
            ||
| 744 | * @param string $subject  | 
            ||
| 745 | * @param string $message  | 
            ||
| 746 | * @param bool $resend  | 
            ||
| 747 | * @param bool | string $adminOnlyOrToEmail you can set to false = send to customer, true: send to admin, or email = send to email  | 
            ||
| 748 | * @param string $emailClassName  | 
            ||
| 749 | *  | 
            ||
| 750 | * @return boolean;  | 
            ||
| 751 | */  | 
            ||
| 752 | protected function sendEmailForStep(  | 
            ||
| 798 | |||
| 799 | /**  | 
            ||
| 800 | * sets the email class used for emailing the  | 
            ||
| 801 | * customer during a specific step (IF ANY!).  | 
            ||
| 802 | *  | 
            ||
| 803 | * @param string  | 
            ||
| 804 | */  | 
            ||
| 805 | public function setEmailClassName($s)  | 
            ||
| 809 | |||
| 810 | /**  | 
            ||
| 811 | * returns a link that can be used to test  | 
            ||
| 812 | * the email being sent during this step  | 
            ||
| 813 | * this method returns NULL if no email  | 
            ||
| 814 | * is being sent OR if there is no suitable Order  | 
            ||
| 815 | * to test with...  | 
            ||
| 816 | *  | 
            ||
| 817 | * @return string  | 
            ||
| 818 | */  | 
            ||
| 819 | protected function testEmailLink()  | 
            ||
| 833 | |||
| 834 | /**  | 
            ||
| 835 | * Has an email been sent to the customer for this  | 
            ||
| 836 | * order step.  | 
            ||
| 837 | *"-10 days".  | 
            ||
| 838 | *  | 
            ||
| 839 | * @param Order $order  | 
            ||
| 840 | * @param bool $checkDateOfOrder  | 
            ||
| 841 | *  | 
            ||
| 842 | * @return bool  | 
            ||
| 843 | **/  | 
            ||
| 844 | public function hasBeenSent(Order $order, $checkDateOfOrder = true)  | 
            ||
| 868 | |||
| 869 | /**  | 
            ||
| 870 | * For some ordersteps this returns true...  | 
            ||
| 871 | *  | 
            ||
| 872 | * @return bool  | 
            ||
| 873 | **/  | 
            ||
| 874 | protected function hasCustomerMessage()  | 
            ||
| 878 | |||
| 879 | /**  | 
            ||
| 880 | * can this order step be delayed?  | 
            ||
| 881 | * @return bool  | 
            ||
| 882 | **/  | 
            ||
| 883 | protected function canBeDefered()  | 
            ||
| 887 | |||
| 888 | /**  | 
            ||
| 889 | * Formatted answer for "hasCustomerMessage".  | 
            ||
| 890 | *  | 
            ||
| 891 | * @return string  | 
            ||
| 892 | */  | 
            ||
| 893 | public function HasCustomerMessageNice()  | 
            ||
| 901 | |||
| 902 | /**  | 
            ||
| 903 | * Formatted answer for "hasCustomerMessage".  | 
            ||
| 904 | *  | 
            ||
| 905 | * @return string  | 
            ||
| 906 | */  | 
            ||
| 907 | public function ShowAsSummary()  | 
            ||
| 911 | |||
| 912 | /**  | 
            ||
| 913 | *  | 
            ||
| 914 | *  | 
            ||
| 915 | * @return string  | 
            ||
| 916 | */  | 
            ||
| 917 | public function getShowAsSummary()  | 
            ||
| 950 | |||
| 951 | /**  | 
            ||
| 952 | * @return string  | 
            ||
| 953 | */  | 
            ||
| 954 | protected function humanReadeableDeferTimeInSeconds()  | 
            ||
| 971 | |||
| 972 | /**  | 
            ||
| 973 | * Formatted answer for "hasCustomerMessage".  | 
            ||
| 974 | *  | 
            ||
| 975 | * @return string  | 
            ||
| 976 | */  | 
            ||
| 977 | public function NameAndDescription()  | 
            ||
| 981 | |||
| 982 | public function getNameAndDescription()  | 
            ||
| 988 | |||
| 989 | /**************************************************  | 
            ||
| 990 | * Order Status Logs  | 
            ||
| 991 | **************************************************/  | 
            ||
| 992 | |||
| 993 | /**  | 
            ||
| 994 | * The OrderStatusLog that is relevant to the particular step.  | 
            ||
| 995 | *  | 
            ||
| 996 | * @var string  | 
            ||
| 997 | */  | 
            ||
| 998 | protected $relevantLogEntryClassName = '';  | 
            ||
| 999 | |||
| 1000 | /**  | 
            ||
| 1001 | * @return string  | 
            ||
| 1002 | */  | 
            ||
| 1003 | public function getRelevantLogEntryClassName()  | 
            ||
| 1007 | |||
| 1008 | /**  | 
            ||
| 1009 | * @param string  | 
            ||
| 1010 | */  | 
            ||
| 1011 | public function setRelevantLogEntryClassName($s)  | 
            ||
| 1015 | |||
| 1016 | /**  | 
            ||
| 1017 | * returns the OrderStatusLog that is relevant to this step.  | 
            ||
| 1018 | *  | 
            ||
| 1019 | * @param Order $order  | 
            ||
| 1020 | *  | 
            ||
| 1021 | * @return OrderStatusLog | null  | 
            ||
| 1022 | */  | 
            ||
| 1023 | public function RelevantLogEntry(Order $order)  | 
            ||
| 1029 | |||
| 1030 | /**  | 
            ||
| 1031 | * returns the OrderStatusLogs that are relevant to this step.  | 
            ||
| 1032 | *  | 
            ||
| 1033 | * @param Order $order  | 
            ||
| 1034 | *  | 
            ||
| 1035 | * @return DataObjectSet | null  | 
            ||
| 1036 | */  | 
            ||
| 1037 | public function RelevantLogEntries(Order $order)  | 
            ||
| 1043 | |||
| 1044 | /**************************************************  | 
            ||
| 1045 | * Silverstripe Standard Data Object Methods  | 
            ||
| 1046 | **************************************************/  | 
            ||
| 1047 | |||
| 1048 | /**  | 
            ||
| 1049 | * Standard SS method  | 
            ||
| 1050 | * These are only created programmatically.  | 
            ||
| 1051 | *  | 
            ||
| 1052 | * @param Member $member  | 
            ||
| 1053 | *  | 
            ||
| 1054 | * @return bool  | 
            ||
| 1055 | */  | 
            ||
| 1056 | public function canCreate($member = null)  | 
            ||
| 1060 | |||
| 1061 | /**  | 
            ||
| 1062 | * Standard SS method.  | 
            ||
| 1063 | *  | 
            ||
| 1064 | * @param Member $member  | 
            ||
| 1065 | *  | 
            ||
| 1066 | * @return bool  | 
            ||
| 1067 | */  | 
            ||
| 1068 | public function canView($member = null)  | 
            ||
| 1083 | |||
| 1084 | /**  | 
            ||
| 1085 | * the default for this is TRUE, but for completed order steps  | 
            ||
| 1086 | *  | 
            ||
| 1087 | * we do not allow this.  | 
            ||
| 1088 | *  | 
            ||
| 1089 | * @param Order $order  | 
            ||
| 1090 | * @param Member $member optional  | 
            ||
| 1091 | * @return bool  | 
            ||
| 1092 | */  | 
            ||
| 1093 | public function canOverrideCanViewForOrder($order, $member = null)  | 
            ||
| 1102 | |||
| 1103 | /**  | 
            ||
| 1104 | * standard SS method.  | 
            ||
| 1105 | *  | 
            ||
| 1106 | * @param Member | NULL  | 
            ||
| 1107 | *  | 
            ||
| 1108 | * @return bool  | 
            ||
| 1109 | */  | 
            ||
| 1110 | public function canEdit($member = null)  | 
            ||
| 1125 | |||
| 1126 | /**  | 
            ||
| 1127 | * Standard SS method.  | 
            ||
| 1128 | *  | 
            ||
| 1129 | * @param Member $member  | 
            ||
| 1130 | *  | 
            ||
| 1131 | * @return bool  | 
            ||
| 1132 | */  | 
            ||
| 1133 | public function canDelete($member = null)  | 
            ||
| 1163 | |||
| 1164 | /**  | 
            ||
| 1165 | * standard SS method.  | 
            ||
| 1166 | */  | 
            ||
| 1167 | public function onBeforeWrite()  | 
            ||
| 1196 | |||
| 1197 | /**  | 
            ||
| 1198 | * move linked orders to the next status  | 
            ||
| 1199 | * standard SS method.  | 
            ||
| 1200 | */  | 
            ||
| 1201 | public function onBeforeDelete()  | 
            ||
| 1222 | |||
| 1223 | /**  | 
            ||
| 1224 | * standard SS method.  | 
            ||
| 1225 | */  | 
            ||
| 1226 | public function onAfterDelete()  | 
            ||
| 1231 | |||
| 1232 | protected function NextOrderStep()  | 
            ||
| 1238 | |||
| 1239 | protected function PreviousOrderStep()  | 
            ||
| 1245 | |||
| 1246 | /**  | 
            ||
| 1247 | * standard SS method  | 
            ||
| 1248 | * USED TO BE: Unpaid,Query,Paid,Processing,Sent,Complete,AdminCancelled,MemberCancelled,Cart.  | 
            ||
| 1249 | */  | 
            ||
| 1250 | public function requireDefaultRecords()  | 
            ||
| 1303 | |||
| 1304 | /**  | 
            ||
| 1305 | * returns the standard EcommerceDBConfig for use within OrderSteps.  | 
            ||
| 1306 | *  | 
            ||
| 1307 | * @return EcommerceDBConfig  | 
            ||
| 1308 | */  | 
            ||
| 1309 | protected function EcomConfig()  | 
            ||
| 1313 | |||
| 1314 | /**  | 
            ||
| 1315 | * Explains the current order step.  | 
            ||
| 1316 | *  | 
            ||
| 1317 | * @return string  | 
            ||
| 1318 | */  | 
            ||
| 1319 | protected function myDescription()  | 
            ||
| 1323 | }  | 
            ||
| 1324 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.