for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the League.csv library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/csv/
* @version 9.0.0
* @package League.csv
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace League\Csv;
use League\Csv\Exception\LengthException;
* A trait to validate csv control characters
* @since 9.0.0
* @author Ignace Nyamagana Butera <[email protected]>
* @internal Use to validate incoming data
trait CsvControlTrait
{
* Filter Csv control character
* @param string $char Csv control character
* @param string $type Csv control character type
* @param string $caller public API method calling the method
* @throws LengthException If the Csv control character is not one character only.
* @return string
protected function filterControl(string $char, string $type, string $caller): string
if (1 == strlen($char)) {
return $char;
}
throw new LengthException(sprintf('%s() expects %s to be a single character %s given', $caller, $type, $char));