Version2060Date20200302132145::changeSchema()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 6
Ratio 40 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 6
loc 15
rs 9.7666
c 0
b 0
f 0
ccs 0
cts 10
cp 0
cc 2
nc 2
nop 3
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OCA\Richdocuments\Migration;
6
7
use Closure;
8
use OCP\DB\ISchemaWrapper;
9
use OCP\Migration\IOutput;
10
use OCP\Migration\SimpleMigrationStep;
11
12
class Version2060Date20200302132145 extends SimpleMigrationStep
13
{
14
15
	/**
16
	 * @param IOutput $output
17
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
18
	 * @param array $options
19
	 * @return null|ISchemaWrapper
20
	 */
21
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
22
	{
23
		/** @var ISchemaWrapper $schema */
24
		$schema = $schemaClosure();
25
26
		$table = $schema->getTable('richdocuments_wopi');
27 View Code Duplication
		if (!$table->hasColumn('share')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
			$table->addColumn('share', 'string', [
29
				'notnull' => false,
30
				'length' => 64
31
			]);
32
		}
33
34
		return $schema;
35
	}
36
37
}
38