original_string: public function calculateWidth(string $text, int $size = null)
      {
          $size = round(($size ?: static::TEXT_SIZE) * 0.75, 1);
          $box = imagettfbbox($size, 0, $this->path, $text);
  
          return round(abs($box[2] - $box[0]) + static::SHIELD_PADDING_EXTERNAL + static::SHIELD_PADDING_INTERNAL, 1);
      }
code: public function calculateWidth(string $text, int $size = null)
      {
          $size = round(($size ?: static::TEXT_SIZE) * 0.75, 1);
          $box = imagettfbbox($size, 0, $this->path, $text);
  
          return round(abs($box[2] - $box[0]) + static::SHIELD_PADDING_EXTERNAL + static::SHIELD_PADDING_INTERNAL, 1);
      }
code_tokens: public function calculateWidth ( string $ text , int $ size = null ) { $ size = round ( ( $ size ? : static :: TEXT_SIZE ) * 0.75 , 1 ) ; $ box = imagettfbbox ( $ size , 0 , $ this -> path , $ text ) ; return round ( abs ( $ box [ 2 ] - $ box [ 0 ] ) + static :: SHIELD_PADDING_EXTERNAL + static :: SHIELD_PADDING_INTERNAL , 1 ) ; }
docstring: Calculate the width of the text box.
  
  @param string   $text
  @param int|null $size
  
  @return float
docstring_tokens: Calculate the width of the text box .