Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\AbstractIntegration;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
class AbstractPluginIntegrationEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @var AbstractIntegration
|
||||
*/
|
||||
protected $integration;
|
||||
|
||||
/**
|
||||
* Get the integration's name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getIntegrationName()
|
||||
{
|
||||
return $this->integration->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the integration object.
|
||||
*
|
||||
* @return AbstractIntegration
|
||||
*/
|
||||
public function getIntegration()
|
||||
{
|
||||
return $this->integration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Mautic\PluginBundle\Entity\Plugin;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
class PluginInstallEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @param array<class-string, ClassMetadata>|null $metadata
|
||||
*/
|
||||
public function __construct(
|
||||
private Plugin $plugin,
|
||||
private ?array $metadata,
|
||||
private ?bool $installedSchema,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getPlugin(): Plugin
|
||||
{
|
||||
return $this->plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<class-string, ClassMetadata>|null
|
||||
*/
|
||||
public function getMetadata(): ?array
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
public function getInstalledSchema(): ?bool
|
||||
{
|
||||
return $this->installedSchema;
|
||||
}
|
||||
|
||||
public function checkContext(string $pluginName): bool
|
||||
{
|
||||
return $pluginName === $this->plugin->getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
class PluginIntegrationAuthCallbackUrlEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
/**
|
||||
* @param string $callbackUrl
|
||||
*/
|
||||
public function __construct(
|
||||
UnifiedIntegrationInterface $integration,
|
||||
private $callbackUrl,
|
||||
) {
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCallbackUrl()
|
||||
{
|
||||
return $this->callbackUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $callbackUrl
|
||||
*/
|
||||
public function setCallbackUrl($callbackUrl): void
|
||||
{
|
||||
$this->callbackUrl = $callbackUrl;
|
||||
|
||||
$this->stopPropagation();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
class PluginIntegrationAuthRedirectEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
/**
|
||||
* @param string $authUrl
|
||||
*/
|
||||
public function __construct(
|
||||
UnifiedIntegrationInterface $integration,
|
||||
private $authUrl,
|
||||
) {
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthUrl()
|
||||
{
|
||||
return $this->authUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $authUrl
|
||||
*/
|
||||
public function setAuthUrl($authUrl): void
|
||||
{
|
||||
$this->authUrl = $authUrl;
|
||||
|
||||
$this->stopPropagation();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Entity\Integration;
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
class PluginIntegrationEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
public function __construct(UnifiedIntegrationInterface $integration)
|
||||
{
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Integration
|
||||
*/
|
||||
public function getEntity()
|
||||
{
|
||||
return $this->integration->getIntegrationSettings();
|
||||
}
|
||||
|
||||
public function setEntity(Integration $integration): void
|
||||
{
|
||||
$this->integration->setIntegrationSettings($integration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class PluginIntegrationFormBuildEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
public function __construct(
|
||||
UnifiedIntegrationInterface $integration,
|
||||
private FormBuilderInterface $builder,
|
||||
private array $options,
|
||||
) {
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FormBuilderInterface
|
||||
*/
|
||||
public function getFormBuilder()
|
||||
{
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
class PluginIntegrationFormDisplayEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public function __construct(
|
||||
UnifiedIntegrationInterface $integration,
|
||||
private array $settings,
|
||||
) {
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
public function setSettings(array $settings): void
|
||||
{
|
||||
$this->settings = $settings;
|
||||
|
||||
$this->stopPropagation();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
class PluginIntegrationKeyEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
public function __construct(
|
||||
UnifiedIntegrationInterface $integration,
|
||||
private ?array $keys = null,
|
||||
) {
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the keys array.
|
||||
*/
|
||||
public function getKeys()
|
||||
{
|
||||
return $this->keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new keys array.
|
||||
*/
|
||||
public function setKeys(array $keys): void
|
||||
{
|
||||
$this->keys = $keys;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class PluginIntegrationRequestEvent extends AbstractPluginIntegrationEvent
|
||||
{
|
||||
private ?ResponseInterface $response = null;
|
||||
|
||||
/**
|
||||
* @param mixed[] $parameters
|
||||
* @param string $method
|
||||
* @param mixed[] $settings
|
||||
* @param string $authType
|
||||
*/
|
||||
public function __construct(
|
||||
UnifiedIntegrationInterface $integration,
|
||||
private $url,
|
||||
private $parameters,
|
||||
private $headers,
|
||||
private $method,
|
||||
private $settings,
|
||||
private $authType,
|
||||
) {
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
public function setParameters(array $parameters): void
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthType()
|
||||
{
|
||||
return $this->authType;
|
||||
}
|
||||
|
||||
public function setResponse(ResponseInterface $response): void
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function getResponse(): ResponseInterface
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHeaders()
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
public function setHeaders(array $headers): void
|
||||
{
|
||||
$this->headers = $headers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
class PluginIsPublishedEvent extends \Symfony\Contracts\EventDispatcher\Event
|
||||
{
|
||||
private string $message = '';
|
||||
private bool $canPublish = true;
|
||||
|
||||
public function __construct(private int $value, private string $integrationName)
|
||||
{
|
||||
}
|
||||
|
||||
public function getValue(): int
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function setMessage(string $message): void
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
public function isCanPublish(): bool
|
||||
{
|
||||
return $this->canPublish;
|
||||
}
|
||||
|
||||
public function setCanPublish(bool $canPublish): void
|
||||
{
|
||||
$this->canPublish = $canPublish;
|
||||
}
|
||||
|
||||
public function getIntegrationName(): string
|
||||
{
|
||||
return $this->integrationName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\PluginBundle\Event;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Mautic\PluginBundle\Entity\Plugin;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
class PluginUpdateEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @param array<class-string, ClassMetadata> $metadata
|
||||
*/
|
||||
public function __construct(
|
||||
private Plugin $plugin,
|
||||
private string $oldVersion,
|
||||
private array $metadata,
|
||||
private ?Schema $installedSchema,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getPlugin(): Plugin
|
||||
{
|
||||
return $this->plugin;
|
||||
}
|
||||
|
||||
public function getOldVersion(): string
|
||||
{
|
||||
return $this->oldVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<class-string, ClassMetadata>
|
||||
*/
|
||||
public function getMetadata(): array
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
public function getInstalledSchema(): ?Schema
|
||||
{
|
||||
return $this->installedSchema;
|
||||
}
|
||||
|
||||
public function checkContext(string $pluginName): bool
|
||||
{
|
||||
return $pluginName === $this->plugin->getName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user