console-helpers /
jira-cli
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * This file is part of the Jira-CLI library. |
||||
| 4 | * For the full copyright and license information, please view |
||||
| 5 | * the LICENSE file that was distributed with this source code. |
||||
| 6 | * |
||||
| 7 | * @copyright Alexander Obuhovich <[email protected]> |
||||
| 8 | * @link https://github.com/console-helpers/jira-cli |
||||
| 9 | */ |
||||
| 10 | |||||
| 11 | namespace ConsoleHelpers\JiraCLI; |
||||
| 12 | |||||
| 13 | |||||
| 14 | use chobie\Jira\Api\Authentication\Basic; |
||||
| 15 | use ConsoleHelpers\ConsoleKit\Config\ConfigEditor; |
||||
| 16 | use ConsoleHelpers\JiraCLI\Cache\CacheFactory; |
||||
| 17 | use ConsoleHelpers\JiraCLI\Issue\BackportableIssueCloner; |
||||
| 18 | use ConsoleHelpers\JiraCLI\Issue\ChangeLogIssueCloner; |
||||
| 19 | |||||
| 20 | class Container extends \ConsoleHelpers\ConsoleKit\Container |
||||
| 21 | { |
||||
| 22 | |||||
| 23 | /** |
||||
| 24 | * {@inheritdoc} |
||||
| 25 | */ |
||||
| 26 | 15 | public function __construct(array $values = array()) |
|||
| 27 | { |
||||
| 28 | 15 | parent::__construct($values); |
|||
| 29 | |||||
| 30 | 15 | $this['app_name'] = 'Jira-CLI'; |
|||
| 31 | 15 | $this['app_version'] = '@git-version@'; |
|||
| 32 | |||||
| 33 | 15 | $this['working_directory_sub_folder'] = '.jira-cli'; |
|||
| 34 | |||||
| 35 | 15 | $this['config_defaults'] = array( |
|||
| 36 | 15 | 'jira.url' => '', |
|||
| 37 | 15 | 'jira.username' => '', |
|||
| 38 | 15 | 'jira.password' => '', |
|||
| 39 | 15 | 'cache.provider' => '', |
|||
| 40 | 15 | ); |
|||
| 41 | |||||
| 42 | 15 | $this['cache'] = function ($c) { |
|||
| 43 | /** @var ConfigEditor $config_editor */ |
||||
| 44 | 4 | $config_editor = $c['config_editor']; |
|||
| 45 | 4 | $cache_provider = $config_editor->get('cache.provider'); |
|||
| 46 | |||||
| 47 | 4 | $cache_factory = new CacheFactory('jira_url:' . $config_editor->get('jira.url')); |
|||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 48 | |||||
| 49 | 4 | return $cache_factory->create('chain', array('array', $cache_provider)); |
|||
| 50 | 15 | }; |
|||
| 51 | |||||
| 52 | 15 | $this['jira_api'] = function ($c) { |
|||
| 53 | /** @var ConfigEditor $config_editor */ |
||||
| 54 | 3 | $config_editor = $c['config_editor']; |
|||
| 55 | |||||
| 56 | 3 | $authentication = new Basic( |
|||
| 57 | 3 | $config_editor->get('jira.username'), |
|||
|
0 ignored issues
–
show
It seems like
$config_editor->get('jira.username') can also be of type array and array; however, parameter $user_id of chobie\Jira\Api\Authenti...on\Basic::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 58 | 3 | $config_editor->get('jira.password') |
|||
|
0 ignored issues
–
show
It seems like
$config_editor->get('jira.password') can also be of type array and array; however, parameter $password of chobie\Jira\Api\Authenti...on\Basic::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 59 | 3 | ); |
|||
| 60 | |||||
| 61 | 3 | $api = new JiraApi($config_editor->get('jira.url'), $authentication); |
|||
|
0 ignored issues
–
show
It seems like
$config_editor->get('jira.url') can also be of type array and array; however, parameter $endpoint of ConsoleHelpers\JiraCLI\JiraApi::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 62 | 3 | $api->setCache($c['cache']); |
|||
| 63 | |||||
| 64 | 3 | return $api; |
|||
| 65 | 15 | }; |
|||
| 66 | |||||
| 67 | 15 | $this['backportable_issue_cloner'] = function ($c) { |
|||
| 68 | 1 | return new BackportableIssueCloner($c['jira_api']); |
|||
| 69 | 15 | }; |
|||
| 70 | |||||
| 71 | 15 | $this['changelog_issue_cloner'] = function ($c) { |
|||
| 72 | 1 | return new ChangeLogIssueCloner($c['jira_api']); |
|||
| 73 | 15 | }; |
|||
| 74 | } |
||||
| 75 | |||||
| 76 | } |
||||
| 77 |