Test::execute()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 2
b 0
f 0
nc 3
nop 2
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright Copyright (c) 2018, Roeland Jago Douma <[email protected]>
7
 *
8
 * @author Roeland Jago Douma <[email protected]>
9
 *
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
namespace OCA\Sentry\Command;
28
29
use OCP\ILogger;
30
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
34
class Test extends Command {
35
	/** @var ILogger */
36
	private $logger;
37
38
	public function __construct(ILogger $logger) {
39
		parent::__construct();
40
		$this->logger = $logger;
41
	}
42
43
	protected function configure() {
44
		$this->setName('sentry:test')
45
			->setDescription('Fire off a test sentry event');
46
	}
47
48
	public function execute(InputInterface $input, OutputInterface $output) {
49
		$this->logger->info("starting sentry test command");
0 ignored issues
show
Deprecated Code introduced by
The function OCP\ILogger::info() has been deprecated: 20.0.0 use \Psr\Log\LoggerInterface::info ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

49
		/** @scrutinizer ignore-deprecated */ $this->logger->info("starting sentry test command");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
50
		try {
51
			$this->logger->warning("you should get at least one Sentry alert soon");
0 ignored issues
show
Deprecated Code introduced by
The function OCP\ILogger::warning() has been deprecated: 20.0.0 use \Psr\Log\LoggerInterface::warning ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

51
			/** @scrutinizer ignore-deprecated */ $this->logger->warning("you should get at least one Sentry alert soon");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
52
			$this->logger->emergency("This is a sentry emergency test message");
0 ignored issues
show
Deprecated Code introduced by
The function OCP\ILogger::emergency() has been deprecated: 20.0.0 use \Psr\Log\LoggerInterface::emergency ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

52
			/** @scrutinizer ignore-deprecated */ $this->logger->emergency("This is a sentry emergency test message");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
53
			throw new \Exception('This is a sentry test exception!');
54
		} catch (\Exception $e) {
55
			$this->logger->logException($e, ['app' => 'sentry']);
0 ignored issues
show
Deprecated Code introduced by
The function OCP\ILogger::logException() has been deprecated: 20.0.0 use the `exception` entry in the context of any method in \Psr\Log\LoggerInterface ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

55
			/** @scrutinizer ignore-deprecated */ $this->logger->logException($e, ['app' => 'sentry']);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
56
		}
57
	}
58
}
59