Overview

Namespaces

  • Datadepo
    • Api
      • DataStores
      • Structures
      • Synchronizers

Classes

  • Datadepo\Api\ApiWrapper
  • Datadepo\Api\Collector
  • Datadepo\Api\DataDepoResponse
  • Datadepo\Api\DataDepoSync
  • Datadepo\Api\DataStores\PdoDataStore
  • Datadepo\Api\IniConfiguration
  • Datadepo\Api\RunningFiles
  • Datadepo\Api\Structures\AbstractStructure
  • Datadepo\Api\Structures\BusinessLine
  • Datadepo\Api\Structures\BusinessSupplierLine
  • Datadepo\Api\Structures\CategoryLine
  • Datadepo\Api\Structures\DataLine
  • Datadepo\Api\Structures\ImageLine
  • Datadepo\Api\Structures\ParameterLine
  • Datadepo\Api\Structures\PriceLine
  • Datadepo\Api\Structures\RelatedLine
  • Datadepo\Api\Structures\StoreLine
  • Datadepo\Api\Structures\SupplierBankAccountLine
  • Datadepo\Api\Structures\SupplierLine
  • Datadepo\Api\Structures\SupplierPersonLine
  • Datadepo\Api\Structures\VariantLine
  • Datadepo\Api\Synchronizers\AbstractSynchronizer
  • Datadepo\Api\Synchronizers\BusinessSynchronizer
  • Datadepo\Api\Synchronizers\CategorySynchronizer
  • Datadepo\Api\Synchronizers\DataSynchronizer
  • Datadepo\Api\Synchronizers\SuppliersSynchronizer

Interfaces

  • Datadepo\Api\DataStores\IDataStore

Exceptions

  • Datadepo\Api\ApiException
  • Datadepo\Api\ConfigurationException
  • Datadepo\Api\DataDepoRunningException
  • Datadepo\Api\DataDepoSuspendedException
  • Overview
  • Namespace
  • Class
  1: <?php
  2: namespace Datadepo\Api\Structures;
  3: 
  4: 
  5: /**
  6:  * @property-read string $supplierIdName
  7:  * @property-read string $supplierCode
  8:  * @property-read StoreLine $store
  9:  * @property-read PriceLine[] $prices
 10:  * @property-read VariantLine[] $variants
 11:  */
 12: class BusinessSupplierLine extends AbstractStructure
 13: {
 14:   
 15:   /** @var string */
 16:   protected $idName;
 17:   
 18:   /** @var StoreLine */
 19:   private $_store;
 20:   
 21:   /** @var PriceLine[] */
 22:   private $_prices;
 23:   
 24:   /** @var VariantLine[] */
 25:   private $_variants;
 26:   
 27:   /**
 28:    * @param array $data
 29:    * @param string $idName
 30:    */
 31:   public function __construct($data, $idName)
 32:   {
 33:     $this->data = $data;
 34:     $this->idName = $idName;
 35:   }
 36:   
 37:   /**
 38:    * @return string
 39:    */
 40:   public function getJson()
 41:   {
 42:     return json_encode($this->data);
 43:   }
 44:   
 45:   /**
 46:    * @return string
 47:    */
 48:   public function getPrimary()
 49:   {
 50:     return $this->getSupplierIdName();
 51:   }
 52:   
 53:   /**
 54:    * @return string
 55:    */
 56:   public function getSupplierIdName()
 57:   {
 58:     return $this->idName;
 59:   }
 60:   
 61:   /**
 62:    * @return string
 63:    */
 64:   public function getSupplierCode()
 65:   {
 66:     return $this->data->store->supplier_code;
 67:   }
 68:   
 69:   /**
 70:    * @return StoreLine
 71:    */
 72:   public function getStore()
 73:   {
 74:     if ($this->_store === NULL) {
 75:       $this->_store = new StoreLine($this->data->store);
 76:     }
 77:     return $this->_store;
 78:   }
 79:   
 80:   /**
 81:    * @return PriceLine[]
 82:    */
 83:   public function getPrices()
 84:   {
 85:     if ($this->_prices === NULL) {
 86:       $this->_prices = array();
 87:       foreach ($this->data->prices as $currency => $data) {
 88:         $this->_prices[$currency] = new PriceLine($data, $currency);
 89:       }
 90:     }
 91:     return $this->_prices;
 92:   }
 93:   
 94:   /**
 95:    * @return PriceLine[]
 96:    */
 97:   public function getVariants()
 98:   {
 99:     if ($this->_variants === NULL) {
100:       $this->_variants = array();
101:       if (isset($this->data->variants)) {
102:         foreach ($this->data->variants as $hash => $data) {
103:           $this->_variants[$hash] = new VariantLine($data);
104:         }
105:       }
106:     }
107:     return $this->_variants;
108:   }
109: 
110:   
111: }
API documentation generated by ApiGen