Version20170808222334   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 24
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A run() 0 6 2
1
<?php
2
/**
3
 * Files_antivirus
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Viktar Dubiniuk <[email protected]>
9
 *
10
 * @copyright Viktar Dubiniuk 2018
11
 * @license AGPL-3.0
12
 */
13
14
namespace OCA\Files_Antivirus\Migrations;
15
use OCA\Files_Antivirus\Db\RuleMapper;
16
use OCP\Migration\IOutput;
17
use OCP\Migration\ISimpleMigration;
18
19
/**
20
 * Populate statuses
21
 */
22
class Version20170808222334 implements ISimpleMigration {
23
	private $ruleMapper;
24
25
	/**
26
	 * Version20170808222334 constructor.
27
	 *
28
	 * @param RuleMapper $ruleMapper
29
	 */
30
	public function __construct(RuleMapper $ruleMapper) {
31
		$this->ruleMapper = $ruleMapper;
32
	}
33
34
	/**
35
	 * @param IOutput $out
36
	 *
37
	 * @return void
38
	 */
39
	public function run(IOutput $out) {
40
		$rules = $this->ruleMapper->findAll();
41
		if (!\count($rules)) {
42
			$this->ruleMapper->populate();
43
		}
44
	}
45
}
46