Completed
Push — master ( 98eac7...758f15 )
by Jacob
02:28
created

StorageMetadataFactory::handleValidate()   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
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace As3\Modlr\Search\Elastic;
4
5
use As3\Modlr\Util\EntityUtility;
6
use As3\Modlr\Exception\MetadataException;
7
use As3\Modlr\Metadata\EntityMetadata;
8
use As3\Modlr\Metadata\Interfaces\StorageMetadataFactoryInterface;
9
10
/**
11
 * Creates Elastic search storage Metadata instances for use with metadata drivers.
12
 * Is also responsible for validating storage objects.
13
 *
14
 * @author Jacob Bare <[email protected]>
15
 */
16
final class StorageMetadataFactory implements StorageMetadataFactoryInterface
17
{
18
    /**
19
     * {@inheritDoc}
20
     */
21
    public function getNewInstance()
22
    {
23
        return new StorageMetadata();
24
    }
25
26
    /**
27
     * {@inheritDoc}
28
     */
29
    public function handleLoad(EntityMetadata $metadata)
30
    {
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function handleValidate(EntityMetadata $metadata)
37
    {
38
        $search = $metadata->search;
0 ignored issues
show
Unused Code introduced by
$search is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
39
    }
40
}
41