diff --git a/library/Class/NoticeUnimarc.php b/library/Class/NoticeUnimarc.php index 249c86f0d3cd1356854ad88fde7fc4e1ac0c1595..92819b7dc950e1e91137e9d914d8358bff639298 100644 --- a/library/Class/NoticeUnimarc.php +++ b/library/Class/NoticeUnimarc.php @@ -176,34 +176,32 @@ class Class_NoticeUnimarc { return $this->_pattern_subfield_cache[$subfield]; } - -// ---------------------------------------------------------------- -// Rend un tableau de valeurs a partir d'un champ inner_data -// ---------------------------------------------------------------- - public function getValeursBloc($bloc) - { - $bloc=substr($bloc,3); - $champs=split($this->subfield_begin,$bloc); - for($j=0;$j<count($champs); $j++) $valeur[]=substr($champs[$j],1); - return $valeur; + public function getValeursBloc($bloc) { + $valeurs = []; + $bloc = substr($bloc, 3); + $fields = explode($this->subfield_begin, $bloc); + foreach ($fields as $field) + $valeurs[] = substr($field, 1); + return $valeurs; } - // --------------------------------------------------- // Decoupe un bloc zone en sous-champs // --------------------------------------------------- - public function decoupe_bloc_champ($bloc) - { - $bloc=substr($bloc,3); - $champs=explode($this->subfield_begin,$bloc); - for($j=0;$j<count($champs); $j++) - { - $sc[$j]["code"]=substr($champs[$j],0,1); - $sc[$j]["valeur"]=substr($champs[$j],1); - } - return $sc; + + public function decoupe_bloc_champ($bloc,$num=false) { + $sc = []; + $bloc = substr($bloc, 3); + $fields = explode($this->subfield_begin, $bloc); + foreach($fields as $field) + $sc[] = $num == true + ? [substr($field, 0, 1), substr($field, 1)] + : ['code' => substr($field, 0, 1), 'valeur' => substr($field, 1)]; + + return (0 == count($sc)) ? null : $sc; } + public function decoupe_bloc_champ_thesaurus($bloc) { $bloc=substr($bloc,3); diff --git a/library/Class/NoticeUnimarc/Writer.php b/library/Class/NoticeUnimarc/Writer.php index 26598681f4225e01d2ebcb5dc761ca43a3bfe1ab..ff435edd331a0384eed7f809a458c288117c3120 100644 --- a/library/Class/NoticeUnimarc/Writer.php +++ b/library/Class/NoticeUnimarc/Writer.php @@ -153,18 +153,6 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { } - public function getValeursBloc($bloc) { - $valeurs = array(); - $bloc = substr($bloc, 3); - $fields = explode($this->subfield_begin, $bloc); - foreach ($fields as $field) - $valeurs[] = substr($field, 1); - - if (0 == count($valeurs)) - return null; - return $valeurs; - } - public function makeZoneByValeurs($indicateurs, $sous_champ, $valeurs) { $new = $indicateurs; @@ -173,17 +161,6 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { return $new; } - public function decoupe_bloc_champ($bloc,$num=false) { - $sc = []; - $bloc = substr($bloc, 3); - $fields = explode($this->subfield_begin, $bloc); - foreach($fields as $field) - $sc[] = $num == true - ? [substr($field, 0, 1), substr($field, 1)] - : ['code' => substr($field, 0, 1), 'valeur' => substr($field, 1)]; - - return (0 == count($sc)) ? null : $sc; - } public function add_zone($zone, $valeur) { if (!isset($this->inner_data[$zone]))