| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public static function handle(ModelEvent $event) |
||
| 25 | { |
||
| 26 | /** @var Token $token */ |
||
| 27 | $token = $event->sender; |
||
| 28 | |||
| 29 | // Ignore if already set |
||
| 30 | if ($token->isRelationPopulated('environments') === true) { |
||
| 31 | return; |
||
| 32 | } |
||
| 33 | |||
| 34 | $token->setEnvironments( |
||
| 35 | $token->getProvider()->getEnvironments()->select('environment')->column() |
||
| 36 | ); |
||
| 37 | $token->autoSaveEnvironments = true; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |