| Total Complexity | 39 |
| Total Lines | 376 |
| Duplicated Lines | 0 % |
| Coverage | 93.81% |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | class Context |
||
| 33 | { |
||
| 34 | /** |
||
|
1 ignored issue
–
show
|
|||
| 35 | * @var ArrayList |
||
| 36 | */ |
||
| 37 | private $macros; |
||
| 38 | |||
| 39 | /** |
||
|
1 ignored issue
–
show
|
|||
| 40 | * @var Locale |
||
| 41 | */ |
||
| 42 | private $locale; |
||
| 43 | |||
| 44 | /** |
||
|
1 ignored issue
–
show
|
|||
| 45 | * @var Bibliography |
||
| 46 | */ |
||
| 47 | private $bibliography; |
||
| 48 | |||
| 49 | /** |
||
|
1 ignored issue
–
show
|
|||
| 50 | * @var Citation |
||
| 51 | */ |
||
| 52 | private $citation; |
||
| 53 | |||
| 54 | /** |
||
|
1 ignored issue
–
show
|
|||
| 55 | * @var Sort |
||
| 56 | */ |
||
| 57 | private $sorting; |
||
| 58 | |||
| 59 | /** |
||
|
1 ignored issue
–
show
|
|||
| 60 | * @var string |
||
| 61 | */ |
||
| 62 | private $mode; |
||
| 63 | |||
| 64 | /** |
||
|
1 ignored issue
–
show
|
|||
| 65 | * @var DataList |
||
| 66 | */ |
||
| 67 | private $citationItems; |
||
| 68 | |||
| 69 | /** |
||
|
1 ignored issue
–
show
|
|||
| 70 | * @var ArrayList |
||
| 71 | */ |
||
| 72 | private $results; |
||
| 73 | |||
| 74 | /** |
||
|
1 ignored issue
–
show
|
|||
| 75 | * @var Root |
||
| 76 | */ |
||
| 77 | private $root; |
||
| 78 | |||
| 79 | /** |
||
|
1 ignored issue
–
show
|
|||
| 80 | * @var GlobalOptions |
||
| 81 | */ |
||
| 82 | private $globalOptions; |
||
| 83 | |||
| 84 | /** |
||
|
1 ignored issue
–
show
|
|||
| 85 | * @var BibliographyOptions |
||
| 86 | */ |
||
| 87 | private $bibliographySpecificOptions; |
||
| 88 | |||
| 89 | /** |
||
|
1 ignored issue
–
show
|
|||
| 90 | * @var CitationOptions |
||
| 91 | */ |
||
| 92 | private $citationSpecificOptions; |
||
| 93 | |||
| 94 | /** |
||
|
1 ignored issue
–
show
|
|||
| 95 | * @var RenderingState |
||
| 96 | */ |
||
| 97 | private $renderingState; |
||
| 98 | |||
| 99 | /** |
||
|
1 ignored issue
–
show
|
|||
| 100 | * @var CssStyle |
||
| 101 | */ |
||
| 102 | private $cssStyle; |
||
| 103 | |||
| 104 | /** |
||
|
1 ignored issue
–
show
|
|||
| 105 | * @var Info |
||
| 106 | */ |
||
| 107 | private $info; |
||
| 108 | |||
| 109 | /** |
||
|
1 ignored issue
–
show
|
|||
| 110 | * @var array |
||
| 111 | */ |
||
| 112 | protected $markupExtension = []; |
||
| 113 | |||
| 114 | /** |
||
|
1 ignored issue
–
show
|
|||
| 115 | * @var bool |
||
| 116 | */ |
||
| 117 | private $citationsAsArray = false; |
||
| 118 | |||
| 119 | 142 | public function __construct($locale = null) |
|
| 120 | { |
||
| 121 | 142 | if (!empty($locale)) { |
|
| 122 | 135 | $this->locale = $locale; |
|
| 123 | } |
||
| 124 | |||
| 125 | 142 | $this->macros = new ArrayList(); |
|
| 126 | 142 | $this->citationItems = new DataList(); |
|
| 127 | 142 | $this->results = new ArrayList(); |
|
| 128 | 142 | $this->renderingState = new RenderingState(RenderingState::__default); |
|
| 129 | 142 | } |
|
| 130 | |||
| 131 | 47 | public function addMacro($key, $macro) |
|
| 132 | { |
||
| 133 | 47 | $this->macros->add($key, $macro); |
|
| 134 | 47 | } |
|
| 135 | |||
| 136 | /** |
||
|
1 ignored issue
–
show
|
|||
| 137 | * @param $key |
||
|
1 ignored issue
–
show
|
|||
| 138 | * @return Macro |
||
|
1 ignored issue
–
show
|
|||
| 139 | */ |
||
| 140 | 41 | public function getMacro($key) |
|
| 141 | { |
||
| 142 | 41 | return $this->macros->get($key); |
|
| 143 | } |
||
| 144 | |||
| 145 | /** |
||
|
1 ignored issue
–
show
|
|||
| 146 | * @param Locale $locale |
||
|
1 ignored issue
–
show
|
|||
| 147 | */ |
||
| 148 | 142 | public function setLocale(Locale $locale) |
|
| 149 | { |
||
| 150 | 142 | $this->locale = $locale; |
|
| 151 | 142 | } |
|
| 152 | |||
| 153 | /** |
||
|
1 ignored issue
–
show
|
|||
| 154 | * @return Locale |
||
| 155 | */ |
||
| 156 | 96 | public function getLocale() |
|
| 157 | { |
||
| 158 | 96 | return $this->locale; |
|
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
|
1 ignored issue
–
show
|
|||
| 162 | * @return Bibliography |
||
| 163 | */ |
||
| 164 | 56 | public function getBibliography() |
|
| 165 | { |
||
| 166 | 56 | return $this->bibliography; |
|
| 167 | } |
||
| 168 | |||
| 169 | /** |
||
|
1 ignored issue
–
show
|
|||
| 170 | * @param Bibliography $bibliography |
||
|
1 ignored issue
–
show
|
|||
| 171 | */ |
||
| 172 | 63 | public function setBibliography(Bibliography $bibliography) |
|
| 173 | { |
||
| 174 | 63 | $this->bibliography = $bibliography; |
|
| 175 | 63 | } |
|
| 176 | |||
| 177 | /** |
||
|
1 ignored issue
–
show
|
|||
| 178 | * @return Citation |
||
| 179 | */ |
||
| 180 | 133 | public function getCitation() |
|
| 181 | { |
||
| 182 | 133 | return $this->citation; |
|
| 183 | } |
||
| 184 | |||
| 185 | /** |
||
|
1 ignored issue
–
show
|
|||
| 186 | * @param Citation $citation |
||
|
1 ignored issue
–
show
|
|||
| 187 | */ |
||
| 188 | 130 | public function setCitation($citation) |
|
| 189 | { |
||
| 190 | 130 | $this->citation = $citation; |
|
| 191 | 130 | } |
|
| 192 | |||
| 193 | /** |
||
|
1 ignored issue
–
show
|
|||
| 194 | * @param $citationsAsArray |
||
| 195 | */ |
||
| 196 | 135 | public function setCitationsAsArray($citationsAsArray = true) |
|
| 197 | { |
||
| 198 | 135 | $this->citationsAsArray = $citationsAsArray; |
|
| 199 | 135 | } |
|
| 200 | |||
| 201 | 2 | public function isCitationsAsArray() |
|
| 202 | { |
||
| 203 | 2 | return $this->citationsAsArray; |
|
| 204 | } |
||
| 205 | |||
| 206 | 44 | public function setSorting($sorting) |
|
| 207 | { |
||
| 208 | 44 | $this->sorting = $sorting; |
|
| 209 | 44 | } |
|
| 210 | |||
| 211 | 131 | public function getSorting() |
|
| 212 | { |
||
| 213 | 131 | return $this->sorting; |
|
| 214 | } |
||
| 215 | |||
| 216 | /** |
||
| 217 | * return the render mode (citation|bibliography) |
||
| 218 | * @return string |
||
|
1 ignored issue
–
show
|
|||
| 219 | */ |
||
| 220 | 139 | public function getMode() |
|
| 221 | { |
||
| 222 | 139 | return $this->mode; |
|
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
|
1 ignored issue
–
show
|
|||
| 226 | * @param string $mode |
||
|
1 ignored issue
–
show
|
|||
| 227 | */ |
||
| 228 | 131 | public function setMode($mode) |
|
| 229 | { |
||
| 230 | 131 | $this->mode = $mode; |
|
| 231 | 131 | } |
|
| 232 | |||
| 233 | /** |
||
| 234 | * returns true if the render mode is set to citation |
||
| 235 | * @return bool |
||
|
1 ignored issue
–
show
|
|||
| 236 | */ |
||
| 237 | 91 | public function isModeCitation() |
|
| 238 | { |
||
| 239 | 91 | return $this->mode === "citation"; |
|
| 240 | } |
||
| 241 | |||
| 242 | /** |
||
| 243 | * returns true if the render mode is set to bibliography |
||
| 244 | * @return bool |
||
|
1 ignored issue
–
show
|
|||
| 245 | */ |
||
| 246 | 131 | public function isModeBibliography() |
|
| 247 | { |
||
| 248 | 131 | return $this->mode === "bibliography"; |
|
| 249 | } |
||
| 250 | |||
| 251 | /** |
||
|
1 ignored issue
–
show
|
|||
| 252 | * @return DataList |
||
| 253 | */ |
||
| 254 | 88 | public function getCitationItems() |
|
| 255 | { |
||
| 256 | 88 | return $this->citationItems; |
|
| 257 | } |
||
| 258 | |||
| 259 | /** |
||
|
1 ignored issue
–
show
|
|||
| 260 | * @param DataList $citationItems |
||
|
1 ignored issue
–
show
|
|||
| 261 | */ |
||
| 262 | 58 | public function setCitationItems(&$citationItems) |
|
| 263 | { |
||
| 264 | 58 | $this->citationItems = $citationItems; |
|
| 265 | 58 | } |
|
| 266 | |||
| 267 | public function hasCitationItems() |
||
| 268 | { |
||
| 269 | return ($this->citationItems->count() > 0); |
||
| 270 | } |
||
| 271 | |||
| 272 | /** |
||
|
1 ignored issue
–
show
|
|||
| 273 | * @return ArrayList |
||
| 274 | */ |
||
| 275 | public function getMacros() |
||
| 276 | { |
||
| 277 | return $this->macros; |
||
| 278 | } |
||
| 279 | |||
| 280 | /** |
||
|
1 ignored issue
–
show
|
|||
| 281 | * @return ArrayList |
||
| 282 | */ |
||
| 283 | 131 | public function getResults() |
|
| 284 | { |
||
| 285 | 131 | return $this->results; |
|
| 286 | } |
||
| 287 | |||
| 288 | /** |
||
|
1 ignored issue
–
show
|
|||
| 289 | * @return Root |
||
| 290 | */ |
||
| 291 | 135 | public function getRoot() |
|
| 292 | { |
||
| 293 | 135 | return $this->root; |
|
| 294 | } |
||
| 295 | |||
| 296 | /** |
||
|
1 ignored issue
–
show
|
|||
| 297 | * @param Root $root |
||
|
1 ignored issue
–
show
|
|||
| 298 | */ |
||
| 299 | 135 | public function setRoot(Root $root) |
|
| 302 | 135 | } |
|
| 303 | |||
| 304 | /** |
||
|
1 ignored issue
–
show
|
|||
| 305 | * @return GlobalOptions |
||
| 306 | */ |
||
| 307 | 89 | public function getGlobalOptions() |
|
| 308 | { |
||
| 309 | 89 | return $this->globalOptions; |
|
| 310 | } |
||
| 311 | |||
| 312 | /** |
||
|
1 ignored issue
–
show
|
|||
| 313 | * @param GlobalOptions $globalOptions |
||
|
1 ignored issue
–
show
|
|||
| 314 | */ |
||
| 315 | 135 | public function setGlobalOptions(GlobalOptions $globalOptions) |
|
| 318 | 135 | } |
|
| 319 | |||
| 320 | /** |
||
|
1 ignored issue
–
show
|
|||
| 321 | * @return RenderingState |
||
| 322 | */ |
||
| 323 | 108 | public function getRenderingState() |
|
| 324 | { |
||
| 325 | 108 | return $this->renderingState; |
|
| 326 | } |
||
| 327 | |||
| 328 | /** |
||
|
1 ignored issue
–
show
|
|||
| 329 | * @param RenderingState|string $renderingState |
||
|
1 ignored issue
–
show
|
|||
| 330 | */ |
||
| 331 | 47 | public function setRenderingState(RenderingState $renderingState) |
|
| 332 | { |
||
| 333 | 47 | $this->renderingState = $renderingState; |
|
| 334 | 47 | } |
|
| 335 | |||
| 336 | /** |
||
|
1 ignored issue
–
show
|
|||
| 337 | * @return BibliographyOptions |
||
| 338 | */ |
||
| 339 | 134 | public function getBibliographySpecificOptions() |
|
| 340 | { |
||
| 341 | 134 | return $this->bibliographySpecificOptions; |
|
| 342 | } |
||
| 343 | |||
| 344 | /** |
||
|
1 ignored issue
–
show
|
|||
| 345 | * @param BibliographyOptions $bibliographySpecificOptions |
||
|
1 ignored issue
–
show
|
|||
| 346 | */ |
||
| 347 | 63 | public function setBibliographySpecificOptions(BibliographyOptions $bibliographySpecificOptions) |
|
| 348 | { |
||
| 349 | 63 | $this->bibliographySpecificOptions = $bibliographySpecificOptions; |
|
| 350 | 63 | } |
|
| 351 | |||
| 352 | /** |
||
|
1 ignored issue
–
show
|
|||
| 353 | * @return CitationOptions |
||
| 354 | */ |
||
| 355 | public function getCitationSpecificOptions() |
||
| 356 | { |
||
| 357 | return $this->citationSpecificOptions; |
||
| 358 | } |
||
| 359 | |||
| 360 | /** |
||
|
1 ignored issue
–
show
|
|||
| 361 | * @param CitationOptions $citationSpecificOptions |
||
|
1 ignored issue
–
show
|
|||
| 362 | */ |
||
| 363 | 130 | public function setCitationSpecificOptions(CitationOptions $citationSpecificOptions) |
|
| 364 | { |
||
| 365 | 130 | $this->citationSpecificOptions = $citationSpecificOptions; |
|
| 366 | 130 | } |
|
| 367 | |||
| 368 | /** |
||
|
1 ignored issue
–
show
|
|||
| 369 | * @param CssStyle $cssStyle |
||
|
1 ignored issue
–
show
|
|||
| 370 | */ |
||
| 371 | 3 | public function setCssStyle(CssStyle $cssStyle) |
|
| 372 | { |
||
| 373 | 3 | $this->cssStyle = $cssStyle; |
|
| 374 | 3 | } |
|
| 375 | |||
| 376 | /** |
||
|
1 ignored issue
–
show
|
|||
| 377 | * @return CssStyle |
||
| 378 | */ |
||
| 379 | 3 | public function getCssStyle() |
|
| 380 | { |
||
| 381 | 3 | return $this->cssStyle; |
|
| 382 | } |
||
| 383 | |||
| 384 | 128 | public function setInfo(Info $info) |
|
| 385 | { |
||
| 386 | 128 | $this->info = $info; |
|
| 387 | 128 | } |
|
| 388 | |||
| 389 | 1 | public function getInfo() |
|
| 390 | { |
||
| 391 | 1 | return $this->info; |
|
| 392 | } |
||
| 393 | |||
| 394 | /** |
||
|
1 ignored issue
–
show
|
|||
| 395 | * @return array |
||
| 396 | */ |
||
| 397 | 135 | public function getMarkupExtension() |
|
| 398 | { |
||
| 399 | 135 | return $this->markupExtension; |
|
| 400 | } |
||
| 401 | |||
| 402 | /** |
||
|
1 ignored issue
–
show
|
|||
| 403 | * @param array $markupExtension |
||
|
1 ignored issue
–
show
|
|||
| 404 | */ |
||
| 405 | 135 | public function setMarkupExtension($markupExtension) |
|
| 408 | } |
||
| 409 | } |