From 5acf6023c52a1029477fd2580ff2d527a3bb82a7 Mon Sep 17 00:00:00 2001 From: Gunter Grodotzki Date: Tue, 20 Feb 2018 15:42:56 +0200 Subject: [PATCH] Prefixable tel (#10) * make tel prefixable * make tel prefixable --- app/Transformer/Transformers/Tel.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Transformer/Transformers/Tel.php b/app/Transformer/Transformers/Tel.php index 5847f15..af54893 100644 --- a/app/Transformer/Transformers/Tel.php +++ b/app/Transformer/Transformers/Tel.php @@ -4,8 +4,19 @@ class Tel extends Transformer { + protected $prefix = ''; + public function transform(array $columns_n, array $values, $column) { - return $this->replaceValue($values[$column], sprintf('999%d', rand(1000000000, 9999999999))); + return $this->replaceValue($values[$column], sprintf('%s999%d', $this->prefix, rand(1000000000, 9999999999))); + } + + public function setParam($param) + { + $this->param = $param; + + if (!empty($param)) { + $this->prefix = $param; + } } }