Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the beginning and end of a string
<?php trim(string $string, string $characters = " \n\r\t\v\x00"): string
<?php             }



            foreach ($package->getIncludePaths() as $includePath) {

                $includePath = trim($includePath, '/');

                $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;

            }

        }
<?php                     if ($type === 'exclude-from-classmap') {


                        $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));




                        $path = strtr($path, array('\\*\\*' => '.+?', '\\*' => '[^/]+?'));
<?php                 $message = 'File at "%s" does not exist, check your classmap definitions';

            } elseif (!Filesystem::isReadable($path)) {

                $message = 'File at "%s" is not readable, check its permissions';

            } elseif ('' === trim((string) file_get_contents($path))) {


                return array();

            } else {
<?php         }



        $this->process->execute('git config color.ui', $output);

        if (strtolower(trim($output)) === 'always') {

            return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';

        }
<?php                     case 'openssl_version':


                        $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);

                        $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;



                        $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
<?php         if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {

            if ($this->isValidEmail($match['email'])) {

                return array(

                    'name' => trim($match['name']),

                    'email' => $match['email'],

                );

            }
<?php                 if (false !== $package && false === strpos($package, ' ')) {

                    $validator = function ($input) {

                        $input = trim($input);



                        return $input ?: false;

                    };
<?php         $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');



        $validator = function ($value) {

            if (!Preg::isMatch('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {

                throw new \UnexpectedValueException('Invalid input');

            }
<?php                 throw new \UnexpectedValueException('Invalid input');

            }



            return trim($value)."\n";

        };



        $devKey = '';
<?php         while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {

            $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);

            while ($line = $io->ask('')) {

                $devKey .= trim($line)."\n";

                if (trim($line) === '-----END PUBLIC KEY-----') {

                    break;

                }
<?php             $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);

            while ($line = $io->ask('')) {

                $devKey .= trim($line)."\n";

                if (trim($line) === '-----END PUBLIC KEY-----') {

                    break;

                }

            }
<?php         while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {

            $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);

            while ($line = $io->ask('')) {

                $tagsKey .= trim($line)."\n";

                if (trim($line) === '-----END PUBLIC KEY-----') {

                    break;

                }
<?php             $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);

            while ($line = $io->ask('')) {

                $tagsKey .= trim($line)."\n";

                if (trim($line) === '-----END PUBLIC KEY-----') {

                    break;

                }

            }
<?php         if ($process->run() != 0) {

            throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');

        }

        $this->version = trim($process->getOutput());



        $process = new Process(array('git', 'log', '-n1', '--pretty=%ci', 'HEAD'), __DIR__);

        if ($process->run() != 0) {
<?php             throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');

        }



        $this->versionDate = new \DateTime(trim($process->getOutput()));

        $this->versionDate->setTimezone(new \DateTimeZone('UTC'));



        $process = new Process(array('git', 'describe', '--tags', '--exact-match', 'HEAD'), __DIR__);