@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * MetsExporter |
| 19 | 19 | */ |
| 20 | -class MetsExporter |
|
| 21 | -{ |
|
| 20 | +class MetsExporter { |
|
| 22 | 21 | /** |
| 23 | 22 | * formData |
| 24 | 23 | * |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | /** |
| 97 | 96 | * Constructor |
| 98 | 97 | */ |
| 99 | - public function __construct() |
|
| 100 | - { |
|
| 98 | + public function __construct() { |
|
| 101 | 99 | // mets data beginning |
| 102 | 100 | $this->metsHeader = '<mets:mets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 103 | 101 | xmlns:mets="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink" |
@@ -138,8 +136,7 @@ discard block |
||
| 138 | 136 | * returns the mets xml string |
| 139 | 137 | * @return string mets xml |
| 140 | 138 | */ |
| 141 | - public function getMetsData() |
|
| 142 | - { |
|
| 139 | + public function getMetsData() { |
|
| 143 | 140 | $xml = $this->metsData->saveXML(); |
| 144 | 141 | |
| 145 | 142 | $xml = preg_replace("/eww=\"\d-\d-\d\"/", '${1}${2}${3}', $xml); |
@@ -152,8 +149,7 @@ discard block |
||
| 152 | 149 | * returns the mods xml string |
| 153 | 150 | * @return string mods xml |
| 154 | 151 | */ |
| 155 | - public function getModsData() |
|
| 156 | - { |
|
| 152 | + public function getModsData() { |
|
| 157 | 153 | return $this->modsData->saveXML(); |
| 158 | 154 | } |
| 159 | 155 | |
@@ -161,8 +157,7 @@ discard block |
||
| 161 | 157 | * Build mets data structure |
| 162 | 158 | * @return string mets xml |
| 163 | 159 | */ |
| 164 | - public function buildMets() |
|
| 165 | - { |
|
| 160 | + public function buildMets() { |
|
| 166 | 161 | // get mods domDocument |
| 167 | 162 | $modsWrap = $this->buildModsWrap(); |
| 168 | 163 | // get mets filesection |
@@ -203,8 +198,7 @@ discard block |
||
| 203 | 198 | * @param xml $xml xml data which should be wrapped with mods |
| 204 | 199 | * @return xml wrapped xml |
| 205 | 200 | */ |
| 206 | - public function wrapMods($xml) |
|
| 207 | - { |
|
| 201 | + public function wrapMods($xml) { |
|
| 208 | 202 | $newXML = $this->modsHeader; |
| 209 | 203 | |
| 210 | 204 | $newXML = str_replace("</mods:mods>", $xml . "</mods:mods>", $newXML); |
@@ -212,8 +206,7 @@ discard block |
||
| 212 | 206 | return $newXML; |
| 213 | 207 | } |
| 214 | 208 | |
| 215 | - public function wrapSlub($xml) |
|
| 216 | - { |
|
| 209 | + public function wrapSlub($xml) { |
|
| 217 | 210 | $newXML = $this->slubHeader; |
| 218 | 211 | |
| 219 | 212 | $newXML = str_replace("</slub:info>", $xml . "</slub:info>", $newXML); |
@@ -225,8 +218,7 @@ discard block |
||
| 225 | 218 | * build mods from form array |
| 226 | 219 | * @param array $array structured form data array |
| 227 | 220 | */ |
| 228 | - public function buildModsFromForm($array) |
|
| 229 | - { |
|
| 221 | + public function buildModsFromForm($array) { |
|
| 230 | 222 | $this->xmlData = $this->modsData; |
| 231 | 223 | // Build xml mods from form fields |
| 232 | 224 | // loop each group |
@@ -308,8 +300,7 @@ discard block |
||
| 308 | 300 | * @param xpath $xPath xPath expression |
| 309 | 301 | * @return xml |
| 310 | 302 | */ |
| 311 | - public function parseXPath($xPath) |
|
| 312 | - { |
|
| 303 | + public function parseXPath($xPath) { |
|
| 313 | 304 | // |
| 314 | 305 | $xml = $this->parser->parse($xPath); |
| 315 | 306 | |
@@ -322,8 +313,7 @@ discard block |
||
| 322 | 313 | * @param string $value form value |
| 323 | 314 | * @return xml created xml |
| 324 | 315 | */ |
| 325 | - public function customXPath($xPath, $newGroupFlag = false, $value = '', $attributeOnly = false) |
|
| 326 | - { |
|
| 316 | + public function customXPath($xPath, $newGroupFlag = false, $value = '', $attributeOnly = false) { |
|
| 327 | 317 | if (!$attributeOnly) { |
| 328 | 318 | // Explode xPath |
| 329 | 319 | $newPath = explode('%', $xPath); |
@@ -494,8 +484,7 @@ discard block |
||
| 494 | 484 | return $this->xmlData->saveXML(); |
| 495 | 485 | } |
| 496 | 486 | |
| 497 | - public function customXPathSlub($xPath, $newGroupFlag = false, $value = '', $attributeOnly = false) |
|
| 498 | - { |
|
| 487 | + public function customXPathSlub($xPath, $newGroupFlag = false, $value = '', $attributeOnly = false) { |
|
| 499 | 488 | if (!$attributeOnly) { |
| 500 | 489 | // Explode xPath |
| 501 | 490 | $newPath = explode('%', $xPath); |
@@ -609,8 +598,7 @@ discard block |
||
| 609 | 598 | * Builds the xml wrapping part for mods |
| 610 | 599 | * @return xml |
| 611 | 600 | */ |
| 612 | - public function buildModsWrap() |
|
| 613 | - { |
|
| 601 | + public function buildModsWrap() { |
|
| 614 | 602 | // Build wrap for mod |
| 615 | 603 | |
| 616 | 604 | $domDocument = new \DOMDocument(); |
@@ -648,8 +636,7 @@ discard block |
||
| 648 | 636 | * Builds xml amdSection |
| 649 | 637 | * @return xml |
| 650 | 638 | */ |
| 651 | - public function buildAmdSection() |
|
| 652 | - { |
|
| 639 | + public function buildAmdSection() { |
|
| 653 | 640 | // Build xml amd:sec |
| 654 | 641 | |
| 655 | 642 | $domDocument = new \DOMDocument(); |
@@ -660,8 +647,7 @@ discard block |
||
| 660 | 647 | $amdSec = $domDocument->createElement('mets:amdSec'); |
| 661 | 648 | } |
| 662 | 649 | |
| 663 | - public function setMods($value = '') |
|
| 664 | - { |
|
| 650 | + public function setMods($value = '') { |
|
| 665 | 651 | $domDocument = new \DOMDocument(); |
| 666 | 652 | if (is_null(@$domDocument->loadXML($value))) { |
| 667 | 653 | throw new \Exception("Couldn't load MODS data"); |
@@ -669,13 +655,11 @@ discard block |
||
| 669 | 655 | $this->modsData = $domDocument; |
| 670 | 656 | } |
| 671 | 657 | |
| 672 | - public function setFileData($value = '') |
|
| 673 | - { |
|
| 658 | + public function setFileData($value = '') { |
|
| 674 | 659 | $this->files = $value; |
| 675 | 660 | } |
| 676 | 661 | |
| 677 | - public function loopFiles($array, $domElement, $domDocument) |
|
| 678 | - { |
|
| 662 | + public function loopFiles($array, $domElement, $domDocument) { |
|
| 679 | 663 | $i = 0; |
| 680 | 664 | // set xml for uploded files |
| 681 | 665 | foreach ($array as $key => $value) { |
@@ -720,8 +704,7 @@ discard block |
||
| 720 | 704 | * Builds the xml fileSection part if files are uploaded |
| 721 | 705 | * @return xml |
| 722 | 706 | */ |
| 723 | - public function buildFileSection() |
|
| 724 | - { |
|
| 707 | + public function buildFileSection() { |
|
| 725 | 708 | if (empty($this->files['original']) && empty($this->files['download'])) { |
| 726 | 709 | return; |
| 727 | 710 | } |
@@ -768,8 +751,7 @@ discard block |
||
| 768 | 751 | * Builds the xml structMap part if files are uploaded |
| 769 | 752 | * @return xml |
| 770 | 753 | */ |
| 771 | - public function buildStructureMap() |
|
| 772 | - { |
|
| 754 | + public function buildStructureMap() { |
|
| 773 | 755 | // Build xml Mets:structMap |
| 774 | 756 | |
| 775 | 757 | $domDocument = new \DOMDocument(); |
@@ -808,8 +790,7 @@ discard block |
||
| 808 | 790 | return $domDocument; |
| 809 | 791 | } |
| 810 | 792 | |
| 811 | - public function setSlubInfo($value = '') |
|
| 812 | - { |
|
| 793 | + public function setSlubInfo($value = '') { |
|
| 813 | 794 | // build DOMDocument with slub xml |
| 814 | 795 | $domDocument = new \DOMDocument(); |
| 815 | 796 | $domDocument->loadXML($value); |
@@ -821,8 +802,7 @@ discard block |
||
| 821 | 802 | * @param Array $array Array with slub information |
| 822 | 803 | * @return xml xml slubInfo |
| 823 | 804 | */ |
| 824 | - public function buildMetsSlub() |
|
| 825 | - { |
|
| 805 | + public function buildMetsSlub() { |
|
| 826 | 806 | $domDocument = new \DOMDocument(); |
| 827 | 807 | $domDocument->loadXML('<mets:amdSec ID="AMD_000" xmlns:mets="http://www.loc.gov/METS/"></mets:amdSec>'); |
| 828 | 808 | $domWrapElement = $domDocument->firstChild; |
@@ -863,8 +843,7 @@ discard block |
||
| 863 | 843 | * returns the mods xml string |
| 864 | 844 | * @return string mods xml |
| 865 | 845 | */ |
| 866 | - public function getSlubData() |
|
| 867 | - { |
|
| 846 | + public function getSlubData() { |
|
| 868 | 847 | return $this->slubData->saveXML(); |
| 869 | 848 | } |
| 870 | 849 | |
@@ -872,8 +851,7 @@ discard block |
||
| 872 | 851 | * |
| 873 | 852 | * @param string $slubInfoData |
| 874 | 853 | */ |
| 875 | - public function buildSlubInfoFromForm($slubInfoData, $documentType, $processNumber) |
|
| 876 | - { |
|
| 854 | + public function buildSlubInfoFromForm($slubInfoData, $documentType, $processNumber) { |
|
| 877 | 855 | $this->xmlData = $this->slubData; |
| 878 | 856 | if (is_array($slubInfoData['metadata'])) { |
| 879 | 857 | foreach ($slubInfoData['metadata'] as $key => $group) { |
@@ -956,8 +934,7 @@ discard block |
||
| 956 | 934 | * |
| 957 | 935 | * @return string slub info xml |
| 958 | 936 | */ |
| 959 | - public function getSlubInfoData() |
|
| 960 | - { |
|
| 937 | + public function getSlubInfoData() { |
|
| 961 | 938 | return $this->slubData->saveXML(); |
| 962 | 939 | } |
| 963 | 940 | |
@@ -966,8 +943,7 @@ discard block |
||
| 966 | 943 | * @param string $objId |
| 967 | 944 | * @return void |
| 968 | 945 | */ |
| 969 | - public function setObjId($objId) |
|
| 970 | - { |
|
| 946 | + public function setObjId($objId) { |
|
| 971 | 947 | $this->objId = $objId; |
| 972 | 948 | } |
| 973 | 949 | } |