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

StorageMetadataFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 25
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getNewInstance() 0 4 1
A handleLoad() 0 3 1
A handleValidate() 0 4 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