| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0116 |
| Changes | 0 | ||
| 1 | <?php |
||
| 150 | 3 | public static function getActiveForThisApp() : Subscription |
|
| 151 | { |
||
| 152 | 3 | $subscription = self::findFirst([ |
|
| 153 | 3 | 'conditions' => 'companies_id = ?0 and apps_id = ?1 and is_deleted = 0', |
|
| 154 | 3 | 'bind' => [Di::getDefault()->getUserData()->currentCompanyId(), Di::getDefault()->getApp()->getId()] |
|
| 155 | ]); |
||
| 156 | |||
| 157 | 3 | if (!is_object($subscription)) { |
|
| 158 | throw new ServerErrorHttpException(_('No active subscription for this app ' . Di::getDefault()->getApp()->getId() . ' at the company ' . Di::getDefault()->getUserData()->currentCompanyId())); |
||
| 159 | } |
||
| 160 | |||
| 161 | 3 | return $subscription; |
|
| 162 | } |
||
| 164 |