| Conditions | 7 |
| Paths | 7 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public static function getOrganization($organization) |
||
| 34 | { |
||
| 35 | if (!$organization) { |
||
| 36 | return null; |
||
| 37 | } |
||
| 38 | $class = Yii::$app->user->identity->organizationClass; |
||
| 39 | if ($organization instanceof $class) { |
||
| 40 | $organization = $organization->getID(); |
||
| 41 | } |
||
| 42 | if (is_numeric($organization) || is_int($organization)) { |
||
| 43 | return $class::find()->id($organization)->one(); |
||
| 44 | } |
||
| 45 | if (is_string($organization) && strlen($organization) == 16) { |
||
| 46 | return $class::find()->guid($organization)->one(); |
||
| 47 | } |
||
| 48 | return null; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |