1 | <?php |
||
2 | |||
3 | /* |
||
4 | * @copyright 2014 Mautic Contributors. All rights reserved |
||
5 | * @author Mautic |
||
6 | * |
||
7 | * @link http://mautic.org |
||
8 | * |
||
9 | * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html |
||
10 | */ |
||
11 | |||
12 | namespace MauticPlugin\MauticCloudStorageBundle\Integration; |
||
13 | |||
14 | use Gaufrette\Adapter; |
||
15 | use Mautic\PluginBundle\Integration\AbstractIntegration; |
||
16 | use MauticPlugin\MauticCloudStorageBundle\Exception\NoFormNeededException; |
||
17 | |||
18 | abstract class CloudStorageIntegration extends AbstractIntegration |
||
19 | { |
||
20 | /** |
||
21 | * @var Adapter |
||
22 | */ |
||
23 | protected $adapter; |
||
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public function appendToForm(&$builder, $data, $formArea) |
||
29 | { |
||
30 | if ('features' !== $formArea) { |
||
31 | return; |
||
32 | } |
||
33 | |||
34 | try { |
||
35 | $builder->add( |
||
36 | 'provider', |
||
37 | $this->getForm(), |
||
38 | [ |
||
39 | 'label' => 'mautic.integration.form.provider.settings', |
||
40 | 'required' => false, |
||
41 | 'data' => (isset($data['provider'])) ? $data['provider'] : [], |
||
42 | ] |
||
43 | ); |
||
44 | } catch (NoFormNeededException $e) { |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
![]() |
|||
45 | } |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function getAuthenticationType() |
||
52 | { |
||
53 | return 'api'; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Retrieves an Adapter object for this integration. |
||
58 | * |
||
59 | * @return Adapter |
||
60 | */ |
||
61 | abstract public function getAdapter(); |
||
62 | |||
63 | /** |
||
64 | * Retrieves FQCN form type class name. |
||
65 | * |
||
66 | * @return string |
||
67 | * |
||
68 | * @throws NoFormNeededException |
||
69 | */ |
||
70 | abstract public function getForm(); |
||
71 | |||
72 | /** |
||
73 | * Retrieves the public URL for a given key. |
||
74 | * |
||
75 | * @param string $key |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | abstract public function getPublicUrl($key); |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function getSupportedFeatures() |
||
85 | { |
||
86 | return ['cloud_storage']; |
||
87 | } |
||
88 | } |
||
89 |