original_string: protected function mergeConfig(PageInterface $page, $deep = false, $params = [], $type = 'plugins')
      {
          $class_name = $this->name;
          $class_name_merged = $class_name . '.merged';
          $defaults = $this->config->get($type . '.' . $class_name, []);
          $page_header = $page->header();
          $header = [];
  
          if (!isset($page_header->{$class_name_merged}) && isset($page_header->{$class_name})) {
              // Get default plugin configurations and retrieve page header configuration
              $config = $page_header->{$class_name};
              if (\is_bool($config)) {
                  // Overwrite enabled option with boolean value in page header
                  $config = ['enabled' => $config];
              }
              // Merge page header settings using deep or shallow merging technique
              $header = $this->mergeArrays($deep, $defaults, $config);
  
              // Create new config object and set it on the page object so it's cached for next time
              $page->modifyHeader($class_name_merged, new Data($header));
          } else if (isset($page_header->{$class_name_merged})) {
              $merged = $page_header->{$class_name_merged};
              $header = $merged->toArray();
          }
          if (empty($header)) {
              $header = $defaults;
          }
          // Merge additional parameter with configuration options
          $header = $this->mergeArrays($deep, $header, $params);
  
          // Return configurations as a new data config class
          return new Data($header);
      }
code: protected function mergeConfig(PageInterface $page, $deep = false, $params = [], $type = 'plugins')
      {
          $class_name = $this->name;
          $class_name_merged = $class_name . '.merged';
          $defaults = $this->config->get($type . '.' . $class_name, []);
          $page_header = $page->header();
          $header = [];
  
          if (!isset($page_header->{$class_name_merged}) && isset($page_header->{$class_name})) {
              // Get default plugin configurations and retrieve page header configuration
              $config = $page_header->{$class_name};
              if (\is_bool($config)) {
                  // Overwrite enabled option with boolean value in page header
                  $config = ['enabled' => $config];
              }
              // Merge page header settings using deep or shallow merging technique
              $header = $this->mergeArrays($deep, $defaults, $config);
  
              // Create new config object and set it on the page object so it's cached for next time
              $page->modifyHeader($class_name_merged, new Data($header));
          } else if (isset($page_header->{$class_name_merged})) {
              $merged = $page_header->{$class_name_merged};
              $header = $merged->toArray();
          }
          if (empty($header)) {
              $header = $defaults;
          }
          // Merge additional parameter with configuration options
          $header = $this->mergeArrays($deep, $header, $params);
  
          // Return configurations as a new data config class
          return new Data($header);
      }
code_tokens: protected function mergeConfig ( PageInterface $ page , $ deep = false , $ params = [ ] , $ type = 'plugins' ) { $ class_name = $ this -> name ; $ class_name_merged = $ class_name . '.merged' ; $ defaults = $ this -> config -> get ( $ type . '.' . $ class_name , [ ] ) ; $ page_header = $ page -> header ( ) ; $ header = [ ] ; if ( ! isset ( $ page_header -> { $ class_name_merged } ) && isset ( $ page_header -> { $ class_name } ) ) { // Get default plugin configurations and retrieve page header configuration $ config = $ page_header -> { $ class_name } ; if ( \ is_bool ( $ config ) ) { // Overwrite enabled option with boolean value in page header $ config = [ 'enabled' => $ config ] ; } // Merge page header settings using deep or shallow merging technique $ header = $ this -> mergeArrays ( $ deep , $ defaults , $ config ) ; // Create new config object and set it on the page object so it's cached for next time $ page -> modifyHeader ( $ class_name_merged , new Data ( $ header ) ) ; } else if ( isset ( $ page_header -> { $ class_name_merged } ) ) { $ merged = $ page_header -> { $ class_name_merged } ; $ header = $ merged -> toArray ( ) ; } if ( empty ( $ header ) ) { $ header = $ defaults ; } // Merge additional parameter with configuration options $ header = $ this -> mergeArrays ( $ deep , $ header , $ params ) ; // Return configurations as a new data config class return new Data ( $ header ) ; }
docstring: Merge global and page configurations.
  
  @param PageInterface $page The page to merge the configurations with the
  plugin settings.
  @param mixed $deep false = shallow|true = recursive|merge = recursive+unique
  @param array $params Array of additional configuration options to
  merge with the plugin settings.
  @param string $type Is this 'plugins' or 'themes'
  
  @return Data
docstring_tokens: Merge global and page configurations .