mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			833 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			833 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * ExternalId.php
 | |
|  * Copyright (C) 2016 thegrumpydictator@gmail.com
 | |
|  *
 | |
|  * 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\Converter;
 | |
| 
 | |
| /**
 | |
|  * Class ExternalId
 | |
|  *
 | |
|  * @package FireflyIII\Import\Converter
 | |
|  */
 | |
| class ExternalId extends BasicConverter implements ConverterInterface
 | |
| {
 | |
| 
 | |
|     /**
 | |
|      * @param $value
 | |
|      *
 | |
|      * @return string
 | |
|      */
 | |
|     public function convert($value): string
 | |
|     {
 | |
|         // this should replace all control characters
 | |
|         // but leave utf8 intact:
 | |
|         $value = preg_replace('/[\x00-\x1F\x80-\x9F]/u', '', $value);
 | |
|         $this->setCertainty(100);
 | |
| 
 | |
|         return strval(trim($value));
 | |
| 
 | |
|     }
 | |
| }
 |