original_string: public function registerComponent($className, $code = null, $plugin = null)
      {
          if (!$this->classMap) {
              $this->classMap = [];
          }
  
          if (!$this->codeMap) {
              $this->codeMap = [];
          }
  
          if (!$code) {
              $code = Str::getClassId($className);
          }
  
          if ($code == 'viewBag' && $className != 'Cms\Components\ViewBag') {
              throw new SystemException(sprintf(
                  'The component code viewBag is reserved. Please use another code for the component class %s.',
                  $className
              ));
          }
  
          $className = Str::normalizeClassName($className);
          $this->codeMap[$code] = $className;
          $this->classMap[$className] = $code;
          if ($plugin !== null) {
              $this->pluginMap[$className] = $plugin;
          }
      }
code: public function registerComponent($className, $code = null, $plugin = null)
      {
          if (!$this->classMap) {
              $this->classMap = [];
          }
  
          if (!$this->codeMap) {
              $this->codeMap = [];
          }
  
          if (!$code) {
              $code = Str::getClassId($className);
          }
  
          if ($code == 'viewBag' && $className != 'Cms\Components\ViewBag') {
              throw new SystemException(sprintf(
                  'The component code viewBag is reserved. Please use another code for the component class %s.',
                  $className
              ));
          }
  
          $className = Str::normalizeClassName($className);
          $this->codeMap[$code] = $className;
          $this->classMap[$className] = $code;
          if ($plugin !== null) {
              $this->pluginMap[$className] = $plugin;
          }
      }
code_tokens: public function registerComponent ( $ className , $ code = null , $ plugin = null ) { if ( ! $ this -> classMap ) { $ this -> classMap = [ ] ; } if ( ! $ this -> codeMap ) { $ this -> codeMap = [ ] ; } if ( ! $ code ) { $ code = Str :: getClassId ( $ className ) ; } if ( $ code == 'viewBag' && $ className != 'Cms\Components\ViewBag' ) { throw new SystemException ( sprintf ( 'The component code viewBag is reserved. Please use another code for the component class %s.' , $ className ) ) ; } $ className = Str :: normalizeClassName ( $ className ) ; $ this -> codeMap [ $ code ] = $ className ; $ this -> classMap [ $ className ] = $ code ; if ( $ plugin !== null ) { $ this -> pluginMap [ $ className ] = $ plugin ; } }
docstring: Registers a single component.
docstring_tokens: Registers a single component .