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;
  3: use Datadepo\Api\Structures;
  4: 
  5: class Collector implements \Countable, \Iterator
  6: {
  7:  
  8:   /** @var Structures\AbstractStructure[] */
  9:   protected $lines;
 10:   
 11:   /**
 12:    * @param Structures\AbstractStructure $line
 13:    * @return Collector
 14:    */
 15:   public function add(Structures\AbstractStructure $line)
 16:   {
 17:     $this->lines[$line->getPrimary()] = $line;
 18:     return $this;
 19:   }
 20:   
 21:   /**
 22:    * @return array
 23:    */
 24:   public function getPrimaryKeys()
 25:   {
 26:     return array_keys($this->lines);
 27:   }
 28:   
 29:   /**
 30:    * @return array
 31:    */
 32:   public function getChecksums()
 33:   {
 34:     $checksums = array();
 35:     foreach ($this->lines as $primary => $line) {
 36:       $checksums[$primary] = $line->getChecksum();
 37:     }
 38:     return $checksums;
 39:   }
 40:   
 41:   /**
 42:    * @return Structures\AbstractStructure[]
 43:    */
 44:   public function getLines()
 45:   {
 46:     return $this->lines;
 47:   }
 48:   
 49:   
 50:   /* \Countable and \Iterator implementation */
 51:   
 52:   /**
 53:    * @param string $code
 54:    * @return Structures\AbstractStructure
 55:    */
 56:   public function getLine($code)
 57:   {
 58:     if (!isset($this->lines[$code])) {
 59:       return NULL;
 60:     }
 61:     return $this->lines[$code];
 62:   }
 63:   
 64:   /**
 65:    * @return integer
 66:    */
 67:   public function count()
 68:   {
 69:     return count($this->lines);
 70:   }
 71:   
 72:   /**
 73:    * @return Structures\AbstractStructure
 74:    */
 75:   public function rewind() 
 76:   {
 77:     return reset($this->lines);
 78:   }
 79:   
 80:   /**
 81:    * @return Structures\AbstractStructure
 82:    */
 83:   public function current() 
 84:   {
 85:     return current($this->lines);
 86:   }
 87:   
 88:   /**
 89:    * @return string
 90:    */
 91:   public function key() 
 92:   {
 93:     return key($this->lines);
 94:   }
 95:   
 96:   /**
 97:    * @return Structures\AbstractStructure
 98:    */
 99:   public function next() 
100:   {
101:     return next($this->lines);
102:   }
103:   
104:   /**
105:    * @return bool
106:    */
107:   public function valid() 
108:   {
109:     return current($this->lines) !== FALSE;
110:   }
111: 
112: }
API documentation generated by ApiGen