Passed
Push — 2.3.0 ( ...813ccf )
by steve
17:15
created

FileController::actionUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 1
ccs 0
cts 4
cp 0
crap 2
1
<?php
2
/**
3
 * @link http://www.newicon.net/neon
4
 * @copyright Copyright (c) 2017 Newicon Ltd
5
 * @license http://www.newicon.net/neon/license/
6
 * @author Steve O'Brien <[email protected]> 25/05/2017
7
 * @package neon
8
 */
9
10
namespace neon\firefly\controllers\api;
11
12
use neon\core\web\ApiController;
13
use neon\firefly\services\fileManager\actions\DownloadAction;
14
use neon\firefly\services\fileManager\actions\UploadAction;
15
use neon\firefly\services\fileManager\actions\MetaAction;
16
17
class FileController extends ApiController
18
{
19
	/**
20
	 * @inheritdoc
21
	 */
22
	public function rules()
23
	{
24
		$rules = neon()->firefly->fileAccessRules;
25
		return empty($rules) ? parent::rules() : $rules;
26
	}
27
28
	public function verbs()
29
	{
30
		return [
31
			'meta' => ['GET', 'POST'],
32
			'upload' => ['POST'],
33
			'download' => ['GET', 'POST'],
34
			'update' => ['POST']
35
		];
36
	}
37
38
	/**
39
	 * @param $id
40
	 * @return array
41
	 * @throws \yii\base\InvalidConfigException
42
	 */
43
	public function actionUpdate($id)
44
	{
45
		$updates = neon()->request->getBodyParams();
46
		return neon()->firefly->fileManager->update($id, $updates);
0 ignored issues
show
Bug introduced by
The method update() does not exist on neon\firefly\services\fi...interfaces\IFileManager. Since it exists in all sub-types, consider adding an abstract or default implementation to neon\firefly\services\fi...interfaces\IFileManager. ( Ignorable by Annotation )

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

46
		return neon()->firefly->fileManager->/** @scrutinizer ignore-call */ update($id, $updates);
Loading history...
47
	}
48
49
	public function actions()
50
	{
51
		return [
52
			'upload' => UploadAction::class,
53
			'meta' => MetaAction::class,
54
			'download' => DownloadAction::class,
55
		];
56
	}
57
}
58