<commit_before><?php
namespace AsaoKamei\PayJp\WebPay;

use AsaoKamei\PayJp\Interfaces\ChargeFactoryInterface;
use AsaoKamei\PayJp\Interfaces\CreatePayInterface;
use AsaoKamei\PayJp\Interfaces\UpdatePayInterface;
use WebPay\Charge;
use WebPay\WebPay;

class ChargeFactory implements ChargeFactoryInterface
{
    /**
     * @var WebPay
     */
    private $web_pay;

    /**
     * @var string
     */
    private $currency;

    /**
     * ChargeFactory constructor.
     *
     * @param WebPay $web_pay
     * @param string $currency
     */
    public function __construct($web_pay, $currency = 'jpy')
    {
        $this->web_pay  = $web_pay;
        $this->currency = $currency;
    }

    /**
     * @param string $api_key
     * @param string $currency
     * @return self
     */
    public static function forge($api_key, $currency = 'jpy')
    {
        return new self(new WebPay($api_key), $currency);
    }

    /**
     * @return Charge
     */
    private function getCharge()
    {
        return $this->web_pay->charge;
    }

    /**
     * @param string|array $card_id
     * @return CreatePayInterface
     */
    public function create($card_id)
    {
        return new CreateCharge($this->web_pay, $card_id, $this->currency);
    }

    /**
     * @param $charge_id
     * @return UpdatePayInterface
     */
    public function retrieve($charge_id)
    {
        return new UpdateCharge($this->web_pay, $charge_id);
    }

    /**
     * @param int $limit
     * @param int $offset
     * @return UpdatePayInterface[]
     */
    public function getList($limit = 10, $offset = 0)
    {
        $list = $this->getCharge()->all([
            'limit'  => $limit,
            'offset' => $offset,
        ]);
        $found = [];
        $count = $list->count;
        $data  = $list->data;
        for($i = 0; $i < $count; $i++) {
            $found[] = new UpdateCharge($this->web_pay, null, $data[$i]);
        }
        return $found;
    }
}<commit_msg>fixed WebPay/ChargeFactory::getList to use 'count' for limiting number to retrieve.<commit_after><?php
namespace AsaoKamei\PayJp\WebPay;

use AsaoKamei\PayJp\Interfaces\ChargeFactoryInterface;
use AsaoKamei\PayJp\Interfaces\CreatePayInterface;
use AsaoKamei\PayJp\Interfaces\UpdatePayInterface;
use WebPay\Charge;
use WebPay\WebPay;

class ChargeFactory implements ChargeFactoryInterface
{
    /**
     * @var WebPay
     */
    private $web_pay;

    /**
     * @var string
     */
    private $currency;

    /**
     * ChargeFactory constructor.
     *
     * @param WebPay $web_pay
     * @param string $currency
     */
    public function __construct($web_pay, $currency = 'jpy')
    {
        $this->web_pay  = $web_pay;
        $this->currency = $currency;
    }

    /**
     * @param string $api_key
     * @param string $currency
     * @return self
     */
    public static function forge($api_key, $currency = 'jpy')
    {
        return new self(new WebPay($api_key), $currency);
    }

    /**
     * @return Charge
     */
    private function getCharge()
    {
        return $this->web_pay->charge;
    }

    /**
     * @param string|array $card_id
     * @return CreatePayInterface
     */
    public function create($card_id)
    {
        return new CreateCharge($this->web_pay, $card_id, $this->currency);
    }

    /**
     * @param $charge_id
     * @return UpdatePayInterface
     */
    public function retrieve($charge_id)
    {
        return new UpdateCharge($this->web_pay, $charge_id);
    }

    /**
     * @param int $limit
     * @param int $offset
     * @return UpdatePayInterface[]
     */
    public function getList($limit = 10, $offset = 0)
    {
        $list = $this->getCharge()->all([
            'count'  => $limit,
            'offset' => $offset,
        ]);
        $found = [];
        $data  = $list->data;
        $count = count($data);
        for($i = 0; $i < $count; $i++) {
            $found[] = new UpdateCharge($this->web_pay, null, $data[$i]);
        }
        return $found;
    }
}
{'fraction_non_alphanumeric': 0.13973147687717555, 'fraction_numerical': 0.001989060169070114, 'mean_word_length': 2.1503523884103366, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 30, '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': '3685304', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1291, 'n_words': 267}