Skip to content

Commit

Permalink
Final touches before v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaspare Sganga committed Aug 30, 2019
1 parent 043926b commit c56d8f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ gulpfile.js
header.txt
package.json
package-lock.json
documentation/
node_modules/
4 changes: 2 additions & 2 deletions src/Shapefile/Shapefile.php
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ protected function getPRJ()
* Sets PRJ well-known-text.
*
* @param string $prj PRJ well-known-text.
* Pass a falsy value (ie. false or "") to delete it.
* Pass a falsy value (eg. false or "") to delete it.
*/
protected function setPRJ($prj)
{
Expand All @@ -873,7 +873,7 @@ protected function getCharset()
* Sets or resets DBF charset.
*
* @param mixed $charset Name of the charset.
* Pass a falsy value (ie. false or "") to reset it to default.
* Pass a falsy value (eg. false or "") to reset it to default.
*/
protected function setCharset($charset)
{
Expand Down
8 changes: 7 additions & 1 deletion src/Shapefile/ShapefileWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function addField($name, $type, $size, $decimals, $flag_sanitize_name = t

/**
* Adds a char field to the Shapefile definition.
* Returns the effective field name after eventual sanitization.
*
* @param string $name Name of the field. Maximum 10 characters.
* Only letters, numbers and underscores are allowed.
Expand All @@ -145,6 +146,7 @@ public function addCharField($name, $size = 254, $flag_sanitize_name = true)

/**
* Adds a date field to the Shapefile definition.
* Returns the effective field name after eventual sanitization.
*
* @param string $name Name of the field. Maximum 10 characters.
* Only letters, numbers and underscores are allowed.
Expand All @@ -160,6 +162,7 @@ public function addDateField($name, $flag_sanitize_name = true)

/**
* Adds a logical/boolean field to the Shapefile definition.
* Returns the effective field name after eventual sanitization.
*
* @param string $name Name of the field. Maximum 10 characters.
* Only letters, numbers and underscores are allowed.
Expand All @@ -175,6 +178,7 @@ public function addLogicalField($name, $flag_sanitize_name = true)

/**
* Adds a memo field to the Shapefile definition.
* Returns the effective field name after eventual sanitization.
*
* @param string $name Name of the field. Maximum 10 characters.
* Only letters, numbers and underscores are allowed.
Expand All @@ -190,6 +194,7 @@ public function addMemoField($name, $flag_sanitize_name = true)

/**
* Adds numeric to the Shapefile definition.
* Returns the effective field name after eventual sanitization.
*
* @param string $name Name of the field. Maximum 10 characters.
* Only letters, numbers and underscores are allowed.
Expand All @@ -207,6 +212,7 @@ public function addNumericField($name, $size = 10, $decimals = 0, $flag_sanitize

/**
* Adds floating point to the Shapefile definition.
* Returns the effective field name after eventual sanitization.
*
* @param string $name Name of the field. Maximum 10 characters.
* Only letters, numbers and underscores are allowed.
Expand Down Expand Up @@ -976,7 +982,7 @@ private function encodeFieldValue($type, $size, $decimals, $value)
$errors = \DateTime::getLastErrors();
}
if ($errors['warning_count'] || $errors['error_count']) {
$value = $this->getOption(Shapefile::OPTION_DBF_NULLIFY_INVALID_DATES) ? null : $this->truncateOrPadString(preg_replace('/[^0-9]/', '', $value), $size);
$value = $this->getOption(Shapefile::OPTION_DBF_NULLIFY_INVALID_DATES) ? null : $this->truncateOrPadString($this->sanitizeNumber($value), $size);
} else {
$value = $DateTime->format('Ymd');
}
Expand Down

0 comments on commit c56d8f5

Please sign in to comment.