Test Failed
Push — 6-0 ( cfb4d5 )
by Tomas Norre
03:23
created

getProcessIds()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
ccs 5
cts 5
cp 1
crap 2
1
<?php
2
3
/***************************************************************
4
 *  Copyright notice
5
 *
6
 *  Copyright (c) 2009, AOE media GmbH <[email protected]>
7
 *  All rights reserved
8
 *
9
 *  This script is part of the TYPO3 project. The TYPO3 project is
10
 *  free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; either version 2 of the License, or
13
 *  (at your option) any later version.
14
 *
15
 *  The GNU General Public License can be found at
16
 *  http://www.gnu.org/copyleft/gpl.html.
17
 *
18
 *  This script is distributed in the hope that it will be useful,
19
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 *  GNU General Public License for more details.
22
 *
23
 *  This copyright notice MUST APPEAR in all copies of the script!
24
 ***************************************************************/
25
26
/**
27
 * Class tx_crawler_domain_process_collection
28
 */
29
class tx_crawler_domain_process_collection extends ArrayObject
30
{
31
32
    /**
33
     * Method to retrieve an element from the collection.
34
     *
35
     * @throws Exception
36
     * @return tx_crawler_domain_process
37
     */
38
    public function offsetGet($index)
39
    {
40
        if (! parent::offsetExists($index)) {
41
            throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
42
        }
43
        return parent::offsetGet($index);
44
    }
45
46
    /**
47
     * Method to add an element to the collection-
48
     *
49
     * @param mixed $index
50
     * @param tx_crawler_domain_process $subject
51
     * @throws InvalidArgumentException
52
     * @return void
53
     */
54
    public function offsetSet($index, $subject)
55
    {
56
        if (! $subject instanceof tx_crawler_domain_process) {
57
            throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
58
        }
59
        parent::offsetSet($index, $subject);
60
    }
61
62
    /**
63
     * Method to append an element to the collection
64
     * @param tx_crawler_domain_process $subject
65
     * @throws InvalidArgumentException
66
     * @return void
67
     */
68
    public function append($subject)
69
    {
70
        if (! $subject instanceof tx_crawler_domain_process) {
71
            throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
72
        }
73
        parent::append($subject);
74
    }
75
76
    /**
77
     * returns array of process ids of the current collection
78
     * @return array
79
     */
80 1
    public function getProcessIds()
81
    {
82 1
        $result = [];
83 1
        foreach ($this->getIterator() as $value) {
84 1
            $result[] = $value->getProcess_id();
85
        }
86 1
        return $result;
87
    }
88
}
89
90 1
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']) {
0 ignored issues
show
Bug introduced by
The constant TYPO3_MODE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
91
    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']);
92
}
93