1 <?php
2
3 /*
4 * DirectAdmin API Client
5 * (c) Omines Internetbureau B.V. - https://omines.nl/
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11 namespace Omines\DirectAdmin\Objects\Email;
12
13 use Omines\DirectAdmin\Objects\DomainObject;
14
15 /**
16 * Base class for objects exposing a mail address.
17 *
18 * @author Niels Keurentjes <niels.keurentjes@omines.com>
19 */
20 abstract class MailObject extends DomainObject
21 {
22 /**
23 * Delete the object.
24 *
25 * @param string $command Command to execute
26 * @param string $paramName Parameter name for the delete command
27 */
28 protected function invokeDelete($command, $paramName)
29 {
30 $this->invokePost($command, 'delete', [$paramName => $this->getPrefix()]);
31 }
32
33 /**
34 * Returns the full email address for this forwarder.
35 *
36 * @return string
37 */
38 public function getEmailAddress()
39 {
40 return $this->getPrefix() . '@' . $this->getDomainName();
41 }
42
43 /**
44 * Returns the domain-agnostic part before the @ in the forwarder.
45 *
46 * @return string
47 */
48 public function getPrefix()
49 {
50 return $this->getName();
51 }
52 }
53