Completed
Push — master ( 1ee05e...99144a )
by Gaetano
05:13
created

EzBoolean   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 14
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hashToFieldValue() 0 4 2
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\Core\FieldHandler;
4
5
use eZ\Publish\Core\FieldType\Checkbox\Value as CheckboxValue;
6
use Kaliop\eZMigrationBundle\API\FieldValueImporterInterface;
7
8
class EzBoolean extends AbstractFieldHandler implements FieldValueImporterInterface
9
{
10
    /**
11
     * Creates a value object to use as the field value when setting a boolean field type.
12
     *
13
     * @param $fieldValue int:string:bool should all work
14
     * @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration
15
     * @return CheckboxValue
16
     */
17
    public function hashToFieldValue($fieldValue, array $context = array())
18
    {
19
        return new CheckboxValue(($fieldValue == 1) ? true : false);
20
    }
21
}
22