| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | public function firstOrCreateLabel($userEmail, $newLabel) |
||
| 46 | { |
||
| 47 | $labels = $this->labelsList($userEmail); |
||
| 48 | |||
| 49 | foreach ($labels->getLabels() as $existLabel) { |
||
| 50 | if ($existLabel->getName() == $newLabel->getName()) { |
||
| 51 | return $existLabel; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | $service = new Google_Service_Gmail($this); |
||
| 56 | |||
| 57 | return $service->users_labels->create($userEmail, $newLabel); |
||
| 58 | } |
||
| 59 | } |