| Total Complexity | 22 |
| Total Lines | 173 |
| Duplicated Lines | 0 % |
| Coverage | 67.31% |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class BibliographyOptions |
||
| 20 | { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * If set, the value of this attribute replaces names in a bibliographic entry that also occur in the preceding |
||
| 24 | * entry. The exact method of substitution depends on the value of the subsequent-author-substitute-rule attribute. |
||
| 25 | * Substitution is limited to the names of the first cs:names element rendered. (Bibliography-specific option) |
||
| 26 | * |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | private $subsequentAuthorSubstitute; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Specifies when and how names are substituted as a result of subsequent-author-substitute. |
||
| 33 | * (Bibliography-specific option) |
||
| 34 | * |
||
| 35 | * @var SubsequentAuthorSubstituteRule |
||
| 36 | */ |
||
| 37 | private $subsequentAuthorSubstituteRule; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * If set to “true” (“false” is the default), bibliographic entries are rendered with hanging-indents. |
||
| 41 | * @var string |
||
|
1 ignored issue
–
show
|
|||
| 42 | */ |
||
| 43 | private $hangingIndent = false; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * If set, subsequent lines of bibliographic entries are aligned along the second field. With “flush”, the first |
||
| 47 | * field is flush with the margin. With “margin”, the first field is put in the margin, and subsequent lines are |
||
| 48 | * aligned with the margin. |
||
| 49 | * @var string |
||
|
1 ignored issue
–
show
|
|||
| 50 | */ |
||
| 51 | private $secondFieldAlign; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Specifies vertical line distance. Defaults to “1” (single-spacing), and can be set to any positive integer to |
||
| 55 | * specify a multiple of the standard unit of line height (e.g. “2” for double-spacing). |
||
| 56 | * @var string |
||
|
1 ignored issue
–
show
|
|||
| 57 | */ |
||
| 58 | private $lineSpacing; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Specifies vertical distance between bibliographic entries. By default (with a value of “1”), entries are |
||
| 62 | * separated by a single additional line-height (as set by the line-spacing attribute). Can be set to any |
||
| 63 | * non-negative integer to specify a multiple of this amount. |
||
| 64 | * @var string |
||
|
1 ignored issue
–
show
|
|||
| 65 | */ |
||
| 66 | private $entrySpacing; |
||
| 67 | |||
| 68 | 64 | public function __construct(SimpleXMLElement $node) |
|
| 69 | { |
||
| 70 | |||
| 71 | /** @var SimpleXMLElement $attribute */ |
||
|
3 ignored issues
–
show
|
|||
| 72 | 64 | foreach ($node->attributes() as $attribute) { |
|
| 73 | 55 | switch ($attribute->getName()) { |
|
| 74 | 55 | case 'subsequent-author-substitute': |
|
| 75 | 10 | $this->subsequentAuthorSubstitute = (string) $attribute; |
|
| 76 | 10 | break; |
|
| 77 | 53 | case 'subsequent-author-substitute-rule': |
|
| 78 | 4 | $this->subsequentAuthorSubstituteRule = new SubsequentAuthorSubstituteRule((string) $attribute); |
|
| 79 | 4 | break; |
|
| 80 | 49 | case 'hanging-indent': |
|
| 81 | 27 | $this->hangingIndent = "true" === (string) $attribute ? true : false; |
|
| 82 | 27 | break; |
|
| 83 | 49 | case 'second-field-align': |
|
| 84 | 9 | $this->secondFieldAlign = (string) $attribute; |
|
| 85 | 9 | break; |
|
| 86 | 49 | case 'line-spacing': |
|
| 87 | 19 | $this->lineSpacing = (string) $attribute; |
|
| 88 | 19 | break; |
|
| 89 | 49 | case 'entry-spacing': |
|
| 90 | 55 | $this->entrySpacing = (string) $attribute; |
|
| 91 | } |
||
| 92 | } |
||
| 93 | 64 | if (empty($this->subsequentAuthorSubstituteRule)) { |
|
| 94 | 60 | $this->subsequentAuthorSubstituteRule = new SubsequentAuthorSubstituteRule("complete-all"); |
|
| 95 | } |
||
| 96 | 64 | } |
|
| 97 | |||
| 98 | /** |
||
|
1 ignored issue
–
show
|
|||
| 99 | * @return string |
||
| 100 | */ |
||
| 101 | 57 | public function getSubsequentAuthorSubstitute() |
|
| 102 | { |
||
| 103 | 57 | return $this->subsequentAuthorSubstitute; |
|
| 104 | } |
||
| 105 | |||
| 106 | /** |
||
|
1 ignored issue
–
show
|
|||
| 107 | * @param string $subsequentAuthorSubstitute |
||
|
1 ignored issue
–
show
|
|||
| 108 | */ |
||
| 109 | public function setSubsequentAuthorSubstitute($subsequentAuthorSubstitute) |
||
| 110 | { |
||
| 111 | $this->subsequentAuthorSubstitute = $subsequentAuthorSubstitute; |
||
| 112 | } |
||
| 113 | |||
| 114 | /** |
||
|
1 ignored issue
–
show
|
|||
| 115 | * @return SubsequentAuthorSubstituteRule |
||
| 116 | */ |
||
| 117 | 57 | public function getSubsequentAuthorSubstituteRule() |
|
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
|
1 ignored issue
–
show
|
|||
| 123 | * @param SubsequentAuthorSubstituteRule $subsequentAuthorSubstituteRule |
||
|
1 ignored issue
–
show
|
|||
| 124 | */ |
||
| 125 | public function setSubsequentAuthorSubstituteRule($subsequentAuthorSubstituteRule) |
||
| 126 | { |
||
| 127 | $this->subsequentAuthorSubstituteRule = $subsequentAuthorSubstituteRule; |
||
| 128 | } |
||
| 129 | |||
| 130 | /** |
||
|
1 ignored issue
–
show
|
|||
| 131 | * @return string |
||
| 132 | */ |
||
| 133 | 3 | public function getHangingIndent() |
|
| 134 | { |
||
| 135 | 3 | return $this->hangingIndent; |
|
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
|
1 ignored issue
–
show
|
|||
| 139 | * @param string $hangingIndent |
||
|
1 ignored issue
–
show
|
|||
| 140 | */ |
||
| 141 | public function setHangingIndent($hangingIndent) |
||
| 144 | } |
||
| 145 | |||
| 146 | /** |
||
|
1 ignored issue
–
show
|
|||
| 147 | * @return string |
||
| 148 | */ |
||
| 149 | 60 | public function getSecondFieldAlign() |
|
| 152 | } |
||
| 153 | |||
| 154 | /** |
||
|
1 ignored issue
–
show
|
|||
| 155 | * @param string $secondFieldAlign |
||
|
1 ignored issue
–
show
|
|||
| 156 | */ |
||
| 157 | public function setSecondFieldAlign($secondFieldAlign) |
||
| 158 | { |
||
| 159 | $this->secondFieldAlign = $secondFieldAlign; |
||
| 160 | } |
||
| 161 | |||
| 162 | /** |
||
|
1 ignored issue
–
show
|
|||
| 163 | * @return string |
||
| 164 | */ |
||
| 165 | 3 | public function getLineSpacing() |
|
| 168 | } |
||
| 169 | |||
| 170 | /** |
||
|
1 ignored issue
–
show
|
|||
| 171 | * @param string $lineSpacing |
||
|
1 ignored issue
–
show
|
|||
| 172 | */ |
||
| 173 | public function setLineSpacing($lineSpacing) |
||
| 176 | } |
||
| 177 | |||
| 178 | /** |
||
|
1 ignored issue
–
show
|
|||
| 179 | * @return string |
||
| 180 | */ |
||
| 181 | 3 | public function getEntrySpacing() |
|
| 184 | } |
||
| 185 | |||
| 186 | /** |
||
|
1 ignored issue
–
show
|
|||
| 187 | * @param string $entrySpacing |
||
|
1 ignored issue
–
show
|
|||
| 188 | */ |
||
| 189 | public function setEntrySpacing($entrySpacing) |
||
| 192 | } |
||
| 193 | |||
| 195 | } |