1 | <?php |
||
14 | trait CompanyDetailsTrait |
||
15 | { |
||
16 | 11 | public function getCompanyDetails() |
|
17 | { |
||
18 | 11 | return $this->getParameter('companyDetails'); |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * Sets the company detail information. |
||
23 | * |
||
24 | * @param Company $company |
||
25 | * |
||
26 | * @return AuthorizeRequest |
||
27 | */ |
||
28 | public function setCompanyDetails($company) |
||
29 | { |
||
30 | return $this->setParameter('companyDetails', $company); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param SimpleXMLElement $data |
||
35 | * |
||
36 | * @throws InvalidRequestException |
||
37 | */ |
||
38 | 11 | protected function appendCompanyDetails(SimpleXMLElement $data) |
|
39 | { |
||
40 | 11 | if ($this->getCompanyDetails()) { |
|
41 | $data->addChild('company_details'); |
||
42 | $this->appendCompanyDetailsAdditional($data, $this->getCompanyDetails()); |
||
43 | } |
||
44 | 11 | } |
|
45 | |||
46 | /** |
||
47 | * Get a single parameter. |
||
48 | * |
||
49 | * @param string $key The parameter key |
||
50 | * |
||
51 | * @return mixed |
||
52 | * |
||
53 | * @codeCoverageIgnore |
||
54 | */ |
||
55 | abstract protected function getParameter($key); |
||
56 | |||
57 | /** |
||
58 | * Set a single parameter. |
||
59 | * |
||
60 | * @param string $key The parameter key |
||
61 | * @param mixed $value The value to set |
||
62 | * |
||
63 | * @return AbstractRequest Provides a fluent interface |
||
64 | * |
||
65 | * @codeCoverageIgnore |
||
66 | */ |
||
67 | abstract protected function setParameter($key, $value); |
||
68 | |||
69 | /** |
||
70 | * Fills additional data. |
||
71 | * |
||
72 | * @param SimpleXMLElement $data |
||
73 | * @param Company $company |
||
74 | */ |
||
75 | private function appendCompanyDetailsAdditional(SimpleXMLElement $data, Company $company) |
||
83 | } |
||
84 |