Passed
Push — wip-public-release ( a47743...14cdbd )
by Bogdan
02:52
created

FunctionSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getParameters() 0 4 1
A getExceptions() 0 4 1
A getReturn() 0 4 1
A needsExecutionContext() 0 4 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the pinepain/js-sandbox PHP library.
5
 *
6
 * Copyright (c) 2016-2017 Bogdan Padalko <[email protected]>
7
 *
8
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
9
 *
10
 * For the full copyright and license information, please view the
11
 * LICENSE file that was distributed with this source or visit
12
 * http://opensource.org/licenses/MIT
13
 */
14
15
16
namespace Pinepain\JsSandbox\Specs;
17
18
19
use Pinepain\JsSandbox\Specs\ReturnSpec\ReturnSpecInterface;
20
use Pinepain\JsSandbox\Specs\ThrowSpec\ThrowSpecListInterface;
21
22
23
class FunctionSpec implements FunctionSpecInterface
24
{
25
    /**
26
     * @var ParametersListInterface
27
     */
28
    private $parameters;
29
    /**
30
     * @var ThrowSpecListInterface
31
     */
32
    private $exceptions;
33
34
    /**
35
     * @var ReturnSpecInterface
36
     */
37
    private $return;
38
    /**
39
     * @var bool
40
     */
41
    private $needs_execution_context;
42
43
    /**
44
     * @param ParametersListInterface $parameters
45
     * @param ThrowSpecListInterface  $exceptions
46
     * @param ReturnSpecInterface     $return
47
     * @param bool                    $needs_execution_context
48
     */
49 8
    public function __construct(ParametersListInterface $parameters, ThrowSpecListInterface $exceptions, ReturnSpecInterface $return, bool $needs_execution_context = false)
50
    {
51 8
        $this->parameters              = $parameters;
52 8
        $this->exceptions              = $exceptions;
53 8
        $this->return                  = $return;
54 8
        $this->needs_execution_context = $needs_execution_context;
55 8
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 1
    public function getParameters(): ParametersListInterface
61
    {
62 1
        return $this->parameters;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 2
    public function getExceptions(): ThrowSpecListInterface
69
    {
70 2
        return $this->exceptions;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 3
    public function getReturn(): ReturnSpecInterface
77
    {
78 3
        return $this->return;
79
    }
80
81 8
    public function needsExecutionContext(): bool
82
    {
83 8
        return $this->needs_execution_context;
84
    }
85
}
86