Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Failed Conditions
Push — live ( 05ca5f...631a24 )
by Dan
05:49
created

ResettableContainerTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A reset() 0 2 1
A initialized() 0 2 1
1
<?php declare(strict_types=1);
2
3
namespace Smr\Container;
4
5
/**
6
 * Extends a Di\Container to allow for introspection and resetting.
7
 */
8
trait ResettableContainerTrait {
9
10
	/**
11
	 * Test if the entry given by $name has been initialized in the container.
12
	 *
13
	 * @param string $name Entry name or a class name.
14
	 * @return bool Whether or not the entry is initialized.
15
	 */
16
	public function initialized(string $name): bool {
17
		return array_key_exists($name, $this->resolvedEntries);
18
	}
19
20
	/**
21
	 * Unset the entry given by $name in the container.
22
	 *
23
	 * A subsequent call to get() will create a new instance of this entry,
24
	 * according to its definition (if it has one). This can be useful to
25
	 * release resources that are no longer in use or that need to be reset.
26
	 *
27
	 * @param string $name Entry name or a class name.
28
	 */
29
	public function reset(string $name): void {
30
		unset($this->resolvedEntries[$name]);
31
	}
32
33
}
34