Skip to content
Browse files

PEAR standards compliance. Thanks PHP_CodeSniffer

git-svn-id: https://svn.php.net/repository/pear/packages/File_MARC/trunk@301744 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent c620967 commit 3adaf5b9c497bd59f6cb6444c6ddac61d1573c86 Dan Scott committed Jul 31, 2010
Showing with 33 additions and 32 deletions.
  1. +16 −16 MARC.php
  2. +17 −16 MARC/Record.php
View
32 MARC.php
@@ -333,15 +333,15 @@ private function _decode($text)
$indicators = array_shift($subfields);
if (strlen($indicators) != 2) {
- $errorMessage = File_MARC_Exception::formatError(File_MARC_Exception::$messages[File_MARC_Exception::ERROR_INVALID_INDICATORS], array("tag" => $tag, "indicators" => $indicators));
- $marc->addWarning($errorMessage);
- // Do the best with the indicators we've got
- if (strlen($indicators) == 1) {
- $ind1 = $indicators;
- $ind2 = " ";
- } else {
- list($ind1,$ind2) = array(" ", " ");
- }
+ $errorMessage = File_MARC_Exception::formatError(File_MARC_Exception::$messages[File_MARC_Exception::ERROR_INVALID_INDICATORS], array("tag" => $tag, "indicators" => $indicators));
+ $marc->addWarning($errorMessage);
+ // Do the best with the indicators we've got
+ if (strlen($indicators) == 1) {
+ $ind1 = $indicators;
+ $ind2 = " ";
+ } else {
+ list($ind1,$ind2) = array(" ", " ");
+ }
} else {
$ind1 = substr($indicators, 0, 1);
$ind2 = substr($indicators, 1, 1);
@@ -364,13 +364,13 @@ private function _decode($text)
}
- // If the data is invalid, let's just ignore the one field
- try {
- $new_field = new File_MARC_Data_Field($tag, $subfield_data, $ind1, $ind2);
- $marc->appendField($new_field);
- } catch (Exception $e) {
- $marc->addWarning($e->getMessage());
- }
+ // If the data is invalid, let's just ignore the one field
+ try {
+ $new_field = new File_MARC_Data_Field($tag, $subfield_data, $ind1, $ind2);
+ $marc->appendField($new_field);
+ } catch (Exception $e) {
+ $marc->addWarning($e->getMessage());
+ }
}
}
View
33 MARC/Record.php
@@ -97,6 +97,8 @@ class File_MARC_Record
*
* Set all variables to defaults to create new File_MARC_Record object
*
+ * @param File_MARC $marc MARC record from File_MARC or File_MARCXML
+ *
* @return true
*/
function __construct($marc)
@@ -276,20 +278,19 @@ private function _buildDirectory()
/**
* Rules from MARC::Record::USMARC
*/
- $base_address =
- File_MARC::LEADER_LEN + // better be 24
+ $base_address
+ = File_MARC::LEADER_LEN + // better be 24
(count($directory) * File_MARC::DIRECTORY_ENTRY_LEN) +
// all the directory entries
1; // end-of-field marker
- $total =
- $base_address + // stuff before first field
+ $total
+ = $base_address + // stuff before first field
$data_end + // Length of the fields
1; // End-of-record marker
-
return array($fields, $directory, $total, $base_address);
}
// }}}
@@ -339,9 +340,9 @@ function getField($spec = null, $pcre = null)
{
foreach ($this->fields as $field) {
if (($pcre
- && preg_match("/$spec/", $field->getTag()))
- || (!$pcre
- && $spec == $field->getTag())
+ && preg_match("/$spec/", $field->getTag()))
+ || (!$pcre
+ && $spec == $field->getTag())
) {
return $field;
}
@@ -373,7 +374,7 @@ function getFields($spec = null, $pcre = null)
$matches = array();
foreach ($this->fields as $field) {
if (($pcre && preg_match("/$spec/", $field->getTag()))
- || (!$pcre && $spec == $field->getTag())
+ || (!$pcre && $spec == $field->getTag())
) {
$matches[] = $field;
}
@@ -396,9 +397,9 @@ function deleteFields($tag, $pcre = null)
$cnt = 0;
foreach ($this->getFields() as $field) {
if (($pcre
- && preg_match("/$tag/", $field->getTag()))
- || (!$pcre
- && $tag == $field->getTag())
+ && preg_match("/$tag/", $field->getTag()))
+ || (!$pcre
+ && $tag == $field->getTag())
) {
$field->delete();
$cnt++;
@@ -505,11 +506,11 @@ function __toString()
* attempts to adhere to the MARCXML standard documented at
* http://www.loc.gov/standards/marcxml/
*
- * @param string $encoding output encoding for the MARCXML record
- * @param bool $indent pretty-print the MARCXML record
- * @param bool $single wrap the <record> element in a <collection> element
+ * @param string $encoding output encoding for the MARCXML record
+ * @param bool $indent pretty-print the MARCXML record
+ * @param bool $single wrap the <record> element in a <collection> element
*
- * @return string representation of MARC record in MARCXML format
+ * @return string representation of MARC record in MARCXML format
*
* @todo Fix encoding input / output issues (PHP 6.0 required?)
*/

0 comments on commit 3adaf5b

Please sign in to comment.
Something went wrong with that request. Please try again.