original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Add Invoice line
  @param array $data
docstring_tokens: Add Invoice line