src/ComposerConfigurator.php
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;
    }
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;
    }
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 ; }
Configure additional repositories for using WordPress with composer,
and set the installation directories for WordPress packages.

@return void
Configure additional repositories for using WordPress with composer and set the installation directories for WordPress packages .