margin() публичный Метод

Several options are available Array format ------------ First param can be an array with the following options: - bottom - left - right - top Set margin for all borders -------------------------- $bottom is set to a string Leave all other parameters empty Set margin for horizontal and vertical -------------------------------------- $bottom value will be set to bottom and top $left value will be set to left and right
public margin ( null | string | array $bottom = null, null | string $left = null, null | string $right = null, null | string $top = null ) : mixed
$bottom null | string | array bottom margin, or array of margins
$left null | string left margin
$right null | string right margin
$top null | string top margin
Результат mixed
Пример #1
0
 /**
  *
  * @dataProvider provider
  */
 public function testMargin($config)
 {
     $pdf = new CakePdf($config);
     $pdf->margin(15, 20, 25, 30);
     $expected = ['bottom' => 15, 'left' => 20, 'right' => 25, 'top' => 30];
     $this->assertEquals($expected, $pdf->margin());
     $pdf = new CakePdf($config);
     $pdf->margin(75);
     $expected = ['bottom' => 75, 'left' => 75, 'right' => 75, 'top' => 75];
     $this->assertEquals($expected, $pdf->margin());
     $pdf = new CakePdf($config);
     $pdf->margin(20, 50);
     $expected = ['bottom' => 20, 'left' => 50, 'right' => 50, 'top' => 20];
     $this->assertEquals($expected, $pdf->margin());
     $pdf = new CakePdf($config);
     $pdf->margin(['left' => 120, 'right' => 30, 'top' => 34, 'bottom' => 15]);
     $expected = ['bottom' => 15, 'left' => 120, 'right' => 30, 'top' => 34];
     $this->assertEquals($expected, $pdf->margin());
     $pdf = new CakePdf($config);
     $expected = ['bottom' => 15, 'left' => 50, 'right' => 30, 'top' => 45];
     $this->assertEquals($expected, $pdf->margin());
 }
Пример #2
0
 /**
  *
  * @dataProvider provider
  */
 public function testConfigRead($config)
 {
     Configure::write('CakePdf', $config);
     $pdf = new CakePdf();
     $this->assertEquals($config['margin'], $pdf->margin());
     $this->assertEquals($config['orientation'], $pdf->orientation());
 }