original_string: public function cmdDeleteZone()
      {
          $id = $this->getParam(0);
          $all = $this->getParam('all');
  
          if (empty($id) && empty($all)) {
              $this->errorAndExit($this->text('Invalid command'));
          }
  
          $result = false;
  
          if (!empty($id)) {
              $result = $this->zone->delete($id);
          } else if (!empty($all)) {
  
              $deleted = $count = 0;
              foreach ($this->zone->getList() as $zone) {
                  $count++;
                  $deleted += (int) $this->zone->delete($zone['zone_id']);
              }
  
              $result = $count && $count == $deleted;
          }
  
          if (empty($result)) {
              $this->errorAndExit($this->text('Unexpected result'));
          }
  
          $this->output();
      }
code: public function cmdDeleteZone()
      {
          $id = $this->getParam(0);
          $all = $this->getParam('all');
  
          if (empty($id) && empty($all)) {
              $this->errorAndExit($this->text('Invalid command'));
          }
  
          $result = false;
  
          if (!empty($id)) {
              $result = $this->zone->delete($id);
          } else if (!empty($all)) {
  
              $deleted = $count = 0;
              foreach ($this->zone->getList() as $zone) {
                  $count++;
                  $deleted += (int) $this->zone->delete($zone['zone_id']);
              }
  
              $result = $count && $count == $deleted;
          }
  
          if (empty($result)) {
              $this->errorAndExit($this->text('Unexpected result'));
          }
  
          $this->output();
      }
code_tokens: public function cmdDeleteZone ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( ! empty ( $ id ) ) { $ result = $ this -> zone -> delete ( $ id ) ; } else if ( ! empty ( $ all ) ) { $ deleted = $ count = 0 ; foreach ( $ this -> zone -> getList ( ) as $ zone ) { $ count ++ ; $ deleted += ( int ) $ this -> zone -> delete ( $ zone [ 'zone_id' ] ) ; } $ result = $ count && $ count == $ deleted ; } if ( empty ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; }
docstring: Callback for "zone-delete" command
docstring_tokens: Callback for zone - delete command