original_string: protected function mergeServiceConfig(string $name, string $class, array $config): array
      {
          $config = array_merge($this->getServiceDefaults(), $config);
  
          if (!class_exists($class) && !interface_exists($class)) {
              return $config;
          }
  
          if (false === $config['merge']) {
              return $config;
          }
  
          $tree = $this->getConfigTree();
          $parents = array_merge(class_implements($class), class_parents($class));
          foreach ($tree as $parent_config) {
              foreach ($parents as $parent) {
                  if (isset($parent_config[$parent])) {
                      $config = array_replace_recursive($config, $parent_config[$parent]);
                  }
              }
  
              if (isset($parent_config[$name])) {
                  $config = array_replace_recursive($config, $parent_config[$name]);
              }
          }
  
          return $config;
      }
code: protected function mergeServiceConfig(string $name, string $class, array $config): array
      {
          $config = array_merge($this->getServiceDefaults(), $config);
  
          if (!class_exists($class) && !interface_exists($class)) {
              return $config;
          }
  
          if (false === $config['merge']) {
              return $config;
          }
  
          $tree = $this->getConfigTree();
          $parents = array_merge(class_implements($class), class_parents($class));
          foreach ($tree as $parent_config) {
              foreach ($parents as $parent) {
                  if (isset($parent_config[$parent])) {
                      $config = array_replace_recursive($config, $parent_config[$parent]);
                  }
              }
  
              if (isset($parent_config[$name])) {
                  $config = array_replace_recursive($config, $parent_config[$name]);
              }
          }
  
          return $config;
      }
code_tokens: protected function mergeServiceConfig ( string $ name , string $ class , array $ config ) : array { $ config = array_merge ( $ this -> getServiceDefaults ( ) , $ config ) ; if ( ! class_exists ( $ class ) && ! interface_exists ( $ class ) ) { return $ config ; } if ( false === $ config [ 'merge' ] ) { return $ config ; } $ tree = $ this -> getConfigTree ( ) ; $ parents = array_merge ( class_implements ( $ class ) , class_parents ( $ class ) ) ; foreach ( $ tree as $ parent_config ) { foreach ( $ parents as $ parent ) { if ( isset ( $ parent_config [ $ parent ] ) ) { $ config = array_replace_recursive ( $ config , $ parent_config [ $ parent ] ) ; } } if ( isset ( $ parent_config [ $ name ] ) ) { $ config = array_replace_recursive ( $ config , $ parent_config [ $ name ] ) ; } } return $ config ; }
docstring: Find parent classes or interfaces and merge service configurations.
docstring_tokens: Find parent classes or interfaces and merge service configurations .