<commit_before><?php

namespace IBAN\Generation;

use IBAN\Rule\IBANRuleFactory;

class IBANGenerator
{
    public static function DE($instituteIdentification, $bankAccountNumber) {
        $ruleFactory = new IBANRuleFactory('DE');
        $generater = new IBANGenerator($ruleFactory);
        return $generater->generate($instituteIdentification, $bankAccountNumber);
    }

    private $ibanRuleFactory;
    private $instituteIdentification;
    private $bankAccountNumber;
    
    private function __construct($ibanRuleFactory) {
    	$this->ibanRuleFactory = $ibanRuleFactory;
    }
    
    private function generate($instituteIdentification, $bankAccountNumber) {
        $this->instituteIdentification = ltrim($instituteIdentification, '0');
        $this->bankAccountNumber = ltrim($bankAccountNumber, '0');    
        if ($this->areArgumentsValid()) {
            $ibanRule = $this->createRule();
            $iban = $this->createIban($ibanRule);
        }
        return $iban;
    }
    
    private function createRule() {
    	return $this->ibanRuleFactory->createIBANRule(
	        $this->instituteIdentification, 
	        $this->bankAccountNumber);
    }
    
    private function createIban($ibanRule) {
        return $ibanRule->generateIban();
    }
    
    private function areArgumentsValid() {
    	if (empty($this->instituteIdentification)) {
    		throw new \InvalidArgumentException('instituteIdentification is missing');
    	} else if (empty($this->bankAccountNumber)) {
    		throw new \InvalidArgumentException('bankAccountNumber is missing');
    	} else {
    		return true;
    	}
    	return false;
    }
}
<commit_msg>Simplified IBANGenerator<commit_after><?php

namespace IBAN\Generation;

use IBAN\Rule\IBANRuleFactory;

class IBANGenerator
{
	private $ibanRuleFactory;
	private $instituteIdentification;
	private $bankAccountNumber;
	
	public static function DE($instituteIdentification, $bankAccountNumber) {
        $ruleFactory = new IBANRuleFactory('DE');
        $generater = new IBANGenerator($ruleFactory, $instituteIdentification, $bankAccountNumber);
        return $generater->generate();
    }
 
    private function __construct($ibanRuleFactory, $instituteIdentification, $bankAccountNumber) {
    	$this->ibanRuleFactory = $ibanRuleFactory;
    	$this->instituteIdentification = ltrim($instituteIdentification, '0');
    	$this->bankAccountNumber = ltrim($bankAccountNumber, '0');
    }
    
    private function generate() {
        if ($this->areArgumentsValid()) {
            $ibanRule = $this->createRule();
            return $ibanRule->generateIban();
        }
    }
    
    private function createRule() {
    	return $this->ibanRuleFactory->createIBANRule(
	        $this->instituteIdentification, 
	        $this->bankAccountNumber);
    }
    
    private function areArgumentsValid() {
    	if (empty($this->instituteIdentification)) {
    		throw new \InvalidArgumentException('instituteIdentification is missing');
    	} else if (empty($this->bankAccountNumber)) {
    		throw new \InvalidArgumentException('bankAccountNumber is missing');
    	} else {
    		return true;
    	}
    	return false;
    }
}

{'fraction_non_alphanumeric': 0.1107963487566887, 'fraction_numerical': 0.0012590494176896443, 'mean_word_length': 3.3653846153846154, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4995866', 'n_tokens_mistral': 919, 'n_tokens_neox': 876, 'n_words': 166}