original_string: public function filtered_features_with_tags($features = '', $tags = '') {
  
          // This is for BC. Features if not passed then we already have a list in this object.
          if (empty($features)) {
              $features = $this->features;
          }
  
          // If no tags defined then return full list.
          if (empty($tags) && empty($this->tags)) {
              return $features;
          }
  
          // If no tags passed by the caller, then it's already set.
          if (empty($tags)) {
              $tags = $this->tags;
          }
  
          $newfeaturelist = array();
          // Split tags in and and or.
          $tags = explode('&&', $tags);
          $andtags = array();
          $ortags = array();
          foreach ($tags as $tag) {
              // Explode all tags seperated by , and add it to ortags.
              $ortags = array_merge($ortags, explode(',', $tag));
              // And tags will be the first one before comma(,).
              $andtags[] = preg_replace('/,.*/', '', $tag);
          }
  
          foreach ($features as $key => $featurefile) {
              $contents = file_get_contents($featurefile);
              $includefeature = true;
              foreach ($andtags as $tag) {
                  // If negitive tag, then ensure it don't exist.
                  if (strpos($tag, '~') !== false) {
                      $tag = substr($tag, 1);
                      if ($contents && strpos($contents, $tag) !== false) {
                          $includefeature = false;
                          break;
                      }
                  } else if ($contents && strpos($contents, $tag) === false) {
                      $includefeature = false;
                      break;
                  }
              }
  
              // If feature not included then check or tags.
              if (!$includefeature && !empty($ortags)) {
                  foreach ($ortags as $tag) {
                      if ($contents && (strpos($tag, '~') === false) && (strpos($contents, $tag) !== false)) {
                          $includefeature = true;
                          break;
                      }
                  }
              }
  
              if ($includefeature) {
                  $newfeaturelist[$key] = $featurefile;
              }
          }
          return $newfeaturelist;
      }
code: public function filtered_features_with_tags($features = '', $tags = '') {
  
          // This is for BC. Features if not passed then we already have a list in this object.
          if (empty($features)) {
              $features = $this->features;
          }
  
          // If no tags defined then return full list.
          if (empty($tags) && empty($this->tags)) {
              return $features;
          }
  
          // If no tags passed by the caller, then it's already set.
          if (empty($tags)) {
              $tags = $this->tags;
          }
  
          $newfeaturelist = array();
          // Split tags in and and or.
          $tags = explode('&&', $tags);
          $andtags = array();
          $ortags = array();
          foreach ($tags as $tag) {
              // Explode all tags seperated by , and add it to ortags.
              $ortags = array_merge($ortags, explode(',', $tag));
              // And tags will be the first one before comma(,).
              $andtags[] = preg_replace('/,.*/', '', $tag);
          }
  
          foreach ($features as $key => $featurefile) {
              $contents = file_get_contents($featurefile);
              $includefeature = true;
              foreach ($andtags as $tag) {
                  // If negitive tag, then ensure it don't exist.
                  if (strpos($tag, '~') !== false) {
                      $tag = substr($tag, 1);
                      if ($contents && strpos($contents, $tag) !== false) {
                          $includefeature = false;
                          break;
                      }
                  } else if ($contents && strpos($contents, $tag) === false) {
                      $includefeature = false;
                      break;
                  }
              }
  
              // If feature not included then check or tags.
              if (!$includefeature && !empty($ortags)) {
                  foreach ($ortags as $tag) {
                      if ($contents && (strpos($tag, '~') === false) && (strpos($contents, $tag) !== false)) {
                          $includefeature = true;
                          break;
                      }
                  }
              }
  
              if ($includefeature) {
                  $newfeaturelist[$key] = $featurefile;
              }
          }
          return $newfeaturelist;
      }
code_tokens: public function filtered_features_with_tags ( $ features = '' , $ tags = '' ) { // This is for BC. Features if not passed then we already have a list in this object. if ( empty ( $ features ) ) { $ features = $ this -> features ; } // If no tags defined then return full list. if ( empty ( $ tags ) && empty ( $ this -> tags ) ) { return $ features ; } // If no tags passed by the caller, then it's already set. if ( empty ( $ tags ) ) { $ tags = $ this -> tags ; } $ newfeaturelist = array ( ) ; // Split tags in and and or. $ tags = explode ( '&&' , $ tags ) ; $ andtags = array ( ) ; $ ortags = array ( ) ; foreach ( $ tags as $ tag ) { // Explode all tags seperated by , and add it to ortags. $ ortags = array_merge ( $ ortags , explode ( ',' , $ tag ) ) ; // And tags will be the first one before comma(,). $ andtags [ ] = preg_replace ( '/,.*/' , '' , $ tag ) ; } foreach ( $ features as $ key => $ featurefile ) { $ contents = file_get_contents ( $ featurefile ) ; $ includefeature = true ; foreach ( $ andtags as $ tag ) { // If negitive tag, then ensure it don't exist. if ( strpos ( $ tag , '~' ) !== false ) { $ tag = substr ( $ tag , 1 ) ; if ( $ contents && strpos ( $ contents , $ tag ) !== false ) { $ includefeature = false ; break ; } } else if ( $ contents && strpos ( $ contents , $ tag ) === false ) { $ includefeature = false ; break ; } } // If feature not included then check or tags. if ( ! $ includefeature && ! empty ( $ ortags ) ) { foreach ( $ ortags as $ tag ) { if ( $ contents && ( strpos ( $ tag , '~' ) === false ) && ( strpos ( $ contents , $ tag ) !== false ) ) { $ includefeature = true ; break ; } } } if ( $ includefeature ) { $ newfeaturelist [ $ key ] = $ featurefile ; } } return $ newfeaturelist ; }
docstring: Search feature files for set of tags.
  
  @param array $features set of feature files.
  @param string $tags list of tags (currently support && only.)
  @return array filtered list of feature files with tags.
docstring_tokens: Search feature files for set of tags .