/** * @return void */ private function buildGroups() { $serverCount = $this->servers->count(); $charCount = strlen($this->characters); for ($i = 0; $i < $charCount; $i++) { $this->groups[$this->characters[$i]] = $this->getNextServer(); } $this->groups[self::UNKNOWN_GROUP_KEY] = $this->getNextServer(); }
/** * @test */ public function append() { $collection = new Tx_Asdis_Domain_Model_Server_Collection(); $server = new Tx_Asdis_Domain_Model_Server(); $collection->append($server); $this->assertEquals(1, $collection->count()); }
/** * Distributes the given assets to the given servers. * * @param Tx_Asdis_Domain_Model_Asset_Collection $assets * @param Tx_Asdis_Domain_Model_Server_Collection $servers * @return void */ public function distribute(Tx_Asdis_Domain_Model_Asset_Collection $assets, Tx_Asdis_Domain_Model_Server_Collection $servers) { if ($servers->count() < 1) { return; } $this->servers = $servers; foreach ($assets as $asset) { /** @var Tx_Asdis_Domain_Model_Asset $asset */ $asset->setServer($this->getNextServer()); } }