/** * Main analysis method * * @return void */ public function analyse() { $this->_grand_total = 0; $this->_name_length = 0; $this->stats = array(); $this->errors = array(); $mixed = false; if ($this->_options !== array()) { foreach ($this->_options[1] as $name) { if (strpos($name, "/") !== false) { $mixed = true; } } } if (sizeof($this->_channel) == 0) { $default_channel = $this->_config->get('default_channel'); //determine position $pos = array_search($default_channel, $this->_channels_full); //insert name of default channel into the correct position //of the channel array. $this->_channel[$pos] = $default_channel; } if ($mixed) { // if at least one package is specified in mixed // form (channel/package) then iterate through all of them, etc etc. $search_for = array(); foreach ($this->_options[1] as $name) { if (false === strpos($name, "/")) { //if no channel is specified in this //form, assume the default $package = $name; $channel = $default_channel; } else { $temp = explode("/", $name); $channel = $temp[0]; $package = $temp[1]; $pos = array_search($channel, $this->_channels_alias); if (false !== $pos) { $channel = $this->_channels_full[$pos]; } } $search_for[$channel][] = $package; } foreach ($search_for as $channel => $packages) { $index = array_search($channel, $this->_channels_full); //analyse $channel_stats[$channel] = $this->_analysePackages($packages, $this->reg, $index); } } elseif (!$this->_all) { if (empty($this->_options[1]) && !$this->_all_channels) { throw new PEAR_Size_Exception('usage'); } foreach ($this->_channel as $index => $given) { $packages = $this->_options[1]; $cposition = $this->_channels_full[$index]; //analyse $channel_stats[$cposition] = $this->_analysePackages($packages, $this->reg, $index); } } else { foreach ($this->_channel as $index => $given) { $chanalias = $this->reg_channels[$index]->getAlias(); $packages = $this->reg->listPackages($chanalias); $cposition = $this->_channels_full[$index]; sort($packages); //analyse $channel_stats[$cposition] = $this->_analysePackages($packages, $this->reg, $index); } } $this->_channel_stats = $channel_stats; }