Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
6 / 6
JokeFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
6 / 6
 __construct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 getRandomJoke
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 hello
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
1<?php
2
3namespace Mpociot\ChuckNorrisJokes;
4
5class JokeFactory
6{
7    protected $jokes = [
8        'haha',
9        'lol',
10    ];
11
12    public function __construct(array $jokes = null)
13    {
14        if ($jokes) 
15        {
16            $this->jokes = $jokes;
17        }        
18    }
19
20    public function getRandomJoke()
21    {
22        return $this->jokes[array_rand($this->jokes)];
23    }
24
25    public function hello()
26    {
27        echo 'chuck norris joke goes here' . PHP_EOL;
28    }
29}