Completed
Push — 1.0 ( 75b22b...f155d9 )
by Peter
15:56 queued 05:56
created

ArgumentToSelectionConverter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A toSelection() 0 8 2
1
<?php
2
3
namespace Happyr\DoctrineSpecification\Query\Selection;
4
5
use Happyr\DoctrineSpecification\Operand\Field;
6
7
/**
8
 * This service is intended for backward compatibility and may be removed in the future.
9
 */
10
class ArgumentToSelectionConverter
11
{
12
    /**
13
     * Convert the argument into the field operand if it is not an selection.
14
     *
15
     * @param Selection|string $argument
16
     *
17
     * @return Selection
18
     */
19
    public static function toSelection($argument)
20
    {
21
        if ($argument instanceof Selection) {
22
            return $argument;
23
        }
24
25
        return new Field($argument);
26
    }
27
}
28