Passed
Push — master ( a7342a...509034 )
by Jakub
01:53
created

Collection::getAllowedItems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Menu;
5
6
use Nexendrie\Utils\Collection as BaseCollection;
7
8
/**
9
 * Collection of menu items
10
 *
11
 * @author Jakub Konečný
12
 * @property-read MenuItem[] $allowedItems
13
 */
14 1
abstract class Collection extends BaseCollection {
0 ignored issues
show
Coding Style introduced by
Collection does not seem to conform to the naming convention (^(Abstract|Factory|Base)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
15
  /** @var MenuItem[] */
16
  protected $items = [];
17
  /** @var string */
18
  protected $class = MenuItem::class;
19
  
20
  /**
21
   * @return MenuItem[]
22
   */
23
  public function getAllowedItems(): array {
24 1
    return array_values(array_filter($this->items, function(MenuItem $item) {
25 1
      return $item->isAllowed();
26 1
    }));
27
  }
28
}
29
?>