original_string: protected function getCommands($filename, $type)
      {
          $commands = $this->config->get('availableCommands');
  
          if (!$type || !isset($commands[$type])) {
              return array();
          }
  
          $command = array();
  
          foreach ((array)$this->config->get('enabledCommands') as $commandType) {
              if (isset($commands[$type][$commandType])) {
                  $command[] = sprintf(
                      $commands[$type][$commandType],
                      rtrim($this->config->get('binDirectory'), '/'),
                      escapeshellarg($filename),
                      $this->config->get('optimisingQuality')
                  );
              }
          }
  
          return $command;
      }
code: protected function getCommands($filename, $type)
      {
          $commands = $this->config->get('availableCommands');
  
          if (!$type || !isset($commands[$type])) {
              return array();
          }
  
          $command = array();
  
          foreach ((array)$this->config->get('enabledCommands') as $commandType) {
              if (isset($commands[$type][$commandType])) {
                  $command[] = sprintf(
                      $commands[$type][$commandType],
                      rtrim($this->config->get('binDirectory'), '/'),
                      escapeshellarg($filename),
                      $this->config->get('optimisingQuality')
                  );
              }
          }
  
          return $command;
      }
code_tokens: protected function getCommands ( $ filename , $ type ) { $ commands = $ this -> config -> get ( 'availableCommands' ) ; if ( ! $ type || ! isset ( $ commands [ $ type ] ) ) { return array ( ) ; } $ command = array ( ) ; foreach ( ( array ) $ this -> config -> get ( 'enabledCommands' ) as $ commandType ) { if ( isset ( $ commands [ $ type ] [ $ commandType ] ) ) { $ command [ ] = sprintf ( $ commands [ $ type ] [ $ commandType ] , rtrim ( $ this -> config -> get ( 'binDirectory' ) , '/' ) , escapeshellarg ( $ filename ) , $ this -> config -> get ( 'optimisingQuality' ) ) ; } } return $ command ; }
docstring: Gets all enabled commands for the file and type of image
  @param $filename
  @param $type
  @return array
docstring_tokens: Gets all enabled commands for the file and type of image