original_string: public function exec($cmd, $args = array())
      {
          // Arguments must be safe
          if (!is_array($args)) {
              $args = array($args);
          }
          foreach ($args as $val) {
              if (!is_string($val)) {
                  throw new BaseException('You must specify arguments as strings');
              }
              $this->args[] = escapeshellarg($val);
          }
  
          // Command myst be safe
          $this->cmd = escapeshellcmd($cmd);
  
          $this->debug('Executing '.$cmd.($this->args ? ' '.implode(' ', $this->args) : ''));
          // Now do the execution
          $this->executeRaw($this->cmd.' '.implode(' ', $this->args));
  
          return $this;
      }
code: public function exec($cmd, $args = array())
      {
          // Arguments must be safe
          if (!is_array($args)) {
              $args = array($args);
          }
          foreach ($args as $val) {
              if (!is_string($val)) {
                  throw new BaseException('You must specify arguments as strings');
              }
              $this->args[] = escapeshellarg($val);
          }
  
          // Command myst be safe
          $this->cmd = escapeshellcmd($cmd);
  
          $this->debug('Executing '.$cmd.($this->args ? ' '.implode(' ', $this->args) : ''));
          // Now do the execution
          $this->executeRaw($this->cmd.' '.implode(' ', $this->args));
  
          return $this;
      }
code_tokens: public function exec ( $ cmd , $ args = array ( ) ) { // Arguments must be safe if ( ! is_array ( $ args ) ) { $ args = array ( $ args ) ; } foreach ( $ args as $ val ) { if ( ! is_string ( $ val ) ) { throw new BaseException ( 'You must specify arguments as strings' ) ; } $ this -> args [ ] = escapeshellarg ( $ val ) ; } // Command myst be safe $ this -> cmd = escapeshellcmd ( $ cmd ) ; $ this -> debug ( 'Executing ' . $ cmd . ( $ this -> args ? ' ' . implode ( ' ' , $ this -> args ) : '' ) ) ; // Now do the execution $ this -> executeRaw ( $ this -> cmd . ' ' . implode ( ' ' , $ this -> args ) ) ; return $ this ; }
docstring: Execute the process and associate with this object.
  
  @param string $cmd  Command to be executed
  @param array|string  $args Arguments (strings)
  
  @return self
docstring_tokens: Execute the process and associate with this object .