Completed
Pull Request — 3.1 (#290)
by
unknown
09:17
created

BaseEntityScope   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 58
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getContext() 0 3 1
A getEntity() 0 3 1
A getEnvironment() 0 3 1
A getSuite() 0 3 1
1
<?php
2
/**
3
 * @file
4
 * Entity scope.
5
 */
6
namespace Drupal\DrupalExtension\Hook\Scope;
7
8
use Behat\Behat\Context\Context;
9
use Behat\Testwork\Environment\Environment;
10
use Behat\Testwork\Hook\Scope\HookScope;
11
12
/**
13
 * Represents an Entity hook scope.
14
 */
15
abstract class BaseEntityScope implements EntityScope {
16
17
  /**
18
   * @var Environment
19
   */
20
  private $environment;
21
22
  /**
23
   * Context object.
24
   *
25
   * @var \Behat\Behat\Context\Context
26
   */
27
  private $context;
28
29
  /**
30
   * Entity object.
31
   */
32
  private $entity;
33
34
  /**
35
   * Initializes the scope.
36
   */
37
  public function __construct(Environment $environment, Context $context, $entity) {
38
    $this->context = $context;
39
    $this->entity = $entity;
40
    $this->environment = $environment;
41
  }
42
43
  /**
44
   * Returns the context.
45
   *
46
   * @return \Behat\Behat\Context\Context
47
   */
48
  public function getContext() {
49
    return $this->context;
50
  }
51
52
  /**
53
   * Returns the entity object.
54
   */
55
  public function getEntity() {
56
    return $this->entity;
57
  }
58
59
  /**
60
   * {@inheritDoc}
61
   */
62
  public function getEnvironment() {
63
    return $this->environment;
64
  }
65
66
  /**
67
   * {@inheritDoc}
68
   */
69
  public function getSuite() {
70
    return $this->environment->getSuite();
71
  }
72
}
73