<commit_before><?php

namespace app\grabbers;

use app\models\ExchangeRateCurrencyGrabberInfo;

use app\grabbers\ExchangeRateGrabberStrategyAbstract;
use app\grabbers\ExchangeRateGrabbingStrategyInterface;

use serhatozles\simplehtmldom\SimpleHTMLDom;
use serhatozles\simplehtmldom\simple_html_dom;
use serhatozles\simplehtmldom\simple_html_dom_node;

/**
 * This is class for common grabbing banks exchange rates
 */
class CommonBankGrabStrategy extends ExchangeRateGrabberStrategyAbstract implements ExchangeRateGrabbingStrategyInterface
{

    /** @var string String to store bank strategy name */
    protected $bankname;

    /**
     * If bankname is null, it can be only child of CommonBankGrabStrategy
     * 
     * {@inheritdoc}
     */
    public function __construct($bankname = null)
    {
        $this->bankname = empty($bankname) ? parent::getBankName() : $bankname;

        parent::__construct();
    }
    
    /**
     * {@inheritdoc}
     */
    public function getBankName()
    {
            return $this->bankname;
    }

    /**
     * This is how typical bank grabbing works
     * Get URL, scrub document, cells, exchanges, throw exception if something is empty or wrong
     * 
     * {@inheritdoc}
     */
    public function execute()
    {
        // grab bank exchange page, check

        $url = $this->getURL();

        if (empty($url)) {
            throw new \LogicException('broken class:no url');
        }

        // grab bank exchange page, check

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION , 1);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36');<commit_msg>Disabled SSL verify on curl<commit_after><?php

namespace app\grabbers;

use app\models\ExchangeRateCurrencyGrabberInfo;

use app\grabbers\ExchangeRateGrabberStrategyAbstract;
use app\grabbers\ExchangeRateGrabbingStrategyInterface;

use serhatozles\simplehtmldom\SimpleHTMLDom;
use serhatozles\simplehtmldom\simple_html_dom;
use serhatozles\simplehtmldom\simple_html_dom_node;

/**
 * This is class for common grabbing banks exchange rates
 */
class CommonBankGrabStrategy extends ExchangeRateGrabberStrategyAbstract implements ExchangeRateGrabbingStrategyInterface
{

    /** @var string String to store bank strategy name */
    protected $bankname;

    /**
     * If bankname is null, it can be only child of CommonBankGrabStrategy
     * 
     * {@inheritdoc}
     */
    public function __construct($bankname = null)
    {
        $this->bankname = empty($bankname) ? parent::getBankName() : $bankname;

        parent::__construct();
    }
    
    /**
     * {@inheritdoc}
     */
    public function getBankName()
    {
            return $this->bankname;
    }

    /**
     * This is how typical bank grabbing works
     * Get URL, scrub document, cells, exchanges, throw exception if something is empty or wrong
     * 
     * {@inheritdoc}
     */
    public function execute()
    {
        // grab bank exchange page, check

        $url = $this->getURL();

        if (empty($url)) {
            throw new \LogicException('broken class:no url');
        }

        // grab bank exchange page, check

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION , 1);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // @todo add cert to server
        curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36');
{'fraction_non_alphanumeric': 0.10196592398427261, 'fraction_numerical': 0.014941022280471821, 'mean_word_length': 3.0253164556962027, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6948779', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1137, 'n_words': 285}