<commit_before><?php

namespace ThemeAnorak\LaravelShopify\Modules;

use ThemeAnorak\LaravelShopify\Client;

abstract class BaseModule
{
    protected $client;

    protected $relationHandler;

    protected $parent;

    protected $params;

    /**
     * BaseModule constructor.
     * @param $client
     */
    public function __construct(Client $client, RelationHandlerContract $relationHandler)
    {
        $this->client = $client;
        $this->relationHandler = $relationHandler;
    }

    abstract protected function prepareUri(string $uri = ''): string;


    public function get()
    {
        return $this->client->getRequest()->get($this->prepareUri());
    }

    public function count()
    {
        return $this->client->getRequest()->get($this->prepareUri('count.json'));
    }

    public function first(int $id)
    {
        $results = $this->client->getRequest()->get($this->prepareUri("#$id.json"));
        if ($results) {
            $results['related'] = $this->relationHandler->loadRelations($results);
        }
        return $results;
    }

    public function create(array $product)
    {
        return $this->client->getRequest()->post($this->prepareUri(), $product);
    }

    public function update(int $id, array $product)
    {
        return $this->client->getRequest()->update($this->prepareUri("#$id.json"), $product);
    }

    public function with($relations): BaseModule
    {
        $this->relations = $relations;
        return $this;
    }

    public function belongsTo(array $parent): BaseModule
    {
        $this->parent = $parent;
        return $this;
    }

    public function delete(int $id)
    {
        return $this->client->getRequest()->delete($this->prepareUri("#$id.json"));
    }

    protected function generateUri($url): string
    {
        $params = $this->params ? '?' . http_build_query([$this->params]) : '';
        return $url . $params;
    }

}<commit_msg>base module put fixed<commit_after><?php

namespace ThemeAnorak\LaravelShopify\Modules;

use ThemeAnorak\LaravelShopify\Client;

abstract class BaseModule
{
    protected $client;

    protected $relationHandler;

    protected $parent;

    protected $params;

    /**
     * BaseModule constructor.
     * @param $client
     */
    public function __construct(Client $client, RelationHandlerContract $relationHandler)
    {
        $this->client = $client;
        $this->relationHandler = $relationHandler;
    }

    abstract protected function prepareUri(string $uri = ''): string;


    public function get()
    {
        return $this->client->getRequest()->get($this->prepareUri());
    }

    public function count()
    {
        return $this->client->getRequest()->get($this->prepareUri('count.json'));
    }

    public function first(int $id)
    {
        $results = $this->client->getRequest()->get($this->prepareUri("#$id.json"));
        if ($results) {
            $results['related'] = $this->relationHandler->loadRelations($results);
        }
        return $results;
    }

    public function create(array $product)
    {
        return $this->client->getRequest()->post($this->prepareUri(), $product);
    }

    public function update(int $id, array $product)
    {
        return $this->client->getRequest()->put($this->prepareUri("#$id.json"), $product);
    }

    public function with($relations): BaseModule
    {
        $this->relations = $relations;
        return $this;
    }

    public function belongsTo(array $parent): BaseModule
    {
        $this->parent = $parent;
        return $this;
    }

    public function delete(int $id)
    {
        return $this->client->getRequest()->delete($this->prepareUri("#$id.json"));
    }

    protected function generateUri($url): string
    {
        $params = $this->params ? '?' . http_build_query([$this->params]) : '';
        return $url . $params;
    }

}
{'fraction_non_alphanumeric': 0.15186615186615188, 'fraction_numerical': 0.0, 'mean_word_length': 2.7222222222222223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '5186661', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1082, 'n_words': 217}