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

Collection   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAllowedItems() 0 5 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
?>