/**
  * {@inheritdoc}
  */
 public function getStringWidth()
 {
     if (null === $this->strWidthCache) {
         $this->strWidthCache = $this->strPrefixWidth + $this->wrapped->getStringWidth();
     }
     return $this->strWidthCache;
 }
예제 #2
0
 /**
  * Calculates the real width of the pad
  */
 protected function calculatePadRealSize()
 {
     // when retrieving width, the width of the expanded version is retrieved.
     // string type may have a collapsed version longer than its expanded version
     $this->expandAll($this->var);
     $expandedWidth = max($this->var->getStringWidth(), $this->var->getChildrenWidth(true));
     $this->var->collapse(true);
     $collapsedWidth = max($this->var->getStringWidth(), $this->var->getChildrenWidth(true));
     $this->padRealWidth = max($collapsedWidth, $expandedWidth);
 }