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.

TwViewHelper::__invoke()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 2
nop 2
crap 3
1
<?php
2
/*
3
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
5
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
6
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
7
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
8
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
 */
10
11
namespace ZfTwitterWidget\View;
12
13
use InvalidArgumentException;
14
use TwitterWidgets\Options\WidgetOptions;
15
use TwitterWidgets\Options\WidgetOptionsInterface;
16
use TwitterWidgets\Timeline\TimelineBuilderInterface;
17
use Zend\View\Helper\AbstractHelper;
18
19
class TwViewHelper extends AbstractHelper
20
{
21
    protected $widgetOptions;
22
    protected $timeline;
23
24
    /**
25
     * @param WidgetOptions            $widgetOptions
26
     * @param TimelineBuilderInterface $timeline
27
     */
28 3
    public function __construct(WidgetOptions $widgetOptions, TimelineBuilderInterface $timeline)
29
    {
30 3
        $this->widgetOptions = $widgetOptions;
31 3
        $this->timeline      = $timeline;
32 3
    }
33
34
    /**
35
     * @param  array|WidgetOptionsInterface $options
36
     * @param  bool                         $addJs
37
     * @return string
38
     * @throws InvalidArgumentException
39
     */
40 2
    public function __invoke($options, $addJs = true)
41
    {
42 2
        if (!is_array($options) && !($options instanceof WidgetOptionsInterface)) {
43 1
            throw new InvalidArgumentException(
44 1
                '"options" must be an array or an implementation of WidgetOptionsInterface'
45
            );
46
        }
47 1
        $this->widgetOptions->setFromArray($options);
48
49 1
        return $this->timeline->renderWidget($addJs);
50
    }
51
}
52