1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Fabrica\Tasks; |
7
|
|
|
|
8
|
|
|
use Fabrica\Tools\Databases\Mysql\Mysql as MysqlTool; |
9
|
|
|
use Integrations\Models\Token; |
10
|
|
|
use Integrations\Connectors\Sentry\Sentry; |
11
|
|
|
use Integrations\Connectors\Sentry\Import as SentryImport; |
12
|
|
|
use Integrations\Connectors\Jira\Jira; |
13
|
|
|
use Integrations\Connectors\Jira\Import as JiraImport; |
14
|
|
|
use Integrations\Connectors\Gitlab\Gitlab; |
15
|
|
|
use Integrations\Connectors\Gitlab\Import as GitlabImport; |
16
|
|
|
use Log; |
17
|
|
|
use Operador\Contracts\ActionInterface; |
18
|
|
|
|
19
|
|
|
use Operador\Actions\Action as ActionBase; |
20
|
|
|
|
21
|
|
|
class ImportFromToken extends ActionBase implements ActionInterface |
22
|
|
|
{ |
23
|
|
|
const CODE = 'importIntegrationToken'; |
24
|
|
|
CONST MODEL = \Integrations\Models\Token::class; |
25
|
|
|
const TYPE = \Operador\Actions\Action::ROUTINE; |
26
|
|
|
|
27
|
|
|
protected $token = false; |
28
|
|
|
|
29
|
|
|
public function __construct(Token $token) |
30
|
|
|
{ |
31
|
|
|
$this->token = $token; |
|
|
|
|
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function execute() |
35
|
|
|
{ |
36
|
|
|
if (!$this->token->account || !$this->token->account->status) { |
37
|
|
|
$this->notice('Token ignorado sem account .. '.print_r($this->token, true)); |
38
|
|
|
return false; |
39
|
|
|
} |
40
|
|
|
$this->info('Tratando Token de Integração: '.$this->token->account->integration_id); |
41
|
|
|
|
42
|
|
|
if ($this->token->account->integration_id == Sentry::getCodeForPrimaryKey()) { |
43
|
|
|
SentryImport::makeWithOutput($this->output, $this->token)->handle(); |
44
|
|
|
} else if ($this->token->account->integration_id == Jira::getCodeForPrimaryKey()) { |
45
|
|
|
JiraImport::makeWithOutput($this->output, $this->token)->handle(); |
46
|
|
|
} else if ($this->token->account->integration_id == Gitlab::getCodeForPrimaryKey()) { |
47
|
|
|
GitlabImport::makeWithOutput($this->output, $this->token)->handle(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
return true; |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..