GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( aacd2f...926faa )
by Florian
04:47
created

FacetSetAdapter   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 72
wmc 9
lcom 1
cbo 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A addFacetValue() 0 9 3
A getFacet() 0 7 2
A getFacets() 0 3 1
A getIterator() 0 3 1
A count() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Stinger Enity Search package.
5
 *
6
 * (c) Oliver Kotte <[email protected]>
7
 * (c) Florian Meyer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
namespace StingerSoft\EntitySearchBundle\Model\Result;
13
14
class FacetSetAdapter implements FacetSet {
15
16
	/**
17
	 * Facet array.
18
	 *
19
	 * @var int[string]
20
	 */
21
	protected $facets;
22
23
	/**
24
	 * Constructor.
25
	 *
26
	 * @param int[string] $facets        	
0 ignored issues
show
Documentation introduced by
The doc-type int[string] could not be parsed: Expected "]" at position 2, but found "string". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
27
	 */
28
	public function __construct(array $facets = array()) {
29
		$this->facets = $facets;
30
	}
31
32
	public function addFacetValue($key, $value, $increaseCounterBy = 1) {
33
		if(!isset($this->facets[$key])){
34
			$this->facets[$key] = array();
35
		}
36
		if(!isset($this->facets[$key][$value])){
37
			$this->facets[$key][$value] = 0;
38
		}
39
		$this->facets[$key][$value] = $this->facets[$key][$value] + $increaseCounterBy;
40
	}
41
42
	/**
43
	 *
44
	 * {@inheritDoc}
45
	 *
46
	 * @see \StingerSoft\EntitySearchBundle\Model\Result\FacetSet::getFacet()
47
	 */
48
	public function getFacet($key) {
49
		if(isset($this->facets[$key])) {
50
			return $this->facets[$key];
51
		} else {
52
			return;
53
		}
54
	}
55
56
	/**
57
	 *
58
	 * {@inheritDoc}
59
	 *
60
	 * @see \StingerSoft\EntitySearchBundle\Model\Result\FacetSet::getFacets()
61
	 */
62
	public function getFacets() {
63
		return $this->facets;
64
	}
65
66
	/**
67
	 *
68
	 * {@inheritDoc}
69
	 *
70
	 * @see IteratorAggregate::getIterator()
71
	 */
72
	public function getIterator() {
73
		return new \ArrayIterator($this->facets);
74
	}
75
76
	/**
77
	 *
78
	 * {@inheritDoc}
79
	 *
80
	 * @see Countable::count()
81
	 */
82
	public function count() {
83
		return count($this->facets);
84
	}
85
}