Protocol\FCGI\Record::setContentData PHP Method

setContentData() public method

Sets the content data and adjusts the length fields
public setContentData ( $data )
$data
    public function setContentData($data)
    {
        $this->contentData = $data;
        $this->contentLength = strlen($this->contentData);
        $extraLength = $this->contentLength % 8;
        $this->paddingLength = $extraLength ? 8 - $extraLength : 0;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Padding size should resize the packet size to the 8 bytes boundary for optimal performance
  */
 public function testAutomaticCalculationOfPaddingLength()
 {
     $record = new Record();
     $record->setContentData('12345');
     $this->assertEquals($record->getPaddingLength(), 3);
     $record->setContentData('12345678');
     $this->assertEquals($record->getPaddingLength(), 0);
 }