@@ -31,66 +31,66 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | abstract class BaseNode |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * @var boolean |
|
| 36 | - */ |
|
| 37 | - protected $complete; |
|
| 38 | - /** |
|
| 39 | - * Whether this item has already been initialized |
|
| 40 | - */ |
|
| 41 | - abstract protected function isDiscovered(); |
|
| 34 | + /** |
|
| 35 | + * @var boolean |
|
| 36 | + */ |
|
| 37 | + protected $complete; |
|
| 38 | + /** |
|
| 39 | + * Whether this item has already been initialized |
|
| 40 | + */ |
|
| 41 | + abstract protected function isDiscovered(); |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling |
|
| 45 | - * discover(). |
|
| 46 | - * @since $VID:$ |
|
| 47 | - * @return boolean |
|
| 48 | - */ |
|
| 49 | - abstract public function isComplete(); |
|
| 43 | + /** |
|
| 44 | + * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling |
|
| 45 | + * discover(). |
|
| 46 | + * @since $VID:$ |
|
| 47 | + * @return boolean |
|
| 48 | + */ |
|
| 49 | + abstract public function isComplete(); |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Discovers what work needs to be done to complete traversing this node and its children. |
|
| 53 | - * Note that this is separate from the constructor, so we can create child nodes without |
|
| 54 | - * discovering them immediately. |
|
| 55 | - * @since $VID:$ |
|
| 56 | - * @return mixed |
|
| 57 | - */ |
|
| 58 | - abstract protected function discover(); |
|
| 51 | + /** |
|
| 52 | + * Discovers what work needs to be done to complete traversing this node and its children. |
|
| 53 | + * Note that this is separate from the constructor, so we can create child nodes without |
|
| 54 | + * discovering them immediately. |
|
| 55 | + * @since $VID:$ |
|
| 56 | + * @return mixed |
|
| 57 | + */ |
|
| 58 | + abstract protected function discover(); |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Identifies model objects, up to the limit $model_objects_to_identify. |
|
| 62 | - * @since $VID:$ |
|
| 63 | - * @param int $model_objects_to_identify |
|
| 64 | - * @return int units of work done |
|
| 65 | - */ |
|
| 66 | - abstract protected function work($model_objects_to_identify); |
|
| 60 | + /** |
|
| 61 | + * Identifies model objects, up to the limit $model_objects_to_identify. |
|
| 62 | + * @since $VID:$ |
|
| 63 | + * @param int $model_objects_to_identify |
|
| 64 | + * @return int units of work done |
|
| 65 | + */ |
|
| 66 | + abstract protected function work($model_objects_to_identify); |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Shows the entity/relation node as an array. |
|
| 70 | - * @since $VID:$ |
|
| 71 | - * @return array |
|
| 72 | - */ |
|
| 73 | - abstract public function toArray(); |
|
| 68 | + /** |
|
| 69 | + * Shows the entity/relation node as an array. |
|
| 70 | + * @since $VID:$ |
|
| 71 | + * @return array |
|
| 72 | + */ |
|
| 73 | + abstract public function toArray(); |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work. |
|
| 77 | - * Note: do not call when site is in maintenance mode level 2. |
|
| 78 | - * |
|
| 79 | - * @since $VID:$ |
|
| 80 | - * @param $model_objects_to_identify |
|
| 81 | - * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue |
|
| 82 | - * where we left off. |
|
| 83 | - */ |
|
| 84 | - public function visit($model_objects_to_identify) |
|
| 85 | - { |
|
| 86 | - if (! $this->isDiscovered()) { |
|
| 87 | - $this->discover(); |
|
| 88 | - } |
|
| 89 | - if ($this->isComplete()) { |
|
| 90 | - return 0; |
|
| 91 | - } |
|
| 92 | - return $this->work($model_objects_to_identify); |
|
| 93 | - } |
|
| 75 | + /** |
|
| 76 | + * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work. |
|
| 77 | + * Note: do not call when site is in maintenance mode level 2. |
|
| 78 | + * |
|
| 79 | + * @since $VID:$ |
|
| 80 | + * @param $model_objects_to_identify |
|
| 81 | + * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue |
|
| 82 | + * where we left off. |
|
| 83 | + */ |
|
| 84 | + public function visit($model_objects_to_identify) |
|
| 85 | + { |
|
| 86 | + if (! $this->isDiscovered()) { |
|
| 87 | + $this->discover(); |
|
| 88 | + } |
|
| 89 | + if ($this->isComplete()) { |
|
| 90 | + return 0; |
|
| 91 | + } |
|
| 92 | + return $this->work($model_objects_to_identify); |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | // End of file BaseNode.php |
| 96 | 96 | // Location: EventEspresso\core\services\orm\tree_traversal/BaseNode.php |