示例#1
0
文件: Box.php 项目: molovo/graphite
 /**
  * Add a margin around the content.
  *
  * @param string $content The content, without margin
  *
  * @return array The content, with margin
  */
 private function addMargin(array $content = [])
 {
     // Add a blank line at the top and bottom of the content
     // for each line of padding
     $size = 0;
     while ($size++ < $this->styles['marginY']) {
         array_unshift($content, '');
         array_push($content, '');
     }
     // Add whitespace at either of end of each line
     // to create the horizontal padding
     $pad = $this->graphite->repeat(' ', $this->styles['marginX']);
     foreach ($content as $i => $line) {
         $content[$i] = $pad . $line . $pad;
     }
     return $content;
 }