This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * The MIT License |
||
4 | * |
||
5 | * Copyright 2017 Julien Fastré <[email protected]>. |
||
6 | * |
||
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
||
8 | * of this software and associated documentation files (the "Software"), to deal |
||
9 | * in the Software without restriction, including without limitation the rights |
||
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||
11 | * copies of the Software, and to permit persons to whom the Software is |
||
12 | * furnished to do so, subject to the following conditions: |
||
13 | * |
||
14 | * The above copyright notice and this permission notice shall be included in |
||
15 | * all copies or substantial portions of the Software. |
||
16 | * |
||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||
23 | * THE SOFTWARE. |
||
24 | */ |
||
25 | namespace PHPHealth\CDA\Elements; |
||
26 | |||
27 | use PHPHealth\CDA\Elements\AbstractElement; |
||
28 | use PHPHealth\CDA\Elements\TableCell; |
||
29 | use PHPHealth\CDA\Elements\AbstractTableSection; |
||
30 | use PHPHealth\CDA\Elements\TableHead; |
||
31 | use PHPHealth\CDA\Elements\ReferenceType; |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | * |
||
36 | * @author Julien Fastré <[email protected]> |
||
37 | */ |
||
38 | class TableRow extends AbstractElement |
||
39 | { |
||
40 | /** |
||
41 | * |
||
42 | * @var TableCell[] |
||
43 | */ |
||
44 | private $cells; |
||
45 | |||
46 | /** |
||
47 | * a reference to the section this row is attached to |
||
48 | * |
||
49 | * @var AbstractTableSection |
||
50 | */ |
||
51 | private $section; |
||
52 | |||
53 | /** |
||
54 | * |
||
55 | * @var Reference |
||
56 | */ |
||
57 | private $reference; |
||
58 | |||
59 | function __construct(AbstractTableSection $section = null) |
||
0 ignored issues
–
show
|
|||
60 | { |
||
61 | $this->section = $section; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * |
||
66 | * @param string $content |
||
67 | * @return TableCell |
||
68 | */ |
||
69 | function createCell($content) |
||
0 ignored issues
–
show
|
|||
70 | { |
||
71 | $cell = new TableCell( |
||
72 | $this->getSection() instanceof TableHead ? TableCell::TH : TableCell::TD, |
||
73 | $this, |
||
74 | $content); |
||
75 | |||
76 | $this->addCell($cell); |
||
77 | |||
78 | return $cell; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * |
||
83 | * @param TableCell $cell |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function addCell(TableCell $cell) |
||
87 | { |
||
88 | $cell->setRow($this); |
||
89 | |||
90 | $this->cells[] = $cell; |
||
91 | |||
92 | return $this; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * |
||
97 | * @return TableCell[] |
||
98 | */ |
||
99 | function getCells(): array |
||
0 ignored issues
–
show
|
|||
100 | { |
||
101 | return $this->cells; |
||
102 | } |
||
103 | |||
104 | function getSection(): AbstractTableSection |
||
0 ignored issues
–
show
|
|||
105 | { |
||
106 | return $this->section; |
||
107 | } |
||
108 | |||
109 | function setCells(array $cells) |
||
0 ignored issues
–
show
|
|||
110 | { |
||
111 | $this->cells = $cells; |
||
112 | return $this; |
||
113 | } |
||
114 | |||
115 | function setSection(AbstractTableSection $section) |
||
0 ignored issues
–
show
|
|||
116 | { |
||
117 | $this->section = $section; |
||
118 | return $this; |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * |
||
123 | * @return Reference |
||
124 | */ |
||
125 | function getReference() |
||
0 ignored issues
–
show
|
|||
126 | { |
||
127 | return $this->reference; |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * |
||
132 | * @param ReferenceType $reference |
||
133 | * @return $this |
||
134 | */ |
||
135 | function setReference(ReferenceType $reference) |
||
0 ignored issues
–
show
|
|||
136 | { |
||
137 | $this->reference = $reference; |
||
0 ignored issues
–
show
It seems like
$reference of type object<PHPHealth\CDA\Elements\ReferenceType> is incompatible with the declared type object<PHPHealth\CDA\Elements\Reference> of property $reference .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
138 | |||
139 | return $this; |
||
140 | } |
||
141 | |||
142 | |||
143 | /** |
||
144 | * |
||
145 | * @return boolean |
||
146 | */ |
||
147 | public function isEmpty() |
||
148 | { |
||
149 | return count($this->getCells()) > 0; |
||
150 | } |
||
151 | |||
152 | |||
153 | protected function getElementTag(): string |
||
154 | { |
||
155 | return 'tr'; |
||
156 | } |
||
157 | |||
158 | View Code Duplication | public function toDOMElement(\DOMDocument $doc): \DOMElement |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
159 | { |
||
160 | $el = $this->createElement($doc); |
||
161 | |||
162 | if ($this->getReference() !== null) { |
||
163 | $this->getReference()->setValueToElement($el, $doc); |
||
164 | } |
||
165 | |||
166 | foreach ($this->getCells() as $cell) { |
||
167 | $el->appendChild($cell->toDOMElement($doc)); |
||
168 | } |
||
169 | |||
170 | return $el; |
||
171 | } |
||
172 | } |
||
173 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.