<commit_before><?php

/**
 * This file is part of the PHP Generics package.
 *
 * @package Generics
 */
namespace Generics\Socket;

use Generics\Streams\SocketStream;

/**
 * This abstract class provides basic socket functionality
 *
 * @author <NAME> <<EMAIL>>
 */
abstract class Socket implements SocketStream
{

    /**
     * The socket handle
     *
     * @var resource
     */
    protected $handle;

    /**
     * The socket endpoint
     *
     * @var Endpoint
     */
    protected $endpoint;

    /**<commit_msg>Throw exception when socket extension is not available<commit_after><?php

/**
 * This file is part of the PHP Generics package.
 *
 * @package Generics
 */
namespace Generics\Socket;

use Generics\Streams\SocketStream;

if (!extension_loaded('sockets')) {
    throw new \Generics\GenericsException("Socket extension not loaded");
}

/**
 * This abstract class provides basic socket functionality
 *
 * @author <NAME> <<EMAIL>>
 */
abstract class Socket implements SocketStream
{

    /**
     * The socket handle
     *
     * @var resource
     */
    protected $handle;

    /**
     * The socket endpoint
     *
     * @var Endpoint
     */
    protected $endpoint;

    /**
{'fraction_non_alphanumeric': 0.11480865224625623, 'fraction_numerical': 0.0, 'mean_word_length': 2.634441087613293, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '7635096', 'n_tokens_mistral': 345, 'n_tokens_neox': 340, 'n_words': 105}