Skip to content

Firefly III: a personal finances manager

Added SNS specifics code for removing quotes from description

Hugo van Duijna1e2814990bb
diff --git a/app/Import/Specifics/SnsDescription.php b/app/Import/Specifics/SnsDescription.php
new file mode 100644
index 0000000000..8af5e8ef6c
--- /dev/null
+++ b/app/Import/Specifics/SnsDescription.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * snsDescription.php
+ * Author 2017 [email protected]
+ *
+ * This software may be modified and distributed under the terms of the
+ * Creative Commons Attribution-ShareAlike 4.0 International License.
+ *
+ * See the LICENSE file for details.
+ */
+
+declare(strict_types=1);
+
+namespace FireflyIII\Import\Specifics;
+
+use Log;
+
+/**
+ * Class SnsDescription
+ *
+ * @package FireflyIII\Import\Specifics
+ */
+class SnsDescription implements SpecificInterface
+{
+ /**
+ * @return string
+ */
+ public static function getDescription(): string
+ {
+ return 'Trim quotes from SNS descriptions.';
+ }
+
+ /**
+ * @return string
+ */
+ public static function getName(): string
+ {
+ return 'SNS description';
+ }
+
+ /**
+ * @param array $row
+ *
+ * @return array
+ */
+ public function run(array $row): array
+ {
+ $row[17] = ltrim($row[17],"'");
+ $row[17] = rtrim($row[17],"'");
+ return $row;
+ }
+}
diff --git a/config/csv.php b/config/csv.php
index 1f69bda24e..6b86ad625e 100644
--- a/config/csv.php
+++ b/config/csv.php
@@ -21,6 +21,7 @@ return [
'IngDescription' => 'FireflyIII\Import\Specifics\IngDescription',
'RabobankDescription' => 'FireflyIII\Import\Specifics\RabobankDescription',
'AbnAmroDescription' => 'FireflyIII\Import\Specifics\AbnAmroDescription',
+ 'SnsDescription' => 'FireflyIII\Import\Specifics\SnsDescription',
'PresidentsChoice' => 'FireflyIII\Import\Specifics\PresidentsChoice',
],