Box\Spout\Writer\Style\Style::serialize PHP Method

serialize() public method

The ID is excluded from the comparison, as we only care about actual style properties.
public serialize ( ) : string
return string The serialized style
    public function serialize()
    {
        // In order to be able to properly compare style, set static ID value
        $currentId = $this->id;
        $this->setId(0);
        $serializedStyle = serialize($this);
        $this->setId($currentId);
        return $serializedStyle;
    }

Usage Example

Esempio n. 1
0
 /**
  * Returns whether the given style has already been registered.
  *
  * @param \Box\Spout\Writer\Style\Style $style
  * @return bool
  */
 protected function hasStyleAlreadyBeenRegistered($style)
 {
     $serializedStyle = $style->serialize();
     // Using isset here because it is way faster than array_key_exists...
     return isset($this->serializedStyleToStyleIdMappingTable[$serializedStyle]);
 }
All Usage Examples Of Box\Spout\Writer\Style\Style::serialize