| Total Complexity | 39 |
| Total Lines | 376 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| 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 | public function __construct($locale = null) |
||
| 120 | { |
||
| 121 | if (!empty($locale)) { |
||
| 122 | $this->locale = $locale; |
||
| 123 | } |
||
| 124 | |||
| 125 | $this->macros = new ArrayList(); |
||
| 126 | $this->citationItems = new DataList(); |
||
| 127 | $this->results = new ArrayList(); |
||
| 128 | $this->renderingState = new RenderingState(RenderingState::__default); |
||
| 129 | } |
||
| 130 | |||
| 131 | public function addMacro($key, $macro) |
||
| 132 | { |
||
| 133 | $this->macros->add($key, $macro); |
||
| 134 | } |
||
| 135 | |||
| 136 | /** |
||
|
1 ignored issue
–
show
|
|||
| 137 | * @param $key |
||
|
1 ignored issue
–
show
|
|||
| 138 | * @return Macro |
||
|
1 ignored issue
–
show
|
|||
| 139 | */ |
||
| 140 | public function getMacro($key) |
||
| 141 | { |
||
| 142 | return $this->macros->get($key); |
||
| 143 | } |
||
| 144 | |||
| 145 | /** |
||
|
1 ignored issue
–
show
|
|||
| 146 | * @param Locale $locale |
||
|
1 ignored issue
–
show
|
|||
| 147 | */ |
||
| 148 | public function setLocale(Locale $locale) |
||
| 149 | { |
||
| 150 | $this->locale = $locale; |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
|
1 ignored issue
–
show
|
|||
| 154 | * @return Locale |
||
| 155 | */ |
||
| 156 | public function getLocale() |
||
| 157 | { |
||
| 158 | return $this->locale; |
||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
|
1 ignored issue
–
show
|
|||
| 162 | * @return Bibliography |
||
| 163 | */ |
||
| 164 | public function getBibliography() |
||
| 165 | { |
||
| 166 | return $this->bibliography; |
||
| 167 | } |
||
| 168 | |||
| 169 | /** |
||
|
1 ignored issue
–
show
|
|||
| 170 | * @param Bibliography $bibliography |
||
|
1 ignored issue
–
show
|
|||
| 171 | */ |
||
| 172 | public function setBibliography(Bibliography $bibliography) |
||
| 173 | { |
||
| 174 | $this->bibliography = $bibliography; |
||
| 175 | } |
||
| 176 | |||
| 177 | /** |
||
|
1 ignored issue
–
show
|
|||
| 178 | * @return Citation |
||
| 179 | */ |
||
| 180 | public function getCitation() |
||
| 181 | { |
||
| 182 | return $this->citation; |
||
| 183 | } |
||
| 184 | |||
| 185 | /** |
||
|
1 ignored issue
–
show
|
|||
| 186 | * @param Citation $citation |
||
|
1 ignored issue
–
show
|
|||
| 187 | */ |
||
| 188 | public function setCitation($citation) |
||
| 189 | { |
||
| 190 | $this->citation = $citation; |
||
| 191 | } |
||
| 192 | |||
| 193 | /** |
||
|
1 ignored issue
–
show
|
|||
| 194 | * @param $citationsAsArray |
||
| 195 | */ |
||
| 196 | public function setCitationsAsArray($citationsAsArray = true) |
||
| 197 | { |
||
| 198 | $this->citationsAsArray = $citationsAsArray; |
||
| 199 | } |
||
| 200 | |||
| 201 | public function isCitationsAsArray() |
||
| 202 | { |
||
| 203 | return $this->citationsAsArray; |
||
| 204 | } |
||
| 205 | |||
| 206 | public function setSorting($sorting) |
||
| 207 | { |
||
| 208 | $this->sorting = $sorting; |
||
| 209 | } |
||
| 210 | |||
| 211 | public function getSorting() |
||
| 212 | { |
||
| 213 | return $this->sorting; |
||
| 214 | } |
||
| 215 | |||
| 216 | /** |
||
| 217 | * return the render mode (citation|bibliography) |
||
| 218 | * @return string |
||
|
1 ignored issue
–
show
|
|||
| 219 | */ |
||
| 220 | public function getMode() |
||
| 221 | { |
||
| 222 | return $this->mode; |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
|
1 ignored issue
–
show
|
|||
| 226 | * @param string $mode |
||
|
1 ignored issue
–
show
|
|||
| 227 | */ |
||
| 228 | public function setMode($mode) |
||
| 229 | { |
||
| 230 | $this->mode = $mode; |
||
| 231 | } |
||
| 232 | |||
| 233 | /** |
||
| 234 | * returns true if the render mode is set to citation |
||
| 235 | * @return bool |
||
|
1 ignored issue
–
show
|
|||
| 236 | */ |
||
| 237 | public function isModeCitation() |
||
| 238 | { |
||
| 239 | 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 | public function isModeBibliography() |
||
| 247 | { |
||
| 248 | return $this->mode === "bibliography"; |
||
| 249 | } |
||
| 250 | |||
| 251 | /** |
||
|
1 ignored issue
–
show
|
|||
| 252 | * @return DataList |
||
| 253 | */ |
||
| 254 | public function getCitationItems() |
||
| 255 | { |
||
| 256 | return $this->citationItems; |
||
| 257 | } |
||
| 258 | |||
| 259 | /** |
||
|
1 ignored issue
–
show
|
|||
| 260 | * @param DataList $citationItems |
||
|
1 ignored issue
–
show
|
|||
| 261 | */ |
||
| 262 | public function setCitationItems(&$citationItems) |
||
| 263 | { |
||
| 264 | $this->citationItems = $citationItems; |
||
| 265 | } |
||
| 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 | public function getResults() |
||
| 284 | { |
||
| 285 | return $this->results; |
||
| 286 | } |
||
| 287 | |||
| 288 | /** |
||
|
1 ignored issue
–
show
|
|||
| 289 | * @return Root |
||
| 290 | */ |
||
| 291 | public function getRoot() |
||
| 292 | { |
||
| 293 | return $this->root; |
||
| 294 | } |
||
| 295 | |||
| 296 | /** |
||
|
1 ignored issue
–
show
|
|||
| 297 | * @param Root $root |
||
|
1 ignored issue
–
show
|
|||
| 298 | */ |
||
| 299 | public function setRoot(Root $root) |
||
| 302 | } |
||
| 303 | |||
| 304 | /** |
||
|
1 ignored issue
–
show
|
|||
| 305 | * @return GlobalOptions |
||
| 306 | */ |
||
| 307 | public function getGlobalOptions() |
||
| 308 | { |
||
| 309 | return $this->globalOptions; |
||
| 310 | } |
||
| 311 | |||
| 312 | /** |
||
|
1 ignored issue
–
show
|
|||
| 313 | * @param GlobalOptions $globalOptions |
||
|
1 ignored issue
–
show
|
|||
| 314 | */ |
||
| 315 | public function setGlobalOptions(GlobalOptions $globalOptions) |
||
| 318 | } |
||
| 319 | |||
| 320 | /** |
||
|
1 ignored issue
–
show
|
|||
| 321 | * @return RenderingState |
||
| 322 | */ |
||
| 323 | public function getRenderingState() |
||
| 324 | { |
||
| 325 | return $this->renderingState; |
||
| 326 | } |
||
| 327 | |||
| 328 | /** |
||
|
1 ignored issue
–
show
|
|||
| 329 | * @param RenderingState|string $renderingState |
||
|
1 ignored issue
–
show
|
|||
| 330 | */ |
||
| 331 | public function setRenderingState(RenderingState $renderingState) |
||
| 332 | { |
||
| 333 | $this->renderingState = $renderingState; |
||
| 334 | } |
||
| 335 | |||
| 336 | /** |
||
|
1 ignored issue
–
show
|
|||
| 337 | * @return BibliographyOptions |
||
| 338 | */ |
||
| 339 | public function getBibliographySpecificOptions() |
||
| 340 | { |
||
| 341 | return $this->bibliographySpecificOptions; |
||
| 342 | } |
||
| 343 | |||
| 344 | /** |
||
|
1 ignored issue
–
show
|
|||
| 345 | * @param BibliographyOptions $bibliographySpecificOptions |
||
|
1 ignored issue
–
show
|
|||
| 346 | */ |
||
| 347 | public function setBibliographySpecificOptions(BibliographyOptions $bibliographySpecificOptions) |
||
| 348 | { |
||
| 349 | $this->bibliographySpecificOptions = $bibliographySpecificOptions; |
||
| 350 | } |
||
| 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 | public function setCitationSpecificOptions(CitationOptions $citationSpecificOptions) |
||
| 364 | { |
||
| 365 | $this->citationSpecificOptions = $citationSpecificOptions; |
||
| 366 | } |
||
| 367 | |||
| 368 | /** |
||
|
1 ignored issue
–
show
|
|||
| 369 | * @param CssStyle $cssStyle |
||
|
1 ignored issue
–
show
|
|||
| 370 | */ |
||
| 371 | public function setCssStyle(CssStyle $cssStyle) |
||
| 372 | { |
||
| 373 | $this->cssStyle = $cssStyle; |
||
| 374 | } |
||
| 375 | |||
| 376 | /** |
||
|
1 ignored issue
–
show
|
|||
| 377 | * @return CssStyle |
||
| 378 | */ |
||
| 379 | public function getCssStyle() |
||
| 380 | { |
||
| 381 | return $this->cssStyle; |
||
| 382 | } |
||
| 383 | |||
| 384 | public function setInfo(Info $info) |
||
| 385 | { |
||
| 386 | $this->info = $info; |
||
| 387 | } |
||
| 388 | |||
| 389 | public function getInfo() |
||
| 390 | { |
||
| 391 | return $this->info; |
||
| 392 | } |
||
| 393 | |||
| 394 | /** |
||
|
1 ignored issue
–
show
|
|||
| 395 | * @return array |
||
| 396 | */ |
||
| 397 | public function getMarkupExtension() |
||
| 398 | { |
||
| 399 | return $this->markupExtension; |
||
| 400 | } |
||
| 401 | |||
| 402 | /** |
||
|
1 ignored issue
–
show
|
|||
| 403 | * @param array $markupExtension |
||
|
1 ignored issue
–
show
|
|||
| 404 | */ |
||
| 405 | public function setMarkupExtension($markupExtension) |
||
| 408 | } |
||
| 409 | } |