original_string: protected function registerBorder($style)
      {
          $styleId = $style->getId();
  
          if ($style->shouldApplyBorder()) {
              $border = $style->getBorder();
              $serializedBorder = serialize($border);
  
              $isBorderAlreadyRegistered = isset($this->registeredBorders[$serializedBorder]);
  
              if ($isBorderAlreadyRegistered) {
                  $registeredStyleId = $this->registeredBorders[$serializedBorder];
                  $registeredBorderId = $this->styleIdToBorderMappingTable[$registeredStyleId];
                  $this->styleIdToBorderMappingTable[$styleId] = $registeredBorderId;
              } else {
                  $this->registeredBorders[$serializedBorder] = $styleId;
                  $this->styleIdToBorderMappingTable[$styleId] = count($this->registeredBorders);
              }
  
          } else {
              // If no border should be applied - the mapping is the default border: 0
              $this->styleIdToBorderMappingTable[$styleId] = 0;
          }
      }
code: protected function registerBorder($style)
      {
          $styleId = $style->getId();
  
          if ($style->shouldApplyBorder()) {
              $border = $style->getBorder();
              $serializedBorder = serialize($border);
  
              $isBorderAlreadyRegistered = isset($this->registeredBorders[$serializedBorder]);
  
              if ($isBorderAlreadyRegistered) {
                  $registeredStyleId = $this->registeredBorders[$serializedBorder];
                  $registeredBorderId = $this->styleIdToBorderMappingTable[$registeredStyleId];
                  $this->styleIdToBorderMappingTable[$styleId] = $registeredBorderId;
              } else {
                  $this->registeredBorders[$serializedBorder] = $styleId;
                  $this->styleIdToBorderMappingTable[$styleId] = count($this->registeredBorders);
              }
  
          } else {
              // If no border should be applied - the mapping is the default border: 0
              $this->styleIdToBorderMappingTable[$styleId] = 0;
          }
      }
code_tokens: protected function registerBorder ( $ style ) { $ styleId = $ style -> getId ( ) ; if ( $ style -> shouldApplyBorder ( ) ) { $ border = $ style -> getBorder ( ) ; $ serializedBorder = serialize ( $ border ) ; $ isBorderAlreadyRegistered = isset ( $ this -> registeredBorders [ $ serializedBorder ] ) ; if ( $ isBorderAlreadyRegistered ) { $ registeredStyleId = $ this -> registeredBorders [ $ serializedBorder ] ; $ registeredBorderId = $ this -> styleIdToBorderMappingTable [ $ registeredStyleId ] ; $ this -> styleIdToBorderMappingTable [ $ styleId ] = $ registeredBorderId ; } else { $ this -> registeredBorders [ $ serializedBorder ] = $ styleId ; $ this -> styleIdToBorderMappingTable [ $ styleId ] = count ( $ this -> registeredBorders ) ; } } else { // If no border should be applied - the mapping is the default border: 0 $ this -> styleIdToBorderMappingTable [ $ styleId ] = 0 ; } }
docstring: Register a border definition
  
  @param \Box\Spout\Writer\Style\Style $style
docstring_tokens: Register a border definition