Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialHunkModern.php
<?php | <?php | ||||
final class DifferentialHunkModern extends DifferentialHunk { | final class DifferentialHunkModern extends DifferentialHunk { | ||||
const DATATYPE_TEXT = 'text'; | const DATATYPE_TEXT = 'text'; | ||||
const DATATYPE_FILE = 'file'; | const DATATYPE_FILE = 'file'; | ||||
const DATAFORMAT_RAW = 'byte'; | const DATAFORMAT_RAW = 'byte'; | ||||
const DATAFORMAT_DEFLATED = 'gzde'; | const DATAFORMAT_DEFLATED = 'gzde'; | ||||
protected $dataType; | protected $dataType; | ||||
protected $dataEncoding; | protected $dataEncoding; | ||||
protected $dataFormat; | protected $dataFormat; | ||||
protected $data; | protected $data; | ||||
private $rawData; | private $rawData; | ||||
private $forcedEncoding; | |||||
public function getTableName() { | public function getTableName() { | ||||
return 'differential_hunk_modern'; | return 'differential_hunk_modern'; | ||||
} | } | ||||
public function getConfiguration() { | public function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_BINARY => array( | self::CONFIG_BINARY => array( | ||||
Show All 11 Lines | public function setChanges($text) { | ||||
$this->data = $text; | $this->data = $text; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getChanges() { | public function getChanges() { | ||||
return $this->getUTF8StringFromStorage( | return $this->getUTF8StringFromStorage( | ||||
$this->getRawData(), | $this->getRawData(), | ||||
$this->getDataEncoding()); | nonempty($this->forcedEncoding, $this->getDataEncoding())); | ||||
} | |||||
public function forceEncoding($encoding) { | |||||
$this->forcedEncoding = $encoding; | |||||
return $this; | |||||
} | } | ||||
public function save() { | public function save() { | ||||
$type = $this->getDataType(); | $type = $this->getDataType(); | ||||
$format = $this->getDataFormat(); | $format = $this->getDataFormat(); | ||||
// Before saving the data, attempt to compress it. | // Before saving the data, attempt to compress it. | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |