Passed
Push — master ( 4d1241...80f59e )
by Craig
03:09
created

WordFinder::getRandomChar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace CustomD\WordFinder;
4
5
use Illuminate\Support\Collection;
6
use Illuminate\Support\Facades\Config;
7
8
class WordFinder
9
{
10
11
    protected array $config;
12
13
    public function __construct($config)
14
    {
15
        $this->config = $config;
16
    }
17
18
    public function create(
19
        Collection $wordList,
20
        ?int $gridSize = null,
21
        ?int $min_word_length = null,
22
        ?int $max_word_length = null
23
    ): Grid {
24
        return (new Grid(
25
            $gridSize ?? $this->config['default_grid_size'],
26
            $min_word_length ?? $this->config['default_min_word_length'],
27
            $max_word_length ?? $this->config['default_max_word_length'],
28
            $wordList
29
        ))->generate();
30
    }
31
32
    public function getRandomChar(?CharacterMap $characterMap = null): string
33
    {
34
        $class = $characterMap ?? resolve($this->config['character_map']);
35
        return $class->getRandomChar();
0 ignored issues
show
Bug introduced by
The method getRandomChar() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        return $class->/** @scrutinizer ignore-call */ getRandomChar();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
    }
37
}
38