Skip to content

Commit 33b65bd

Browse files
committed
Add Subject::getParts() method
1 parent 544f4d4 commit 33b65bd

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Fields/Subject.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,18 @@ public function getControlNumber($value='')
3939
return $this->field->getSubfield('0');
4040
}
4141

42-
/**
43-
* Returns the title of the record (245 $a, $b, $n and $p).
44-
* - Joins the subfields by colon if no ISBD marker present at the end of $a
45-
* - Removes trailing '/'
46-
* - See tests/TitleFieldTest.php for more info.
47-
*/
48-
public function __toString()
49-
{
42+
function getParts() {
5043
$parts = array();
5144
foreach ($this->field->getSubfields() as $c) {
5245
if (in_array($c->getCode(), array('a', 'b', 'x', 'y', 'z'))) {
5346
$parts[] = $c->getData();
5447
}
5548
}
49+
return $parts;
50+
}
5651

57-
return implode(self::$glue, $parts);
52+
public function __toString()
53+
{
54+
return implode(self::$glue, $this->getParts());
5855
}
5956
}

0 commit comments

Comments
 (0)