src/Charcoal/App/Script/PathScriptTrait.php
public function filterPath($path, $trim = null)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException('The path must be a string.');
        }

        if ($trim === null && defined(get_called_class().'::DIRECTORY_SEPARATORS')) {
            $trim = static::DIRECTORY_SEPARATORS;
        }

        if ($trim) {
            if (!is_string($trim)) {
                throw new InvalidArgumentException(
                    'The characters to strip must be a string or use static::DIRECTORY_SEPARATORS.'
                );
            }

            $path = trim($path, $trim);
        }

        return trim($path);
    }
public function filterPath($path, $trim = null)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException('The path must be a string.');
        }

        if ($trim === null && defined(get_called_class().'::DIRECTORY_SEPARATORS')) {
            $trim = static::DIRECTORY_SEPARATORS;
        }

        if ($trim) {
            if (!is_string($trim)) {
                throw new InvalidArgumentException(
                    'The characters to strip must be a string or use static::DIRECTORY_SEPARATORS.'
                );
            }

            $path = trim($path, $trim);
        }

        return trim($path);
    }
public function filterPath ( $ path , $ trim = null ) { if ( ! is_string ( $ path ) ) { throw new InvalidArgumentException ( 'The path must be a string.' ) ; } if ( $ trim === null && defined ( get_called_class ( ) . '::DIRECTORY_SEPARATORS' ) ) { $ trim = static :: DIRECTORY_SEPARATORS ; } if ( $ trim ) { if ( ! is_string ( $ trim ) ) { throw new InvalidArgumentException ( 'The characters to strip must be a string or use static::DIRECTORY_SEPARATORS.' ) ; } $ path = trim ( $ path , $ trim ) ; } return trim ( $ path ) ; }
Filter the given path.

Trims leading and trailing directory paths

@param  string      $path Path to the file or directory.
@param  string|null $trim The characters to strip from the $path.
@throws InvalidArgumentException If the path is invalid.
@return string Returns the filtered path.
Filter the given path .