Completed
Push — feature/fine-grained-authoriza... ( ae30cd...54dbb3 )
by Michiel
01:44
created

RaListingCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createElementFromData() 0 4 1
A isListed() 0 10 3
1
<?php
2
3
/**
4
 * Copyright 2014 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupMiddlewareClientBundle\Identity\Dto;
20
21
use Surfnet\StepupMiddlewareClientBundle\Dto\CollectionDto;
22
23
class RaListingCollection extends CollectionDto
24
{
25
    protected static function createElementFromData(array $raListing)
26
    {
27
        return RaListing::fromData($raListing);
28
    }
29
30
    /**
31
     * Checks if a certain institution is listed in the RA listing
32
     * @param $institution
33
     * @return bool
34
     */
35
    public function isListed($institution)
36
    {
37
        /** @var RaListing $raListing */
38
        foreach ($this->getElements() as $raListing) {
39
            if ($raListing->institution === $institution) {
40
                return true;
41
            }
42
        }
43
        return false;
44
    }
45
}
46