Completed
Pull Request — master (#114)
by Bart
09:44
created

Volumes::getRecords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace NerdsAndCompany\Schematic\Services;
4
5
use Craft;
6
use craft\base\VolumeInterface;
7
use craft\base\Model;
8
use craft\volumes\Local;
9
use NerdsAndCompany\Schematic\Schematic;
10
11
/**
12
 * Schematic Asset Sources Service.
13
 *
14
 * Sync Craft Setups.
15
 *
16
 * @author    Nerds & Company
17
 * @copyright Copyright (c) 2015-2018, Nerds & Company
18
 * @license   MIT
19
 *
20
 * @see      http://www.nerds.company
21
 */
22
class Volumes extends Base
23
{
24
    /**
25
     * Get all volumes
26
     *
27
     * @return VolumeInterface[]
28
     */
29
    protected function getRecords()
30
    {
31
        return Craft::$app->volumes->getAllVolumes();
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    protected function saveRecord(Model $record, array $definition)
38
    {
39
        return Craft::$app->volumes->saveVolume($record);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    protected function deleteRecord(Model $record)
46
    {
47
        return Craft::$app->volumes->deleteVolume($record);
48
    }
49
}
50