1 | <?php |
||
27 | class ExportService |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * Repository with registrations for the events |
||
32 | * |
||
33 | * @var \DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository |
||
34 | */ |
||
35 | protected $registrationRepository; |
||
36 | |||
37 | /** |
||
38 | * ResourceFactory |
||
39 | * |
||
40 | * @var \TYPO3\CMS\Core\Resource\ResourceFactory |
||
41 | */ |
||
42 | protected $resourceFactory = null; |
||
43 | |||
44 | /** |
||
45 | * ExportService constructor. |
||
46 | * |
||
47 | * @param RegistrationRepository $registrationRepository |
||
48 | * @param ResourceFactory $resourceFactory |
||
49 | */ |
||
50 | public function __construct(RegistrationRepository $registrationRepository, ResourceFactory $resourceFactory) |
||
55 | 2 | ||
56 | 2 | /** |
|
57 | 1 | * Initiates the CSV downloads for registrations of the given event uid |
|
58 | * |
||
59 | 1 | * @param int $eventUid EventUid |
|
60 | 1 | * @param array $settings Settings |
|
61 | 1 | * @throws Exception RuntimeException |
|
62 | 1 | * @return void |
|
63 | 1 | */ |
|
64 | 1 | public function downloadRegistrationsCsv($eventUid, $settings = []) |
|
77 | |||
78 | 5 | /** |
|
79 | 5 | * Returns all Registrations for the given eventUid as a CSV string |
|
80 | 5 | * |
|
81 | 5 | * @param int $eventUid EventUid |
|
82 | 5 | * @param array $settings Settings |
|
83 | 5 | * @throws Exception RuntimeException |
|
84 | 5 | * @return string |
|
85 | 5 | */ |
|
86 | 5 | public function exportRegistrationsCsv($eventUid, $settings = []) |
|
113 | |||
114 | /** |
||
115 | * Prepends Byte Order Mark to exported registrations |
||
116 | * |
||
117 | * @param string $exportedRegistrations |
||
118 | * @param array $settings |
||
119 | * @return string |
||
120 | */ |
||
121 | protected function prependByteOrderMark($exportedRegistrations, $settings) |
||
128 | |||
129 | /** |
||
130 | * Returns the requested field from the given registration. If the field is a DateTime object, |
||
131 | * a formatted date string is returned |
||
132 | * |
||
133 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration |
||
134 | * @param string $field |
||
135 | * @return string |
||
136 | */ |
||
137 | protected function getFieldValue($registration, $field) |
||
145 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.