original_string: protected function configureRepos()
      {
          if (! $this->json) {
              $this->readJson();
          }
          
          $public = $this->plugin->getPublicDirectory();
          $plugins_path = $public . '/plugins/{$name}/';
          $themes_path = $public . '/themes/{$name}/';
          
          $this->json['repositories'][] = [
              'type' => 'composer',
              'url' => 'https://wpackagist.org',
          ];
          
          $extra = $this->json['extra'];
          
          if (isset($extra['installer-paths'])) {
              foreach ($extra['installer-paths'] as $path => &$names) {
                  if ($path != $plugins_path && ($key = array_search('type:wordpress-plugin', $names)) !== false ||
                      $path != $themes_path && ($key = array_search('type:wordpress-theme', $names)) !== false
                  ) {
                      unset($names[$key]);
                      
                      if (! count($names)) {
                          unset($extra['installer-paths'][$path]);
                      }
                  }
              }
          }
          
          $extra['installer-paths'][$plugins_path][] = 'type:wordpress-plugin';
          $extra['installer-paths'][$themes_path][] = 'type:wordpress-theme';
          
          $this->json['extra'] = $extra;
      }
code: protected function configureRepos()
      {
          if (! $this->json) {
              $this->readJson();
          }
          
          $public = $this->plugin->getPublicDirectory();
          $plugins_path = $public . '/plugins/{$name}/';
          $themes_path = $public . '/themes/{$name}/';
          
          $this->json['repositories'][] = [
              'type' => 'composer',
              'url' => 'https://wpackagist.org',
          ];
          
          $extra = $this->json['extra'];
          
          if (isset($extra['installer-paths'])) {
              foreach ($extra['installer-paths'] as $path => &$names) {
                  if ($path != $plugins_path && ($key = array_search('type:wordpress-plugin', $names)) !== false ||
                      $path != $themes_path && ($key = array_search('type:wordpress-theme', $names)) !== false
                  ) {
                      unset($names[$key]);
                      
                      if (! count($names)) {
                          unset($extra['installer-paths'][$path]);
                      }
                  }
              }
          }
          
          $extra['installer-paths'][$plugins_path][] = 'type:wordpress-plugin';
          $extra['installer-paths'][$themes_path][] = 'type:wordpress-theme';
          
          $this->json['extra'] = $extra;
      }
code_tokens: protected function configureRepos ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } $ public = $ this -> plugin -> getPublicDirectory ( ) ; $ plugins_path = $ public . '/plugins/{$name}/' ; $ themes_path = $ public . '/themes/{$name}/' ; $ this -> json [ 'repositories' ] [ ] = [ 'type' => 'composer' , 'url' => 'https://wpackagist.org' , ] ; $ extra = $ this -> json [ 'extra' ] ; if ( isset ( $ extra [ 'installer-paths' ] ) ) { foreach ( $ extra [ 'installer-paths' ] as $ path => & $ names ) { if ( $ path != $ plugins_path && ( $ key = array_search ( 'type:wordpress-plugin' , $ names ) ) !== false || $ path != $ themes_path && ( $ key = array_search ( 'type:wordpress-theme' , $ names ) ) !== false ) { unset ( $ names [ $ key ] ) ; if ( ! count ( $ names ) ) { unset ( $ extra [ 'installer-paths' ] [ $ path ] ) ; } } } } $ extra [ 'installer-paths' ] [ $ plugins_path ] [ ] = 'type:wordpress-plugin' ; $ extra [ 'installer-paths' ] [ $ themes_path ] [ ] = 'type:wordpress-theme' ; $ this -> json [ 'extra' ] = $ extra ; }
docstring: Configure additional repositories for using WordPress with composer,
  and set the installation directories for WordPress packages.
  
  @return void
docstring_tokens: Configure additional repositories for using WordPress with composer and set the installation directories for WordPress packages .