GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

convertToSimpleType()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 8
cp 0
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
namespace Dkd\PhpCmis\Converter\Types\Definitions;
3
4
/*
5
 * This file is part of php-cmis-client.
6
 *
7
 * (c) Sascha Egerer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
use Dkd\PhpCmis\Bindings\Browser\JSONConstants;
14
use Dkd\PhpCmis\Converter\Types\TypeConverterInterface;
15
use Dkd\PhpCmis\Definitions\TypeMutabilityInterface;
16
use Dkd\PhpCmis\Exception\CmisInvalidArgumentException;
17
18
/**
19
 * Convert a Type Mutability Object to a array representation
20
 */
21
class TypeMutabilityInterfaceConverter implements TypeConverterInterface
22
{
23
    /**
24
     * Convert given object to a scalar representation or an array of scalar values.
25
     *
26
     * @param TypeMutabilityInterface $object
27
     * @return boolean[] Array representation of object
28
     * @throws CmisInvalidArgumentException thrown if given object does not implement expected TypeMutabilityInterface
29
     */
30
    public static function convertToSimpleType($object)
31
    {
32
        if (!$object instanceof TypeMutabilityInterface) {
33
            throw new CmisInvalidArgumentException('Given object must be of type TypeMutabilityInterface');
34
        }
35
36
        $result = [];
37
        $result[JSONConstants::JSON_TYPE_TYPE_MUTABILITY_CREATE] = $object->canCreate();
38
        $result[JSONConstants::JSON_TYPE_TYPE_MUTABILITY_UPDATE] = $object->canUpdate();
39
        $result[JSONConstants::JSON_TYPE_TYPE_MUTABILITY_DELETE] = $object->canDelete();
40
41
        return $result;
42
    }
43
}
44