<commit_before><?php
/**
 * League.Url (http://url.thephpleague.com)
 *
 * @link      https://github.com/thephpleague/uri/
 * @copyright Copyright (c) 2013-2015 <NAME>
 * @license   https://github.com/thephpleague/uri/blob/master/LICENSE (MIT License)
 * @version   4.0.0
 * @package   League.uri
 */
namespace League\Uri\Schemes\Generic;

use Exception;
use InvalidArgumentException;
use League\Uri\Interfaces\Components\Fragment as FragmentInterface;
use League\Uri\Interfaces\Components\Host as HostInterface;
use League\Uri\Interfaces\Components\Path as PathInterface;
use League\Uri\Interfaces\Components\Port as PortInterface;
use League\Uri\Interfaces\Components\Query as QueryInterface;
use League\Uri\Interfaces\Components\Scheme as SchemeInterface;
use League\Uri\Interfaces\Components\UserInfo as UserInfoInterface;
use League\Uri\Interfaces\Schemes\Uri;
use League\Uri\Types\ImmutablePropertyTrait;
use League\Uri\UriParser;
use Psr\Http\Message\UriInterface;
use RuntimeException;

/**
 * common URI Object properties and methods
 *
 * @package League.uri
 * @since   4.0.0
 *
 * @property-read SchemeInterface   $scheme
 * @property-read UserInfoInterface $userInfo
 * @property-read HostInterface     $host
 * @property-read PortInterface     $port
 * @property-read PathInterface     $path
 * @property-read QueryInterface    $query
 * @property-read FragmentInterface $fragment
 */
abstract class AbstractUri
{
    use ImmutablePropertyTrait;

    use PathFormatterTrait;

    use HostModifierTrait;

    use QueryModifierTrait;

    /**
     * Scheme Component
     *
     * @var SchemeInterface
     */
    protected $scheme;

    /**
     * User Information Part
     *
     * @var UserInfoInterface
     */
    protected $userInfo;

    /**
     * Port Component
     *
     * @var PortInterface
     */
    protected $port;

    /**
     * Fragment Component
     *
     * @var FragmentInterface
     */
    protected $fragment;

    /**
     * Supported Schemes
     *
     * @var array
     */
    protected static $supportedSchemes = [];

    /**
     * Check if a URI is valid
     *
     * @throws \InvalidArgumentException If the scheme is not supported
     *
     * @return bool
     */
    abstract protected function isValid();

    /**
     * Create a new instance from a string
     *
     * @param string $uri
     *
     * @throws \InvalidArgumentException If the URI can not be parsed
     *
     * @return static
     */
    public static function createFromString($uri = '')
    {
        return static::createFromComponents((new UriParser())->parse($uri));
    }

    /**
     * Assert the object is valid
     *
     * @throws RuntimeException if the resulting URI is not valid
     */
    protected function assertValidObject()
    {
        if (!$this->isValid()) {
            throw new RuntimeException('The submitted properties will produce an invalid object');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getScheme()
    {
        return $this->scheme->__toString();<commit_msg>Remove unused use in AbstractUri<commit_after><?php
/**
 * League.Url (http://url.thephpleague.com)
 *
 * @link      https://github.com/thephpleague/uri/
 * @copyright Copyright (c) 2013-2015 <NAME>
 * @license   https://github.com/thephpleague/uri/blob/master/LICENSE (MIT License)
 * @version   4.0.0
 * @package   League.uri
 */
namespace League\Uri\Schemes\Generic;

use Exception;
use InvalidArgumentException;
use League\Uri\Interfaces\Schemes\Uri;
use League\Uri\Types\ImmutablePropertyTrait;
use League\Uri\UriParser;
use Psr\Http\Message\UriInterface;
use RuntimeException;

/**
 * common URI Object properties and methods
 *
 * @package League.uri
 * @since   4.0.0
 *
 * @property-read Scheme   $scheme
 * @property-read UserInfo $userInfo
 * @property-read Host     $host
 * @property-read Port     $port
 * @property-read Path     $path
 * @property-read Query    $query
 * @property-read Fragment $fragment
 */
abstract class AbstractUri
{
    use ImmutablePropertyTrait;

    use PathFormatterTrait;

    use HostModifierTrait;

    use QueryModifierTrait;

    /**
     * Scheme Component
     *
     * @var Scheme
     */
    protected $scheme;

    /**
     * User Information Part
     *
     * @var UserInfo
     */
    protected $userInfo;

    /**
     * Port Component
     *
     * @var Port
     */
    protected $port;

    /**
     * Fragment Component
     *
     * @var Fragment
     */
    protected $fragment;

    /**
     * Supported Schemes
     *
     * @var array
     */
    protected static $supportedSchemes = [];

    /**
     * Check if a URI is valid
     *
     * @throws InvalidArgumentException If the scheme is not supported
     *
     * @return bool
     */
    abstract protected function isValid();

    /**
     * Create a new instance from a string
     *
     * @param string $uri
     *
     * @throws InvalidArgumentException If the URI can not be parsed
     *
     * @return static
     */
    public static function createFromString($uri = '')
    {
        return static::createFromComponents((new UriParser())->parse($uri));
    }

    /**
     * Assert the object is valid
     *
     * @throws RuntimeException if the resulting URI is not valid
     */
    protected function assertValidObject()
    {
        if (!$this->isValid()) {
            throw new RuntimeException('The submitted properties will produce an invalid object');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getScheme()
    {
        return $this->scheme->__toString();
{'fraction_non_alphanumeric': 0.10902255639097744, 'fraction_numerical': 0.005012531328320802, 'mean_word_length': 2.50721908349027, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2630452', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1564, 'n_words': 413}