PhpOffice\PhpPresentation\Style\Alignment::setMarginRight PHP Method

setMarginRight() public method

Set margin ight
public setMarginRight ( integer $pValue ) : Alignment
$pValue integer
return Alignment
    public function setMarginRight($pValue = 0)
    {
        if ($pValue > 0 && !in_array($this->getHorizontal(), $this->supportedStyles)) {
            $pValue = 0;
            // margin right not supported
        }
        $this->marginRight = $pValue;
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Test get/set margin right
  */
 public function testSetGetMarginRight()
 {
     $object = new Alignment();
     // != Alignment::HORIZONTAL_GENERAL
     $object->setHorizontal(Alignment::HORIZONTAL_CENTER);
     $value = rand(1, 100);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value));
     $this->assertEquals(0, $object->getMarginRight());
     $value = rand(-100, 0);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value));
     $this->assertEquals($value, $object->getMarginRight());
     $object->setHorizontal(Alignment::HORIZONTAL_GENERAL);
     $value = rand(1, 100);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value));
     $this->assertEquals($value, $object->getMarginRight());
     $value = rand(-100, 0);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value));
     $this->assertEquals($value, $object->getMarginRight());
 }