Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2.0116 |
Changes | 0 |
1 | <?php |
||
113 | 4 | public static function getActiveForThisApp() : Subscription |
|
114 | { |
||
115 | 4 | $subscription = self::findFirst([ |
|
116 | 4 | 'conditions' => 'company_id = ?0 and apps_id = ?1 and is_deleted = 0', |
|
117 | 4 | 'bind' => [Di::getDefault()->getUserData()->default_company, Di::getDefault()->getApp()->getId()] |
|
118 | ]); |
||
119 | |||
120 | 4 | if (!is_object($subscription)) { |
|
121 | throw new ServerErrorHttpException(_('No active subscription for this app ' . Di::getDefault()->getApp()->getId() . ' at the company ' . Di::getDefault()->getUserData()->default_company)); |
||
122 | } |
||
123 | |||
124 | 4 | return $subscription; |
|
125 | } |
||
127 |