| @@ 17-36 (lines=20) @@ | ||
| 14 | * @param $options |
|
| 15 | * @return callable|\Swift_Message |
|
| 16 | */ |
|
| 17 | public function getSwiftMessage($options) |
|
| 18 | { |
|
| 19 | if (empty($options['message'])) { |
|
| 20 | throw new MissingConfigException( |
|
| 21 | 'No message service name or callback provided' |
|
| 22 | ); |
|
| 23 | } |
|
| 24 | ||
| 25 | if (is_callable($options['message'])) { |
|
| 26 | return $options['message']; |
|
| 27 | } |
|
| 28 | ||
| 29 | if (!$this->getContainer()->has($options['message'])) { |
|
| 30 | throw new MissingServiceException( |
|
| 31 | 'No Message service found' |
|
| 32 | ); |
|
| 33 | } |
|
| 34 | ||
| 35 | return $this->getContainer()->get($options['message']); |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||
| @@ 29-48 (lines=20) @@ | ||
| 26 | ); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function getServerDataService(array $options) |
|
| 30 | { |
|
| 31 | if (empty($options['serverData'])) { |
|
| 32 | return null; |
|
| 33 | } |
|
| 34 | ||
| 35 | if ( |
|
| 36 | is_array($options['serverData']) |
|
| 37 | || $options['serverData'] instanceof ArrayAccess |
|
| 38 | ) { |
|
| 39 | return $options['serverData']; |
|
| 40 | } |
|
| 41 | ||
| 42 | if (!$this->getContainer()->has($options['serverData'])) { |
|
| 43 | throw new MissingServiceException( |
|
| 44 | 'No serverData service found' |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | return $this->getContainer()->get($options['serverData']); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||