<commit_before><?php

namespace Freyo\Flysystem\QcloudCOSv4;

use Carbon\Carbon;
use DateTimeInterface;
use Freyo\Flysystem\QcloudCOSv4\Exceptions\RuntimeException;
use League\Flysystem\Adapter\AbstractAdapter;
use League\Flysystem\AdapterInterface;
use League\Flysystem\Config;
use League\Flysystem\Util;
use QCloud\Cos\Api;

/**
 * Class Adapter.
 */
class Adapter extends AbstractAdapter
{
    /**
     * @var Api
     */
    protected $cosApi;

    /**
     * @var string
     */
    protected $bucket;

    /**
     * @var bool
     */
    protected $debug;

    /**
     * Adapter constructor.
     *
     * @param Api   $cosApi
     * @param array $config
     */
    public function __construct(Api $cosApi, array $config)
    {
        $this->cosApi = $cosApi;

        $this->bucket = $config['bucket'];
        $this->debug = $config['debug'];

        $this->setPathPrefix($config['protocol'].'://'.$config['domain'].'/');
    }

    /**
     * @return string
     */
    public function getBucket()
    {
        return $this->bucket;
    }

    /**
     * @param string $path
     *
     * @return string
     */
    public function getUrl($path)
    {
        return $this->applyPathPrefix($path);
    }

    /**
     * @param  string             $path
     * @param  \DateTimeInterface $expiration
     * @param  array              $options
     *
     * @return string|bool
     */
    public function getTemporaryUrl($path, DateTimeInterface $expiration, array $options = [])
    {
        $response = $this->cosApi->getDownloadUrl(
            $this->getBucket(), $path, Carbon::now()->diffInSeconds($expiration)
        );

        $response = $this->normalizeResponse($response);<commit_msg>Apply fixes from StyleCI (#34)<commit_after><?php

namespace Freyo\Flysystem\QcloudCOSv4;

use Carbon\Carbon;
use DateTimeInterface;
use Freyo\Flysystem\QcloudCOSv4\Exceptions\RuntimeException;
use League\Flysystem\Adapter\AbstractAdapter;
use League\Flysystem\AdapterInterface;
use League\Flysystem\Config;
use League\Flysystem\Util;
use QCloud\Cos\Api;

/**
 * Class Adapter.
 */
class Adapter extends AbstractAdapter
{
    /**
     * @var Api
     */
    protected $cosApi;

    /**
     * @var string
     */
    protected $bucket;

    /**
     * @var bool
     */
    protected $debug;

    /**
     * Adapter constructor.
     *
     * @param Api   $cosApi
     * @param array $config
     */
    public function __construct(Api $cosApi, array $config)
    {
        $this->cosApi = $cosApi;

        $this->bucket = $config['bucket'];
        $this->debug = $config['debug'];

        $this->setPathPrefix($config['protocol'].'://'.$config['domain'].'/');
    }

    /**
     * @return string
     */
    public function getBucket()
    {
        return $this->bucket;
    }

    /**
     * @param string $path
     *
     * @return string
     */
    public function getUrl($path)
    {
        return $this->applyPathPrefix($path);
    }

    /**
     * @param string             $path
     * @param \DateTimeInterface $expiration
     * @param array              $options
     *
     * @return string|bool
     */
    public function getTemporaryUrl($path, DateTimeInterface $expiration, array $options = [])
    {
        $response = $this->cosApi->getDownloadUrl(
            $this->getBucket(), $path, Carbon::now()->diffInSeconds($expiration)
        );

        $response = $this->normalizeResponse($response);
{'fraction_non_alphanumeric': 0.14339732402559627, 'fraction_numerical': 0.0017452006980802793, 'mean_word_length': 2.2443396226415095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1823783', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1033, 'n_words': 203}