UrlOptionsBuilder::getDefaultProtocol()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace steevanb\SymfonyFormOptionsBuilder\OptionsBuilder;
4
5
6
use steevanb\SymfonyFormOptionsBuilder\Behavior\OptionAccessorsTrait;
7
use Symfony\Component\Form\Extension\Core\Type\UrlType;
8
9 View Code Duplication
class UrlOptionsBuilder extends AbstractOptionsBuilder
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    use OptionAccessorsTrait;
12
    use Behavior\AttrPlaceHolderTrait;
13
    use Behavior\AutofocusTrait;
14
    use Behavior\AutocompleteTrait;
15
16
    const PROTOCOL_HTTP = 'http';
17
    const PROTOCOL_HTTPS = 'https';
18
    const PROTOCOL_FTP = 'ftp';
19
20
    /**
21
     * @return string
22
     */
23
    public static function getBuilderType()
24
    {
25
        return UrlType::class;
26
    }
27
28
    /**
29
     * @param mixed $protocol
30
     * @return $this
31
     * @link http://symfony.com/doc/current/reference/forms/types/url.html#default-protocol
32
     */
33
    public function setDefaultProtocol($protocol)
34
    {
35
        return $this->setOption('default_protocol', $protocol);
36
    }
37
38
    /**
39
     * @return mixed
40
     */
41
    public function getDefaultProtocol()
42
    {
43
        return $this->getOption('default_protocol');
44
    }
45
}
46