src/Invoice/CompletorStrategyLines.php
protected function replaceLinesCompleted(array $linesCompleted, array $completedLines, $strategyName)
    {
        // Remove old strategy lines that are now completed.
        $lines = array();
        foreach ($this->invoice[Tag::Customer][Tag::Invoice][Tag::Line] as $key => $line) {
            if (!in_array($key, $linesCompleted)) {
                $lines[] = $line;
            }
        }

        // And merge in the new completed ones.
        foreach ($completedLines as &$completedLine) {
            if ($completedLine[Meta::VatRateSource] === Creator::VatRateSource_Strategy) {
                $completedLine[Meta::VatRateSource] = Completor::VatRateSource_Strategy_Completed;
                $completedLine[Meta::CompletorStrategyUsed] = $strategyName;
            }
        }
        $this->invoice[Tag::Customer][Tag::Invoice][Tag::Line] = array_merge($lines, $completedLines);
    }
protected function replaceLinesCompleted(array $linesCompleted, array $completedLines, $strategyName)
    {
        // Remove old strategy lines that are now completed.
        $lines = array();
        foreach ($this->invoice[Tag::Customer][Tag::Invoice][Tag::Line] as $key => $line) {
            if (!in_array($key, $linesCompleted)) {
                $lines[] = $line;
            }
        }

        // And merge in the new completed ones.
        foreach ($completedLines as &$completedLine) {
            if ($completedLine[Meta::VatRateSource] === Creator::VatRateSource_Strategy) {
                $completedLine[Meta::VatRateSource] = Completor::VatRateSource_Strategy_Completed;
                $completedLine[Meta::CompletorStrategyUsed] = $strategyName;
            }
        }
        $this->invoice[Tag::Customer][Tag::Invoice][Tag::Line] = array_merge($lines, $completedLines);
    }
protected function replaceLinesCompleted ( array $ linesCompleted , array $ completedLines , $ strategyName ) { // Remove old strategy lines that are now completed. $ lines = array ( ) ; foreach ( $ this -> invoice [ Tag :: Customer ] [ Tag :: Invoice ] [ Tag :: Line ] as $ key => $ line ) { if ( ! in_array ( $ key , $ linesCompleted ) ) { $ lines [ ] = $ line ; } } // And merge in the new completed ones. foreach ( $ completedLines as & $ completedLine ) { if ( $ completedLine [ Meta :: VatRateSource ] === Creator :: VatRateSource_Strategy ) { $ completedLine [ Meta :: VatRateSource ] = Completor :: VatRateSource_Strategy_Completed ; $ completedLine [ Meta :: CompletorStrategyUsed ] = $ strategyName ; } } $ this -> invoice [ Tag :: Customer ] [ Tag :: Invoice ] [ Tag :: Line ] = array_merge ( $ lines , $ completedLines ) ; }
Replaces all completed strategy lines with the given completed lines.

@param int[] $linesCompleted
@param array[] $completedLines
An array of completed invoice lines to replace the strategy lines with.
@param string $strategyName
Replaces all completed strategy lines with the given completed lines .