AFile::deleteRecord()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
namespace kalanis\kw_mapper\Mappers\File;
4
5
6
use kalanis\kw_files\FilesException;
7
use kalanis\kw_mapper\MapperException;
8
use kalanis\kw_mapper\Mappers\Shared\TFile;
9
use kalanis\kw_mapper\Records\ARecord;
10
use kalanis\kw_mapper\Records\PageRecord;
11
use kalanis\kw_paths\PathsException;
12
13
14
/**
15
 * Class AFile
16
 * @package kalanis\kw_mapper\Mappers\File
17
 * Abstract layer for working with single files as content source
18
 */
19
abstract class AFile extends AFileSource
20
{
21
    use TFile;
22
23
    /**
24
     * @param ARecord|PageRecord $record
25
     * @throws MapperException
26
     * @return bool
27
     */
28 1
    protected function deleteRecord(ARecord $record): bool
29
    {
30
        try {
31 1
            return $this->getFileAccessor()->deleteFile($this->getPath());
32 1
        } catch (FilesException | PathsException $ex) {
33 1
            return false;
34
        }
35
    }
36
}
37