FaqGroup   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toOptionArray() 0 10 2
A __construct() 0 4 1
1
<?php
2
/**
3
 * MagePrince
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the mageprince.com license that is
8
 * available through the world-wide-web at this URL:
9
 * https://mageprince.com/end-user-license-agreement
10
 *
11
 * DISCLAIMER
12
 *
13
 * Do not edit or add to this file if you wish to upgrade this extension to newer
14
 * version in the future.
15
 *
16
 * @category    MagePrince
17
 * @package     Mageprince_Faq
18
 * @copyright   Copyright (c) MagePrince (https://mageprince.com/)
19
 * @license     https://mageprince.com/end-user-license-agreement
20
 */
21
22
namespace Mageprince\Faq\Ui\Component\Listing\Column;
23
24
use Magento\Framework\Data\OptionSourceInterface;
0 ignored issues
show
Bug introduced by
The type Magento\Framework\Data\OptionSourceInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
use Mageprince\Faq\Model\ResourceModel\FaqGroup\CollectionFactory;
0 ignored issues
show
Bug introduced by
The type Mageprince\Faq\Model\Res...Group\CollectionFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
27
class FaqGroup implements OptionSourceInterface
28
{
29
    /**
30
     * @var CollectionFactory
31
     */
32
    protected $groupCollection;
33
34
    /**
35
     * FaqGroup constructor.
36
     * @param CollectionFactory $groupCollection
37
     */
38
    public function __construct(
39
        CollectionFactory $groupCollection
40
    ) {
41
        $this->groupCollection = $groupCollection;
42
    }
43
44
    /**
45
     * Options getter
46
     *
47
     * @return array
48
     */
49
    public function toOptionArray()
50
    {
51
        $groupArr = [];
52
        $groups = $this->groupCollection->create();
53
54
        foreach ($groups as $group) {
55
            $groupArr[] = ['value' => $group->getFaqGroupId(), 'label' => __($group->getGroupname())];
0 ignored issues
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

55
            $groupArr[] = ['value' => $group->getFaqGroupId(), 'label' => /** @scrutinizer ignore-call */ __($group->getGroupname())];
Loading history...
56
        }
57
58
        return $groupArr;
59
    }
60
}
61