|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Copyright 2021 Google Inc. |
| 5 | + * |
| 6 | + * This program is free software; you can redistribute it and/or modify it under |
| 7 | + * the terms of the GNU General Public License version 2 as published by the |
| 8 | + * Free Software Foundation. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 12 | + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 13 | + * License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License along |
| 16 | + * with this program; if not, write to the Free Software Foundation, Inc., 51 |
| 17 | + * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | + */ |
| 19 | + |
| 20 | +namespace Drupal\apigee_edge\Exception; |
| 21 | + |
| 22 | +use Apigee\Edge\Exception\ApiException; |
| 23 | + |
| 24 | +/** |
| 25 | + * This exception is thrown when the developer profile update fails. |
| 26 | + */ |
| 27 | +final class DeveloperUpdateFailedException extends ApiException implements ApigeeEdgeExceptionInterface { |
| 28 | + |
| 29 | + /** |
| 30 | + * Email address of the developer. |
| 31 | + * |
| 32 | + * @var string |
| 33 | + */ |
| 34 | + private $email; |
| 35 | + |
| 36 | + /** |
| 37 | + * DeveloperUpdateFailedException constructor. |
| 38 | + * |
| 39 | + * @param string $email |
| 40 | + * Developer email. |
| 41 | + * @param string $message |
| 42 | + * Exception message. |
| 43 | + * @param int $code |
| 44 | + * Error code. |
| 45 | + * @param \Throwable|null $previous |
| 46 | + * Previous exception. |
| 47 | + */ |
| 48 | + public function __construct(string $email, string $message = 'Developer @email profile update failed.', int $code = 0, \Throwable $previous = NULL) { |
| 49 | + $this->email = $email; |
| 50 | + $message = strtr($message, ['@email' => $email]); |
| 51 | + parent::__construct($message, $code, $previous); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Email address of the developer. |
| 56 | + * |
| 57 | + * @return string |
| 58 | + * Email address. |
| 59 | + */ |
| 60 | + public function getEmail(): string { |
| 61 | + return $this->email; |
| 62 | + } |
| 63 | + |
| 64 | +} |
0 commit comments