ManageBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 38
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add_assets() 0 6 1
A __construct() 0 8 1
A get_available_columns() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Icybee package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Icybee\Modules\Files\Block;
13
14
use Brickrouge\Document;
15
16
use Icybee\Modules\Files as Root;
17
use Icybee\Modules\Files\File;
18
use Icybee\Modules\Files\Module;
19
20
/**
21
 * A block to manage files.
22
 */
23
class ManageBlock extends \Icybee\Modules\Nodes\Block\ManageBlock
24
{
25
	static protected function add_assets(Document $document)
26
	{
27
		parent::add_assets($document);
28
29
		$document->css->add(Root\DIR . '/public/manage.css');
30
	}
31
32
	public function __construct(Module $module, array $attributes)
33
	{
34
		parent::__construct($module, $attributes + [
35
36
			self::T_COLUMNS_ORDER => [ 'title', 'size', 'download', 'is_online', 'uid', 'mime', 'updated_at' ]
37
38
		]);
39
	}
40
41
	/**
42
	 * Adds the following columns:
43
	 *
44
	 * - `mime`: An instance of {@link ManageBlock\MimeColumn}.
45
	 * - `size`: An instance of {@link ManageBlock\SizeColumn}.
46
	 * - `download`: An instance of {@link ManageBlock\DownloadColumn}.
47
	 *
48
	 * @return array
49
	 */
50
	protected function get_available_columns()
51
	{
52
		return array_merge(parent::get_available_columns(), [
53
54
			File::MIME => ManageBlock\MimeColumn::class,
55
			File::SIZE => ManageBlock\SizeColumn::class,
56
			'download' => ManageBlock\DownloadColumn::class
57
58
		]);
59
	}
60
}
61