<commit_before><?php

namespace Mateusjatenee\Iugu;

use Mateusjatenee\Iugu\Resource;
use Mateusjatenee\Iugu\Responses\SubAccountResponse;

class SubAccount extends Resource
{
    private $iugu;

    /**
     * @param \Mateusjatenee\Iugu\Iugu $iugu
     */
    public function __construct($iugu)
    {
        $this->iugu = $iugu;
    }

    public function create($data)
    {
        $response = $this->iugu->client->post(
            $this->getEndpoint('marketplace.create_account'), $data
        );

        return $response->to(SubAccountResponse::class);
    }

    public function find($id)
    {
        $response = $this->iugu->client->get(
            $this->getEndpoint('accounts', ['id' => $id])
        );

        return $response->to(SubAccountResponse::class);
    }

    public function verify($id, $data)
    {
        if ($id instanceof SubAccountResponse) {
            $userToken = $id->user_token;
            $id = $id->getId();
        } else {
            [$id, $userToken] = $id;
        }

        $token = tap($this->iugu->token, function () use ($userToken) {
            $this->iugu->setAuth($userToken);
        });

        $response = $this->iugu->client->post(
            $this->getEndpoint('accounts.verify', ['id' => $id]), ['data' => $data]
        );

        $this->iugu->setAuth($token);

        return $response->to(SubAccountResponse::class);
    }

    public function requestWithdraw($id, $amount)
    {
        if ($id instanceof SubAccountResponse) {
            $id = $id->id;
        }

        $response = $this->iugu->client->post(<commit_msg>fix php7 syntax error<commit_after><?php

namespace Mateusjatenee\Iugu;

use Mateusjatenee\Iugu\Resource;
use Mateusjatenee\Iugu\Responses\SubAccountResponse;

class SubAccount extends Resource
{
    private $iugu;

    /**
     * @param \Mateusjatenee\Iugu\Iugu $iugu
     */
    public function __construct($iugu)
    {
        $this->iugu = $iugu;
    }

    public function create($data)
    {
        $response = $this->iugu->client->post(
            $this->getEndpoint('marketplace.create_account'), $data
        );

        return $response->to(SubAccountResponse::class);
    }

    public function find($id)
    {
        $response = $this->iugu->client->get(
            $this->getEndpoint('accounts', ['id' => $id])
        );

        return $response->to(SubAccountResponse::class);
    }

    public function verify($id, $data)
    {
        if ($id instanceof SubAccountResponse) {
            $userToken = $id->user_token;
            $id = $id->getId();
        } else {
            list($id, $userToken) = $id;
        }

        $token = tap($this->iugu->token, function () use ($userToken) {
            $this->iugu->setAuth($userToken);
        });

        $response = $this->iugu->client->post(
            $this->getEndpoint('accounts.verify', ['id' => $id]), ['data' => $data]
        );

        $this->iugu->setAuth($token);

        return $response->to(SubAccountResponse::class);
    }

    public function requestWithdraw($id, $amount)
    {
        if ($id instanceof SubAccountResponse) {
            $id = $id->id;
        }

        $response = $this->iugu->client->post(
{'fraction_non_alphanumeric': 0.16042446941323346, 'fraction_numerical': 0.00031210986267166043, 'mean_word_length': 2.1986027944111775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, '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': '2836899', 'n_tokens_mistral': 1026, 'n_tokens_neox': 996, 'n_words': 170}