Passed
Branch feature/code-quality (2bf2a5)
by Filipe
13:16
created

Scope::Singleton()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of slick/di package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Di\Definition;
11
12
/**
13
 * Scope used in the definition
14
 *
15
 * @package Slick\Di\Definition
16
 * @author  Filipe Silva <[email protected]>
17
 *
18
 */
19
class Scope
20
{
21
    private $value;
22
23
    const SINGLETON = 'singleton';
24
    const PROTOTYPE = 'prototype';
25
26
    public function __construct($value)
27
    {
28
        $this->value = $value;
29
    }
30
31
    public static function Singleton()
32
    {
33
        return new Scope(Scope::SINGLETON);
34
    }
35
36
    public static function Prototype()
37
    {
38
        return new Scope(Scope::PROTOTYPE);
39
    }
40
41
    public function __toString()
42
    {
43
        return $this->value;
44
    }
45
}
46