| @@ 60-81 (lines=22) @@ | ||
| 57 | * @throws UnexpectedEntityException | |
| 58 | * @throws InvalidArgumentException | |
| 59 | */ | |
| 60 | public function optimumSalesAtStart($wpdb_row, $request, $controller) | |
| 61 |     { | |
| 62 | $event_obj = null; | |
| 63 |         if (Event::wpdbRowHasEventId($wpdb_row)) { | |
| 64 | $event_obj = $this->event_model->get_one_by_ID($wpdb_row['Event_CPT.ID']); | |
| 65 | } | |
| 66 |         if ($event_obj instanceof EE_Event) { | |
| 67 | return $event_obj->total_available_spaces(); | |
| 68 | } | |
| 69 | throw new EE_Error( | |
| 70 | sprintf( | |
| 71 | __( | |
| 72 | // @codingStandardsIgnoreStart | |
| 73 | 'Cannot calculate optimum_sales_at_start because the event with ID %1$s (from database row %2$s) was not found', | |
| 74 | // @codingStandardsIgnoreEnd | |
| 75 | 'event_espresso' | |
| 76 | ), | |
| 77 | $wpdb_row['Event_CPT.ID'], | |
| 78 | print_r($wpdb_row, true) | |
| 79 | ) | |
| 80 | ); | |
| 81 | } | |
| 82 | ||
| 83 | ||
| 84 | /** | |
| @@ 100-121 (lines=22) @@ | ||
| 97 | * @throws InvalidInterfaceException | |
| 98 | * @throws UnexpectedEntityException | |
| 99 | */ | |
| 100 | public function optimumSalesNow($wpdb_row, $request, $controller) | |
| 101 |     { | |
| 102 | $event_obj = null; | |
| 103 |         if (Event::wpdbRowHasEventId($wpdb_row)) { | |
| 104 | $event_obj = $this->event_model->get_one_by_ID($wpdb_row['Event_CPT.ID']); | |
| 105 | } | |
| 106 |         if ($event_obj instanceof EE_Event) { | |
| 107 | return $event_obj->total_available_spaces(true); | |
| 108 | } | |
| 109 | throw new EE_Error( | |
| 110 | sprintf( | |
| 111 | __( | |
| 112 | // @codingStandardsIgnoreStart | |
| 113 | 'Cannot calculate optimum_sales_now because the event with ID %1$s (from database row %2$s) was not found', | |
| 114 | // @codingStandardsIgnoreEnd | |
| 115 | 'event_espresso' | |
| 116 | ), | |
| 117 | $wpdb_row['Event_CPT.ID'], | |
| 118 | print_r($wpdb_row, true) | |
| 119 | ) | |
| 120 | ); | |
| 121 | } | |
| 122 | ||
| 123 | ||
| 124 | /** | |
| @@ 139-160 (lines=22) @@ | ||
| 136 | * @throws InvalidInterfaceException | |
| 137 | * @throws UnexpectedEntityException | |
| 138 | */ | |
| 139 | public function spacesRemaining($wpdb_row, $request, $controller) | |
| 140 |     { | |
| 141 | $event_obj = null; | |
| 142 |         if (Event::wpdbRowHasEventId($wpdb_row)) { | |
| 143 | $event_obj = $this->event_model->get_one_by_ID($wpdb_row['Event_CPT.ID']); | |
| 144 | } | |
| 145 |         if ($event_obj instanceof EE_Event) { | |
| 146 | return $event_obj->spaces_remaining_for_sale(); | |
| 147 | } | |
| 148 | throw new EE_Error( | |
| 149 | sprintf( | |
| 150 | __( | |
| 151 | // @codingStandardsIgnoreStart | |
| 152 | 'Cannot calculate spaces_remaining because the event with ID %1$s (from database row %2$s) was not found', | |
| 153 | // @codingStandardsIgnoreEnd | |
| 154 | 'event_espresso' | |
| 155 | ), | |
| 156 | $wpdb_row['Event_CPT.ID'], | |
| 157 | print_r($wpdb_row, true) | |
| 158 | ) | |
| 159 | ); | |
| 160 | } | |
| 161 | ||
| 162 | ||
| 163 | /** | |