Completed
Push — master ( 3563e8...eabdc7 )
by Nikola
04:08
created

NullDestination::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * This file is part of the Backup package, an RunOpenCode project.
4
 *
5
 * (c) 2015 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * This project is fork of "kbond/php-backup", for full credits info, please
11
 * view CREDITS file that was distributed with this source code.
12
 */
13
namespace RunOpenCode\Backup\Destination;
14
15
use RunOpenCode\Backup\Contract\BackupInterface;
16
use RunOpenCode\Backup\Contract\DestinationInterface;
17
18
/**
19
 * Class NullDestination
20
 *
21
 * Null destination does not contains or store any backups.
22
 *
23
 * @package RunOpenCode\Backup\Destination
24
 */
25
class NullDestination implements DestinationInterface
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getIterator()
31
    {
32
        return new \ArrayIterator(array());
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 2
    public function push(BackupInterface $backup)
39
    {
40
        // Do nothing.
41 2
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function get($name)
47
    {
48
        throw new \RuntimeException('Null destination does not have backups to fetch.');
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function delete($name)
55
    {
56
        throw new \RuntimeException('Null destination does not have backups to delete.');
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 4
    public function all()
63
    {
64 4
        return array();
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function has($name)
71
    {
72
        return false;
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78 4
    public function count()
79
    {
80 4
        return 0;
81
    }
82
}
83