<commit_before><?php
namespace spec\rtens\mockster;

use rtens\mockster\filter\Filter;
use watoki\scrut\Fixture;

class FilterFixture extends Fixture {

    /**
     * @var Filter
     */
    private $filter;

    /**
     * @var array|\ReflectionMethod[]
     */
    private $filterOutput = [];

    public function givenTheFilterWithTheBitMask($bitmask) {
        $this->filter = new Filter($bitmask);
    }

    public function whenTheFilterIsAppliedToTheMethodsOfClass($class) {
        $reflectionClass = new \ReflectionClass($class);
        $filter = $this->filter;
        $this->filterOutput = array_filter($reflectionClass->getMethods(), function($method) use ($filter) {
            return $filter->apply($method);
        });
    }

    public function thenTheFilterMatched_Methods($count) {
        $this->spec->assertEquals($count, count($this->filterOutput));
    }

    public function thenFilterMatchesContainTheMethod($methodName) {
        $this->spec->assertNotNull($this->getFilteredMethod($methodName));
    }

    /**
     * @param string $methodName<commit_msg>fixed array declaration in FilterFixture to be compatible with PHP 5.3<commit_after><?php
namespace spec\rtens\mockster;

use rtens\mockster\filter\Filter;
use watoki\scrut\Fixture;

class FilterFixture extends Fixture {

    /**
     * @var Filter
     */
    private $filter;

    /**
     * @var array|\ReflectionMethod[]
     */
    private $filterOutput = array();

    public function givenTheFilterWithTheBitMask($bitmask) {
        $this->filter = new Filter($bitmask);
    }

    public function whenTheFilterIsAppliedToTheMethodsOfClass($class) {
        $reflectionClass = new \ReflectionClass($class);
        $filter = $this->filter;
        $this->filterOutput = array_filter($reflectionClass->getMethods(), function($method) use ($filter) {
            return $filter->apply($method);
        });
    }

    public function thenTheFilterMatched_Methods($count) {
        $this->spec->assertEquals($count, count($this->filterOutput));
    }

    public function thenFilterMatchesContainTheMethod($methodName) {
        $this->spec->assertNotNull($this->getFilteredMethod($methodName));
    }

    /**
     * @param string $methodName
{'fraction_non_alphanumeric': 0.1303763440860215, 'fraction_numerical': 0.0008960573476702509, 'mean_word_length': 3.2777777777777777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7304506', 'n_tokens_mistral': 635, 'n_tokens_neox': 619, 'n_words': 114}