Add Invoice line
@param array $data
962053
public function add(array $data)
    {
        $defaults = array(
            "description" => null,
            "price"       => null,
            "discount"    => null,
            "qty"         => 1,
            "unit"        => null
        );

        $merged = array_merge($defaults, $data);

        $line = $this->create($this->invoiceHandle);

        if( isset($merged['product']) )
        {
            $this->product($line, $merged['product']);
            unset( $merged['product'] );
        }

        return $this->update($data, $line);
    }
42887
public function add($data)
    {
        $ea = (array) $data;
        foreach ($ea as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $k => $v) {
                    if (is_null($v)) {
                        unset($value[$k]);
                    }
                }
                $value = array_values($value);
                $ea[$key] = $value;
            }
        }

        $this->_errors = $ea;
    }
992471
public function add(array $data)
    {
        //if there is no content set throw error as it is a required field
        if (!isset($data['content'])) {
            throw new PipedriveMissingFieldError('You must include a "content" field when inserting a note');
        }

        //if there is no deal, person, organisation id set throw error as one of the fields is required
        if (!isset($data['deal_id']) && !isset($data['person_id']) && !isset($data['org_id'])) {
            throw new PipedriveMissingFieldError('You must include one of the following "deal_id", "person_id", "org_id" field when inserting a note');
        }

        return $this->curl->post('notes', $data);
    }
1284221
private function addInvoice($trans, $invoice_no, $ref_no, $options)
    {
        $trans->addChild('InvoiceNo', $invoice_no);
        $trans->addChild('RefNo', $ref_no ?: $invoice_no);
        if ($options['merchant']) {
            $trans->addChild('OperatorID', $options['merchant']);
        }
        if ($options['description']) {
            $trans->addChild('Memo', $options['description']);
        }
    }
1035062
public static function createFromData(array $data)
    {
        if (!isset($data['type'])) {
            throw new DomainException(self::MSG_REQUIRED_TYPE);
        }

        switch ($data['type']) {
            case self::TYPE_DISCOUNTS_PER_REDEMPTION:
                $restriction = new Restrictions\DiscountsPerRedemption($data);

                break;
            case self::TYPE_REDEMPTIONS_PER_CUSTOMER:
                $restriction = new Restrictions\RedemptionsPerCustomer($data);

                break;
            case self::TYPE_RESTRICT_TO_INVOICES:
                $restriction = new Restrictions\RestrictToInvoices($data);

                break;
            case self::TYPE_RESTRICT_TO_PLANS:
                $restriction = new Restrictions\RestrictToPlans($data);

                break;
            case self::TYPE_RESTRICT_TO_SUBSCRIPTIONS:
                $restriction = new Restrictions\RestrictToSubscriptions($data);

                break;
            case self::TYPE_TOTAL_REDEMPTIONS:
                $restriction = new Restrictions\TotalRedemptions($data);

                break;
            case self::TYPE_MINIMUM_ORDER_AMOUNT:
                $restriction = new Restrictions\MinimumOrderAmount($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::MSG_UNSUPPORTED_TYPE, implode(',', self::$supportedTypes))
                );
        }

        return $restriction;
    }
1024702
protected function addProductInfo(array &$line)
    {
        $invoiceSettings = $this->config->getInvoiceSettings();
        $this->addTokenDefault($line, Tag::ItemNumber, $invoiceSettings['itemNumber']);
        $this->addTokenDefault($line, Tag::Product, $invoiceSettings['productName']);
        $this->addNature($line);
        if (!empty($invoiceSettings['costPrice'])) {
            $value = $this->getTokenizedValue($invoiceSettings['costPrice']);
            if (!Number::isZero($value)) {
                // If we have a cost price we add it, even if this is no margin
                // invoice.
                $line[Tag::CostPrice] = $value;
            }
        }
    }
1160676
function _append($data)
    {
        if ($this->_using_tmpfile) {
            // Add CONTINUE records if necessary
            if (strlen($data) > $this->_limit) {
                $data = $this->_addContinue($data);
            }
            fwrite($this->_filehandle, $data);
            $this->_datasize += strlen($data);
        } else {
            parent::_append($data);
        }
    }
254330
protected function fill(array $data)
    {
        $this->isoCode = $data['iso_code'];
        $this->name = $data['name'];
        $this->symbol = $data['symbol'];
        $this->subunit = $data['subunit'];
        $this->symbolFirst = $data['symbol_first'];
        $this->htmlEntity = $data['html_entity'];
        $this->decimalMark = $data['decimal_mark'];
        $this->thousandsSeparator = $data['thousands_separator'];
        $this->isoNumeric = $data['iso_numeric'];

        if (array_key_exists('alternate_symbols', $data)) {
            $this->alternateSymbols = $data['alternate_symbols'];
        }

        if (array_key_exists('disambiguate_symbol', $data)) {
            $this->disambiguateSymbol = $data['disambiguate_symbol'];
        }
    }
19781
public function create(array $data, array $headers = [])
    {
        $url = $this->url('invoices');

        return $this->post($url, $data, $headers);
    }
550829
public function add(array $data, array $options = array())
    {
        $result = array();
        $this->hook->attach('order.submit.before', $data, $options, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        $data['order_id'] = $this->order->add($data);

        if (empty($data['order_id'])) {
            return $this->getResultError();
        }

        $order = $this->order->get($data['order_id']);
        $this->setBundledProducts($order, $data);

        if (empty($options['admin'])) {
            $this->setPriceRules($order);
            $this->updateCart($order, $data['cart']);
            $this->notifyCreated($order);
            $result = $this->getResultAdded($order);
        } else {
            $this->cloneCart($order, $data['cart']);
            $result = $this->getResultAddedAdmin($order);
        }

        $this->hook->attach('order.submit.after', $data, $options, $result, $this);
        return (array) $result;
    }
364644
protected function attachAppends(array $data)
    {
        $appends = [];
        foreach ($this->appends as $key => $value) {
            if (is_callable($value)) {
                $appends[$key] = value($value($this->getFilteredQuery()));
            } else {
                $appends[$key] = $value;
            }
        }

        return array_merge($data, $appends);
    }
314026
private function addPathsFromArray(array $data)
    {
        $_documentClass = $this->_documentClass;
        $_edgeClass = $this->_edgeClass;

        $entry = [
            'vertices'    => [],
            'edges'       => [],
            'source'      => $_documentClass::createFromArray($data['source'], $this->_options),
            'destination' => $_documentClass::createFromArray($data['destination'], $this->_options),
        ];
        foreach ($data['vertices'] as $v) {
            $entry['vertices'][] = $_documentClass::createFromArray($v, $this->_options);
        }
        foreach ($data['edges'] as $v) {
            $entry['edges'][] = $_edgeClass::createFromArray($v, $this->_options);
        }
        $this->_result[] = $entry;
    }
268529
public function setStartInsert(array $data)
    {
        $columnsAndMarkers = $this->getColumnsAndGetMarkersForInsert($data);

        $this->setStart(
            "INSERT INTO ".$this->model->getDbTable()." (".$columnsAndMarkers['columns'].")
             VALUES (".$columnsAndMarkers['markers'].")"
        );
    }
464044
public function add(array $data)
    {
        $weight = (int) $this->db->fetchColumn('SELECT COUNT(*) FROM module', array());

        $data += array('weight' => $weight + 1);
        $data['created'] = $data['modified'] = GC_TIME;
        $this->db->insert('module', $data);
    }
144094
private function processData(array $data): void
    {
        foreach ($data['formatters'] as $locale => $f) {
            if (!isset($this->formatters[$locale])) {
                $this->formatters[$locale] = array();
            }
            
            foreach ($f as $formatter => $d) {
                $calendar = \IntlDateFormatter::GREGORIAN;
                if (isset($d['calendar']) && $d['calendar'] === 'traditional') {
                    $calendar = \IntlDateFormatter::TRADITIONAL;
                }
                
                $this->formatters[$locale][$formatter] = new \IntlDateFormatter($locale, null, null, null, $calendar, $d['pattern']);
            }
        }
    }
416429
public function rows(array $data): void
    {
        $this->rows = $data;
        $pdoStatement = $this->provideStatement();
        $this->execute($pdoStatement);
    }
659979
public function add( $data )
	{
		$enclosure = $this->_enclosure;

		foreach( (array) $data as $key => $entry )
		{
			$entry = str_replace( $this->_lineend, $this->_endsubst, $entry );
			$data[$key] = $enclosure . str_replace( $enclosure, $this->_escape . $enclosure, $entry ) . $enclosure;
		}

		if( fwrite( $this->_fh, implode( $this->_separator, $data ) . $this->_lineend ) === false ) {
			throw new MW_Container_Exception( sprintf( 'Unable to add content to file "%1$s"', $this->getName() ) );
		}
	}