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 ( 6fd524...ba304a )
by Maximilian
07:36
created

FeatureContext::iSerializeAndUnserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use Behat\Behat\Tester\Exception\PendingException;
4
use Behat\Behat\Context\Context;
5
use Behat\Behat\Context\SnippetAcceptingContext;
6
use Behat\Gherkin\Node\PyStringNode;
7
use Behat\Gherkin\Node\TableNode;
8
use maxwilms\BloomFilter\BloomFilter;
9
use maxwilms\BloomFilter\BloomFilterGenerator;
10
11
/**
12
 * Defines application features from the specific context.
13
 */
14
class FeatureContext implements Context, SnippetAcceptingContext
0 ignored issues
show
Deprecated Code introduced by
The interface Behat\Behat\Context\SnippetAcceptingContext has been deprecated with message: will be removed in 4.0. Use --snippets-for CLI option instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
15
{
16
17
    /**
18
     * @var BloomFilter
19
     */
20
    protected $bloomFilter;
21
22
    /**
23
     * Initializes context.
24
     *
25
     * Every scenario gets its own context instance.
26
     * You can also pass arbitrary arguments to the
27
     * context constructor through behat.yml.
28
     */
29
    public function __construct()
30
    {
31
    }
32
    
33
34
    /**
35
     * @Given a BloomFilter for :elements elements with probability :probability for a false-positive
36
     */
37
    public function aBloomfilterForElementsWithProbabilityForAFalsePositive($elements, $probability)
38
    {
39
        $this->bloomFilter = BloomFilterGenerator::generate($elements, $probability);
40
    }
41
42
    /**
43
     * @When I insert :item
44
     */
45
    public function iInsert($item)
46
    {
47
        $this->bloomFilter->add($item);
48
    }
49
50
    /**
51
     * @Then it should confirm :item is in set
52
     */
53
    public function itShouldConfirmIsInSet($item)
54
    {
55
        if (!$this->bloomFilter->contains($item)) {
56
            throw new Exception("$item is not in set!");
57
        }
58
    }
59
60
    /**
61
     * @Then it should confirm :item is not in set
62
     */
63
    public function itShouldConfirmIsNotInSet($item)
64
    {
65
        if ($this->bloomFilter->contains($item)) {
66
            throw new Exception("$item is in set");
67
        }
68
    }
69
70
    /**
71
     * @Given /^I serialize and unserialize$/
72
     */
73
    public function iSerializeAndUnserialize()
74
    {
75
        $serialized = serialize($this->bloomFilter);
76
        $this->bloomFilter = unserialize($serialized);
77
    }
78
79
80
}
81